Skip to content

Commit

Permalink
Split irobot_create_toolbox (#153)
Browse files Browse the repository at this point in the history
* rename irobot_create_toolbox into irobot_create_nodes

Signed-off-by: Alberto Soragna <alberto.soragna@gmail.com>

* move common utilities to irobot_create_toolbox

Signed-off-by: Alberto Soragna <alberto.soragna@gmail.com>

* register irobot_create_nodes as rclcpp_components

Signed-off-by: Alberto Soragna <alberto.soragna@gmail.com>

* update readme

Signed-off-by: Alberto Soragna <alberto.soragna@gmail.com>

* use new node names in parameter files

Signed-off-by: Alberto Soragna <alberto.soragna@gmail.com>

* remove declare parameter utility and fix linter tests

Signed-off-by: Alberto Soragna <alberto.soragna@gmail.com>
  • Loading branch information
alsora committed Feb 24, 2022
1 parent 5abd046 commit f1d9359
Show file tree
Hide file tree
Showing 78 changed files with 834 additions and 787 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
irobot_create_common_bringup
irobot_create_control
irobot_create_description
irobot_create_nodes
irobot_create_toolbox
irobot_create_gazebo_bringup
irobot_create_gazebo_plugins
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ vcs import ~/create3_ws/src/ < ~/create3_ws/src/create3_sim/dependencies.repos

```bash
cd ~/create3_ws
sudo apt-get update
rosdep install --from-path src -yi
```

Expand Down Expand Up @@ -110,7 +111,8 @@ This repository contains packages for both the Classic and Ignition Gazebo simul
- `irobot_create_common_bringup` Launch files and configurations
- `irobot_create_control` Launch control nodes
- `irobot_create_description` URDF and mesh files describing the robot
- `irobot_create_toolbox` Nodes for simulating robot topics and motion control
- `irobot_create_nodes` Nodes for simulating robot topics and motion control
- `irobot_create_toolbox` Tools and helpers for creating nodes and plugins

- `irobot_create_gazebo` Packages used for the Classic Gazebo Simulator
- `irobot_create_gazebo_bringup` Launch files and configurations
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
hazards_vector_node:
hazards_vector_publisher:
ros__parameters:
# Hazard detection publisher topic
publisher_topic: /hazard_detection
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
ir_intensity_vector_node:
ir_intensity_vector_publisher:
ros__parameters:
# IR intensity publisher topic
publisher_topic: /ir_intensity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
---
kidnap_estimator:
kidnap_estimator_publisher:
ros__parameters:
# Kidnap status publisher topic
kidnap_status_topic: /kidnap_status
# Publishers rate
kidnap_status_publish_rate: 1.0
# Subscription topics
hazard_topic: /hazard_detection
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
mock_publisher_node:
mock_publisher:
ros__parameters:
# Mock buttons publisher topic
button_topic: /interface_buttons
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
wheel_status_publisher_node:
wheel_status_publisher:
ros__parameters:
# Publish rate
publish_rate: 62.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,27 @@ def generate_launch_description():

# Publish hazards vector
hazards_vector_node = Node(
package='irobot_create_toolbox',
name='hazards_vector_node',
executable='hazards_vector_publisher_node',
package='irobot_create_nodes',
name='hazards_vector_publisher',
executable='hazards_vector_publisher',
parameters=[hazards_params_yaml_file,
{'use_sim_time': True}],
output='screen',
)

# Publish IR intensity vector
ir_intensity_vector_node = Node(
package='irobot_create_toolbox',
name='ir_intensity_vector_node',
executable='ir_intensity_vector_publisher_node',
package='irobot_create_nodes',
name='ir_intensity_vector_publisher',
executable='ir_intensity_vector_publisher',
parameters=[ir_intensity_params_yaml_file,
{'use_sim_time': True}],
output='screen',
)

# Motion Control
motion_control_node = Node(
package='irobot_create_toolbox',
package='irobot_create_nodes',
name='motion_control',
executable='motion_control',
parameters=[{'use_sim_time': True}],
Expand All @@ -76,19 +76,19 @@ def generate_launch_description():

# Publish wheel status
wheel_status_node = Node(
package='irobot_create_toolbox',
name='wheel_status_publisher_node',
executable='wheel_status_publisher_node',
package='irobot_create_nodes',
name='wheel_status_publisher',
executable='wheel_status_publisher',
parameters=[wheel_status_params_yaml_file,
{'use_sim_time': True}],
output='screen',
)

# Publish mock topics
mock_topics_node = Node(
package='irobot_create_toolbox',
name='mock_publisher_node',
executable='mock_publisher_node',
package='irobot_create_nodes',
name='mock_publisher',
executable='mock_publisher',
parameters=[mock_params_yaml_file,
{'use_sim_time': True},
{'gazebo': LaunchConfiguration('gazebo')}],
Expand All @@ -97,19 +97,19 @@ def generate_launch_description():

# Publish robot state
robot_state_node = Node(
package='irobot_create_toolbox',
package='irobot_create_nodes',
name='robot_state',
executable='robot_state_node',
executable='robot_state',
parameters=[robot_state_yaml_file,
{'use_sim_time': True}],
output='screen',
)

# Publish kidnap estimator
kidnap_estimator_node = Node(
package='irobot_create_toolbox',
name='kidnap_estimator',
executable='kidnap_estimator_publisher_node',
package='irobot_create_nodes',
name='kidnap_estimator_publisher',
executable='kidnap_estimator_publisher',
parameters=[kidnap_estimator_yaml_file,
{'use_sim_time': True}],
output='screen',
Expand Down
2 changes: 1 addition & 1 deletion irobot_create_common/irobot_create_control/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<exec_depend>gazebo_ros2_control</exec_depend>
<exec_depend>ign_ros2_control</exec_depend>
<exec_depend>irobot_create_toolbox</exec_depend>
<exec_depend>irobot_create_nodes</exec_depend>
<exec_depend>joint_state_broadcaster</exec_depend>
<exec_depend>ros2launch</exec_depend>
<exec_depend>ros2_controllers</exec_depend>
Expand Down
195 changes: 195 additions & 0 deletions irobot_create_common/irobot_create_nodes/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
cmake_minimum_required(VERSION 3.5)

project(irobot_create_nodes)

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

find_package(ament_cmake REQUIRED)
find_package(angles REQUIRED)
find_package(control_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(irobot_create_msgs REQUIRED)
find_package(irobot_create_toolbox REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_action REQUIRED)
find_package(rclcpp_components REQUIRED)
find_package(tf2 REQUIRED)
find_package(tf2_geometry_msgs REQUIRED)
find_package(tf2_ros REQUIRED)

#### Libraries

set(dependencies
angles
control_msgs
geometry_msgs
sensor_msgs
nav_msgs
irobot_create_msgs
irobot_create_toolbox
nav_msgs
rclcpp
rclcpp_action
tf2
tf2_geometry_msgs
tf2_ros
)

# Hazards vector publisher
add_library(hazard_publisher_lib SHARED)
target_sources(
hazard_publisher_lib
PRIVATE
src/hazards_vector_publisher.cpp
)
target_include_directories(hazard_publisher_lib PUBLIC include)
ament_target_dependencies(hazard_publisher_lib
${dependencies}
)

rclcpp_components_register_node(hazard_publisher_lib
PLUGIN "irobot_create_nodes::HazardsVectorPublisher"
EXECUTABLE hazards_vector_publisher)

# IR intensity vector publisher
add_library(ir_intensity_publisher_lib SHARED)
target_sources(
ir_intensity_publisher_lib
PRIVATE
src/ir_intensity_vector_publisher.cpp
)
target_include_directories(ir_intensity_publisher_lib PUBLIC include)
ament_target_dependencies(ir_intensity_publisher_lib
${dependencies}
)

rclcpp_components_register_node(ir_intensity_publisher_lib
PLUGIN "irobot_create_nodes::IrIntensityVectorPublisher"
EXECUTABLE ir_intensity_vector_publisher)

# Motion control node
add_library(motion_control_lib SHARED)
target_sources(
motion_control_lib
PRIVATE
src/motion_control_node.cpp
src/motion_control/docking_behavior.cpp
src/motion_control/drive_goal_behaviors.cpp
src/motion_control/reflex_behavior.cpp
src/motion_control/wall_follow_behavior.cpp
src/motion_control/wall_follow_states.cpp
)
target_include_directories(motion_control_lib PUBLIC include)
ament_target_dependencies(motion_control_lib
${dependencies}
)

rclcpp_components_register_node(motion_control_lib
PLUGIN "irobot_create_nodes::MotionControlNode"
EXECUTABLE motion_control)

# Wheel status publisher
add_library(wheel_status_publisher_lib SHARED)
target_sources(
wheel_status_publisher_lib
PRIVATE
src/wheels_publisher.cpp
)
target_include_directories(wheel_status_publisher_lib PUBLIC include)
ament_target_dependencies(wheel_status_publisher_lib
${dependencies}
)

rclcpp_components_register_node(wheel_status_publisher_lib
PLUGIN "irobot_create_nodes::WheelsPublisher"
EXECUTABLE wheel_status_publisher)

# Robot status publisher
add_library(robot_state_lib SHARED)
target_sources(
robot_state_lib
PRIVATE
src/robot_state.cpp
)
target_include_directories(robot_state_lib PUBLIC include)
ament_target_dependencies(robot_state_lib
${dependencies}
)

rclcpp_components_register_node(robot_state_lib
PLUGIN "irobot_create_nodes::RobotState"
EXECUTABLE robot_state)

# Mock publisher
add_library(mock_publisher_lib SHARED)
target_sources(
mock_publisher_lib
PRIVATE
src/mock_publisher.cpp
)
target_include_directories(mock_publisher_lib PUBLIC include)
ament_target_dependencies(mock_publisher_lib
${dependencies}
)

rclcpp_components_register_node(mock_publisher_lib
PLUGIN "irobot_create_nodes::MockPublisher"
EXECUTABLE mock_publisher)

# Kidnap estimator publisher
add_library(kidnap_estimator_publisher_lib SHARED)
target_sources(
kidnap_estimator_publisher_lib
PRIVATE
src/kidnap_estimator_publisher.cpp
)
target_include_directories(kidnap_estimator_publisher_lib PUBLIC include)
ament_target_dependencies(kidnap_estimator_publisher_lib
${dependencies}
)

rclcpp_components_register_node(kidnap_estimator_publisher_lib
PLUGIN "irobot_create_nodes::KidnapEstimator"
EXECUTABLE kidnap_estimator_publisher)

set(libraries_names
hazard_publisher_lib
ir_intensity_publisher_lib
motion_control_lib
wheel_status_publisher_lib
robot_state_lib
mock_publisher_lib
kidnap_estimator_publisher_lib
)

#### Install

install(TARGETS ${libraries_names}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)

install(DIRECTORY include/
DESTINATION include
)

ament_export_include_directories(include)
ament_export_libraries(${libraries_names})
ament_export_dependencies(${dependencies})

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()

ament_package()
4 changes: 4 additions & 0 deletions irobot_create_common/irobot_create_nodes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# iRobot® Create® 3 Nodes

This package contains a set of nodes used for simulating a iRobot® Create® 3 robot.
Each node is defined in its own shared library and registered using `rclcpp_components` to allow run-time composition in applications.
Loading

0 comments on commit f1d9359

Please sign in to comment.