0
$\begingroup$

Rosanswers logo

Hello guys,

I'm fairly new to ROS and still learning. I've been struggling with this problem for a while, and I can't seem to solve it. I've dug through countless ROS Answers, but can't seem to find the solution.

I'm running through the URDF Tutorial and finished it. This is as in, if I run the last 13-diffdrive.launch all starts up correctly. To prove to myself that I know how it works, I attempted to make R2D2's legs also rotate at his shoulders, by changing the joint from fixed to revolute, which also requires a few additional changes as well.


So first what I did was change the following in the *.urdf.xacro file:

<joint name="base_to_${prefix}_leg" type="fixed">
      <parent link="base_link"/>
      <child link="${prefix}_leg"/>
      <origin xyz="0 ${reflect*(width+.02)} 0.25" />
</joint>

to

<joint name="base_to_${prefix}_leg" type="revolute">
      <parent link="base_link"/>
      <child link="${prefix}_leg"/>
      <origin xyz="0 ${reflect*(width+.02)} 0.25" />
      <axis xyz="0 1 0"/>      
      <limit effort="1000.0" lower="0.0" upper="0.548" velocity="0.5"/>
      <dynamics damping="0.0" friction="0.0"/>
</joint>

by copying code from the _gripper_joint. When running the launch file again it opens RViz and Gazebo with a little wheel controlling interface. In Gazebo everything displays correctly, and I can see the new joint swiwels when I drive R2D2 around. But, in RViz the legs are displayed at the origin and not at the shoulders. This because the TF Transform isn't published. I double checked this using the command rostopic echo /joint_states -n 1, which didn't display the new shoulder joint.


According to the tutorial to get the joint state published you need to add a transmission. So added the transmission like below, again copying from the _gripper_joint.

<joint name="base_to_${prefix}_leg" type="revolute">
      <parent link="base_link"/>
      <child link="${prefix}_leg"/>
      <origin xyz="0 ${reflect*(width+.02)} 0.25" />
      <axis xyz="0 1 0"/>      
      <limit effort="1000.0" lower="0.0" upper="0.548" velocity="0.5"/>
      <dynamics damping="0.0" friction="0.0"/>
</joint>
<transmission name="$base_to_${prefix}_trans">
      <type>transmission_interface/SimpleTransmission</type>
      <actuator name="$base_to_${prefix}_motor">
        <mechanicalReduction>1</mechanicalReduction>
      </actuator>
      <joint name="$base_to_${prefix}_leg">
        <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
      </joint>
</transmission>

This breaks a few things, and I don't understand where I'm going wrong. The symptoms that I see are the following:

  • Gazebo still seems to display the bot correctly, but gripper retracts into the body with no command given. This makes me think that some joints are getting confused.
  • In Gazebo I've lost control of the wheel, which is also why I think some joints are getting confused.
  • In RViz only half of the bot is loaded.
  • Nothing is being published in the /joint_states topic.
  • In the terminal I get the following error message:

[ERROR] [1586155354.004703965, 0.067000000]: This robot has a joint named "$base_to_right_leg" which is not in the gazebo model.

[FATAL] [1586154968.212960797, 0.255000000]: Could not initialize robot simulation interface


The rest of the code is as it's in the final tutorial step. There is a JointStateController.

The most general problem for this ERROR is that the joint's child or parent link does not have mass/intertia, but this is isn't the case. This can be double checked by seeing the base code I'm using here.

Does anyone know what could be wrong? Please let me know if I should supply more information.


Originally posted by Hein Wessels on ROS Answers with karma: 13 on 2020-04-06

Post score: 0


Original comments

Comment by gvdhoorn on 2020-04-06:
It would help (others) if you could show the complete urdf. It's a bit hard to figure out what the states of things is without it.

Also:

According to the tutorial to get the joint state published you need to add a transmission.

this is (most likely) only true if/when using Gazebo, as the standard joint_state_publisher won't care about transmissions at all.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Try to change:

<transmission name="$base_to_${prefix}_trans">
<joint name="$base_to_${prefix}_leg">

To: ( Removing the $ ahead of the name )

<transmission name="base_to_${prefix}_trans">
<joint name="base_to_${prefix}_leg">

If the problem remains. Comment here.


Originally posted by Teo Cardoso with karma: 378 on 2020-04-06

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Hein Wessels on 2020-04-06:
That did the trick! I can't believe the issue was a simple copy-paste mistake. Thanks!

$\endgroup$

Your Answer

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