ArduPilot / ardupilot_gazebo

Plugins and models for vehicle simulation in Gazebo Sim with ArduPilot SITL controllers
GNU Lesser General Public License v3.0
82 stars 78 forks source link

Add COMMAND control type #18

Closed srmainwaring closed 2 years ago

srmainwaring commented 2 years ago

This PR authored by @clydemcqueen adds a new control type COMMAND that forwards a command value calculated from the SITL PWM inputs to an ignition transport topic. The published command is expected to be processed by another plugin that will apply the command to the joint / joints for which it is responsible. An immediate application is to supply commands to the ignition-gazebo thruster system plugin for use with an ROV controlled by ArduSub.

Details

Example: to use the new control type on channel 0:

<control channel="0">
  <jointName>thruster1_joint</jointName>
  <servo_min>1100</servo_min>
  <servo_max>1900</servo_max>
  <type>COMMAND</type>
  <cmd_topic>/model/bluerov2/joint/thruster1_joint/cmd_thrust</cmd_topic>
  <offset>-0.5</offset>
  <multiplier>100</multiplier>
</control>

Here the command is being forwarded to the topic /model/bluerov2/joint/thruster1_joint/cmd_thrust that will be processed by the thruster plugin.

Testing

Example usage with ArduSub and a prototype of the BlueROV2

https://user-images.githubusercontent.com/24916364/160691895-d58599f6-2ce6-4809-841d-7a7c1da485fb.mov

clydemcqueen commented 2 years ago

LGTM+++

I tested with the simple model in https://github.com/clydemcqueen/bluerov2_ignition/tree/clyde_relay using generate_model.py to try both /cmd_thrust and /cmd_vel.

Thanks!

srmainwaring commented 2 years ago

Another test - this time using a WAM-V model and ArduPilot Rover:

sim_vehicle.py -v Rover -f rover-vectored --model JSON --aircraft=wam-v --map --console -L RATBeach

wam-v_tuning