writing first node, have some questions about the Subscriber
I'm writing my first node and there are a few things that I don't quite understand and am looking for some clarification. (This node will read Float64 messages from the /phidgets_ros/interface_kit node and then publish a cmd_vel)
I've read through the http://www.ros.org/wiki/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29 (Writing a Simple Publisher and Subscriber (C++)) and still have some questions, specifically about the Subscriber.
I've defined my publisher and subscriber as
youbot_flexiforce_sensor_touch::youbot_flexiforce_sensor_touch()
{
cmd_vel_ = nh.advertise<youbot::Velocity>("cmd_vel", 1);
sens_sub_ = nh.subscribe<std_msgs::Float64>("/phidgets_ros/interface_kit/116807/sensor/1", 1, &flexiCallback, this);
}
where "/phidgets_ros/interface_kit/116807/sensor/1" is where the messages are being sent from (of type Float64)
My question then is regarding how that message is stored for use later in my node.
void youbot_flexiforce_sensor_touch::flexiCallback(const std_msgs::Float64::ConstPtr& msg)
{
stuff
}
I'm not understanding how the tutorial is explaining where the data is stored. In the tutorial, "msg" is the data (a string) and has a pointer pointing to it... am I misunderstanding that? Why not just keep it in a variable that is updated?
I'm a bit confused and could use a point in the right direction... thank you
EDIT: bad spilling