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

Problem with ros1 Bridge bridging a custom mesage

asked 2018-03-23 05:21:53 -0600

dennis.bergin gravatar image

updated 2018-03-24 03:01:21 -0600

gvdhoorn gravatar image

environment: ros: kinetic, ros2 ardent, ubuntu 16.0.4 I am using a package of custom messages There are 6 messages in the package. 5 of the 6 are working in the ros1 bridge. The package names, message names and message formats are equivalent in both ros and ros2. I have followed the steps outlined in previous posts and the bridge instructions, as far as adding the message package info the the ros1bridge build (package and CMakeLists).

I have traced the problem into the EmPy generation. The message mappings and factories are not being generated. This is as far as I have traced the problem.

Please let me now how best to proceed to identify if this is a problem i my message/package or a bug in the bridge.
I assume you will need to look at specific files and packages. Lmk how best to get them to you. Thank you in advance, Dennis

ROS Message: file is GvrbotMobilityValues.msg in package gvrbot_msgs

uint16 LeftDACOutput
uint16 RightDACOutput
int32 LeftPIDError
int32 LeftPIDPTerm
int32 LeftPIDITerm
int32 LeftPIDDTerm
int32 RightPIDError
int32 RightPIDPTerm 
int32 RightPIDITerm 
int32 RightPIDDTerm
uint16 ActualDriveVelocitySetPoint
uint16 ActualTurnVelocitySetPoint
int16 LeftTrackEncoderSpeedSetPoint
int16 RightTrackEncoderSpeedSetPoint
uint32 AverageLoopTime
uint32 MaximumLoopTime
uint16 NumberOfBadPackets

ROS2 message: GvrbotMobilityValues.msg in package gvrbot_msgs

uint16 left_dac_output
uint16 right_dac_output
int32 left_pid_error
int32 left_pid_p_term
int32 left_pid_i_term
int32 left_pid_d_term
int32 right_pid_error
int32 right_pid_p_term
int32 right_pid_i_term
int32 right_pid_d_term
uint16 actual_drive_velocity_set_point
uint16 actual_turn_velocity_set_point
int16 left_track_encoder_speed_set_point
int16 right_track_encoder_speed_set_point
uint32 average_loop_time
uint32 maximum_loop_time
uint16 number_of_bad_packets

One more thing. There is another message named GvrbotMobilityData. This message works. Just wanted to mention this as it is coincidental that a similar named message does not work. The other four messages are name differently: GvrbotComms, GvrbotOrientation, GvrbotState, and GvrbotPowerData

yaml file:

ros1_package_name: 'gvrbot_msgs'
ros1_message_name: 'GvrbotMobilityValues'
ros2_package_name: 'gvrbot_msgs'
ros2_message_name: 'GvrbotMobilityValues'
ros1_package_name: 'gvrbot_msgs'
ros1_message_name: 'GvrbotMobilityData'
ros2_package_name: 'gvrbot_msgs'
ros2_message_name: 'GvrbotMobilityData'

I apologize for adding info to the answer and answer/comments section. Thanks for pointing my error out! Also, as I was redoing this question, I now realize that the attributes within the two messages are different. I am assuming this is causing the issue.

The ROS message is legacy and cannot be changed. The original format gives idl errors in ROS2. Hence this must be why I used the alternate format. The ROS message is the only one of this CamelCase format. The others are use "_". Must have been an oversight from original development. I forgot about this difference as I defined the ROS2 messages months ago.

I can try to add the fields to the yaml file. IF the yaml file is actually supported. I did not see it referenced in the generator code. Please advise

Dennis (I apologize as I cannot seem to get the formatting in the editor to work).

Dirk I did not have any luck with the mapping file. Here is the file

ros1_package_name: 'gvrbot_msgs'
ros1_message_name: 'GvrbotMobilityValues'
ros2_package_name: 'gvrbot_msgs'
ros2_message_name: 'GvrbotMobilityValues'
  LeftDACOutput: 'left_dac_output'
  RightDACOutput: 'right_dac_output'
  LeftPIDError: 'left_pid_error'
  LeftPIDPTerm: 'left_pid_p_term'
  LeftPIDITerm: 'left_pid_i_term'
  LeftPIDDTermr: 'left_pid_d_term'
  RightPIDError: 'right_pid_error'
  RightPIDPTerm: 'right_pid_p_term'
  RightPIDITerm: 'right_pid_i_term'
  RightPIDDTerm: 'right_pid_d_term'
  ActualDriveVelocitySetPoint: 'actual_drive_velocity_set_point'
  ActualTurnVelocitySetPoint ...
edit retag flag offensive close merge delete


It might help if you share the messages in question. Especially the one which doesn't work.

Dirk Thomas gravatar image Dirk Thomas  ( 2018-03-23 10:20:09 -0600 )edit

The mapping rules should be specified in the ROS 2 message package.

Dirk Thomas gravatar image Dirk Thomas  ( 2018-03-26 14:50:46 -0600 )edit

Dirk Thanks I tried it again and I still do not have any luck. I followed the steps as previously outlined for the CMakeLists and package files for the gvrbot_msgs package within a ros2_overlay project. How best to proceed? Can you point me to the code that does the processing of the yaml

dennis.bergin gravatar image dennis.bergin  ( 2018-03-26 17:51:00 -0600 )edit

The information is extracted here:

Dirk Thomas gravatar image Dirk Thomas  ( 2018-03-26 17:52:28 -0600 )edit

If you can share a simple example which can be run / reproduced with a few command lines than I might be able to take a closer look.

Dirk Thomas gravatar image Dirk Thomas  ( 2018-03-26 17:53:15 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-03-23 16:02:19 -0600

Dirk Thomas gravatar image

updated 2018-03-23 17:42:13 -0600

For now defining a custom mapping rule as described in this doc should make it work for you.

In the future it is likely that we will optionally relax the checks on the formatting of field names etc. So maybe then you can make the ROS 2 message the same as the ROS 1 message again.


After creating the mapping file you will need to build the ros1_bridge package again since the information is being transformed into C++ code which then gets compiled.

edit flag offensive delete link more


I will give that a try and get back to you. Thank you! (Again I apologize for not using the site correctly! I appreciate your patience.)

dennis.bergin gravatar image dennis.bergin  ( 2018-03-23 16:04:33 -0600 )edit

I apologize for not being clear. I did rebuild the bridge.I did not try to run the dynamic bridge in a full setup. I ran the bridge with --print-pairs and still did not see the gvrbot_mgs/GvrbotMobilityValues mappings. I looked at the generated files and did not see anything related to the message

dennis.bergin gravatar image dennis.bergin  ( 2018-03-23 17:47:44 -0600 )edit

I have it working now. It was a spacing/indentation issue on the package_name lines of the yaml file. Thank you for all of your help, Dirk!

dennis.bergin gravatar image dennis.bergin  ( 2018-03-27 03:22:57 -0600 )edit

Can you please share your invalid configuration file. Maybe the interpretation could be improved to make this more obvious.

Dirk Thomas gravatar image Dirk Thomas  ( 2018-03-27 12:42:51 -0600 )edit

The invalid file format is shown above in the problem section. I believe the issue is the lack of start of document char '-' and the indentation of the list.

dennis.bergin gravatar image dennis.bergin  ( 2018-03-27 18:06:11 -0600 )edit

Thanks, that case will result in an error message once the following PR gets merged:

Dirk Thomas gravatar image Dirk Thomas  ( 2018-03-27 18:57:48 -0600 )edit

Question Tools



Asked: 2018-03-23 05:21:53 -0600

Seen: 1,251 times

Last updated: Mar 24 '18