ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
First, change your callback argument const es_1::Draw msg
to const es_1::Draw::ConstPtr& msg
.
As mentioned in section 2.2. of roscpp tutorial, "The message is passed in a boost shared_ptr"
Now since callback accepts the arguments as boost::shared_ptr, you may encapsulate your action client like this:
boost::shared_ptr<Client> client;
client.reset(new Client(..)); // initialize
ros::Subscriber sub = n.subscribe<es_1::Draw>("draw", 1000, boost::bind(polygonCallback, _1, client));
...
void polygonCallback(const es_1::Draw::ConstPtr &msg, const boost::shared_ptr<Client> &cl){//Stuff} // use cl by ->
2 | No.2 Revision |
First, change your callback argument const es_1::Draw msg
to const es_1::Draw::ConstPtr& msg
.
As mentioned in section 2.2. of roscpp tutorial, "The message is passed in a boost shared_ptr"
Now since callback accepts the arguments as boost::shared_ptr, you may encapsulate your action client like this:
```
boost::shared_ptr<client> client;
```
3 | No.3 Revision |
First, change your callback argument const es_1::Draw msg
to const es_1::Draw::ConstPtr& msg
.
As mentioned in section 2.2. of roscpp tutorial, "The message is passed in a boost shared_ptr"
Now since callback accepts the arguments as boost::shared_ptr, you may encapsulate your action client like this:
```
boost::shared_ptr<client> client;
```
4 | No.4 Revision |
First, change your callback argument const es_1::Draw msg
to const es_1::Draw::ConstPtr& msg
.
As mentioned in section 2.2. of roscpp tutorial, "The message is passed in a boost shared_ptr"
Now since callback accepts the arguments as boost::shared_ptr, you may encapsulate your action client like this:
boost::shared_ptr<Client> client;
...