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

Ros1_bridge not mapping custom fields with different names even with yaml file

asked 2020-11-06 11:55:28 -0500

maclo4 gravatar image

I am using the bridge and all of my messages are correctly mapped except for 1 where I had to change the name from the ros1 version of the message (ros2 does not allow capital letters).

Here is the ros2 version

float32 velocity
float32 current
uint8 command_flag
float32 r_jnt

Here is the ros1 version

float32 velocity
float32 current
uint8 commandFlag
float32 R_jnt

Here is my yaml file

-
  ros1_package_name: 'edo_core_msgs'
  ros1_msg_name: 'JointState'
  ros2_package_name: 'edo_core_msgs'
  ros2_msg_name: 'JointState'
  fields_1_to_2: 
    R_jnt: 'r_jnt'
    commandFlag: 'command_flag'
    current: 'current'
    position: 'position'
    velocity: 'velocity'

Here is the CMakeLists.txt (only the related part)

rosidl_generate_interfaces(${PROJECT_NAME}

  ${msg_files}
  ${srv_files}

 )

 install(
  FILES mapping.yaml
  DESTINATION share/${PROJECT_NAME})


 ament_export_dependencies(rosidl_default_runtime)

ament_package()

Package.xml

  <export>
    <ros1_bridge mapping_rules="mapping.yaml"/> 
    <build_type>ament_cmake</build_type>

  </export>

My file structure looks like this

.
├─ ros1_msgs_ws
│  └─ src
│     └─ bridge_msgs
│        └─ msg
│           └─ JointCommand.msg
├─ ros2_msgs_ws
│  └─ src
│     └─ bridge_msgs
│        ├─ msg
│        │  └─ JointCommand.msg
│        └─ # YAML file if your custom interfaces have non-matching names
└─ bridge_ws
   └─ src
      └─ ros1_bridge

I am using Eloquent built from debian and am bridging to melodic. Im using ubuntu 18.04. Ive followed all the instructions for building very closely and have reproduced the error on mulptiple computers. The bridge builds and includes all my messages except this one. I am now trying to build eloquent from source.

One last thing tht may be related or not. I get error messages when I build the bridge in the format of this:

CMake Warning at /opt/ros/eloquent/share/actionlib_msgs/cmake/actionlib_msgsConfig.cmake:29 (message):     
  Package 'actionlib_msgs' is deprecated (This package will be removed in a                                
  future ROS distro, once the ROS 1 bridge supports actions.)                                              
Call Stack (most recent call first):                                                                       
  CMakeLists.txt:106 (find_package)                                                                        


CMake Warning at CMakeLists.txt:186 (add_library):                                                         
  Cannot generate a safe runtime search path for target ros1_bridge because                                
  files in some directories may conflict with libraries in implicit                                        
  directories:                                                                                             

    runtime library [liburdfdom_sensor.so.1.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:     
      /opt/ros/eloquent/lib                                                                                
    runtime library [liburdfdom_model_state.so.1.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /opt/ros/eloquent/lib                                                                                
    runtime library [liburdfdom_model.so.1.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:      
      /opt/ros/eloquent/lib                                                                                
    runtime library [liburdfdom_world.so.1.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:      
      /opt/ros/eloquent/lib                                                                                

  Some of these libraries may not be found correctly.
edit retag flag offensive close merge delete

Comments

I don't know if this is related, but position seems to be present in yaml, but not in msg.

miura gravatar image miura  ( 2020-11-06 20:25:02 -0500 )edit

Scared me for a sec but that’s just a typo. Position is in the message

maclo4 gravatar image maclo4  ( 2020-11-06 20:52:14 -0500 )edit

2 Answers

Sort by » oldest newest most voted
1

answered 2020-11-08 17:50:04 -0500

maclo4 gravatar image

Update: we got it working by changing the bridges cmakelist and package.xml, along with adding the yaml file to the bridge package shrug

edit flag offensive delete link more

Comments

Hi there,

I am facing the same question. Could you provide more details for your solution? It would be helpful! Thanks!

BananaaGorilla98 gravatar image BananaaGorilla98  ( 2021-09-05 22:43:23 -0500 )edit
0

answered 2020-11-06 21:10:19 -0500

miura gravatar image

According to the error message, the error is due to the existence of the same library in /opt/ros/eloquent/lib and /usr/lib/x86_64-linux-gnu. If you delete or rename the library in /opt/ros/eloquent/lib, this message should disappear.

edit flag offensive delete link more

Comments

I probably could’ve clarified, I don’t think the error message is related, do you think it is? I was getting this message since I first built the bridge without any custom messages

maclo4 gravatar image maclo4  ( 2020-11-06 21:12:59 -0500 )edit

It was out from the beginning, wasn't it? If so, I don't think it's related.

But if you're not getting any other warnings or errors, I think it's worth a try.

miura gravatar image miura  ( 2020-11-06 21:17:33 -0500 )edit

Just saw this, thanks yea ill try that and hope. Really running out of ideas

maclo4 gravatar image maclo4  ( 2020-11-07 18:49:40 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2020-11-06 11:55:28 -0500

Seen: 518 times

Last updated: Nov 08 '20