Aswin - Finishing my advanced wind plugin.My a...

Finishing my advanced wind plugin. My advanced wind plugin is functionally complete and stable and I am cleaning up the code. There are however some questions and design considerations that still bother me. 1) I have implemented an express router to provide the webapp with data. Registering with the router has to be done in the module, where as the data it reports on is maintained in the start function. To give the router get methods access to this data I had to create the data outside the start method in the module. (I hope I am clear about this, I grasp for the right terminology sometimes. Maybe look at how and where I instantiate the PolarDelta objects in https://github.com/Asw1n/advancedwind/blob/main/index.js) . As a result my data lives well behond the scope of the start function and is still there when the plugin is disabled. Is there a better way to do this? Preferable I want my objects and data only to be there when the plugin is active. 2) I get the apparent wind deltas using the registerDeltaInputHandler function to be able to replace the original values with the corrected apparent wind values. I do not unregister as I don't know how. In combination with the situation described is question 1 the plugin still catches even when the plugin is not active. Is there a way to unregister? 3) I created classes to deal with delta's (https://github.com/Asw1n/advancedwind/blob/main/pluginUtils.js). Each instance individually subscribes to a single delta Also each instance will update its delta associated delta individually. I noticed that other plugins (like derived data) update several delta's in one go leading to less traffic. Is my method ok or are there drawbacks and should it be changed?
3 Replies
Matti Airas
Matti Airas2w ago
Remarkable! I did some work on the same topic last winter, deriving the matrix transforms for correcting boat heel, mast movement and boat movement, but never found the time to implement that in code. I didn't consider mast rotation or upwash, though. I will definitely look into your code and compare that with my calculations!
Scott Bender
Scott Bender2w ago
input handlers are unregistered automatically no need to do anything there It’s fine to send send multiple deltas I don’t understand why you can’t create your objects on the start method. And remove them at stop. They can still be accessible to the router functions. You should be able to find many examples of this. Just make those variables like “const apparentWind” “var apprentWind” and initialize them in start. Then null them out in stop.
Aswin
AswinOP2w ago
Sometimes its too simple to see. Thanks.

Did you find this page helpful?