0
$\begingroup$

Gazebo Answers logo

Hello,

I want to know how the joints work with gazebo. My problem is that I don't know what kind of physics laws are used for gazebo.

I am using one plugin for control the wheels on (4 wheel) differential car. I am using one class in the pkg pr2_controller/manager and one of my question is the next:

In this plugin, there are 3 states, star, update and stop. I configure update to 50 Hz. Every time to run this state, I send efforts to joints by this way:

std::string joint_blw;
  if (!n.getParam("joint_blw", joint_blw))
  {
    ROS_ERROR("No joint BLW given in namespace: '%s')",
              n.getNamespace().c_str());
    return false;
  }
  joint_state_blw_ = robot->getJointState(joint_blw);
  if (!joint_state_blw_)
  {
    ROS_ERROR("summit_xl_ctrl could not find joint named '%s'",
              joint_blw.c_str());
    return false;
  }
  ROS_DEBUG("summit_xl_ctrl found joint named '%s'", joint_blw.c_str());
...
...
joint_state_blw_->commanded_effort_ = ...

This joint is continuous and has this urdf:

.. ..

  <joint name="joint_back_left_wheel" type="continuous">
    <parent link="base_link"/>
    <child link="back_left_wheel"/>
    <origin xyz="-0.223 0.154 0" rpy="0 0 0" /> 
    <axis xyz="0 1 0" rpy="0 0 0" />
    <limit effort="100" velocity="100"/>
    <joint_properties damping="0.0" friction="0.0"/>
  </joint>

  <transmission name="joint_blw_trans" type="pr2_mechanism_model/SimpleTransmission">
     <actuator name="joint_blw_motor" />
     <joint name="joint_back_left_wheel" />
     <mechanicalReduction>1</mechanicalReduction>
     <motorTorqueConstant>1</motorTorqueConstant>
  </transmission>

Finally, I don't know where is this effort apply and what is the performance of this effort, like I send torque to make par or whatever in N or Nm?. Where can I find any documentation or tutorial about this?

By the Way this is for the Uc3m University


Originally posted by pmarinplaza on Gazebo Answers with karma: 3 on 2012-11-06

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Gazebo Answers logo

pmarinplaza

I copied an example from erratic_robot diffdrive_plugin.cpp. It should be in your opt/ros/stacks/erratic_robot/ erratic_robot_plugins/ directory or something like that.

Essentially they created a pointer to a joint in their plugin using: physics::JointPtr joint; joint = this->model->getJoint("joint_name");

then in the update method applied a torque to that joint through:

joint->SetForce(0, force_in_N_or_Nm);

where the force is in N or Nm depending on the type of joint. This method seems to work well. I would expect were you to subscribe to a topic that generated your torques then put them in your SetForce method, that should work. Please let me know.

BTW I don't think SetVelocity actually does anything in Gazebo but I would like enlightenment if that is not the case. When ever i post a value to it nothing seems to happen.

cheers

Peter


Originally posted by PMilani with karma: 203 on 2012-11-21

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by pmarinplaza on 2012-11-21:
Very nice answer, I'll see that code and see what I can use. In my case, I am using pr2 manager to control the joints and I want to know if I can control the joint in velocity (like rpm) because torque force depends on weight. Thank you very much ;)

Comment by PMilani on 2012-11-29:
If you want to control velocity, your plugin will have to do dynamics conversions. You will need a state space representation of your drive/transmission that converts your control signal into torque or force. If you observe the velocity (joint->getVelocity(0)) you can adjust your control signal.

Comment by asomerville on 2012-11-29:
@pmarinplaza, mark this as the correct answer if you believe it is. Doing so will give you and @PMilani to karma so that you will be able to vote on questions and answers and improve the system.

Comment by hsu on 2012-11-29:
@PMilani: In theory ODE"s dParamVel will try to set the desired velocity but limited by dParamFMax. Have you tried setting dParamFMax to a larger value?

Comment by PMilani on 2012-12-02:
@hsu, unfortunately no, it may be the problem if the default of dParamFMax is zero. Though I do like having to convert electricity or pressure to force as this is really the basis for all mechanical movement. Also it would be helpful if GetForce() were implemented in Gazebo for force sensing.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.