Home        Store        Docs        Blog

How to use mavlink to set manual mode


(Mike Tall) #1

Hi,

I’m able to set the system from Manual mode to Depth Hold mode, but I cannot seem to find a way to set it back to Manual mode.

I need this since I’ve untethered the ROV and if it’s in Depth hold mode and I stop sending commands from the RPi then the ROV doesn’t come back up.

I’ve tried disarming the motors at the end of my programmed mission, but for some reason that command doesn’t always seem to take. So, I’m hoping that by setting back to manual mode, then if I stop sending commands the ROV will come back up.

I do need depth hold mode since I cannot get it to hold depth as well with my straight PID in manual mode.

MT


(Jacob) #2

Hi Mike, can you share any of your code? The answers you are looking for might depend on your approach, but in general:

  • There are two failsafe mechanisms that you can take advantage of (gcs heartbeat and pilot input).

  • To put the ROV into manual mode you should probably use the same command that you used to put it into depth hold mode. The mode ID of manual is 19.

  • You can check for an ACKNOWLEDGE from the ROV after you send a command (like disarm) to see if the ROV has received/accepted the command, and then decide if you need to send the command again.

  • Perhaps you should add one last step to your mission by setting the depth target to the surface, and waiting to get there before you disarm.


(Mike Tall) #3

That last bullet is a good idea. I am not near the vehicle now, but I will try to post some of my code later.

Also, I didn’t know about the acknowledge command. I will have to try that. I read that disarm won’t work if you are currently commanded the motors. That quite possible since my control loop is in a different thread and there could be some overlap between when I stop sending commands and when I try to disarm the motor.

Thanks!


(Jacob) #4

A disarm command should always be executed immediately by the ROV, no matter what. If this is not the case (and you are sure the ROV actually received the correct command), then it is a problem.

Also note that those failsafes are enabled by default, and I don’t recommend purposefully triggering them to achieve your goals, but it is an option…


(Mike Tall) #5

Ah. I was looking at the attached and saw that for Copter, you needed to use 21196 to disarm the vehicle in flight, so I just assumed that applied to the Sub also. I reckon I’ll go the route of commanding it to the surface and double checking that I verify the command was acknowledged. Thanks!


(Jacob) #6

Send a value of 0 in param 1 to disarm. ArduSub doesn’t care about param 2 or the ground/where it is.