Driving a boat with direct thruster commands with mavros

Hi, I need to test a new controller design on my boat. The algorithm will be running on a raspberry with ROS and mavros. I wan to use the navigation system of the ardurover and make direct thruster commands.
Is there a topic that allows me to write direct commands to the thrusters? What controllers are working in GUIDED mode? Do I need to use MANUAL mode and override RC out channels with mavros?

Thank!

@elgarbe,

We have some documentation on the mavlink commands that can be used to control a Rover/Boat here.

My guess is a turn-rate + speed control is best. using RC overrides is normally not the best way because it can interfere with a pilot controlling the vehicle.

The problem here is that I need to test the whole low level control, so I need AP do not send command to the motors. In manual mode, if anybody touch the RC, is there a way to send command to the motors using mavlink/mavros?

Rover has a “set_steering_and_throttle()” method in Guided mode that accepts a raw steering and throttle input (both in the range -1 to +1) but at the moment it is only accessible via scripting so we are missing some plumbing to allow it to work with mavlink and mavros.

I’m very happy to add support in Rover to improve external control if we can figure out what mavlink messages to use.

The SET_ATTITUDE_TARGET message is probably already supported from mavros but it only allows control using turn rate and thrust.

Our controller will output Thrust in X body frame direction and Torque around Z axis. Then we have a model of the thrusters and can convert Thrust/Torque into PWM signal. Something like this:

Wrench command is of the form:
http://docs.ros.org/en/noetic/api/geometry_msgs/html/msg/Wrench.html

@elgarbe,

I’m not sure how we could get that really low level output all the way through to the motors. Maybe a lua script could be used to write a special AP motor driver (like we’ve done for walking robots) and then it could also intercept mavlink messages.

It’s ugly though, by sending pwm you’re really re-doing a lot of the good stuff that AP already takes care of. I think it would be better to modify the model to provide a higher level output.

Yes, understand.
The thing is we try to make a controller that takes into account the dynamic model of the ASV. We already make some parameters identification and working on the low level controller.
For reference here and here are some work on the subject.
I think I will need to command the motors outside the AP for now.
Thank @rmackay9 for your help.

Is rcoverride implemented on ardurover? I’m making some test and it seems that it doesn’t work.

@elgarbe,

Yes, RC Overrides should work in all vehicles. As far as I know the implementation is not vehicle specific.