Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Gimbal #37

Closed
srmainwaring opened this issue Dec 21, 2022 · 5 comments · Fixed by #43
Closed

Add Gimbal #37

srmainwaring opened this issue Dec 21, 2022 · 5 comments · Fixed by #43
Assignees
Labels
enhancement New feature or request

Comments

@srmainwaring
Copy link
Collaborator

Feature request

The original version of the project for Gazebo11 included a plugin for a small 2d gimbal. This request is to have the gimbal model updated to run in Gazebo Sim and for the plugin to be ported to work with the gz-sim7 libraries.

Desired outcome

  • A small gimbal model is available to attach to the Iris quadcopter.
  • The gimbal joints may be controlled using a suitable plugin.
  • There is a topic to which commands may be published to set the gimbal joint position.

Alternatives

The gimbal model is available for download from Gimbal Small 2D but has not been ported to Gazebo Sim / PBS shading:

  • It uses the deprecated material <script> element for specifying visual colours.
  • It uses the plugin libGimbalSmall2dPlugin which does not work in Gazebo Sim.

Platform

[ ] All
[ ] AntennaTracker
[ x ] Copter
[ x ] Plane
[ x ] Rover
[ x ] Submarine

Additional context

@srmainwaring srmainwaring added the enhancement New feature or request label Dec 21, 2022
@srmainwaring srmainwaring self-assigned this Dec 21, 2022
@srmainwaring
Copy link
Collaborator Author

srmainwaring commented Dec 21, 2022

Tracking development on https://github.com/srmainwaring/ardupilot_gazebo-1/tree/srmainwaring/garden/gimbal-plugin

  • Update gimbal_small_2d model to render in Gazebo Sim.
  • Add an arm joint in gimbal_small_2d for an extra DOF.
  • Update iris_with_ardupilot model to enable gimbal.
  • Add plugin for joint position control (reuse gz::sim::systems::JointPositionControl if it works for nested models).
  • Add example world and configure the ArduPilotPlugin to forward servo commands to the joint position control topics.

Progress

Model, additional joint and camera sensor rendering correctly in Gazebo.

gimbal2d

Issues

  1. The gz::sim::systems::JointPositionControl plugin in Gazebo Garden does not seem to work with nested models. It's not clear why not, but it appear that the physics engine is not registering the components::JointPosition on nested models so queries for the joint entities component values fail (because the returned component is empty).

So for example this model can be controlled from the command line:

  <include>
    <uri>model://gimbal_small_2d</uri>
    <name>gimbal</name>
    <pose>0 0 0.11 -1.57 0 1.57</pose>
    <plugin
      filename="gz-sim-joint-position-controller-system"
      name="gz::sim::systems::JointPositionController">
      <joint_name>arm_joint</joint_name>
      <topic>arm_cmd</topic>
      <p_gain>2</p_gain>
      <i_gain>0.1</i_gain>
      <d_gain>0.01</d_gain>
      <i_max>1</i_max>
      <i_min>-1</i_min>
      <cmd_max>1000</cmd_max>
      <cmd_min>-1000</cmd_min>
    </plugin>
    <plugin
      filename="gz-sim-joint-position-controller-system"
      name="gz::sim::systems::JointPositionController">
      <joint_name>tilt_joint</joint_name>
      <topic>tilt_cmd</topic>
      <p_gain>2</p_gain>
      <i_gain>0.1</i_gain>
      <d_gain>0.01</d_gain>
      <i_max>1</i_max>
      <i_min>-1</i_min>
      <cmd_max>1000</cmd_max>
      <cmd_min>-1000</cmd_min>
    </plugin>
  </include>

with

# rotate the arm -1.0 radian
gz topic -t "/arm_cmd" -m gz.msgs.Double -p "data: -1.0"

# tilt the camera +2.0 radian
gz topic -t "/tilt_cmd" -m gz.msgs.Double -p "data: 2.0"

but the same model nested one level deeper does not work.

Issues logged with the Gazebo team: gazebosim/gz-sim#1844

@chngdickson
Copy link

@srmainwaring How do we control said gimbal using ardupilot's plugin?

@srmainwaring
Copy link
Collaborator Author

How do we control said gimbal using ardupilot's plugin?

@chngdickson, the PR #43 includes a note on how to control the gimbal from MAVProxy using RC overrides. The example is set up as a standard servo gimbal so you should be able to follow the wiki guide https://ardupilot.org/copter/docs/common-camera-gimbal.html with the Gazebo version.

@samiamlabs
Copy link

Hi @srmainwaring!

I have been trying to control the camera tilt on a simulated bluerov2 using ardusub and the camera tilt RC input (https://www.ardusub.com/developers/rc-input-and-output.html).

I used this and #43 as a reference. Controlling it using the gz topic works now, but I seem to be getting only a static value on control channel 16 (<control channel="15">) from the ardupilot gazebo plugin. This is the output channel used for tilt on the physical bluerov2 https://bluerobotics.com/store/comm-control-power/control/navigator/.

Do you happen to know if it should be possible to control a simulated camera gimbal this way using ardusub? I'm guessing I may need to add something to my .param file, but am not sure what, or where to find more info about it.

@srmainwaring
Copy link
Collaborator Author

Hi @samiamlabs,

We should be able to sort something out. This issue is closed now, so it would be better to follow up on ArduPilot Discourse (https://discuss.ardupilot.org/). If you add a topic that includes gazebo, gimbal and tag me we can pick it up there. May also be good to add the BlueROV2 model to ArduPilot/SITL_Models so we can provide a standard configuration with a few variants for common payloads.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants