Ask Your Question

Revision history [back]

Check the listener and talker under demo_node_cpp. If you don't have repositories look here https://github.com/ros2/ros2/wiki/Ament-Tutorial.

Change the message and include your sensor message type, and use as in ROS 1.

e.g. if sensor messages are from a camera and type image

const sensor_msgs::msg::Image& img

should be the message type.

Check the listener and talker under demo_node_cpp. If you don't have repositories look here https://github.com/ros2/ros2/wiki/Ament-Tutorial.

Change the message and include your sensor message type, and use as in ROS 1.

Also, check this Imu listener: https://github.com/ros2/demos/blob/master/demo_nodes_cpp/src/topics/imu_listener.cpp

e.g. if sensor messages are from Joint State of a camera and type imagerobot

#include "sensor_msgs/msg/joint_state.hpp"

const sensor_msgs::msg::Image& img
sensor_msgs::msg::JointState state;

should be the message type.