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

Cpp code genrators for ROS2 nodes #130

Merged
merged 3 commits into from
May 27, 2021
Merged

Conversation

ipa-nhg
Copy link
Member

@ipa-nhg ipa-nhg commented May 17, 2021

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'}}}}
}}
~~~~~~~~~~~
###########

@ipa-nhg ipa-nhg requested a review from hsd-dev May 17, 2021 14:23
@ipa-nhg
Copy link
Member Author

ipa-nhg commented May 17, 2021

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

@ipa-nhg ipa-nhg mentioned this pull request May 17, 2021
12 tasks
@ipa-nhg ipa-nhg mentioned this pull request May 24, 2021
7 tasks
@ipa-nhg ipa-nhg 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
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
Member Author

Choose a reason for hiding this comment

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

@ipa-nhg
Copy link
Member Author

ipa-nhg commented May 27, 2021

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
Copy link
Collaborator

hsd-dev commented May 27, 2021

LGTM let's merge this one!

@ipa-nhg ipa-nhg merged commit faa441b into ipa320:master May 27, 2021
@ipa-nhg ipa-nhg 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