I am working on a custom-built submarine. I would like to implement a system where pressing a single button on the controller causes two servos to increase in value.
My current implementation is this: holding button 1 updates a Boolean data lake variable from 0 to 1. Then, the variable is linked to a two custom actions (MAVLink messages) for MAV_CMD_DO_SET_SERVO. They take in the servo number for parameter 1, and parameter 2 is a compound data lake variable that is the current servo value + 200.
My current problem I am having is that the custom actions seem to be running even when the Boolean variable is not being updated. Furthermore, it seems to be occurring at the frequency of the “no faster than __” frequency, implying that the variable is constantly updating even when it isn’t.
Are there any mistakes that seem likely to cause this issue? Alternatively, is there a simpler way to implement multiple MAVLink actions with a single button press?
I brought this up internally last week, and it seems to be an oversight in Cockpit’s triggering logic. I’ve raised a pull request to try to fix it, but there is seemingly an issue with the build system so I’m unsure when it will be testable / get merged in.
It is technically possible to work around this with a custom JavaScript Action that just checks whether the variable value has changed since the last trigger, but that seems needlessly complicated.
I expect the most straightforward approach would be to use a built in autopilot functionality (like the lights, or a servo) that you then assign multiple outputs for, and access through the corresponding MAVLink MANUAL_CONTROL joystick button function options (i.e. the non-custom button functions in Cockpit).
The specifics of that have been changing somewhat over the last few firmware versions, but if you specify the ArduSub version you’re using I can try to provide working instructions.
I am using Ardupilot 4.5.3 as my firmware version. If you would be able to provide instructions for changing the MANUAL_CONTROL options whenever you get the opportunity, I would greatly appreciate it. If you need anything else, just let me know.
This has been merged in, so your existing solution should work if you wait until the next beta release, or if you update to the master tag of Cockpit by either:
Editing the Docker tag field in the BlueOS Extensions manager (requires Pirate Mode), if you’re running Cockpit as a BlueOS Extension through your browser, or
Downloading the relevant Artifact for your system from GitHub, if you’re running Cockpit as a standalone application on your computer
I’m short on time at the moment, but minimal instructions are: