I’ve been trying to get two servos and a relay to work with Cockpit and Navigator, but I’m running into several issues. I’ve connected two servos to PWM outputs 9 and 10 and one relay to the signal pin on output 11 and mapped buttons on the controller to match outputs (dpad up/down to toggle min/max on servo 1, dpad left/right to toggle min/max on servo 2, and A to toggle relay 1), but servo 2 and relay 1 functionality doesn’t work as expected.
Are there actually correct pins I’m supposed to plug the relay into? I saw this post about requiring servos on ports 9, 10, & 11 but a GitHub search yielded nothing as specific for relay pins (except for pins in the 50-100 range?).
The output range of these servos is 500-2500 us, whereas it seems the min/max is set to 1100-1900 by default. Is there any way to change this?
Somewhat related to #2, I was scrolling through the mavlink-manual-control action list in the joystick binding menu, and I only saw min/max/trim-related actions. Are there any actions to set the servo output to a specific value?
The observed behavior when pressing dpad left/right seemed to be toggling vertical thruster movement (1100 output on output 5, 1900 output on output 6) as observed in the SERVO_OUTPUT_RAW messages in the BlueOS MAVLink Inspector. The observed behavior when toggling relays was no change in SERVO_OUTPUT_RAW messages. The same can be observed with the PWM Output display in the Vehicle Setup menu. Why does this behavior occur, and how can I fix it or debug it such that I can fix it? EDIT: the vertical thruster behavior no longer occurs after a restart, instead it simply doesn’t change the output at all.
Hi @democat -
I’m working on updating our guide to connecting devices to the Navigator to have this sort of information - stay tuned! In the meantime, assuming you’re running ArduSub, both relay and servo should be easily possible, you just need to edit some Autopilot parameters.
Specifically:
SERVO#_FUNCTION should be set to RCIN# (with the two # matching.)
SERVO#_MIN and MAX can adjust the range to the 500 to 2500 range you require.
The joystick servo_inc and servo/dec can incrementally change the servo output signal.
I am working with Colin. I was wondering how we would be able to map a button on our controller to RCIN7 which is set for SERVO7_FUNCTION for example? I’m not sure where the connection is for that between cockpit and BlueOS.
ArduSub only supports servo 1,2, and 3, so you would set the Servo# function to RCIN7, and setup the corresponding button in QGround Control for the corresponding Servo# used.
@tony-white
In the BlueOS Autopilot Parameter menu, I’ve set SERVO9_FUNCTION to Disabled, and pressing buttons bound to Servo 1 min/max toggle seem to work as expected to control that particular servo. However, I’ve tried various things to set SERVO10_FUNCTION and SERVO11_FUNCTION to, with no response from buttons bound to Servo 2 or 3 min/max toggle. The things I’ve tried setting the FUNCTION to include RCIN10/11, RCIN2/3, and Disabled, all with no effect on the servos plugged into ports 10 and 11 on the navigator. I’ve also tried to set SERVO2_FUNCTION and SERVO3_FUNCTION to RCIN10/11 and RCIN2/3 with no response either. Also, we are using Cockpit instead of QGroundControl, if that matters.
Also, how do I control relays?
EDIT: I’ve just tried with QGC and the same behavior occurs.
Apologies @democat and @farhanj1 - I was not steering you in the right direction, got things confused with ArduRover.
This documentation should be all you need, specifically:
@tony-white I just realized the issue. There’s a bug in Ardusub where servos 2 and 3 are missing min and max toggle cases in the button-handling switch-case, leading to no-ops when those commands are sent. I’ve just made a PR to fix this issue.