ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

problem during converting grid_map_msgs message from ros1 to ros2

asked 2022-12-12 16:26:53 -0500

ARGHYAJONY gravatar image

updated 2022-12-12 17:27:06 -0500

ljaniec gravatar image

Required Info:

  • Operating System:
    • Ubuntu 20.04
  • ROS Versions
    • ROS1 noetic, ROS2 Foxy
  • Installation type:
    • Source

Steps to reproduce issue

I have converted a grid_map_msgs type message from ros1 to ros2. I have a ros1 version for noetic and ros2 version for foxy. I have installed ros-noetic-grid-map-msgs from binaries in ros1 and built grid-map-msgs foxy devel in ros2 from the source. Now I can convert the message to 90% using ros1_bridge and I can see the message is able to publish the grid_map_msgs in ros2 but for some reason, the header and frame id seems to be publishing null value in ros2 side. Other data are correct.

For ros1 side, grid_map_msgs looks following:

GridMapInfo info
string[] layers
string[] basic_layers
std_msgs/Float32MultiArray[] data
uint16 outer_start_index
uint16 inner_start_index

grid_map_info looks following:

Header header
float64 resolution
float64 length_x
float64 length_y
geometry_msgs/Pose pose

For ros2 side, grid_map_msgs looks following:

std_msgs/Header header
GridMapInfo info
string[] layers
string[] basic_layers
std_msgs/Float32MultiArray[] data
uint16 outer_start_index
uint16 inner_start_index

grid_map_info_msgs looks the following:

float64 resolution
float64 length_x
float64 length_y
geometry_msgs/Pose pose

As you can clearly see, in ros2 side the header and frame id has been swapped from grid_map_info to grid_map_msgs. In ros1 side, the header and frame id was inside grid_map_info and grid_map_info was called inside grid_map_msgs.

Expected behavior

The grid_map_msgs ros2 package should map the frame id and header from the grid_map_info_msgs in ros1 package. During mapping, the way it should map:

grid_map_msgs.msgs.GridMap.header (ros2) = grid_map_msgs.GridMapInfo.header (ros1)
grid_map_msgs.msgs.GridMap.frame_id (ros2) = grid_map_msgs.GridMapInfo.frame_id (ros1)

Actual behavior

The grid_map_msgs ros2 package is mapping the frame id and header from the grid_map_msgs in ros1 package right now.

grid_map_msgs.msgs.GridMap.header (ros2) = grid_map_msgs.GridMap.header (ros1, which is null)
grid_map_msgs.msgs.GridMap.frame_id (ros2) = grid_map_msgs.GridMap.frame_id (ros1, which is null)

My question is, how can I manually edit the conversion file (inside build/install of bridge workspace) so that I can map that specific element (header and frameid) inside grid_map_msgs manually before or after the build?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-12-12 17:23:05 -0500

ljaniec gravatar image

Why do you have to install ros-noetic-grid-map-msgs from binaries? I am not sure if I follow here.

Did you try to use YAML with mappings? It surprised me that the headers don't work out of the box straight away though.

Regarding YAML with mappings, I used it some time ago, this issue describes my problems.

You can use examples mentioned for your problem:

edit flag offensive delete link more

Comments

Hi, thanks a lot for your reply. I was stuck for quite a bit. You can install it from binaries or from source, I think that doesn't matter. In my case, it was binaries, that's what I mentioned.

So, for my mapping rules, I have my_mapping_pkg.yaml inside ros2 workspace. Inside that file, I have these 2 lines: ros1_package_name: 'grid_map_msgs' ros2_package_name: 'grid_map_msgs' Here is a video of that: https://www.youtube.com/watch?v=OE781...

As you can see inside the video, it's able to convert and publish gridmap messages 90% but it fails to map the header and frame id and as result it publishes null in the ros2 side.

ARGHYAJONY gravatar image ARGHYAJONY  ( 2022-12-12 18:58:32 -0500 )edit

Can you check the message logs for these 10%? Maybe it is an error of incorrect timestamps or IDs?

ljaniec gravatar image ljaniec  ( 2022-12-13 02:22:16 -0500 )edit

Can you elaborate on how to check the message logs and how I understand it's the result of an error of incorrect timestamps or Ids ? Sorry for my late reply as I was travelling. So, my mapping package 'my_mapping_pkg.yaml' is:

```

ros1_package_name: 'grid_map_msgs'
ros2_package_name: 'grid_map_msgs'

``` According to your reffered issue, there is a way to map the ros1 to ros2 conversion (https://github.com/amifsud/fields_map...:

```

ros1_package_name: 'ros1_msgs'
ros1_message_name: 'Example'
ros2_package_name: 'ros2_msgs'
ros2_message_name: 'Example1'
fields_2_to_1:
    w: 'a'
    x: 'b'
    y: 'c'
    z: 'd'

```

ARGHYAJONY gravatar image ARGHYAJONY  ( 2022-12-27 20:51:08 -0500 )edit

if you see here in this video created by me: https://www.youtube.com/watch?v=OE781..., you can clearly see I tried to echo the topic in ros2 and each message has a header with time stamp 0 and frame id:' ' (null) after the conversion. This looks like not any asynchronized timestamp issue or something like that rather an issue of not able to map the header correctly during conversion, so it's letting the header null at each conversion step. Other fields are mapped correctly but for some reason, the header is not correct. Now as grid_map_msgs package combines 2 custom messages namely GridMap.msg and GridMapInfo.msg and the first one calls the later one inside it. The problem looks like as in ros1, the header is inside GridMapInfo.msg and in ros2 the header is inside GridMap.msg.

ARGHYAJONY gravatar image ARGHYAJONY  ( 2022-12-27 21:54:04 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2022-12-12 16:26:53 -0500

Seen: 163 times

Last updated: Dec 12 '22