ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I don't want the node to process images when the robot is moving. so this parameter is there so i can tell the node "now i want you to actually process an image"
It would appear that you have the following situation:
sensor_msgs/Image
messages to a topicThe question you posted seems to be an example of an xy-problem: you're asking about a detail of a solution you've picked, instead of about the actual problem.
I would propose to implement what you describe in the following way:
ProcessImage
service or action (I would suggest to use a more descriptive name, this is of course just an example)rospy.wait_for_message(..)
(docs) to retrieve a single Image
from the camera streamSuch a setup would seem to cover all your requirements: it only processes images when requested and it only works on the "latest data".
In addition it doesn't require any bookkeeping in your node, no disabling of callbacks, no queue_size
tweaking, does not poll the parameter server at a high frequency and uses appropriate communication patterns for the interaction between service consumer and provider.
2 | No.2 Revision |
I don't want the node to process images when the robot is moving. so this parameter is there so i can tell the node "now i want you to actually process an image"
It would appear that you have the following situation:
sensor_msgs/Image
messages to a topicThe question you posted seems to be an example of an xy-problem: you're asking about a detail of a solution you've picked, instead of about the actual problem.
I would propose to implement what you describe in the following way:
ProcessImage
service or action (I would suggest to use a more descriptive name, this is of course just an example)rospy.wait_for_message(..)
(docs) to retrieve a single Image
from the camera streamSuch a setup would seem to cover all your requirements: it only processes images when requested and it only works on the "latest data".
In addition it doesn't require any bookkeeping in your node, no disabling of callbacks, no queue_size
tweaking, does not poll the parameter server at a high frequency and uses appropriate communication patterns for the interaction between service consumer and provider.
There does not seem to be a need to store Image
s at all in the service provider, nor is there a need to be notified of each and every message that gets published to the camera's topic. If the camera driver was not publishing continuously, this would be a different matter, but as it stands now I believe sampling a single message from the continuous stream whenever it is needed makes the most sense.
3 | No.3 Revision |
I don't want the node to process images when the robot is moving. so this parameter is there so i can tell the node "now i want you to actually process an image"
It would appear that you have the following situation:
sensor_msgs/Image
messages to a topicThe question you posted seems to be an example of an xy-problem: you're asking about a detail of a solution you've picked, instead of about the actual problem.problem. The answers you receive are then focused on the implementation detail, instead of the bigger picture.
I would propose to implement what you describe in the following way:
ProcessImage
service or action (I would suggest to use a more descriptive name, this is of course just an example)rospy.wait_for_message(..)
(docs) to retrieve a single Image
from the camera streamSuch a setup would seem to cover all your requirements: it only processes images when requested and it only works on the "latest data".
In addition it doesn't require any bookkeeping in your node, no disabling of callbacks, no queue_size
tweaking, does not poll the parameter server at a high frequency and uses appropriate communication patterns for the interaction between service consumer and provider.
There does not seem to be a need to store Image
s at all in the service provider, nor is there a need to be notified of each and every message that gets published to the camera's topic. If the camera driver was not publishing continuously, this would be a different matter, but as it stands now I believe sampling a single message from the continuous stream whenever it is needed makes the most sense.