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

Bug: PoseStamped.idl: Illegal identifier: geometry_msgs::msg::pose is already defined #56

Closed
Ryanf55 opened this issue Mar 11, 2023 · 3 comments
Assignees

Comments

@Ryanf55
Copy link
Contributor

Ryanf55 commented Mar 11, 2023

Summary

This bug reports a illegal identifier when trying to generate PoseStamped. One theory is because Pose and pose are different cases, but treated the same.

Versioning

OS: Ubuntu 22.04
Hash: 0eed89a
Message: ROS2 geometry_msgs/msg/PoseStamped

Steps to reproduce

  1. Take the ROS2 IDL's that make up PoseStamped, dump them in a single folder, and edit the includes to not have folders
  2. Run the genretor on messages sequentially to build up PoseStamped.
    • microxrceddsgen Quaternion.idl
    • microxrceddsgen Point.idl
    • microxrceddsgen Time.idl
    • microxrceddsgen Header.idl
    • microxrceddsgen Pose.idl
    • microxrceddsgen PoseStamped.idl
  3. Observe this error:
$ microxrceddsgen libraries/AP_XRCE_Client/Idl/PoseStamped.idl
openjdk version "11.0.18" 2023-01-17
OpenJDK Runtime Environment (build 11.0.18+10-post-Ubuntu-0ubuntu122.04)
OpenJDK 64-Bit Server VM (build 11.0.18+10-post-Ubuntu-0ubuntu122.04, mixed mode, sharing)
Loading templates...
Processing the file libraries/AP_XRCE_Client/Idl/PoseStamped.idl...
libraries/AP_XRCE_Client/Idl/PoseStamped.idl:15:35: error: Illegal identifier: geometry_msgs::msg::pose is already defined (Definition: com.eprosima.idl.parser.tree.TypeDeclaration@6aeb35e6)

Message Definition

ROS2 .msg

$ ros2 interface show geometry_msgs/msg/PoseStamped
# A Pose with reference coordinate frame and timestamp

std_msgs/Header header
        builtin_interfaces/Time stamp
                int32 sec
                uint32 nanosec
        string frame_id
Pose pose
        Point position
                float64 x
                float64 y
                float64 z
        Quaternion orientation
                float64 x 0
                float64 y 0
                float64 z 0
                float64 w 1

IDL

$ PoseStamped.idl 
// generated from rosidl_adapter/resource/msg.idl.em
// with input from geometry_msgs/msg/PoseStamped.msg
// generated code does not contain a copyright notice

#include "Pose.idl"
#include "Header.idl"

module geometry_msgs {
 module msg {
   @verbatim (language="comment", text=
     "A Pose with reference coordinate frame and timestamp")
   struct PoseStamped {
     std_msgs::msg::Header header;

     geometry_msgs::msg::Pose pose;
   };
 };
};
@Acuadros95
Copy link
Contributor

You need to run the generator with the case sensitive -cs option.

I have added it on this PR: #61

@Acuadros95
Copy link
Contributor

Closing as the fix is merged, feel free to reopen if any other problem appears

@dambrosio
Copy link

I have run into a similar issue trying to generate .h and .c files for ROS packages installed by default with the ros-base Humble variant.

If I copy all .idl files from /opt/ros/humble/share to ~/idl:

mkdir ~/idl
pushd /opt/ros/humble/share
find . -name "*.idl" -exec cp --parents {} ~/idl \;

I then get the following structure:

ls
rmw_dds_common
std_msgs
nav_msgs
map_msgs
...

If I attempt to run the microxrceddsgen script on all .idl files in ~/idl:

find idl -name "*.idl" -exec bash -c './micro-xrce-dds-gen/scripts/microxrceddsgen -cs -replace -I idl -d $(dirname "$1") "$1"' x {} \;

I get a bunch of Illegal identifier: is already defined errors, even with the -cs flag specified.

For example:

Processing the file idl/rmw_dds_common/msg/ParticipantEntitiesInfo.idl...
In file included from idl/rmw_dds_common/msg/NodeEntitiesInfo.idl:5:0,
                      idl/rmw_dds_common/msg/ParticipantEntitiesInfo.idl:6:0:
idl/rmw_dds_common/msg/Gid.idl:8:12: error: 'uint8' was redefined
In file included from idl/rmw_dds_common/msg/NodeEntitiesInfo.idl:5:0,
                      idl/rmw_dds_common/msg/ParticipantEntitiesInfo.idl:6:0:
idl/rmw_dds_common/msg/Gid.idl:9:15: error: Illegal identifier: rmw_dds_common::msg::Gid is already defined (Definition: com.eprosima.idl.parser.tree.TypeDeclaration@70cf32e3)
In file included from idl/rmw_dds_common/msg/NodeEntitiesInfo.idl:5:0,
                      idl/rmw_dds_common/msg/ParticipantEntitiesInfo.idl:6:0:
idl/rmw_dds_common/msg/Gid.idl:13:0: error: Unexpected input '}'

If I just generate from .idls in geometry_msgs, everything works as expected:

find idl/geometry_msgs -name "*.idl" -exec bash -c './micro-xrce-dds-gen/scripts/microxrceddsgen -cs -I idl -d $(dirname "$1") -replace "$1"' x {} \;

The packages with issues:

  • rmw_dds_common
  • nav_msgs
  • map_msgs
  • tf2_msgs
  • visualization_msgs
  • sensor_msgs
  • pcl_msgs
  • stereo_msgs
  • trajectory_msgs

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

No branches or pull requests

3 participants