Skip to content

Creating and Using Custom Messages #138

@Hateley123

Description

@Hateley123

I downloaded your repository and I am able to build the packages. However, the system fails to recognize the new msg that I created.

The message (RFIDTagMsgs.msg):
float64 freq1_phase
float64 freq2_phase
float64 ant1_phase
float64 ant2_phase
float64 ant3_phase

In my Cmakelist I have:
set(ROSIDL_GENERATE_CSHARP ON CACHE BOOL "Generate C# messages")

Define message files

set(MSG_FILES
"msg/RFIDTagMsgs.msg"
)

Generate message interfaces, including C#

rosidl_generate_interfaces(${PROJECT_NAME}
${MSG_FILES}
DEPENDENCIES std_msgs
)

and in my package.xml I have:

rfid_ros_package 0.0.0 TODO: Package description root TODO: License declaration

<buildtool_depend>ament_cmake</buildtool_depend>
<buildtool_depend>ament_cmake_export_assemblies</buildtool_depend>
<buildtool_depend>dotnet_cmake_module</buildtool_depend>
<buildtool_depend>rcldotnet_common</buildtool_depend>
<buildtool_export_depend>rosidl_cmake</buildtool_export_depend>

<exec_depend>rmw_implementation</exec_depend>
<exec_depend>rmw_implementation_cmake</exec_depend>
<exec_depend>rosidl_generator_c</exec_depend>
<exec_depend>rosidl_parser</exec_depend>

<exec_depend>dotnet</exec_depend>
<exec_depend>rcldotnet</exec_depend>
<exec_depend>rcl</exec_depend>
<exec_depend>rcl_interfaces</exec_depend>
<exec_depend>rcl_action</exec_depend>
<exec_depend>action_msgs</exec_depend>
<exec_depend>builtin_interfaces</exec_depend>
<exec_depend>unique_identifier_msgs</exec_depend>
<exec_depend>rosidl_default_runtime</exec_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>

<build_depend>rmw_implementation_cmake</build_depend>
<build_depend>rcl</build_depend>
<build_depend>rcl_interfaces</build_depend>
<build_depend>rcl_action</build_depend>
<build_depend>rmw</build_depend>
<build_depend>action_msgs</build_depend>
<build_depend>builtin_interfaces</build_depend>
<build_depend>unique_identifier_msgs</build_depend>
<build_depend>rosdil_default_generators</build_depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>

std_msgs
rclcpp

<member_of_group>rosidl_interface_packages</member_of_group>

ament_cmake

and in my main cs file I have:
using RFIDTagMsgs.Msg.RFIDTagMsgs;
and have used using RFIDTagMsgs.Msg; and using RFIDTagMsg = RFIDTagMsgs.Msg.RFIDTagMsgs;

but no matter what i do it does not let me use the new msg file. I have gone through your repository and it does not seem like you use custom messages. do you know how I can get this to work?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions