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

How does one ship an app with a ROS2 subscriber for a non-ROS environment target?

asked 2023-03-01 06:20:06 -0600

JeffS gravatar image

updated 2023-03-06 16:20:51 -0600

I am interested in building an application that subscribes to ROS2 messages over a network. This app would display message information in either console or GUI mode. The message topics are already known and fixed. The idea is that app is small, super-easy to install, and does not require the end user to be a developer. (i.e. no need to step in the the ROS2 install world).

Certainly I can build this C++ app on humble with the full ROS2 environment. Is there any info on how to package an app with just the ROS2 lib dependencies (rclcpp, etc) for installation on a user computer?

I hope this does not sound to vague, but I don’t see anything about a minimal environment to subscribe to ROS2 messages. Any help pointing me in the right direction is appreciated!

edit retag flag offensive close merge delete

Comments

You don't say anything about the target platform (other than "user computer"). I'd suggest to add some information about it (or them), as it's going to affect what techniques could/would work, and which can't or won't.

"easiest" would perhaps be to use static linking. In quotes, as it's unclear whether that would be easy to achieve, given the various plugins a typical ROS 2 node uses (such as the RMW). micro-ROS uses static linking, and I've used it extensively, so I know it can work.

Alternatively: build the binary + all (transitive) dependencies with shared linking, take the install space and distribute that as a single archive. After setting up the various search paths correctly (ie: PATH, LD_LIBRARY_PATH, etc), things should-just-work (but of course: famous last words).

The idea is that app is small [..]

what does small mean exactly? Depending on the dependencies ...(more)

gvdhoorn gravatar image gvdhoorn  ( 2023-03-06 03:48:49 -0600 )edit

I would perhaps also add whether you really want/need to distribute a native ROS 2 implementation, or whether approaches such as rosbridge, micro-ROS (ie: rmw_microxrcedds + Agent), alternative client libraries, visualisation tools such as foxglove or any other lightweight approaches would be acceptable.

The question (and potential answers) becomes rather different, depending on what your actual goal is (to avoid an xy-problem).

gvdhoorn gravatar image gvdhoorn  ( 2023-03-06 03:56:03 -0600 )edit

@gvdhoom : Thanks for your input on distributing a ROS app.
* By small, I mean that the libraries (dependencies) added to my application should be no more that a few MB.
* Target platforms (Ubuntu 20.04, 22.04, Windows 10, Windows 11) * RosBridge (at first glance) looks like it could work. I'll give that a shot

JeffS gravatar image JeffS  ( 2023-03-06 07:35:41 -0600 )edit

Hmm - Maybe ROSBridge won't do. I did find this on the NVidia site: "In order to use the ROS bridge you have to install ROS on your device. For example if you want to use the ROS bridge on Jetson you have to install ROS on Jetson. If you want to use ROS on the desktop you have to install ROS on the desktop. The ROS version you install has to match the operating system of your device." I don't want to have to install ROS on the target - since the end- user will have no clue how to install ROS. And having to bundle that with the app violates my "make is small and easy" requirement.

JeffS gravatar image JeffS  ( 2023-03-06 07:42:00 -0600 )edit

I would suggest to perhaps update your original post to more clearly state your requirements and your actual goal.

Is this going to be a visualisation tool, a remote control station, a debugging/inspection tool, something else?

re: nvidia site: I don't know which site you've found, but that's not how I work with rosbridge. Rosbridge is started on the ROS device, and the client application opens a websocket. There is no need for ROS on the client in that case. Just a browser.

But again: there are so many possibilities that without you providing a clearer description of the goal it's going to be difficult to really recommend anything.

gvdhoorn gravatar image gvdhoorn  ( 2023-03-06 07:58:02 -0600 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2023-03-06 16:15:44 -0600

JeffS gravatar image

updated 2023-03-06 16:19:27 -0600

The question has been rephrased (suggested by @gvdhoom) and answered here.

I tried two different approaches and then compared the dependencies. This was done on Ubuntu 22.04 (known as humble) with ROS2 debian package installed.

1) built the basic pub-sub cpp ros tutorial here

2) built the same source using just a simple script with g++. I did not create a workspace, did not source from /opt/ros/humble/setup.bash. Just straight up compile and link. I takes a few tries to figure out the dependencies to get a clean build.

3) I compared the dependencies for both apps. they match are are listed below

Here's the simple script (of course, you could use make, CMake, etc)

#!/bin/bash
# general includes
ROSINCLUDE=/opt/ros/humble/include
INCLUDES="-I $ROSINCLUDE/rclcpp "
INCLUDES+="-I $ROSINCLUDE/rcl "
INCLUDES+="-I $ROSINCLUDE/rcutils "
INCLUDES+="-I $ROSINCLUDE/rmw "
INCLUDES+="-I $ROSINCLUDE/rcl_yaml_param_parser "
INCLUDES+="-I $ROSINCLUDE/rosidl_runtime_c "
INCLUDES+="-I $ROSINCLUDE/rosidl_typesupport_interface "
INCLUDES+="-I $ROSINCLUDE/rcpputils "
INCLUDES+="-I $ROSINCLUDE/builtin_interfaces "
INCLUDES+="-I $ROSINCLUDE/rosidl_runtime_cpp "
INCLUDES+="-I $ROSINCLUDE/tracetools "
INCLUDES+="-I $ROSINCLUDE/rcl_interfaces "
INCLUDES+="-I $ROSINCLUDE/libstatistics_collector "
INCLUDES+="-I $ROSINCLUDE/statistics_msgs "

#application specific incldues
INCLUDES+="-I $ROSINCLUDE/std_msgs "
echo $INCLUDES

g++ rospub.c $INCLUDES -lrclcpp -lrcutils -lrcl -ltracetools -lrmw -lstd_msgs__rosidl_typesupport_cpp -lrosidl_typesupport_cpp -o rospubexample

Dependencies listed using this command:

LD_DEBUG=libs ./rospubexample --args

/opt/ros/humble/lib/librclcpp.so [0]
/opt/ros/humble/lib/librcl.so [0]
/opt/ros/humble/lib/libstd_msgs__rosidl_typesupport_cpp.so [0]
/opt/ros/humble/lib/liblibstatistics_collector.so [0]
/opt/ros/humble/lib/librcl_interfaces__rosidl_typesupport_cpp.so [0]
/opt/ros/humble/lib/librcl_yaml_param_parser.so [0]
/opt/ros/humble/lib/librosgraph_msgs__rosidl_typesupport_cpp.so [0]
/opt/ros/humble/lib/libstatistics_msgs__rosidl_typesupport_cpp.so [0]
/opt/ros/humble/lib/librmw_implementation.so [0]
/opt/ros/humble/lib/libament_index_cpp.so [0]
/opt/ros/humble/lib/librcl_logging_spdlog.so [0]
/opt/ros/humble/lib/librcl_logging_interface.so [0]
/opt/ros/humble/lib/librcl_interfaces__rosidl_typesupport_c.so [0]
/opt/ros/humble/lib/libyaml.so [0]
/opt/ros/humble/lib/librosidl_typesupport_c.so [0]
/opt/ros/humble/lib/librmw_fastrtps_cpp.so [0]
/opt/ros/humble/lib/librmw_fastrtps_shared_cpp.so [0]
/opt/ros/humble/lib/libfastrtps.so.2.6 [0]
/opt/ros/humble/lib/libtracetools.so [0]
/opt/ros/humble/lib/librmw_dds_common.so [0]
/opt/ros/humble/lib/librmw.so [0]
/opt/ros/humble/lib/librmw_dds_common__rosidl_typesupport_cpp.so [0]
/opt/ros/humble/lib/librosidl_typesupport_cpp.so [0]
/opt/ros/humble/lib/librcpputils.so [0]
/opt/ros/humble/lib/librmw_dds_common__rosidl_typesupport_fastrtps_cpp.so [0]
/opt/ros/humble/lib/librmw_dds_common__rosidl_typesupport_introspection_cpp.so [0]
/opt/ros/humble/lib/librcl_interfaces__rosidl_typesupport_fastrtps_c.so [0]
/opt/ros/humble/lib/libbuiltin_interfaces__rosidl_typesupport_fastrtps_c.so [0]
/opt/ros/humble/lib/librosidl_typesupport_fastrtps_c.so [0]
/opt/ros/humble/lib/librcl_interfaces__rosidl_typesupport_introspection_c.so [0]
/opt/ros/humble/lib/librcl_interfaces__rosidl_generator_c.so [0]
/opt/ros/humble/lib/libbuiltin_interfaces__rosidl_typesupport_introspection_c.so [0]
/opt/ros/humble/lib/librosidl_typesupport_introspection_c.so [0]
/opt/ros/humble/lib/libbuiltin_interfaces__rosidl_generator_c.so [0]
/opt/ros/humble/lib/librcl_interfaces__rosidl_typesupport_fastrtps_cpp.so [0]
/opt/ros/humble/lib/librcl_interfaces__rosidl_typesupport_introspection_cpp.so [0]
/opt/ros/humble/lib/libstd_msgs__rosidl_typesupport_fastrtps_cpp.so [0]
/opt/ros/humble/lib/libbuiltin_interfaces__rosidl_typesupport_fastrtps_cpp.so [0]
/opt/ros/humble/lib/libfastcdr.so.1 [0]
/opt/ros/humble/lib/librosidl_typesupport_fastrtps_cpp.so [0]
/opt ...
(more)
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2023-03-01 06:14:34 -0600

Seen: 278 times

Last updated: Mar 06 '23