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

ROS2 ament overlay issue with messages

asked 2018-01-05 08:54:11 -0500

Tom Moore gravatar image

updated 2018-01-08 09:23:00 -0500

I'm working on adding array parameter support for ROS2, and am having trouble with ament.

I've added new types and values here and here.

I then sourced /opt/ros/ardent/setup.bash, and ran ament build. Eventually, this happened:

[ 83%] Building C object CMakeFiles/rcl_interfaces__rosidl_typesupport_introspection_c__pyext.dir/rosidl_generator_py/rcl_interfaces/msg/_parameter_value_s.c.o
/home/automatom/ros2/build/rcl_interfaces/rosidl_generator_py/rcl_interfaces/msg/_parameter_value_s.c: In function ‘rcl_interfaces_parameter_value__convert_from_py’:
/home/automatom/ros2/build/rcl_interfaces/rosidl_generator_py/rcl_interfaces/msg/_parameter_value_s.c:111:61: error: ‘rcl_interfaces__msg__ParameterValue {aka struct rcl_interfaces__msg__ParameterValue}’ has no member named ‘byte_array_value’
 if (!rosidl_generator_c__byte__Array__init(&(ros_message->byte_array_value), size))

This error repeats for all the new types. However, that structure does have the field in question. From build/rcl_interfaces/rosidl_generator_c/rcl_interfaces/msg/parameter_value__struct.h:

/// Struct of message rcl_interfaces/ParameterValue
typedef struct rcl_interfaces__msg__ParameterValue
{
  uint8_t type;
  bool bool_value;
  int64_t integer_value;
  double double_value;
  rosidl_generator_c__String string_value;
  rosidl_generator_c__byte__Array byte_array_value;
  rosidl_generator_c__bool__Array bool_array_value;
  rosidl_generator_c__int64__Array integer_array_value;
  rosidl_generator_c__float64__Array double_array_value;
  rosidl_generator_c__String__Array string_array_value;
} rcl_interfaces__msg__ParameterValue;

This suggests that ament/cc are looking in the wrong location for the files in question. I manually went into build/rcl_interfaces and ran make VERBOSE=1, and found this for the first object that fails to build:

/usr/lib/ccache/cc  -Drcl_interfaces__rosidl_typesupport_c__pyext_EXPORTS -I/home/automatom/ros2/build/rcl_interfaces/rosidl_typesupport_c -I/opt/ros/ardent/include -I/home/automatom/ros2/build/rcl_interfaces/rosidl_generator_c -I/home/automatom/ros2/build/rcl_interfaces/rosidl_generator_py -I/usr/include/python3.5m  -fPIC   -Wall -Wextra -o CMakeFiles/rcl_interfaces__rosidl_typesupport_c__pyext.dir/rosidl_generator_py/rcl_interfaces/msg/_parameter_value_s.c.o   -c /home/automatom/ros2/build/rcl_interfaces/rosidl_generator_py/rcl_interfaces/msg/_parameter_value_s.c

Note that -I/opt/ros/ardent/include comes before -I/home/automatom/ros2/build/rcl_interfaces/rosidl_generator_c. If I swap them, and manually run the command, it builds successfully.

I'm sure I'm missing something obvious, and I apologize if so, but what am I doing wrong? Am I missing a step for ament workspaces? I already tried sourcing install/local_setup.bash and building again, but to no avail.

EDIT: providing steps to reproduce:

mkdir -p ~/ament_test/src
cd ~/ament_test/src
git clone git@github.com:ayrton04/rcl_interfaces.git -b param-arrays
cd ..
source /opt/ros/ardent/setup.bash
ament build
edit retag flag offensive close merge delete

Comments

May I suggest to use permalinks to the ParameterType.msg and ParameterValue.msg?

gvdhoorn gravatar image gvdhoorn  ( 2018-01-05 09:21:51 -0500 )edit

Good call, have fixed. Thank you!

Tom Moore gravatar image Tom Moore  ( 2018-01-05 09:25:58 -0500 )edit

How have you setup your workspaces? If you changed something in rcl_interfaces in a copy of it in your workspace, then you need to also build from source everything that depends on rcl_interfaces in the overlay. Can you provide some basic steps to reproduce the problem?

William gravatar image William  ( 2018-01-08 09:15:12 -0500 )edit

I'm only building rcl_interfaces, and all I did was add some fields to two messages. I've provided the steps to reproduce, and ran them to verify that it causes the build error for me. It fails at around 95%.

Tom Moore gravatar image Tom Moore  ( 2018-01-08 09:24:15 -0500 )edit

Oh, it's not consistently failing? That sounds like a target dependency issue in cmake. I'll see if I can reproduce it.

William gravatar image William  ( 2018-01-08 10:00:29 -0500 )edit

No, sorry, I don't mean it fails 95% of the time, but rather it fails at the ament 95% build point.

Tom Moore gravatar image Tom Moore  ( 2018-01-08 10:04:06 -0500 )edit

Ok, I can reproduce it. It looks like it is including the old version of the header from the underlay. I'll look into what that is the case. Might be worth moving to an issue on the GitHub repository.

William gravatar image William  ( 2018-01-09 12:49:26 -0500 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2018-01-09 12:54:49 -0500

William gravatar image

The problem is the include path order allows it to get the underlay, this is what it looks like on my machine:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-Drcl_interfaces__rosidl_typesupport_introspection_c__pyext_EXPORTS
-I/Users/william/ament_test/build/rcl_interfaces/rosidl_typesupport_c
-I/Users/william/ament_test/build/rcl_interfaces/rosidl_typesupport_introspection_c
-I/Users/william/ros2_ws/install/include  <-- this has the old header
-I/Users/william/ament_test/build/rcl_interfaces/rosidl_generator_c  <-- this has the new header
-I/Users/william/ament_test/build/rcl_interfaces/rosidl_generator_py
-I/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/include/python3.6m

-fPIC


-Wall
-Wextra
-o
CMakeFiles/rcl_interfaces__rosidl_typesupport_introspection_c__pyext.dir/rosidl_generator_py/rcl_interfaces/srv/_describe_parameters__response_s.c.o


-c
/Users/william/ament_test/build/rcl_interfaces/rosidl_generator_py/rcl_interfaces/srv/_describe_parameters__response_s.c

Please open an issue on the https://github.com/ros2/rcl_interface... repository and reference this question. It might end up needing to be fixed in rosidl instead, but that's the right place for now.

edit flag offensive delete link more

Comments

Will do. Thanks for looking into it.

Tom Moore gravatar image Tom Moore  ( 2018-01-09 12:57:13 -0500 )edit

Update: The order of population of the include path has been fixed in https://github.com/ros2/rosidl/pull/261

marguedas gravatar image marguedas  ( 2018-01-29 11:51:58 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2018-01-05 08:54:11 -0500

Seen: 702 times

Last updated: Jan 09 '18