ROS2 Subscriber create no class
Hallo,
i cannot correct create subscriber without using classes like in ROS2-Tutorials (Creation of Publisher and subscriber).
I want to migrate my code to ros2 and have a problem by creation of Subscriber. example of ros1 code :
//my callback function
void robot_pose_callback(const geometry_msgs::Pose &call_back_target)
{
do what i want;
}
// in main:
ros::Subscriber sub = n.subscribe("robot_pose", 1000,
robot_pose_callback);
ROS2 Tutorial use classes, which i dont want to use. ( i dont check it and i dont want to check it)
in ROS2 it have to be look like :
#includes ...
//my callback - Parameter in brackets are wrong ?
void robot_pose_callback(geometry_msgs::msg::Pose::SharedPtr msg)
{
}
int main(int argc, char** argv)
{
rclcpp::init(argc, argv);
auto move_group_node = rclcpp::Node::make_shared("move_group_interface_tutorial");
(Parameter in brackets are wrong)
auto sub = move_group_node->create_subscription<geometry_msgs::msg::Pose>("robot_pose",10, void(robot_pose_callback));
the right parameter i can look up on this website : https://docs.ros2.org/beta3/api/rclcp...
but i dont know what i have to write for :
Parameters (create subscriber 1/2 => there is another parameter list 2/2)
[in] topic_name The topic to subscribe on.
[in] callback The user-defined callback function.
[in] qos_profile The quality of service profile to pass on to the rmw implementation.
[in] group The callback group for this subscription. NULL for no callback group.
[in] ignore_local_publications True to ignore local publications.
[in] msg_mem_strat The message memory strategy to use for allocating messages.
[in] allocator Optional custom allocator.
can somebody show me simple example for this parameter. Thank you in advice !!!!!!!!!!