Skip to content

Cpp code genrators for ROS2 nodes#130

Merged
NadiaHG merged 3 commits into
ipa320:masterfrom
NadiaHG:Ros2CppNode
May 27, 2021
Merged

Cpp code genrators for ROS2 nodes#130
NadiaHG merged 3 commits into
ipa320:masterfrom
NadiaHG:Ros2CppNode

Conversation

@NadiaHG

@NadiaHG NadiaHG commented May 17, 2021

Copy link
Copy Markdown
Member

These changes creates for the RosModel model:

PackageSet { 
	CatkinPackage test_ros2{ Artifact  test_ros2 {
	  Node { name test_ros2 
		Publishers {
			Publisher { name string_pub message "std_msgs.String"},
			Publisher { name battery_pub message "sensor_msgs.BatteryState"}}
		Subscribers {
			Subscriber {name bool_sub message "std_msgs.Bool"},
			Subscriber {name image_sub message "sensor_msgs.Image"}}
		}
	}}}

the following ROS package:

https://github.com/ipa-nhg/test_ros2_code_extractor/tree/master/test_ros2

To test it I used the ros-model-extractors and its foxy docker container with the commands:

docker build --tag=haros_foxy -f foxy/Dockerfile .
docker run -it haros_foxy:latest /haros_runner.sh test_ros2 test_ros2 node . /root/ws https://github.com/ipa-nhg/test_ros2_code_extractor

The resulted model was:

## Init HAROS ##
[HAROS] Running setup operations...

## Call the HAROS plugin to extract the ros-models ##
###########
~~~~~~~~~~~
Print of the model: test_ros2.ros:
~~~~~~~~~~~
PackageSet {
  CatkinPackage test_ros2 { 
    Artifact test_ros2 {
      Node { name test_ros2
        Publishers {
          Publisher { name 'string_pub' message 'std_msgsString'},
          Publisher { name 'battery_pub' message 'sensor_msgsBatteryState'}}
        Subscribers {
          Subscriber { name 'bool_sub' message 'std_msgsBool'},
          Subscriber { name 'image_sub' message 'sensor_msgsImage'}}}}
}}
~~~~~~~~~~~
###########

@NadiaHG NadiaHG requested a review from hsd-dev May 17, 2021 14:23
@NadiaHG

NadiaHG commented May 17, 2021

Copy link
Copy Markdown
Member Author

Comments from @ipa-hsd of potential improvements for the code template:

@NadiaHG NadiaHG mentioned this pull request May 17, 2021
12 tasks
@NadiaHG NadiaHG mentioned this pull request May 24, 2021
7 tasks
@NadiaHG NadiaHG force-pushed the Ros2CppNode branch 2 times, most recently from 266b844 to 1c73bc0 Compare May 25, 2021 12:14
find_package(sensor_msgs REQUIRED)

add_executable(test_node src/test_node.cpp)
ament_target_dependencies(test_node std_srvs sensor_msgs )

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

rclcpp is missing I think

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@NadiaHG

NadiaHG commented May 27, 2021

Copy link
Copy Markdown
Member Author

I updated here also the ROS1 code generator to generate also a full package.

For testing I added the autogenerated example to: https://github.com/ipa-nhg/test_ros_code_extractor and I am using the cpp code that we are generating to test the extractors: ipa320/ros-model-extractors@dbfc5a6#diff-3722d9ba8feb2d3feac8ce71a209a638d4b404e1c53f937188761181594023e2R23

All the tests are successful: https://github.com/ipa320/ros-model-extractors/actions 👏🏽 👏🏽

@ipa-hsd thanks for your help! should we merge this version and continue the improvements of the ROS2 code generation in #135 ?

@hsd-dev

hsd-dev commented May 27, 2021

Copy link
Copy Markdown
Collaborator

LGTM let's merge this one!

@NadiaHG NadiaHG merged commit faa441b into ipa320:master May 27, 2021
@NadiaHG NadiaHG deleted the Ros2CppNode branch May 27, 2021 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants