ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I think you shouldn't use ros::spinOnce():
, use ros::spin();
instead.
2 | No.2 Revision |
I think you shouldn't use ros::spinOnce():
, use ros::spin();
instead.
EDIT:
Sorry, didn't see the while... have you tried to add something like loop_rate.sleep()
at the end of loop? what is the output of rosnode info YOUR_NODE?
3 | No.3 Revision |
I think you shouldn't use ros::spinOnce():
, use ros::spin();
instead.
EDIT:
Sorry, didn't see the while... have you tried to add something like loop_rate.sleep()
at the end of loop? what is the output of rosnode info
YOUR_NODE?YOUR_NODE?
4 | No.4 Revision |
I think you shouldn't use ros::spinOnce():
, use ros::spin();
instead.
EDIT:
Sorry, didn't see the while... have you tried to add something like loop_rate.sleep()
at the end of loop? what is the output of rosnode info YOUR_NODE
?
EDIT 2:
First check this on your callback arguments:
void chatterCallback(const std_msgs::String**::ConstPtr&** msg)
{
ROS_INFO("I heard: [%s]", msg->data.c_str());
}
Then, if that doesn't work, use ros::Subscriber sub = n.subscribe("chatter", 1000, chatterCallback);
instead of just invoke the method 'subscribe'
5 | No.5 Revision |
I think you shouldn't use ros::spinOnce():
, use ros::spin();
instead.
EDIT:
Sorry, didn't see the while... have you tried to add something like loop_rate.sleep()
at the end of loop? what is the output of rosnode info YOUR_NODE
?
EDIT 2:
First check this on your callback arguments: arguments (see the ConstPtr&
)
void chatterCallback(const std_msgs::String**::ConstPtr&** std_msgs::String::ConstPtr& msg)
{
ROS_INFO("I heard: [%s]", msg->data.c_str());
}
Then, if that doesn't work, use ros::Subscriber sub = n.subscribe("chatter", 1000, chatterCallback);
instead of just invoke the method 'subscribe'
6 | No.6 Revision |
I think you shouldn't use ros::spinOnce():
, use ros::spin();
instead.
EDIT:
Sorry, didn't see the while... have you tried to add something like loop_rate.sleep()
at the end of loop? what is the output of rosnode info YOUR_NODE
?
EDIT 2:
First check this on your callback arguments (see the ConstPtr&
)
void chatterCallback(const std_msgs::String::ConstPtr& msg)
{
ROS_INFO("I heard: [%s]", msg->data.c_str());
}
Then, if that doesn't work, use ros::Subscriber sub = n.subscribe("chatter", 1000, chatterCallback);
instead of just invoke the method 'subscribe'
This is from tutorial: /** * The subscribe() call is how you tell ROS that you want to receive messages * on a given topic. This invokes a call to the ROS * master node, which keeps a registry of who is publishing and who * is subscribing. Messages are passed to a callback function, here * called chatterCallback. subscribe() returns a Subscriber object that you * must hold on to until you want to unsubscribe. When all copies of the Subscriber * object go out of scope, this callback will automatically be unsubscribed from * this topic. * * The second parameter to the subscribe() function is the size of the message * queue. If messages are arriving faster than they are being processed, this * is the number of messages that will be buffered up before beginning to throw * away the oldest ones. */
7 | No.7 Revision |
I think you shouldn't use ros::spinOnce():
, use ros::spin();
instead.
EDIT:
Sorry, didn't see the while... have you tried to add something like loop_rate.sleep()
at the end of loop? what is the output of rosnode info YOUR_NODE
?
EDIT 2:
First check this on your callback arguments (see the ConstPtr&
)
void chatterCallback(const std_msgs::String::ConstPtr& msg)
{
ROS_INFO("I heard: [%s]", msg->data.c_str());
}
Then, if that doesn't work, use ros::Subscriber sub = n.subscribe("chatter", 1000, chatterCallback);
instead of just invoke the method 'subscribe'
This is from subscriber/publisher tutorial:
/**
* The subscribe() call is how you tell ROS that you want to receive messages
* on a given topic. This invokes a call to the ROS
* master node, which keeps a registry of who is publishing and who
* is subscribing. Messages are passed to a callback function, here
* called chatterCallback. subscribe() returns a Subscriber object that you
* must hold on to until you want to unsubscribe. When all copies of the Subscriber
* object go out of scope, this callback will automatically be unsubscribed from
* this topic.
*
* The second parameter to the subscribe() function is the size of the message
* queue. If messages are arriving faster than they are being processed, this
* is the number of messages that will be buffered up before beginning to throw
* away the oldest ones.
*/ */