ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

can't create actionlib client

asked 2013-09-20 09:57:54 -0500

octavian gravatar image

updated 2013-09-21 03:05:13 -0500

BennyRe gravatar image

Hey, I'm kinda new to this as well as c++ so plz bear with me. I'm trying to get a simple_action_client working in roscpp, but cant seem get the template constructor to accept my action. Here's an example:

#include <ros/ros.h>
#include <control_msgs/JointTrajectoryAction.h>
#include <actionlib/client/simple_action_client.h>

typedef  actionlib::SimpleActionClient<control_msgs::JointTrajectoryAction> Client_t;

int main(int argc, char **argv)
{
  ros::init(argc, argv, "move_joints", ros::init_options::AnonymousName);
  ros::NodeHandle nh
  ros::AsyncSpinner spinner(1);
  spinner.start();
  Client_t client;
[  ....   ]

It's giving me a "no matching function" error for the client typdef. Looking at the api documentation does not tell me much. I'm confused as an equivalent python script such as the following works just fine:

import rospy
import actionlib
from control_msgs.msg import *
from trajectory_msgs.msg import *

def main():
   rospy.init_node("move_joints", anonymous=True, disable_signals=True)
   client = actionlib.SimpleActionClient('follow_joint_trajectory',FollowJointTrajectoryAction)
  [...]

Any suggestions?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-09-21 03:04:49 -0500

BennyRe gravatar image

You need to specify the action. Do this (if you want to call the action 'follow_joint_trajectory'):

Client_t client("follow_joint_trajectory", true);

This actionlib tutorial is very easy and well written.

edit flag offensive delete link more

Comments

Thanks for the response. That was pretty silly of me to overlook that. I'll be more scrupulous next time :)

octavian gravatar image octavian  ( 2013-09-21 04:04:59 -0500 )edit

Your welcome. If your problem is solved, please mark the answer as correct.

BennyRe gravatar image BennyRe  ( 2013-09-21 05:10:11 -0500 )edit

Hi BennyRe, I don't know if you can help me to solve this problem: http://answers.ros.org/question/157696/actionlib-client-question/. Thanks for your help!

Yantian_Zha gravatar image Yantian_Zha  ( 2014-04-26 15:36:56 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2013-09-20 09:57:54 -0500

Seen: 633 times

Last updated: Sep 21 '13