Skip to content

Commit

Permalink
[Example 4+5] Fix tool link and slowdown (ros-controls#266)
Browse files Browse the repository at this point in the history
* Fix slowdown of hw interface of example_4

* Readd missing joints for tool_link
  • Loading branch information
christophfroehlich authored May 1, 2023
1 parent 269654f commit f5ccac1
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
3 changes: 2 additions & 1 deletion example_4/description/rviz/rrbot.rviz
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ Visualization Manager:
Update Interval: 0
Value: true
Visual Enabled: true
- Alpha: 1
- Accept NaN Values: true
Alpha: 1
Arrow Width: 0.5
Class: rviz_default_plugins/Wrench
Enabled: true
Expand Down
10 changes: 10 additions & 0 deletions example_4/description/urdf/rrbot_description.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@
</inertial>
</link>

<joint name="${prefix}tool_joint" type="fixed">
<origin xyz="0 0 1" rpy="0 0 0" />
<parent link="${prefix}link2"/>
<child link="${prefix}tool_link" />
</joint>

<!-- Tool Link -->
<link name="${prefix}tool_link">
</link>

</xacro:macro>

</robot>
3 changes: 1 addition & 2 deletions example_4/hardware/rrbot_system_with_sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,7 @@ hardware_interface::return_type RRBotSystemWithSensorHardware::read(
for (uint i = 0; i < hw_joint_states_.size(); i++)
{
// Simulate RRBot's movement
hw_joint_states_[i] =
hw_joint_commands_[i] + (hw_joint_states_[i] - hw_joint_commands_[i]) / hw_slowdown_;
hw_joint_states_[i] += (hw_joint_commands_[i] - hw_joint_states_[i]) / hw_slowdown_;
RCLCPP_INFO(
rclcpp::get_logger("RRBotSystemWithSensorHardware"), "Got state %.5f for joint %u!",
hw_joint_states_[i], i);
Expand Down
10 changes: 10 additions & 0 deletions example_5/description/urdf/rrbot_description.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@
</inertial>
</link>

<joint name="${prefix}tool_joint" type="fixed">
<origin xyz="0 0 1" rpy="0 0 0" />
<parent link="${prefix}link2"/>
<child link="${prefix}tool_link" />
</joint>

<!-- Tool Link -->
<link name="${prefix}tool_link">
</link>

</xacro:macro>

</robot>

0 comments on commit f5ccac1

Please sign in to comment.