eProsima / Fast-DDS-Gen

Fast-DDS IDL code generator tool. Looking for commercial support? Contact info@eprosima.com
Apache License 2.0
77 stars 59 forks source link

Error generating ROS2 idl messages #389

Open com-server-ap opened 1 month ago

com-server-ap commented 1 month ago

Hello everyone , I am trying to generate structures to communicate using ros2 idl messages. fastddsgen runs fine until it encounters nav_msg/srv. The error that appears for the nav_msgs / srv / GetMap.idl message is

/opt/ros/humble/share/nav_msgs/srv/GetMap.idl:17:35: error: Unexpected input 'map'

the GetMap.idl is below:

// generated from rosidl_adapter/resource/srv.idl.em
// with input from nav_msgs/srv/GetMap.srv
// generated code does not contain a copyright notice

#include "nav_msgs/msg/OccupancyGrid.idl"

module nav_msgs {
  module srv {
    @verbatim (language="comment", text=
      "Get the map as a nav_msgs/OccupancyGrid")
    struct GetMap_Request {
      uint8 structure_needs_at_least_one_member;
    };
    @verbatim (language="comment", text=
      "The current map hosted by this map service.")
    struct GetMap_Response {
      nav_msgs::msg::OccupancyGrid map;
    };
  };
};

Is it possible that fastddsgen is treating the map value as a type? Or could it be due to other reasons? How can this be resolved?

reproduce step:

fastddsgen -typeros2  -I /opt/ros/humble/share/   /opt/ros/humble/share/nav_msgs/srv/GetMap.idl -cs

Thanks in advance

MiguelCompany commented 1 month ago

map is a reserved word. You could use _map instead, and it will be generated without the underscore

com-server-ap commented 1 month ago

map is a reserved word. You could use _map instead, and it will be generated without the underscore

thanks a lot , it can meet my need.

by the way, when i generate TwistWithCovariance.idl structure,it will raise

TwistWithCovariance.idl:9:12: error: 'double' was redefined

the idl file is :

#include "Twist.idl"

module geometry_msgs {
  module msg {
    typedef double double__36[36];
    @verbatim (language="comment", text=
      " This expresses velocity in free space with uncertainty.")
    struct TwistWithCovariance {
      geometry_msgs::msg::Twist twist;

      @verbatim (language="comment", text=
        " Row-major representation of the 6x6 covariance matrix" "\n"
        " The orientation parameters use a fixed-axis representation." "\n"
        " In order, the parameters are:" "\n"
        " (x, y, z, rotation about X axis, rotation about Y axis, rotation about Z axis)")
      double__36 covariance;
    };
  };
};

Do you have any suggestions for solving this problem?