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

showcase for transmissions in mock hw #10

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ def generate_launch_description():
"slowdown", default_value="50.0", description="Slowdown factor of the RRbot."
)
)
declared_arguments.append(
DeclareLaunchArgument(
"use_mock_hardware",
default_value="false",
description="Use mock hardware instead of real one.",
choices=["true", "false"],
)
)
declared_arguments.append(
DeclareLaunchArgument(
"robot_controller",
Expand All @@ -57,6 +65,7 @@ def generate_launch_description():
# Initialize Arguments
prefix = LaunchConfiguration("prefix")
slowdown = LaunchConfiguration("slowdown")
use_mock_hardware = LaunchConfiguration("use_mock_hardware")
robot_controller = LaunchConfiguration("robot_controller")
gui = LaunchConfiguration("gui")

Expand All @@ -78,6 +87,9 @@ def generate_launch_description():
" ",
"slowdown:=",
slowdown,
" ",
"use_mock_hardware:=",
use_mock_hardware,
]
)
robot_description = {"robot_description": robot_description_content}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">

<xacro:macro name="rrbot_transmissions_system_position_only" params="name prefix slowdown:=2.0">
<xacro:macro name="rrbot_transmissions_system_position_only" params="name prefix slowdown:=^|2.0 use_mock_hardware:=^|false mock_sensor_commands:=^|false">

<ros2_control name="${name}" type="system">

<hardware>
<plugin>ros2_control_demo_example_8/RRBotTransmissionsSystemPositionOnlyHardware</plugin>
<xacro:if value="${use_mock_hardware}">
<plugin>mock_components/GenericSystem</plugin>
<param name="mock_sensor_commands">${mock_sensor_commands}</param>
</xacro:if>
<xacro:unless value="${use_mock_hardware}">
<plugin>ros2_control_demo_example_8/RRBotTransmissionsSystemPositionOnlyHardware</plugin>
</xacro:unless>
<param name="actuator_slowdown">${slowdown}</param>
</hardware>

Expand All @@ -31,7 +37,7 @@
<actuator name="actuator1" role="actuator1"/>
<joint name="joint1" role="joint1">
<mechanical_reduction>2.0</mechanical_reduction>
<offset>0.0</offset>
<offset>0.2</offset>
</joint>
</transmission>

Expand All @@ -40,7 +46,7 @@
<actuator name="actuator2" role="actuator2"/>
<joint name="joint2" role="joint2">
<mechanical_reduction>4.0</mechanical_reduction>
<offset>0.0</offset>
<offset>-0.2</offset>
</joint>
</transmission>
</ros2_control>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ https://github.com/ros-simulation/gazebo_ros_demos/blob/kinetic-devel/rrbot_desc
<!-- Enable setting arguments from the launch file -->
<xacro:arg name="prefix" default="" />
<xacro:arg name="slowdown" default="100.0" />
<xacro:arg name="use_mock_hardware" default="false" />

<!-- Import RRBot macro -->
<xacro:include filename="$(find ros2_control_demo_description)/rrbot/urdf/rrbot_description.urdf.xacro" />
Expand All @@ -27,7 +28,10 @@ https://github.com/ros-simulation/gazebo_ros_demos/blob/kinetic-devel/rrbot_desc
</xacro:rrbot>

<xacro:rrbot_transmissions_system_position_only
name="RRBotTransmissionsSystemPositionOnly" prefix="$(arg prefix)"
slowdown="$(arg slowdown)" />
name="RRBotTransmissionsSystemPositionOnly"
prefix="$(arg prefix)"
slowdown="$(arg slowdown)"
use_mock_hardware="$(arg use_mock_hardware)"
/>

</robot>
Loading