Skip to content

Working with ros2-foxy Ubuntu 20.04 #1

@aarsht7

Description

@aarsht7

When trying to implement something like this
when I try to load the create_subscription function, it doesn't allow the callback group as one of its atribute.

node = rclcpp::Node::make_shared("draw_shape_server");

auto cb_grp1_ = node->create_callback_group(rclcpp::callback_group::CallbackGroupType::MutuallyExclusive);

auto cb_grp2_ = node->create_callback_group(rclcpp::callback_group::CallbackGroupType::MutuallyExclusive);

rclcpp::Service<whizz_assignment_extra::srv::DrawShape>::SharedPtr drawing_service = node->create_service<whizz_assignment_extra::srv::DrawShape>("draw_shape",&drawing_server,rmw_qos_profile_services_default,cb_grp1_);

rclcpp::Subscription<turtlesim::msg::Pose>::SharedPtr pose_sub_ = node->create_subscription<turtlesim::msg::Pose>("/turtle/pose",10,&trial_callback,rmw_qos_profile_services_default,cb_grp2_);

simple code flow (something like ros1)

Error:
error: no matching function for call to ‘rclcpp::Node::create_subscription <turtlesim::msg::Pose>(const char [13], void (*)(turtlesim::msg::Pose_<std::allocator<void> >::SharedPtr), const rmw_qos_profile_t&, std::shared_ptr<rclcpp::CallbackGroup>&)’ 338 | le/pose",&trial_callback,rmw_qos_profile_sensor_data,cb_grp2_);
Template for create_subscription in ros2 can be found here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions