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

Implemented action bridge #256

Open
wants to merge 43 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
688768b
added action templates
hsd-dev May 3, 2020
5bbc928
generate action interface mappings
hsd-dev May 3, 2020
d4fc03e
added action factories
hsd-dev May 3, 2020
d833d8c
added action_bridge executable
hsd-dev May 5, 2020
629697e
fix template
hsd-dev May 5, 2020
1539a30
hack for GripperCommand
hsd-dev May 5, 2020
5d96c75
Update include/ros1_bridge/action_factory.hpp
hsd-dev Jun 9, 2020
e265f37
Fix python script errors in action generation
Nov 13, 2020
2d51958
Foxy and later action compatibility
Nov 13, 2020
0040380
Reorder ros node initialization to allow renaming of bridge
Nov 17, 2020
580ad9e
fix error during rebase
hsd-dev May 24, 2021
33b8bce
updated deprecated GoalResponseCallback signature
hsd-dev May 24, 2021
3d8dee1
Update resource/interface_factories.cpp.em
hsd-dev Nov 18, 2020
1091806
applied uncrustify patches
hsd-dev Nov 18, 2020
74188ff
fix action mapping rules
hsd-dev Nov 20, 2020
5cd1321
print available action pairs
hsd-dev Nov 21, 2020
3c3fe17
get active ROS1 action servers and clients
hsd-dev Nov 21, 2020
0210c17
remove prints
hsd-dev Nov 23, 2020
b256b9f
fix mapping rules for services
hsd-dev Nov 24, 2020
aafcf3a
reformatted with uncrustify
hsd-dev May 26, 2021
9c83a93
map actions in dynamic_bridge
hsd-dev Jun 6, 2021
bc350f4
shutdown internal server before removing the bridge
hsd-dev Jun 7, 2021
deb5805
updated GoalResponseCallback signature
hsd-dev Jan 12, 2022
69c815b
updated README
hsd-dev Jan 12, 2022
1f600e0
fix formatting
hsd-dev Jan 13, 2022
1dd38b3
add actionlib dependency with condition
hsd-dev Jun 16, 2022
a5eb300
added dependency on rclcpp_action
hsd-dev Jul 6, 2022
91b3197
Update CMakeLists.txt
hsd-dev Nov 25, 2022
51ac119
Update README.md
hsd-dev Nov 25, 2022
94404b0
Update include/ros1_bridge/action_factory.hpp
hsd-dev Nov 25, 2022
d7fdc6d
Update resource/get_factory.cpp.em
hsd-dev Nov 25, 2022
c071edf
Update ros1_bridge/__init__.py
hsd-dev Nov 25, 2022
be56382
Update src/action_bridge.cpp
hsd-dev Nov 25, 2022
94b9c70
risk leaking if the reset call crashes somehow
hsd-dev Mar 27, 2023
21bee28
Add goal ID to log output so it's more useful
hsd-dev Mar 27, 2023
7ba2784
rename variable so it's distinction from the variable with the same n…
hsd-dev Mar 27, 2023
084ed7f
Change cout to use RCLCPP logging macros.
hsd-dev Mar 27, 2023
86a8140
remove commented out code
hsd-dev Mar 27, 2023
12838b9
fix parenthesis
hsd-dev Mar 27, 2023
6b10de4
remove unused params
hsd-dev Mar 27, 2023
514f53d
fix nullptr keyword
hsd-dev Mar 27, 2023
5e3c841
remove outdated comments
hsd-dev Mar 27, 2023
79a46de
pass logger to GoalHandler
hsd-dev Mar 27, 2023
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
12 changes: 11 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rmw_implementation_cmake REQUIRED)
find_package(std_msgs REQUIRED)
find_package(rclcpp_action REQUIRED)

# find ROS 1 packages
set(cmake_extras_files cmake/find_ros1_package.cmake cmake/find_ros1_interface_packages.cmake)
Expand Down Expand Up @@ -43,6 +44,7 @@ if(NOT ros1_roscpp_FOUND)
endif()

find_ros1_package(std_msgs REQUIRED)
find_ros1_package(actionlib REQUIRED)

# Dependency that we should only look for if ROS 1 is installed (it's not present on a ROS 2
# system; see https://github.com/ros2/ros1_bridge/pull/331#issuecomment-1188111510)
Expand Down Expand Up @@ -146,7 +148,7 @@ foreach(package_name ${ros2_interface_packages})
file(TO_CMAKE_PATH "${interface_file}" interface_name)
get_filename_component(interface_basename "${interface_name}" NAME_WE)
# skipping actions and request and response messages of services
if(NOT "${interface_name}" MATCHES "^(msg|srv)/" OR "${interface_basename}" MATCHES "_(Request|Response)$")
if(NOT "${interface_name}" MATCHES "^(msg|srv|action)/" OR "${interface_basename}" MATCHES "_(Request|Response)$")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since _(Request|Response)$ are explicitly being skipped I would expect something similar to be necessary for the parts of actions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was expecting the same, but it doesn't generate _Goal, _Feedback, _Result, so I skipped it.

continue()
endif()
string(REPLACE "/" "__" interface_name "${interface_name}")
Expand Down Expand Up @@ -226,6 +228,7 @@ ament_target_dependencies(${PROJECT_NAME}
${prefixed_ros1_message_packages}
${ros2_interface_packages}
"rclcpp"
"rclcpp_action"
"ros1_roscpp"
"ros1_std_msgs")

Expand All @@ -241,6 +244,13 @@ custom_executable(static_bridge
target_link_libraries(static_bridge
${PROJECT_NAME})

custom_executable(action_bridge
"src/action_bridge.cpp"
ROS1_DEPENDENCIES
TARGET_DEPENDENCIES ${ros2_interface_packages})
target_link_libraries(action_bridge
${PROJECT_NAME})

custom_executable(parameter_bridge
"src/parameter_bridge.cpp"
ROS1_DEPENDENCIES
Expand Down
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -502,3 +502,51 @@ topics:
```

Note that the `qos` section can be omitted entirely and options not set are left default.

# Action bridge

This bridge extends the `ros1_bridge` to support actions. The bridge works in both directions, meaning an action goal can be sent from ROS 1 client to ROS 2 server, or from ROS 2 client to ROS 1 server.

The arguments for the `action_bridge` node are:
`direction`: from client (`ros1` or `ros2`)
e.g.:
- `ROS1` client to `ROS2` server --> `direction` = `ros1`
- `ROS2` client to `ROS1` server --> `direction` = `ros2`

`package`: package of the `ROS1` server node
`type`: action interface type of `ROS1`
`name`: action name

For sending goals from a ROS 2 action client to a ROS 1 action server
```
# Terminal 1 -- action bridge
# Make sure roscore is already running
source <ros1_bridge-install-dir>/setup.bash
ros2 run ros1_bridge action_bridge ros1 actionlib_tutorials Fibonacci fibonacci

# Terminal 2 -- ROS 1 action server
source <ros1-install-dir>/setup.bash
rosrun actionlib_tutorials fibonacci_server

# Terminal 3 -- ROS 2 action client
source <ros2-install-dir>/setup.bash
ros2 run action_tutorials_cpp fibonacci_action_client 20
```

For sending goals from a ROS 1 action client to a ROS 2 action server
```
# Terminal 1 -- action bridge
# Make sure roscore is already running
source <ros1_bridge-install-dir>/setup.bash
ros2 run ros1_bridge action_bridge ros2 action_tutorials_interfaces action/Fibonacci fibonacci

# Terminal 2 -- ROS 2 action server
source <ros2-install-dir>/setup.bash
ros2 run action_tutorials_cpp fibonacci_action_server

# Terminal 3 -- ROS 1 action client
source <ros1-install-dir>/setup.bash
rosrun actionlib_tutorials fibonacci_client 20
```

`dynamic_bridge` has been extended to handle actions as well.
Loading