Gazebo | Ignition | Community
Ask Your Question

Made a 7 dof robot arm in Gazebo. Want the joints for the arm to act like electric motors and not free fall

asked 2016-10-21 10:28:59 -0500

Francis123 gravatar image

Hello Gazebo Community,

I am a programmer that has come from ROS where I didn't have to rely on physics to simulate an arm moving, and I am having problems understanding how to prevent the arm from falling to the floor (from its rest state where the arm is pointing up).

I have some understanding of how to enable the model plugins to apply forces and torques to joints and bodies but i am not sure how i would apply the forces or torques to prevent the model from free falling.

in terms of what I have, I defined my 7 dof arm from scratch in a SDF, I defined the links(collision/visual/inertia), joints(pose/axis/NOT dynamics). I am using gazebo 7.3.1, and sdf ver 1.4. I have installed libgazebo7 to have access to the Gazebo libraries.

I am hoping this awesome community could enlighten me about a couple things:

  1. Is there a joint other than revolute that I should be using to properly control the robot arm. I looked into gearbox joint but not really sure if thats needed.
  2. Should I be using some sort of PID control plugin that controls the force that is being applied to the joints. BTW is there a way to apply torques to joints and not the bodies themselves using the Gazebo physics joints c++ library?
  3. Are there example programs/plugins that are available for me to look at that show how control a robot arm

Thanks Francis123.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-10-21 13:03:11 -0500

If you're using ROS, you should probably start by adding some standard ros controller plugins to your model:

There are a few tutorials, starting with this one.

these plugins should handle the PID for you, and let you just control position/velocity via a standard ros interface

edit flag offensive delete link more


Thanks Peter for the advice. What I am trying to validate are contact dynamics in Gazebo while passing torque based commands using Matlab. I am familiar with ROS control and have used its control plugins before for position and velocity on previous occasions outside of Gazebo. My colleagues would want to use ROS as least as possible. Are there any options within Gazebo to allow me to achieve the same results?

Francis123 gravatar imageFrancis123 ( 2016-10-24 10:08:29 -0500 )edit

Yea for sure. the ROS thing are just heavy wrappers of the existing PID functionality in all gazebo joints. The easiest way (in my opinion) is to send gazebo::msgs::JointCmd. Fill out the joint name, PID, and target and it will just work. You say matlab... gazebo plugins must be C++, and you need C++ to send gazebo msgs. But assuming you can get some C++ going somewhere then it shouldn't be hard.

Peter Mitrano gravatar imagePeter Mitrano ( 2016-10-24 10:41:50 -0500 )edit

Also, one thing to help with the free-fall thing is damping. Try setting damping (try things between 1-20 depending on how heavy your links are). I sometimes just set damping really high to simulate joints where the motor doesn't backdrive easily, but that isn't really an accurate way of doing it

Peter Mitrano gravatar imagePeter Mitrano ( 2016-10-24 10:42:52 -0500 )edit

Ok, looking through the tutorials for control model plugins in Gazebo ( I do not see a use case for gazebo::msgs::JointCmd. But can I assume that if I create a Gazebo node (in c++) to publish commands using that message type I do not have to write a gazebo control plugin in c++? For the Matlab side there is a way to convert the functions into c++ programs so the torque outputs can be handled by the gazebo control plugin.

Francis123 gravatar imageFrancis123 ( 2016-10-24 11:33:52 -0500 )edit

correct. The PID interface is already build in for all joints in gazebo. As long as you publish that message it will work. the joint panel hiding on the right side of gazebo uses the same thing. check `/gazebo/default/my_model/joint_cmd`.

Peter Mitrano gravatar imagePeter Mitrano ( 2016-10-25 20:01:54 -0500 )edit

Question Tools



Asked: 2016-10-21 10:27:41 -0500

Seen: 1,585 times

Last updated: Oct 21 '16