ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
You need to save the entire goal to a variable, rather than just the linear portion of the goal.
Try this:
goal_ = as_.acceptNewGoal();
steer_.linear = goal_.linear*15/2;
steer_.angular = goal_.angular*45/2;
steer_pub_.publish(steer_);
2 | No.2 Revision |
You need to save the entire goal to a variable, rather than just the linear portion of the goal.
EDIT: acceptNewGoal()
returns a boost ConstPtr, so you'll need to change the type of goal_
. For example if your declaration was car_joy::Velocity goal_;
, you'd need to change it to car_joy::Velocity::ConstPtr goal_
and then use ->
operators instead of .
operators.
Try this:
void goalCB()
{
//where goal_ is some kind of ConstPtr
goal_ = as_.acceptNewGoal();
steer_.linear = goal_.linear*15/2; goal_->linear*15/2; steer_.angular = goal_.angular*45/2; goal_->angular*45/2; steer_pub_.publish(steer_);
}