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

Revision history [back]

click to hide/show revision 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_);

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_);
}