Starting a ROS ActionClient with QT Signal

asked 2017-06-20 04:53:39 -0600

ghkraju gravatar image

updated 2017-07-07 06:49:43 -0600

How can I start a ROS ActionClient with a QT Signal? I have followed the procedure of Action Servers but I failed to initiate the action client. The code snippets are as follows:

//Initiating Action Server header file:
// Variable decleration
ros::NodeHandle nh_;
actionlib::SimpleActionServer<aps_msgs::PubMarkersAction> as_; 
ros::Publisher marker_array_pub;    

// Starting Action Server from the constructor:
PubMarkersServer::PubMarkersServer(std::string name) :
as_(nh_, name, boost::bind(&PubMarkersServer::executeCB, this, _1), false),
action_name_(name)
{
  as_.start();
  marker_array_pub = nh_.advertise<visualization_msgs::MarkerArray>("marker_array",1);
}

For Initiating Action Client

// Variable declaration in header file:
ros::NodeHandle nh_;
actionlib::SimpleActionClient<aps_msgs::PubMarkersAction> ac;

// Starting Action Client from the constructor:
StepDialog::StepDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::StepDialog)
{
    nh_("APS");
    ac(nh_,"PubMarkersServer", true);
    ac.waitForServer();
    ui->setupUi(this);
}

Application is aborting once I create an object for Action Client through QT Signal. Can any one please help me with this?

I could successfully create an individual ActionClient but I can able to embed into the existing QT application...

Thanks in advance.

edit retag flag offensive close merge delete