Ask Your Question

PowerfulMing's profile - activity

2020-06-12 00:09:06 -0500 received badge  Nice Question (source)
2020-05-18 15:07:49 -0500 marked best answer Why rclcpp_action create_client cannot choose qos options?

Hi everyone, I'm trying to understand the actionlib of ROS2. I have a question as title... (Hope this question not too stupid)

In rclcpp_action create_action, user can choose which qos they want but why in rclcpp_action create_client doesn't have this function?

Please kindly help me. Many thanks!!!

2020-05-17 20:52:00 -0500 commented answer Why rclcpp_action create_client cannot choose qos options?

Thanks for your reply. I'll try to open an issue first. :)

2020-05-17 20:47:30 -0500 commented question Why rclcpp_action create_client cannot choose qos options?

Thank you! I just afraid that I didn't read ROS2 Documents carefully.

2020-05-17 20:45:44 -0500 received badge  Popular Question (source)
2020-05-15 01:59:41 -0500 received badge  Student (source)
2020-05-14 21:16:00 -0500 asked a question Why rclcpp_action create_client cannot choose qos options?

Why rclcpp_action create_client cannot choose qos options? Hi everyone, I'm trying to understand the actionlib of ROS2.

2019-11-18 09:52:27 -0500 received badge  Famous Question (source)
2019-09-16 17:10:53 -0500 received badge  Notable Question (source)
2019-09-06 00:34:51 -0500 marked best answer ROS2: Specify RTI Connext as rmw implementation on NVidia Jetson Nano not work

I'm trying to build my package with rmw_connext_cpp. It works fine on my PC (64bit, Ubuntu 18.04). Here is what I did:

vim .bashrc

then add line

export RMW_IMPLEMENTATION=rmw_connext_cpp

However, when I try to do the same things on Nvidia Jetson Nano, the systems shows the following error:

-- Found ament_cmake: 0.7.3 (/opt/ros/dashing/share/ament_cmake/cmake)
-- Using PYTHON_EXECUTABLE: /usr/bin/python3
-- Found rclcpp: 0.7.7 (/opt/ros/dashing/share/rclcpp/cmake)
-- Found rosidl_adapter: 0.7.5 (/opt/ros/dashing/share/rosidl_adapter/cmake)
-- Found rmw_implementation_cmake: 0.7.2 (/opt/ros/dashing/share/rmw_implementation_cmake/cmake)
CMake Error at /opt/ros/dashing/share/rmw_implementation/cmake/rmw_implementation-extras.cmake:47 (message):
  The RMW implementation has been specified as 'rmw_connext_cpp' through the
  environment variable 'RMW_IMPLEMENTATION', however it is not in the list of
  supported rmw implementations, which was specified when the 'rmw_implementation' package was built.

Thanks!!!

BTW, I had already install rmw_implementation, rmw_connext_cpp, and rosidl_typesupport_connext_cpp.

2019-09-06 00:34:00 -0500 received badge  Popular Question (source)
2019-09-05 01:39:08 -0500 commented answer ROS2: Specify RTI Connext as rmw implementation on NVidia Jetson Nano not work

Thanks a lot... But it doesn't work... when I build rmw_implementation, it shows error that can't find RTI connext packa

2019-09-05 01:36:08 -0500 commented answer ROS2: Specify RTI Connext as rmw implementation on NVidia Jetson Nano not work

No, it doesn't work... can't find RTI connext package.... I found a tutorial for cross compile RTI connext DDS for Rasp

2019-09-03 22:43:51 -0500 asked a question ROS2: Specify RTI Connext as rmw implementation on NVidia Jetson Nano not work

ROS2: Specify RTI Connext as rmw implementation on NVidia Jetson Nano not work I'm trying to build my package with rmw_c

2019-05-13 15:37:51 -0500 received badge  Famous Question (source)
2019-04-07 21:21:15 -0500 commented answer Multi-navigation robot in RViz

In the launch file, change the name space prefix

2019-04-07 21:19:50 -0500 answered a question Error Compiling razor_imu_9dof Firmware

hey there! I just met the same problem and solved it. I think you didn't select your board correctly. Tool -> Board

2019-03-13 01:05:38 -0500 commented answer How to use function rclcpp_action::create_server in class with ROS2 Crystal?

You're right! It works on me! Thank you~

2019-03-13 01:03:21 -0500 marked best answer How to use function rclcpp_action::create_server in class with ROS2 Crystal?

Hello guys,

I am trying to make a class with actionlib in ROS2 crystal. I started by modifying the example code here.

However, I get stuck in calling the function rclcpp_action::create_server. Is there any example for write a actionlib sever in class with ROS2 crystal??? Thank you!!!

here is the error I get

/home/q600/rclcpp_ws/src/universal_actionlib/src/universal_actionlib_server.cpp: In member function ‘void UniversalActionlibServer::init()’:
/home/q600/rclcpp_ws/src/universal_actionlib/src/universal_actionlib_server.cpp:19:5: error: no matching function for call to ‘create_server<StringTask>(rclcpp::Node::SharedPtr&, std::__cxx11::string&, std::_Bind_helper<false, rclcpp_action::GoalResponse (UniversalActionlibServer::*)(std::array<unsigned char, 16>&, std::shared_ptr<universal_actionlib_interface::action::StringTask_Goal_Request_<std::allocator<void> > >), UniversalActionlibServer*, const std::_Placeholder<1>&, const std::_Placeholder<2>&>::type, std::_Bind_helper<false, rclcpp_action::CancelResponse (UniversalActionlibServer::*)(std::shared_ptr<rclcpp_action::ServerGoalHandle<universal_actionlib_interface::action::StringTask> >), UniversalActionlibServer*, const std::_Placeholder<1>&>::type, std::_Bind_helper<false, void (UniversalActionlibServer::*)(std::shared_ptr<rclcpp_action::ServerGoalHandle<universal_actionlib_interface::action::StringTask> >), UniversalActionlibServer*, const std::_Placeholder<1>&>::type)’
     );
     ^
In file included from /opt/ros/crystal/include/rclcpp_action/rclcpp_action.hpp:34:0,
                 from /home/q600/rclcpp_ws/src/universal_actionlib/include/universal_actionlib/universal_actionlib_server.hpp:4,
                 from /home/q600/rclcpp_ws/src/universal_actionlib/src/universal_actionlib_server.cpp:1:
/opt/ros/crystal/include/rclcpp_action/create_server.hpp:36:1: note: candidate: template<class ActionT> typename rclcpp_action::Server<ActionT>::SharedPtr rclcpp_action::create_server(rclcpp::Node::SharedPtr, const string&, typename rclcpp_action::Server<ActionT>::GoalCallback, typename rclcpp_action::Server<ActionT>::CancelCallback, typename rclcpp_action::Server<ActionT>::AcceptedCallback, const rcl_action_server_options_t&, rclcpp::callback_group::CallbackGroup::SharedPtr)
 create_server(
 ^~~~~~~~~~~~~

I also check the code here. But I still didn't get it how to use actionlib in class.

Here is my code:

StringTask.action

# Goal
string task_s
---
# Result
string result_s
---
# Feedback
string feedback_s

actionlib_server_class.hpp

#ifndef UNIVERSAL_ACTIONLIB_SERVER_H
#define UNIVERSAL_ACTIONLIB_SERVER_H
#include "rclcpp/rclcpp.hpp"
#include "rclcpp_action/rclcpp_action.hpp"
#include "universal_actionlib_interface/action/string_task.hpp"
#include "string"
#include "iostream"
#include "thread"
#include "functional"

using namespace std;
using StringTask = universal_actionlib_interface::action::StringTask;
using GoalHandleStringTask = rclcpp_action::ServerGoalHandle<StringTask>;
using GoalID = rclcpp_action::GoalID;

class UniversalActionlibServer
{
public:
    UniversalActionlibServer(string action_name);
    ~UniversalActionlibServer(){};

    void init();

private:
    rclcpp_action::GoalResponse handle_goal(GoalID &uuid, shared_ptr<StringTask::Goal> goal);
    rclcpp_action::CancelResponse handle_cancel(shared_ptr<GoalHandleStringTask> goal_handle);
    void handle_accepted(shared_ptr<GoalHandleStringTask> goal_handle);
    void execute(const shared_ptr<GoalHandleStringTask> goal_handle);

    string action_name_;
    rclcpp::Node::SharedPtr node_;
};

actionlib_server.cpp

#include "universal_actionlib/universal_actionlib_server.hpp"

UniversalActionlibServer::UniversalActionlibServer(string action_name)
{
    action_name_ = action_name;
    node_ = rclcpp::Node::make_shared(action_name_);
    RCLCPP_INFO(rclcpp::get_logger("server"),"Establishing the action server %s...",action_name_);
}

void UniversalActionlibServer::init()
{
    auto action_server = rclcpp_action::create_server<StringTask>(
        node_,
        action_name_,
        std::bind(&UniversalActionlibServer::handle_goal, this, std::placeholders::_1, std::placeholders::_2),
        std::bind(&UniversalActionlibServer::handle_cancel, this, std::placeholders::_1),
        std::bind(&UniversalActionlibServer::handle_accepted, this, std::placeholders::_1)
    );
}

rclcpp_action::GoalResponse UniversalActionlibServer::handle_goal(GoalID &uuid, shared_ptr<StringTask::Goal> goal)
{
    return rclcpp_action::GoalResponse::ACCEPT_AND_EXECUTE;
}

rclcpp_action::CancelResponse UniversalActionlibServer::handle_cancel(shared_ptr<GoalHandleStringTask> goal_handle)
{
    RCLCPP_INFO(rclcpp::get_logger("server"), "Got request to cancel goal");
    (void)goal_handle;
    return rclcpp_action::CancelResponse::ACCEPT;
}

void UniversalActionlibServer::handle_accepted(shared_ptr<GoalHandleStringTask> goal_handle)
{
    std::thread{&UniversalActionlibServer::execute, this, goal_handle}.detach();
}

void UniversalActionlibServer::execute(const shared_ptr<GoalHandleStringTask> goal_handle)
{
    RCLCPP_INFO(rclcpp::get_logger("server"), "Executing goal");
    rclcpp::Rate loop_rate(1);
    const auto goal = goal_handle->get_goal();
    auto _feedback = std::make_shared ...
(more)
2019-03-13 01:03:21 -0500 received badge  Scholar (source)
2019-03-12 18:56:04 -0500 received badge  Notable Question (source)
2019-02-25 19:48:17 -0500 received badge  Supporter (source)
2019-02-25 02:21:26 -0500 received badge  Enthusiast
2019-02-22 09:29:07 -0500 received badge  Popular Question (source)
2019-02-22 03:02:14 -0500 answered a question Multi-navigation robot in RViz

Yes! It is feasible! Just add the prefix for each robot's tf and link with the same map! Check this video The TF tree

2019-02-18 20:00:57 -0500 edited question How to use function rclcpp_action::create_server in class with ROS2 Crystal?

How to use actionlib in class with ROS2 Crystal? Hello guys, I am trying to make a class with actionlib in ROS2 crystal

2019-02-18 06:08:25 -0500 asked a question How to call actionlib::create_server in class with ROS2 Crystal?

How to call actionlib::create_server in class with ROS2 Crystal? Hello guys, I am trying to make a class with actionli

2019-02-18 06:08:25 -0500 asked a question How to use function rclcpp_action::create_server in class with ROS2 Crystal?

How to use actionlib in class with ROS2 Crystal? Hello guys, I am trying to make a class with actionlib in ROS2 crystal