Skip to content

Commit

Permalink
Fixed the example and improved docs
Browse files Browse the repository at this point in the history
  • Loading branch information
christophfroehlich committed Dec 26, 2023
1 parent 2fb6d52 commit a567858
Show file tree
Hide file tree
Showing 17 changed files with 100 additions and 200 deletions.
7 changes: 4 additions & 3 deletions example_15/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ endforeach()

# INSTALL
install(
DIRECTORY description/ros2_control description/urdf description/rviz
DIRECTORY description/rviz
DESTINATION share/ros2_control_demo_example_15
)
install(
Expand All @@ -29,8 +29,9 @@ if(BUILD_TESTING)
find_package(ament_cmake_gtest REQUIRED)
find_package(ament_cmake_pytest REQUIRED)

ament_add_pytest_test(example_15_urdf_xacro test/test_urdf_xacro.py)
ament_add_pytest_test(view_example_15_launch test/test_view_robot_launch.py)
ament_add_pytest_test(test_rrbot_namespace_launch test/test_rrbot_namespace_launch.py)
ament_add_pytest_test(test_multi_controller_manager_launch test/test_multi_controller_manager_launch.py)

endif()

## EXPORTS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ def generate_launch_description():
declared_arguments = []
declared_arguments.append(
DeclareLaunchArgument(
"use_fake_hardware",
"use_mock_hardware",
default_value="false",
description="Start robot with fake hardware mirroring command to its states.",
)
)
declared_arguments.append(
DeclareLaunchArgument(
"fake_sensor_commands",
"mock_sensor_commands",
default_value="false",
description="Enable fake command interfaces for sensors used for simple simulations. \
Used only if 'use_fake_hardware' parameter is true.",
Used only if 'use_mock_hardware' parameter is true.",
)
)
declared_arguments.append(
Expand All @@ -53,20 +53,22 @@ def generate_launch_description():
)

# Initialize Arguments
use_fake_hardware = LaunchConfiguration("use_fake_hardware")
fake_sensor_commands = LaunchConfiguration("fake_sensor_commands")
use_mock_hardware = LaunchConfiguration("use_mock_hardware")
mock_sensor_commands = LaunchConfiguration("mock_sensor_commands")
slowdown = LaunchConfiguration("slowdown")
robot_controller = LaunchConfiguration("robot_controller")

rrbot_1_launch = IncludeLaunchDescription(
PythonLaunchDescriptionSource([ThisLaunchFileDir(), "/rrbot_base.launch.py"]),
launch_arguments={
"namespace": "rrbot_1",
"controllers_file": "multi_controller_manager_rrbot_1_controllers.yaml",
"description_package": "ros2_control_demo_example_1",
"description_file": "rrbot.urdf.xacro",
"runtime_config_package": "ros2_control_demo_example_15",
"controllers_file": "multi_controller_manager_rrbot_1_controllers.yaml",
"prefix": "rrbot_1_",
"use_fake_hardware": use_fake_hardware,
"fake_sensor_commands": fake_sensor_commands,
"use_mock_hardware": use_mock_hardware,
"mock_sensor_commands": mock_sensor_commands,
"slowdown": slowdown,
"controller_manager_name": "/rrbot_1/controller_manager",
"robot_controller": robot_controller,
Expand All @@ -89,11 +91,13 @@ def generate_launch_description():
PythonLaunchDescriptionSource([ThisLaunchFileDir(), "/rrbot_base.launch.py"]),
launch_arguments={
"namespace": "rrbot_2",
"description_package": "ros2_control_demo_example_5",
"description_file": "rrbot_system_with_external_sensor.urdf.xacro",
"runtime_config_package": "ros2_control_demo_example_15",
"controllers_file": "multi_controller_manager_rrbot_2_controllers.yaml",
"description_file": "rrbot_system_position_only.urdf.xacro",
"prefix": "rrbot_2_",
"use_fake_hardware": use_fake_hardware,
"fake_sensor_commands": fake_sensor_commands,
"use_mock_hardware": use_mock_hardware,
"mock_sensor_commands": mock_sensor_commands,
"slowdown": slowdown,
"controller_manager_name": "/rrbot_2/controller_manager",
"robot_controller": robot_controller,
Expand All @@ -113,7 +117,7 @@ def generate_launch_description():
)

rviz_config_file = PathJoinSubstitution(
[FindPackageShare("rrbot_description"), "config", "multi_controller_manager.rviz"]
[FindPackageShare("ros2_control_demo_example_15"), "rviz", "multi_controller_manager.rviz"]
)

rviz_node = Node(
Expand Down
16 changes: 8 additions & 8 deletions example_15/bringup/launch/rrbot_base.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def generate_launch_description():
declared_arguments.append(
DeclareLaunchArgument(
"description_package",
default_value="rrbot_description",
default_value="ros2_control_demo_description",
description="Description package with robot URDF/xacro files. Usually the argument \
is not set, it enables use of a custom description.",
)
Expand Down Expand Up @@ -80,17 +80,17 @@ def generate_launch_description():
)
declared_arguments.append(
DeclareLaunchArgument(
"use_fake_hardware",
"use_mock_hardware",
default_value="true",
description="Start robot with fake hardware mirroring command to its states.",
description="Start robot with mock hardware mirroring command to its states.",
)
)
declared_arguments.append(
DeclareLaunchArgument(
"mock_sensor_commands",
default_value="false",
description="Enable fake command interfaces for sensors used for simple simulations. \
Used only if 'use_fake_hardware' parameter is true.",
description="Enable mock command interfaces for sensors used for simple simulations. \
Used only if 'use_mock_hardware' parameter is true.",
)
)
declared_arguments.append(
Expand Down Expand Up @@ -129,7 +129,7 @@ def generate_launch_description():
description_file = LaunchConfiguration("description_file")
prefix = LaunchConfiguration("prefix")
use_gazebo = LaunchConfiguration("use_gazebo")
use_fake_hardware = LaunchConfiguration("use_fake_hardware")
use_mock_hardware = LaunchConfiguration("use_mock_hardware")
mock_sensor_commands = LaunchConfiguration("mock_sensor_commands")
slowdown = LaunchConfiguration("slowdown")
controller_manager_name = LaunchConfiguration("controller_manager_name")
Expand All @@ -151,8 +151,8 @@ def generate_launch_description():
"use_gazebo:=",
use_gazebo,
" ",
"use_fake_hardware:=",
use_fake_hardware,
"use_mock_hardware:=",
use_mock_hardware,
" ",
"mock_sensor_commands:=",
mock_sensor_commands,
Expand Down
6 changes: 3 additions & 3 deletions example_15/bringup/launch/rrbot_namespace.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def generate_launch_description():
" ",
PathJoinSubstitution(
[
FindPackageShare("rrbot_description"),
FindPackageShare("ros2_control_demo_example_1"),
"urdf",
"rrbot.urdf.xacro",
]
Expand All @@ -41,13 +41,13 @@ def generate_launch_description():

robot_controllers = PathJoinSubstitution(
[
FindPackageShare("ros2_control_demo_bringup"),
FindPackageShare("ros2_control_demo_example_15"),
"config",
"rrbot_namespace_controllers.yaml",
]
)
rviz_config_file = PathJoinSubstitution(
[FindPackageShare("rrbot_description"), "config", "rrbot_namespace.rviz"]
[FindPackageShare("ros2_control_demo_example_15"), "rviz", "rrbot_namespace.rviz"]
)

control_node = Node(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def generate_launch_description():

position_goals = PathJoinSubstitution(
[
FindPackageShare("ros2_control_demo_bringup"),
FindPackageShare("ros2_control_demo_example_15"),
"config",
publisher_config,
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def generate_launch_description():

position_goals = PathJoinSubstitution(
[
FindPackageShare("ros2_control_demo_bringup"),
FindPackageShare("ros2_control_demo_example_15"),
"config",
publisher_config,
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def generate_launch_description():
# For example: the parameters for different node may be placed into the same yaml file
position_goals = PathJoinSubstitution(
[
FindPackageShare("ros2_control_demo_bringup"),
FindPackageShare("ros2_control_demo_example_15"),
"config",
"multi_controller_manager_forward_position_publisher.yaml",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def generate_launch_description():
# For example: the parameters for different node may be placed into the same yaml file
position_goals = PathJoinSubstitution(
[
FindPackageShare("ros2_control_demo_bringup"),
FindPackageShare("ros2_control_demo_example_15"),
"config",
"multi_controller_manager_joint_trajectory_publisher.yaml",
]
Expand Down
99 changes: 0 additions & 99 deletions example_15/description/launch/view_robot.launch.py

This file was deleted.

Binary file added example_15/doc/two_rrbot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a567858

Please sign in to comment.