Skip to content

Commit c20a34d

Browse files
committed
use rosidl parser, ros2 interface format
1 parent 6431eb5 commit c20a34d

19 files changed

+303
-540
lines changed

CMakeLists.txt

+2-4
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ set(CMAKE_MODULE_PATH
4949
${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules
5050
${LIBPLUGIN_DIR}/cmake)
5151
find_package(CoppeliaSim 4.0.0.0 REQUIRED)
52+
find_package(Python3 REQUIRED COMPONENTS Interpreter)
5253

5354
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/generated)
5455
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc)
@@ -62,13 +63,10 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}/generated)
6263
include_directories(${COPPELIASIM_INCLUDE_DIR})
6364
include_directories(${COPPELIASIM_COMMON_DIR})
6465

65-
set(ROS_MSG_SRV_CACHE "${CMAKE_CURRENT_BINARY_DIR}/ros-msg-srv-defs.pickle")
66-
add_custom_command(OUTPUT "${ROS_MSG_SRV_CACHE}" COMMAND python "${CMAKE_CURRENT_SOURCE_DIR}/tools/parse_messages_and_services.py" "${CMAKE_CURRENT_SOURCE_DIR}/meta/messages.txt" "${CMAKE_CURRENT_SOURCE_DIR}/meta/services.txt" "${ROS_MSG_SRV_CACHE}" DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/meta/messages.txt" "${CMAKE_CURRENT_SOURCE_DIR}/meta/services.txt" "${CMAKE_CURRENT_SOURCE_DIR}/tools/parse_messages_and_services.py")
67-
6866
set(generatedFiles)
6967
file(GLOB templateFiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/templates/ ${CMAKE_CURRENT_SOURCE_DIR}/templates/*)
7068
foreach(templateFile ${templateFiles})
71-
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/generated/${templateFile}" COMMAND python "${LIBPLUGIN_DIR}/simStubsGen/external/pycpp/pycpp.py" -p "cache_file=${ROS_MSG_SRV_CACHE}" -i "${CMAKE_CURRENT_SOURCE_DIR}/templates/${templateFile}" -o "${CMAKE_CURRENT_BINARY_DIR}/generated/${templateFile}" -P "${CMAKE_CURRENT_SOURCE_DIR}/tools" DEPENDS "${ROS_MSG_SRV_CACHE}" "${CMAKE_CURRENT_SOURCE_DIR}/templates/${templateFile}")
69+
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/generated/${templateFile}" COMMAND ${Python3_EXECUTABLE} "${LIBPLUGIN_DIR}/simStubsGen/external/pycpp/pycpp.py" -p "interfaces_file=${CMAKE_CURRENT_SOURCE_DIR}/meta/interfaces.txt" -i "${CMAKE_CURRENT_SOURCE_DIR}/templates/${templateFile}" -o "${CMAKE_CURRENT_BINARY_DIR}/generated/${templateFile}" -P "${CMAKE_CURRENT_SOURCE_DIR}/tools" DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/tools/parse_interfaces.py" "${CMAKE_CURRENT_SOURCE_DIR}/meta/interfaces.txt" "${CMAKE_CURRENT_SOURCE_DIR}/templates/${templateFile}")
7270
set(generatedFiles ${generatedFiles} "${CMAKE_CURRENT_BINARY_DIR}/generated/${templateFile}")
7371
endforeach()
7472
add_custom_target(generate_ros_code DEPENDS ${generatedFiles})

README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,13 @@ _NOTE:_ the directory containing all files (i.e. package.xml etc) must be called
1313
```
1414
$ git clone --recursive https://github.com/CoppeliaRobotics/simExtROS2Interface.git sim_ros2_interface
1515
```
16-
3. Edit `meta/messages.txt` and `meta/services.txt` if you need to include more ROS messages/services. You need to specify the full message/service type, i.e. geometry_msgs/Twist rather than Twist.
16+
3. Edit `meta/interfaces.txt` if you need to include more ROS interfaces. You need to specify the fully qualified interface, e.g. geometry_msgs/msg/Twist rather than Twist.
1717
4. Compile
1818
```
1919
$ colcon build --symlink-install
2020
```
21+
22+
Note: if you are reporting a compile error, please use this command to build:
23+
```
24+
VERBOSE=1 MAKEFLAGS=-j1 colcon build --symlink-install --event-handlers console_direct+ --parallel-workers 1
25+
```

meta/interfaces.txt

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
builtin_interfaces/msg/Duration
2+
builtin_interfaces/msg/Time
3+
geometry_msgs/msg/Quaternion
4+
geometry_msgs/msg/Transform
5+
geometry_msgs/msg/TransformStamped
6+
geometry_msgs/msg/Vector3
7+
sensor_msgs/msg/Image
8+
std_msgs/msg/Bool
9+
std_msgs/msg/Byte
10+
std_msgs/msg/ColorRGBA
11+
std_msgs/msg/Empty
12+
std_msgs/msg/Float32
13+
std_msgs/msg/Float64
14+
std_msgs/msg/Header
15+
std_msgs/msg/Int8
16+
std_msgs/msg/Int16
17+
std_msgs/msg/Int32
18+
std_msgs/msg/Int64
19+
std_msgs/msg/String
20+
std_msgs/msg/UInt8
21+
std_msgs/msg/UInt16
22+
std_msgs/msg/UInt32
23+
std_msgs/msg/UInt64
24+
std_srvs/srv/Empty
25+
std_srvs/srv/SetBool
26+
std_srvs/srv/Trigger
27+
example_interfaces/action/Fibonacci

meta/messages.txt

-129
This file was deleted.

meta/services.txt

-4
This file was deleted.

0 commit comments

Comments
 (0)