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

Generating from ros2 .msg file format [13830] #92

Closed
Nir-Az opened this issue Feb 10, 2022 · 2 comments
Closed

Generating from ros2 .msg file format [13830] #92

Nir-Az opened this issue Feb 10, 2022 · 2 comments
Labels
invalid This doesn't seem right

Comments

@Nir-Az
Copy link

Nir-Az commented Feb 10, 2022

Hi,

I wish to generate code from a ros2 .msg file using fastddsgen.

  1. When I try to input the .msg file (that only has 1 line inside "string name") and execute fastddsgen I gen a syntax error.
  2. If I create an idl file using OMG syntax for it it works, but using the -typeros2 flag doesn't change anything, the output files stay the same with/without it.
    I expected to see something different, shouldn't I?

Thanks
Nir

@JLBuenoLopez JLBuenoLopez changed the title Generating from ros2 .msg file format Generating from ros2 .msg file format [13830] Feb 10, 2022
@RFRIEDM-Trimble
Copy link

In ROS2 galactic release notes, they add a note about this.

Testing this out, here's what I did.

Create the message file

mkdir -p demo/msg
cd demo
cat << EOF > msg/Demo.msg
std_msgs/Header header
geometry_msgs/Twist twist
geometry_msgs/Accel accel
EOF

Run the generator

rosidl generate -o gen -t c -t cpp -t py -I$(ros2 pkg prefix --share std_msgs)/..   -I$(ros2 pkg prefix --share geometry_msgs)/.. demo msg/Demo.msg

View the idl file in the tmp directory

cat gen/cpp/tmp/msg/Demo.idl 
// generated from rosidl_adapter/resource/msg.idl.em
// with input from demo/msg/Demo.msg
// generated code does not contain a copyright notice

#include "geometry_msgs/msg/Accel.idl"
#include "geometry_msgs/msg/Twist.idl"
#include "std_msgs/msg/Header.idl"

module demo {
  module msg {
    struct Demo {
      std_msgs::msg::Header header;

      geometry_msgs::msg::Twist twist;

      geometry_msgs::msg::Accel accel;
    };
  };
};

Note: You can see the includes looking for IDL files at the above paths; I am not yet sure how add /opt/ros/galactic/share to the IDL include path if you wanted to run fastddsgen.

find /opt/ros/galactic/ | grep Twist.idl
/opt/ros/galactic/share/geometry_msgs/msg/Twist.idl

@JLBuenoLopez JLBuenoLopez added the invalid This doesn't seem right label Sep 29, 2023
@JLBuenoLopez
Copy link
Contributor

Fast DDS-Gen is a tool independent from ROS 2 and it supports generation of Fast DDS TypeSupports from the OMG defined IDL format. I am afraid that it is not planned to support ROS 2 .msg format nor the -typeros2 option is intended for the described use in this ticket. I think that ROS 2 has a tool to transform from .msg to IDL files.

@JLBuenoLopez JLBuenoLopez closed this as not planned Won't fix, can't repro, duplicate, stale Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

3 participants