mix rclex.gen.msgs (Rclex (Experimental) v0.12.0)

Copy Markdown View Source

Generate codes of ROS 2 msg type

Before generating, specifying msg types in config.exs is needed.

config :rclex, ros2_message_types: ["std_msgs/msg/String"]

If ros2_message_types is empty, built-in types required by Rclex internals (for example parameter and lifecycle support) are still generated.

The task also generates the code for the request and response message types required by the services defined in

config :rclex, ros2_service_types: ["std_srvs/srv/SetBool"]

and the message types required for internal topics and services of actions defined in

config :rclex, ros2_action_types: ["tf2_msgs/action/LookupTransform"]

Info

Be careful, ros2 msg type is case sensitive.

How to show message types

mix rclex.gen.msgs --show-types

How to generate

mix rclex.gen.msgs

This task assumes that the environment variable ROS_DISTRO is set and refers to the msg types from /opt/ros/[ROS_DISTRO]/share. In addition AMENT_PREFIX_PATH is considered to find msg types.

We can also specify explicitly as follows

mix rclex.gen.msgs --from /opt/ros/humble/share --from /home/ros/workspace/install

or via configuration

config :rclex, ros2_directories: ["/home/ros/workspace/install/example_msgs"]

How to clean

mix rclex.gen.msgs --clean

Summary

Functions

get_ros2_constant_type_map(ros2_message_type, from, acc \\ %{})