View Source mix rclex.gen.msgs (Rclex v0.8.0)

Generate codes of ROS 2 message type

Before generating, we have to specify message types in config.exs.

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

Be careful, ros2 message type is case sensitive.

how-to-generate

How to generate

$ mix rclex.gen.msgs

This task assumes that the environment variable ROS_DISTRO is set and refers to the message types from "/opt/ros/ROS_DISTRO/share".

We can also specify directly as follows

$ mix rclex.gen.msgs --from /opt/ros/foxy/share

how-to-clean

How to clean

$ mix rclex.gen.msgs --clean

Link to this section Summary

Functions

iex> Elixir.Mix.Tasks.Rclex.Gen.Msgs.convert_package_name_to_capitalized("std_msgs") "StdMsgs"

iex> Elixir.Mix.Tasks.Rclex.Gen.Msgs.get_file_name_from_type("std_msgs/msg/String") "std_msgs/msg/string" iex> Elixir.Mix.Tasks.Rclex.Gen.Msgs.get_file_name_from_type("geometry_msgs/msg/TwistWithCovariance") "geometry_msgs/msg/twist_with_covariance"

iex> Elixir.Mix.Tasks.Rclex.Gen.Msgs.get_function_name_from_type("std_msgs/msg/String") "std_msgs_msg_string" iex> Elixir.Mix.Tasks.Rclex.Gen.Msgs.get_function_name_from_type("geometry_msgs/msg/TwistWithCovariance") "geometry_msgs_msg_twist_with_covariance"

iex> Elixir.Mix.Tasks.Rclex.Gen.Msgs.get_module_name_from_path("std_msgs/msg/String") "StdMsgs.Msg.String"

iex> Elixir.Mix.Tasks.Rclex.Gen.Msgs.get_module_name_from_type("std_msgs/msg/String") "Rclex.StdMsgs.Msg.String" iex> Elixir.Mix.Tasks.Rclex.Gen.Msgs.get_module_name_from_type("geometry_msgs/msg/TwistWithCovariance") "Rclex.GeometryMsgs.Msg.TwistWithCovariance"

iex> Elixir.Mix.Tasks.Rclex.Gen.Msgs.get_module_name_impl(["std_msgs", "msg", "String"]) "StdMsgs.Msg.String" iex> Elixir.Mix.Tasks.Rclex.Gen.Msgs.get_module_name_impl(["geometry_msgs", "msg", "TwistWithCovariance"]) "GeometryMsgs.Msg.TwistWithCovariance"

iex> Elixir.Mix.Tasks.Rclex.Gen.Msgs.get_struct_name_from_type("std_msgs/msg/String") "std_msgsmsgString" iex> Elixir.Mix.Tasks.Rclex.Gen.Msgs.get_struct_name_from_type("geometry_msgs/msg/TwistWithCovariance") "geometry_msgsmsgTwistWithCovariance"

Callback implementation for Mix.Task.run/1.

iex> Elixir.Mix.Tasks.Rclex.Gen.Msgs.to_down_snake("Vector3") "vector3" iex> Elixir.Mix.Tasks.Rclex.Gen.Msgs.to_down_snake("TwistWithCovariance") "twist_with_covariance"

Link to this section Functions

Link to this function

convert_package_name_to_capitalized(binary)

View Source

iex> Elixir.Mix.Tasks.Rclex.Gen.Msgs.convert_package_name_to_capitalized("std_msgs") "StdMsgs"

Link to this function

create_fields_for_defstruct(type, ros2_message_type_map)

View Source
Link to this function

create_fields_for_nifs_readdata_return(type, ros2_message_type_map, var \\ "data")

View Source
Link to this function

create_fields_for_nifs_setdata_arg(type, ros2_message_type_map, var \\ "data")

View Source
Link to this function

create_fields_for_read(type, ros2_message_type_map, var \\ "data")

View Source
Link to this function

create_fields_for_type(type, ros2_message_type_map)

View Source
Link to this function

create_readdata_statements(type, ros2_message_type_map)

View Source
@spec create_readdata_statements(String.t(), map()) :: String.t()
Link to this function

create_readdata_statements_impl(type, ros2_message_type_map, var)

View Source
Link to this function

create_readdata_statements_impl_for_list(type, ros2_message_type_map, var)

View Source
Link to this function

create_readdata_statements_impl_for_tuple(type, ros2_message_type_map, var)

View Source
Link to this function

create_setdata_statements(type, ros2_message_type_map)

View Source
Link to this function

create_setdata_statements_impl(type, ros2_message_type_map, var_res, var_term, var_local)

View Source
Link to this function

create_setdata_statements_impl_for_list(type, ros2_message_type_map, var, var_term, var_local)

View Source
Link to this function

create_setdata_statements_impl_for_tuple(type, ros2_message_type_map, var, var_term, var_local)

View Source
Link to this function

generate_msg_mod(type, ros2_message_type_map)

View Source
Link to this function

generate_msg_nif_c(type, ros2_message_type_map)

View Source
Link to this function

generate_msg_nif_h(type, ros2_message_type_map)

View Source
Link to this function

generate_msg_prot(type, ros2_message_type_map)

View Source
Link to this function

generate_msg_types_c(types)

View Source
Link to this function

generate_msg_types_ex(types)

View Source
Link to this function

generate_msg_types_h(types)

View Source
Link to this function

get_file_name_from_type(type)

View Source

iex> Elixir.Mix.Tasks.Rclex.Gen.Msgs.get_file_name_from_type("std_msgs/msg/String") "std_msgs/msg/string" iex> Elixir.Mix.Tasks.Rclex.Gen.Msgs.get_file_name_from_type("geometry_msgs/msg/TwistWithCovariance") "geometry_msgs/msg/twist_with_covariance"

Link to this function

get_function_name_from_type(type)

View Source

iex> Elixir.Mix.Tasks.Rclex.Gen.Msgs.get_function_name_from_type("std_msgs/msg/String") "std_msgs_msg_string" iex> Elixir.Mix.Tasks.Rclex.Gen.Msgs.get_function_name_from_type("geometry_msgs/msg/TwistWithCovariance") "geometry_msgs_msg_twist_with_covariance"

Link to this function

get_module_name_from_path(path)

View Source
@spec get_module_name_from_path(String.t()) :: String.t()

iex> Elixir.Mix.Tasks.Rclex.Gen.Msgs.get_module_name_from_path("std_msgs/msg/String") "StdMsgs.Msg.String"

Link to this function

get_module_name_from_type(type)

View Source

iex> Elixir.Mix.Tasks.Rclex.Gen.Msgs.get_module_name_from_type("std_msgs/msg/String") "Rclex.StdMsgs.Msg.String" iex> Elixir.Mix.Tasks.Rclex.Gen.Msgs.get_module_name_from_type("geometry_msgs/msg/TwistWithCovariance") "Rclex.GeometryMsgs.Msg.TwistWithCovariance"

Link to this function

get_module_name_impl(list)

View Source

iex> Elixir.Mix.Tasks.Rclex.Gen.Msgs.get_module_name_impl(["std_msgs", "msg", "String"]) "StdMsgs.Msg.String" iex> Elixir.Mix.Tasks.Rclex.Gen.Msgs.get_module_name_impl(["geometry_msgs", "msg", "TwistWithCovariance"]) "GeometryMsgs.Msg.TwistWithCovariance"

Link to this function

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

View Source
@spec get_ros2_message_type_map(String.t(), String.t(), map()) :: map()
Link to this function

get_struct_name_from_type(type)

View Source

iex> Elixir.Mix.Tasks.Rclex.Gen.Msgs.get_struct_name_from_type("std_msgs/msg/String") "std_msgsmsgString" iex> Elixir.Mix.Tasks.Rclex.Gen.Msgs.get_struct_name_from_type("geometry_msgs/msg/TwistWithCovariance") "geometry_msgsmsgTwistWithCovariance"

Callback implementation for Mix.Task.run/1.

Link to this function

to_down_snake(type_name)

View Source

iex> Elixir.Mix.Tasks.Rclex.Gen.Msgs.to_down_snake("Vector3") "vector3" iex> Elixir.Mix.Tasks.Rclex.Gen.Msgs.to_down_snake("TwistWithCovariance") "twist_with_covariance"