Skip to main content

Questions tagged [spin]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
0 answers
58 views

Deadlock with spin_until_future_complete in a timer

I am trying to understand how rclpy manages async calls, with a simple example: a timer waits 1sec and then calls a service. ...
courrier's user avatar
0 votes
0 answers
51 views

ROS2 serial driver with ROS message subscription

I need to set up a ROS2 python serial device driver that also subscribes to a ROS message. For serial drivers the only publish messages I set up the serial input in a select call like this. Here, the ...
Chris's user avatar
  • 1
0 votes
0 answers
223 views

rclcpp::spin_until_future_complete(): Timeout for "non-blocking" call

tl;dr Expected behaviour: Having a non-blocking spin. Current behaviour: spin_until_future_complete() always returns timeout without firing any topic callback Hi, I am working on implementing the ...
magladko's user avatar
0 votes
1 answer
36 views

Spin not taking blackboard value instead it always taking 0

In ros2 behavior server Spin Action is not accepting spin_dist as a blackboard variable, the variable will be an Output port of another behavior tree node. Check the code below, ...
Vignesh's user avatar
0 votes
1 answer
99 views

Help me understand ros2 execution model

I'm new to ROS2 and struggling to understand how to architect certain aspects of my system. A recurrent problem I'm facing is dealing with nodes that subscribe to specific data and need to provide ...
user avatar
0 votes
2 answers
6 views

Standby mode for nodes depending on topic value

Let's assume we have 10 nodes performing various operations. We run all the nodes with one launch file at a time. We also have one topic "/mode" in which we specify the value of int. Now we ...
user avatar
0 votes
1 answer
6 views

When exactly is a callback function executed?

Hello, I know that in general a callback function is executed when its associated topic has published values. What I am wondering is how do the commands spin() and spinOnce() in main affect the ...
smarn's user avatar
  • 9
0 votes
1 answer
2 views

Is spin() event driven?

I am wondering how efficient ros::spin() is. Is it event driven so that when messages come in callbacks get called immediately? Or is it simply polling behind the scenes, and if so, how fast? ...
user avatar
0 votes
1 answer
186 views

[ROS2] Correct usage of spin_once to receive multiple callbacks synchronized

Hello everyone, I can't figure out which is the correct way of using rclpy.spin_once() to get the output from multiple existing callbacks at once. Right now I'm ...
user avatar
0 votes
2 answers
13 views

What is the ros::spin rate?

Hi, I need to run a moving robot in simulation and I need to know the translation and rotation of this robot. I was thinking to use the translation = linear.velocity *dt, and rotation = linear....
user avatar
0 votes
1 answer
33 views

How to wait a method until a callback finishes?

Hi all, I'm trying to stop a method until a particular callback is executed, because this method uses data that is updated in the callback, but I don't know how to do this task. I'm using ros kinetic ...
user avatar
0 votes
1 answer
1 view

Design advice for executing sequence of ros msg interactions

I am struggling with a good design for nodes that when receiving a callback must perform a sequence of interactions with one or more other ros nodes. So far I ended up mixing spin and spinOnce but ...
user avatar
0 votes
3 answers
41 views

What is the actual meaning of ros::spin()

I know that ros::spin can make the subscriber and publisher run in loop to publish or receive data. But I dont know which part in the program is running in loop or ...
user avatar
0 votes
1 answer
18 views

Interrupting rospy.spin() or writing a custom loop that does the equivalent

Hi, Is there a way to exit the rospy.spin() loop without completely shutting down the node? Or possibly is there a way to write my own equivalent rospy.spin() loop which answers service calls ...
user avatar
0 votes
1 answer
30 views

Does every ROS node need to spin()?

I have been using ROS for a short time now and learned about callbacks & spinning. My question is, since be default all callbacks are added to the global callback queue, does ros::spin() in node A ...
user avatar
0 votes
1 answer
6 views

An alternative to data processing inside callback functions?

I want to perform calculations on the data from my subscriptions the instant it arrives. I could of course just do this inside the callback function, but i would insted like to perform these ...
user avatar
0 votes
1 answer
8 views

Callback function and Threading

Hello everyone, I am having a callback function which is supposed to receive the data and to assign it to a local variable. Until here, everything is fine. However, after the assignment, when I want ...
user avatar
0 votes
1 answer
4 views

Why doesn't my node publish to the topic cmd_vel?

Hi, I'm trying to send commands to an Ardrone through cmd_vel topic. But I don't know why it isn't working, here is my code: ...
user avatar
0 votes
1 answer
9 views

How to run ros::spin in the background

Hi, I have a qt application and which has many Callbacks. As I dont have and infinite loop, I can't write ros::spin(). I would like to have ros::spin() or spinonce() in the background. How can i ...
user avatar
0 votes
1 answer
5 views

when is the callback function called

Hi all, I am slightly confused about when the callback functions are called from ROS Subscriber. Taking the following code as example: ...
user avatar
0 votes
1 answer
2 views

Keep running the function without restarting it?

I have this problem that i cannot make run my while(true) without it get restarted.. I think the problem occurs since in my main loop ...
user avatar
0 votes
1 answer
22 views

Does ros::Duration::sleep spin?

If I do ros::Duration::sleep does ros spin and are callback functions called? If not is there a way to pause the program while still managing callbacks? Originally posted by HassanNadeem on ROS ...
user avatar
0 votes
1 answer
6 views

move_base_node callbacks

Hi, I was going through the code for the move_base_node: ...
user avatar
0 votes
1 answer
1 view

why to define ros::spin() in another thread?

Hey all, There is an example in actionlib tutorial: wiki.ros.org/actionlib_tutorials/Tutorials/SimpleActionClient(Threaded). In this example the ros::spin() command is used in another thread. Why ...
user avatar
0 votes
2 answers
38 views

Getting messages after an user input?

Hi all, Right now my situation is that there is a node that publishes information, and I need to be able grab information from the publishing node and then print out (I need it for more than just &...
user avatar
0 votes
2 answers
30 views

The difference between Spin() and SpinOnce()

Can someone tell me the difference between Spin() and SpinOnce()? And what exactly they are doing, is it like a while loop to process some ROS stuff? Originally posted by Winston on ROS Answers with ...
user avatar
0 votes
1 answer
2 views

subscriber class method callback problem

Hi, i'm trying to make a node that subscribe to a topic ik_from_pose_request that as the name suggest receive pose messages and compute arm joint values with inverse kinematic. I saw that is possible ...
user avatar
0 votes
1 answer
8 views

Using spinOnce inside Services

I would like to know whether it is safe or bad practice to spin ROS inside a while loop that exists inside a service callback. I am unable to use actions for this particular goal, and have confirmed ...
user avatar
0 votes
1 answer
3 views

Making Subscriber and Publisher work in the same node

I have attached my code. I am trying to make the turtlebot go backward once the bumper is pressed. I'm able to make it move forward and get the bumper pressed signal separately. The problem I'm facing ...
user avatar
0 votes
2 answers
54 views

Python Spin Once Equivalent

Is there an equivalent to spin_once (C++) in ROS for Python? In C++ I have a loop with spin_once and during each iteration of the loop the code checks a couple of global variables for changes and then ...
user avatar
0 votes
1 answer
71 views

rospy and Tkinter - spin() and mainloop()

I want to write a rospy node that uses Python's GUI toolkit Tkinter, problem is that rospy.spin() and top.mainloop() are both blocking calls. I thought of starting one and setting an interrupt to ...
user avatar
0 votes
1 answer
7 views

Is spinOnce needed?

If I have ROS node that has an infinite loop that has other things running, do I need to use spin or spinOnce? The other items have specific timing such as 100 and 50 Hz but the subscriber I have ...
user avatar
0 votes
1 answer
13 views

How can I post to ros's callbackQueue()?

Looking at the "Callbacks and Spinning" wiki, ROS apparently is using an event queue under the hood. I would like to post a callback to this queue from within another callback. Is this ...
user avatar
0 votes
1 answer
39 views

ROS callbacks, threads and spinning

Hello, I have read some tutorials (such as http://www.ros.org/wiki/roscpp/Overview/Callbacks%20and%20Spinning) but I still have some doubts about ROS and callbacks: Let's say that: in my program I ...
user avatar
0 votes
2 answers
3 views

how can I register a Callback when using ros::spinOnce?

Hi all I would like to control if I subscribe or unsubscribe to a topic via a key press. I Can see that the subscribtion works but the registered callback is never called when I use ros::spinOnce(). ...
user avatar
0 votes
2 answers
7 views

Subscriber node not working for topic at 50Hz

Hello all, So I have a topic published by a publisher node, at 50 Hz. The topic publishes a message 'loadMsg' which consists of the following data types string unit float64 load Now I have my ...
user avatar
0 votes
1 answer
10 views

Calling ros::spinOnce() in nodelets?

Is it possible to integrate a while(true){ros::spinOnce(); ..} loop into a nodelet? I've based mine on the velodyne_driver nodelet, which runs a separate thread ...
user avatar
0 votes
1 answer
8 views

Threading function - udp client integration to a Ros node

Hi, I have working ROS node with callBacks for subscriptions, and also with timers like this: ...
user avatar
0 votes
1 answer
6 views

Nodelets and intraprocess communication

Hi there! ;) I'm working on a communication between two Nodelets by making use of the intraprocess communication with shared pointers as mentioned here. I got three questions and hope you can help: ...
user avatar
0 votes
1 answer
3 views

Handling SIGINT

Hi, I was trying to write a node acting as a tcp server, my first try (to see if evrythin worked) is the following ...
user avatar
0 votes
3 answers
35 views

run a subscriber callback once using rospy.spin()

Hi, I am sorry if I am not using the proper words when I refer to "run a callback function" from a subscriber while using rospy. I'm not sure I got the concept of keeping the nodes sleeping. ...
user avatar