Skip to content

Commit

Permalink
Bring-in ROS2 branches
Browse files Browse the repository at this point in the history
  • Loading branch information
gergondet committed Feb 14, 2024
1 parent 246dc30 commit c9b8b99
Show file tree
Hide file tree
Showing 15 changed files with 128 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
with-ros: true
matrix: |
{
"dist": ["bionic", "focal"],
"dist": ["bionic", "focal", "jammy"],
"arch": ["amd64"]
}
secrets:
Expand Down
97 changes: 65 additions & 32 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,34 +1,67 @@
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.5)
project(mc_rtc_msgs VERSION 1.1.0)

find_package(catkin REQUIRED COMPONENTS message_generation geometry_msgs)

add_service_files(
DIRECTORY srv
FILES
EnableController.srv
open_grippers.srv
close_grippers.srv
set_gripper.srv
get_joint_pos.srv
set_joint_pos.srv
play_next_stance.srv
send_msg.srv
send_recv_msg.srv
move_com.srv
)

add_message_files(
DIRECTORY msg
FILES
JointSensors.msg
)
generate_messages(DEPENDENCIES geometry_msgs)

catkin_package(
CATKIN_DEPENDS geometry_msgs
)

install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h")
if(NOT DEFINED ENV{ROS_VERSION})
message(FATAL_ERROR "ROS_VERSION is not set in the environment")
endif()

if($ENV{ROS_VERSION} EQUAL 1)
find_package(catkin REQUIRED COMPONENTS message_generation geometry_msgs)

add_service_files(
DIRECTORY srv
FILES
EnableController.srv
open_grippers.srv
close_grippers.srv
set_gripper.srv
get_joint_pos.srv
set_joint_pos.srv
play_next_stance.srv
send_msg.srv
send_recv_msg.srv
move_com.srv
)

add_message_files(
DIRECTORY msg
FILES
JointSensors.msg
)
generate_messages(DEPENDENCIES geometry_msgs)

catkin_package(
CATKIN_DEPENDS geometry_msgs
)

install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h")
elseif($ENV{ROS_VERSION} EQUAL 2)
find_package(ament_cmake REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(geometry_msgs REQUIRED)

rosidl_generate_interfaces(${PROJECT_NAME}
msg/ros2/JointSensors.msg
srv/ros2/CloseGrippers.srv
srv/EnableController.srv
srv/ros2/GetJointPos.srv
srv/ros2/MoveCoM.srv
srv/ros2/OpenGrippers.srv
srv/ros2/PlayNextStance.srv
srv/ros2/SendMsg.srv
srv/ros2/SendRecvMsg.srv
srv/ros2/SetGripper.srv
srv/ros2/SetJointPos.srv
DEPENDENCIES geometry_msgs
)

install(DIRECTORY include/
DESTINATION include/${PROJECT_NAME}
FILES_MATCHING PATTERN "*.h")

ament_package()
else()
message(FATAL_ERROR "Unknown ROS version: $ENV{ROS_VERSION}")
endif()
11 changes: 8 additions & 3 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,21 @@ Vcs-git: https://github.com/jrl-umi3218/mc_rtc_msgs
Vcs-Browser: https://github.com/jrl-umi3218/mc_rtc_msgs
Build-Depends: debhelper (>= 9),
cmake,
ros-@ROS_DISTRO@-catkin,
ros-@ROS_DISTRO@-message-generation,
#ROS1 ros-@ROS_DISTRO@-catkin,
#ROS1 ros-@ROS_DISTRO@-message-generation,
#ROS2 python3-colcon-common-extensions,
#ROS2 ros-@ROS_DISTRO@-ament-cmake,
#ROS2 ros-@ROS_DISTRO@-ament-package,
#ROS2 ros-@ROS_DISTRO@-rosidl-default-generators,
ros-@ROS_DISTRO@-geometry-msgs


Package: ros-@ROS_DISTRO@-mc-rtc-msgs
Architecture: any
Section: misc
Depends: ${misc:Depends},
ros-@ROS_DISTRO@-message-runtime,
#ROS1 ros-@ROS_DISTRO@-message-runtime,
#ROS2 ros-@ROS_DISTRO@-rosidl-default-runtime,
ros-@ROS_DISTRO@-geometry-msgs
Description: Messages and services used for mc_rtc ROS integration
Messages and services used for mc_rtc ROS integration
3 changes: 2 additions & 1 deletion debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ export ROS_DISTRO:=@ROS_DISTRO@
export ROS_PYTHON_VERSION:=$(shell . /opt/ros/${ROS_DISTRO}/setup.sh && echo $$ROS_PYTHON_VERSION)
ifeq (${ROS_PYTHON_VERSION}, 3)
export PYTHONPATH:=/opt/ros/${ROS_DISTRO}/lib/python3/dist-packages:${PYTHONPATH}
export PYTHONPATH:=/opt/ros/${ROS_DISTRO}/lib/python$(shell python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}');")/site-packages:${PYTHONPATH}
export PYTHON_EXECUTABLE:=/usr/bin/python3
else
export PYTHONPATH:=/opt/ros/${ROS_DISTRO}/lib/python2.7/dist-packages:${PYTHONPATH}
export PYTHON_EXECUTABLE:=/usr/bin/python
endif
export PKG_CONFIG_PATH:=/opt/ros/${ROS_DISTRO}/lib/pkgconfig:$PKG_CONFIG_PATH
export ROS_MASTER_URI:=http://localhost:11311
export PYTHONPATH:=/opt/ros/${ROS_DISTRO}/lib/python2.7/dist-packages:$PYTHONPATH
export LD_LIBRARY_PATH:=/opt/ros/${ROS_DISTRO}/lib:$LD_LIBRARY_PATH
export CMAKE_PREFIX_PATH:=/opt/ros/${ROS_DISTRO}:$CMAKE_PREFIX_PATH

TMP = $(CURDIR)/debian/tmp
Expand Down
5 changes: 5 additions & 0 deletions msg/ros2/JointSensors.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
std_msgs/Header header
string[] name
float64[] motor_temperature
float64[] driver_temperature
float64[] motor_current
28 changes: 19 additions & 9 deletions package.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
<package>
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>mc_rtc_msgs</name>
<description>mc_rtc_msgs</description>
<version>1.1.0</version>
<author>Pierre Gergondet</author>
<description>mc_rtc_msgs</description>
<maintainer email="[email protected]">Pierre Gergondet</maintainer>
<license>BSD</license>
<url>https://github.com/jrl-umi3218/mc_rtc_msgs</url>
<author>Pierre Gergondet</author>

<buildtool_depend>catkin</buildtool_depend>
<buildtool_depend condition="$ROS_VERSION == 1">catkin</buildtool_depend>
<buildtool_depend condition="$ROS_VERSION == 2">ament_cmake</buildtool_depend>
<buildtool_depend condition="$ROS_VERSION == 2">rosidl_default_generators</buildtool_depend>

<build_depend>message_generation</build_depend>
<build_depend>geometry_msgs</build_depend>
<build_depend condition="$ROS_VERSION == 1">message_generation</build_depend>

<run_depend>geometry_msgs</run_depend>
<run_depend>message_runtime</run_depend>
</package>
<depend>geometry_msgs</depend>

<exec_depend condition="$ROS_VERSION == 1">message_runtime</exec_depend>
<exec_depend condition="$ROS_VERSION == 2">rosidl_default_runtime</exec_depend>

<member_of_group condition="$ROS_VERSION == 2">rosidl_interface_packages</member_of_group>

<export>
<build_type condition="$ROS_VERSION == 1">catkin</build_type>
<build_type condition="$ROS_VERSION == 2">ament_cmake</build_type>
</export>
</package>
2 changes: 2 additions & 0 deletions srv/ros2/CloseGrippers.srv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
bool success
4 changes: 4 additions & 0 deletions srv/ros2/GetJointPos.srv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
string jname
---
bool success
float64 q
3 changes: 3 additions & 0 deletions srv/ros2/MoveCoM.srv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
float64[3] com
---
bool success
2 changes: 2 additions & 0 deletions srv/ros2/OpenGrippers.srv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
bool success
2 changes: 2 additions & 0 deletions srv/ros2/PlayNextStance.srv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
bool success
3 changes: 3 additions & 0 deletions srv/ros2/SendMsg.srv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
string msg
---
bool success
4 changes: 4 additions & 0 deletions srv/ros2/SendRecvMsg.srv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
string msg
---
bool success
string msg
4 changes: 4 additions & 0 deletions srv/ros2/SetGripper.srv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
string gname
float64[] values
---
bool success
4 changes: 4 additions & 0 deletions srv/ros2/SetJointPos.srv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
string jname
float64 q
---
bool success

0 comments on commit c9b8b99

Please sign in to comment.