I am putting the final touches on my control software that automates a grid pattern survey for my ROV using the Waterlinked GPS system and a custom camera system that is attached to the BlueROV2. I’ve mostly got it working but wanted to seek a little bit of advice here about driving the ROV via pymavlink and discuss the differences between the MANUAL_CONTROL and RC_CHANNELS_OVERRIDE commands.
Here is my real use scenario. I place the ROV in the water, I drive it around a little bit and get it into position using QGC and an Xbox controller as normal. I then have my separate python program start and take over command and control of the ROV. I want QGC to stay open and running as I’m watching the video there and if I run into a problem, it is easiest to just hit disarm right there and then on the Xbox controller (though I will be adding a big STOP button for this in my other digital and physical control interfaces). Also, easier to manually drive the ROV with the controller if I run into a problem.
When I was testing my code with the ROV in the water this weekend, the navigation was super choppy. The ROV would surge forward then stop then surge then stop etc. I was using the RC_CHANNELS_OVERRIDE command to send forward/back commands and turning left/right. I’m now thinking that the choppiness wasn’t my code but a conflict with QGC and the Xbox controller that was plugged in. Could this be the case? Should I be using MANUAL_CONTROL commands instead? EDIT: If it matters, the ROV will be in Depth Hold mode or possibly in Stablize mode.
My navigation loop is pretty simple. I pull the current GPS point, calculate the required heading to the target GPS point, turn left/right to match the heading, and then drive forward. This loops until I reach the target GPS point. Really, what I want is to set the forward speed and then only send additional left/right adjustments to stay on heading until I reach the target point. Do I need to continue to send the forward command in that loop or once I send the forward command, will it continue to drive forward until I send a stop command? Looking at the MANUAL_CONTROL command, it looks like I will always have to send an x, y, z, and r value for each command while with RC_OVERRIDE I could have just sent the drive forward command and then waited. Am I understanding this correctly?
I’m going to install SITL now to see if I can test this without getting the ROV wet but am hoping to get it back in the water and do some testing again this weekend. Thanks for the guidance!
MANUAL_CONTROL is a higher abstraction level for ArduSub of RC_OVERRIDE, you can check that here.
Since MANUAL_CONTROL uses RC_OVERRIDE to accomplish the functionality, you need to send the commands periodically for both commands. The timeout is configured with RC_OVERRIDE_TIME parameter.
RC_OVERRIDE_TIME: Timeout after which RC overrides will no longer be used, and RC input will resume…
I highly recommend SITL to test your script, this will ensure you that the same setup will work with the real ROV.
Yes, that’s probably what is going. To allow MANUAL_CONTROL or RC_OVERRIDE in your script, you should disconnect or disable joystick in QGC. There is no workaround for it yet to allow multiple MANUAL_CONTROL or RC_OVERRIDE messages.
Thanks for confirming my thoughts. Looks like I’ll just have to connect/disconnect the joystick when I am going to use my program. Thanks! I may be back later with more questions but I’ve got SITL installed, now just need to figure out how to actually use it.
Quick SITL question… I’ve got it up and running and QGC connects to it fine. I can’t get my python app to connect. normally, the rovAddress is udp:0.0.0.0:14660 in my program. I think I remember adding an output to that port through the web interface on the companion. Now, I’m trying to figure out what address I should use when connecting to SITL. I’ve tried starting SITL with the following but that doesn’t help.
Thanks for the suggestion. Unfortunately that didn’t help. QGC connects but my software doesn’t. I’ll keep messing with it and see if I can figure it out. Also, I’m going to hook up the ROV itself and make sure I can connect there and I didn’t screw up the connection code.
If it matters, I’m running SITL and my software within the same virtual computer running Ubuntu within a parallels machine on a Mac. Thanks!
Got it. It was a problem in my code that I had changed a while ago and had forgotten about. Thanks for the help!
On a related note, I have a small icon on my GUI that shows the status of the connection to mavproxy. Any ideas on how to verify that there is an active connection or how to notify the user if the connection drops for some reason? Thanks!