Questions tagged [callbacks]
The callbacks tag has no usage guidance.
63
questions
0
votes
2
answers
21
views
ROS2 Humble C++: Calling a Service and waiting for a response within a ROS2 Callback
I'm working on a ROS2 Node that has a callback, that when it receives a new message should send a ROS2 Service call to a particular Server, and wait for a response before continuing. Furthermore, when ...
1
vote
0
answers
26
views
rclcpp::AsyncParametersClient inside a timer callback
I am trying to have a parameter client set the parameters of a node in a timer callback.But unfortunately the parameters are not set during the callback the code is as follows. i also tested with a ...
0
votes
1
answer
30
views
ROS 2 Service Future - Why underscored vars _done and _result?
My ROS 2 Humble robot makes an async service request /dock to a "docking_node" and saves the "future" provided at the request.
...
0
votes
0
answers
21
views
Cancel previous callback made from subscription ROS2
I'm new to ROS2 and I don't really know how to do this is in a clean way.
I'm in this condition
...
0
votes
0
answers
11
views
Client doesn't revieve response in nested callbacks
I want to create node which provides a action server, this server expects the name of a waypoint and is then able to ask other nodes which calculate the pose of the waypoint for the appropriate ...
0
votes
0
answers
7
views
ROS2 equivalent of ros::CallbackInterface
I have a legacy code that I am changing to ROS2 from ROS. I stumbled upon a class that is inheriting ros::CallbackInterface that I would like to change to ROS2.
I would like to know what is the ROS2 ...
0
votes
0
answers
30
views
Executor multithread doesnt work
Im having problems to execute tasks from 2 nodes using the multithreadExecutors and the call_back groups.
I'm running 1 node with 2 classes:
...
0
votes
1
answer
332
views
[ROS2] asyncio await with timeout a service call in a callback
Hi! I am trying to use the asyncio syntax to await for a service to complete inside a callback function of a Node. A dummy node to test this:
...
0
votes
1
answer
66
views
ROS Subscribe to multiple topics with single function
Thanks for feedback and help in advance,
I want to give input of topic names, initial data and data_type as dictionary to a function, and that function will subscribe to each topic and save data to ...
0
votes
2
answers
4
views
Should callbacks be simple?
I was wondering what is the best thing to do, write very simple callbacks, or to put almost all code inside callbacks. I don't know if there is a general rule, so if you understand more cleary the ...
0
votes
1
answer
61
views
Callback rate is faster than the received message
Hello people. I have a node which subscribes to two topics with different frequencies and using two different callback functions I publish data to two different topics. My code is structured like this:...
0
votes
1
answer
4
views
Is it bad practice to declare variables in a callback?
Hi all,
I would like to know if I should avoid creating new variables in a callback function since the callback will be executed each time I receive new data, thus creating a new variable again and ...
0
votes
1
answer
9
views
Correct way to interrupt a callback
I will present my problem with an example. I have a callback of Imu messages which I want to integrate on the fly. In a parallel thread I want to access the integrated value from the callback and ...
0
votes
1
answer
458
views
Subscribing to multiple topics using one (meta)callback
Hello Guys,
I have 13 different topics of the same class (control_msgs::JointControllerState) that I would like to subscribe to using ROSCPP. If I follow the standard procedure, I would need to define ...
0
votes
1
answer
20
views
Function execution is slow in callbacks. Why?
Hi
My (Heavy) Image processing functionis slow in the subscriber callback.
But if I run the same function outside ROS in release mode it is fast. (10X fast)
Why I want to put the image processing ...
0
votes
1
answer
1
view
how to calculate difference of two messages in callback function on same topic
Hi Sir,
I am actually reading my hand pose from a Leap Motion sensor and I want to calculate how much the hand moves in X direction.
My question is how to read the message in callback function(as you ...
0
votes
1
answer
150
views
How to use timer callback in ROS?
I am working with ROS Kinetic. Like in ROS2, we can use a create_timer() function as described here.
Similarly I would want to use a similar functionality in rospy ...
0
votes
1
answer
5
views
How to invoke a subscriber's callback periodically?
Hello everyone,
I would like to sample messages from my sensors' topics every 15 seconds (mostly) synchronically, using message_filters.ApproximateTimeSynchronizer. Is that any possible way to ...
0
votes
1
answer
1
view
How to call a service with begin and end time as request/input
Hi,
I am looking to call laser_assembler call back service -AssembleScans .
...
0
votes
1
answer
8
views
Using image callback and videocallback OpenCV Kinetic
Hi all! First question in the site!
Hope you guys can help me out, I've got a problem by trying to use an image inside a function. In this function I got an example of edge detector from the camera. I ...
0
votes
1
answer
17
views
Cancelling callbacks
Hello, I am very new to ROS and am trying to make the system work in a very specific way. I want to create a Publisher/Service that will send multiple instructions that would be read by other nodes. ...
0
votes
1
answer
2
views
What is causing my callback functions to not function?
I'm trying to collect image data and save in to a file however, fwrite and cout are giving garbage values when I check the values from my "buffer". In order find out if this from the result ...
0
votes
1
answer
36
views
rospy callback subscribe to topics in parallel
I am trying to run a system where my ROS code subscribes to 'n' different topics, each representing one agent. For each agent I need to run a series of calculations (based on the callback function) ...
0
votes
1
answer
5
views
For loop contaning a subscriber does just the first iteration
hi there, i want to do spiral trajectory using a PID controller, for that i used a for loop so that at each iteration it gives a new target. I used this code for the PID controller. Inside the for ...
0
votes
1
answer
5
views
Multiple callbacks in class. Node is randomly dying
Hi all,
I am quite new to ROS and I have the following problem:
I have three node publish each to a specific topic. On node has a class with three subscribers to each of the topics from before. ...
0
votes
1
answer
5
views
ROS not calling callbacks fast enough
EDIT:
Here's a basic talker/listener example that reproduces the problem, if anyone else wants to try it. The talker is sending msgs of type gazebo_msgs::LinkStates,...
0
votes
1
answer
6
views
Problem with image_transport callback
I have the next scenario,
...
0
votes
1
answer
50
views
Subscribing to a Bool msg via rosserial_arduino
Hello All!
I'm in the process of building a tool for a robot that I'm working with and we are trying to use an Arduino to communicate with ROS to control the end effector. We are right now ...
0
votes
1
answer
63
views
ROS Threading, AsyncSpinners and Control
Hello everybody,
I am a relatively new ROS user (but I've spent years working with other middlewares), and up to now I am generally happy about it. I have a doubt related to my software framework I ...
0
votes
2
answers
67
views
Passing multiple arguments to a callback. (C++)
Hello,
I am currently in the process of writing a ROS node in C++ that subscribes to an image node, then does some processing from some arguments at the launch of the node that points to a few ...
0
votes
1
answer
1
view
C++11 closure as ROS callback?
Is it possible to register a C++11 closure as a ROS callback? I'm using ROS indigo.
Originally posted by drewm1980 on ROS Answers with karma: 258 on 2015-08-11
Post score: 1
0
votes
1
answer
1
view
Subscriber callback function not called when trying to capture data using Kinect [Solved]
This is my current code. It's a node, and I use rosrun to execute/run it.
...
0
votes
1
answer
5
views
subscribing to 2 topics
Hello,
I want to subscribe to 2 topics in one node and then do some kind of calculations and them publish a TF.
The subscribers that I saw in the tutorials only subscribe to a single topic, do ...
0
votes
1
answer
8
views
One callback interrupting another, is that possible?
Hi, I built a node with a class in it, the class has two callbacks one is bind to dynamic reconfigure server, the other is bind to a service. Both callbacks are class member. So it is something like ...
0
votes
2
answers
24
views
starting multiple instances of same callback in MultiThreadedSpinner
My end goal is to have a callback receive a message and until the next message is received to run a few lines of code in an infinite loop.
My initial thought was to create a ...
0
votes
1
answer
15
views
Getting external callbacks (SDK) called in a ROS node
Hello all;
I am trying to integrate a new sensor in a robot. This sensor provides an SDK and the way of acquiring its data is by using a callback, everytime that there are data available, the callback ...
0
votes
1
answer
14
views
how are threads used to service callbacks in nodelets?
I have several nodelets, each subscribes to different messages (using the single threaded node handle). However, I realized one of my nodes, which subscribes to images and to odometry messages, and ...
0
votes
1
answer
67
views
C++ How to set a callback to point to a non-static member function of an object instance?
[Ubuntu 13.10, Hydro Desktop-Full from source, C++]
I am having difficulty setting up callback functions for my ROS Topic subscribers, and would appreciate help.
Since all my Topics use the ...
0
votes
1
answer
1
view
Problem Using Class function as callback
I'm trying to encapsulate nodes to support dynamic node creation. When I try to register a callback from inside a class using one of that classes functions I get a compile error. The following code ...
0
votes
1
answer
39
views
Processing an image outside the Callback function
Hi guys,
The answer to this question is probably trivial, but I have looked around and cannot find the answer I am looking for. I have written a simple Harris corner detector algorithm in which I ...
0
votes
1
answer
13
views
actionlib blocking subscription callbacks
Hi,
I'm using Python, ROS Fuerte and Ubuntu 12.04.
I have an actionlib server as part of a node that subscribes to a certain topic.
Subscription callbacks are attended normally, but when an the ...
0
votes
1
answer
3
views
error when I try to read a ros msg composite by another msg file into a node subscriber calback
Error when I try to read a ros msg composite by another msg file into a node subscriber callback.
I have this ROS msgs.
...
0
votes
1
answer
3
views
Problems calling services within classes
Hello Community,
I have a couple of services and subscribers that are functions of a class that I created. The services are being advertised correctly and I can see them in rosservice list. However ...
0
votes
1
answer
2
views
ROS Answers SE migration: int callback
Is it possible to have a callback function other than type void? If yes, how would you handle a situation where you call ros::spinOnce() and say you are subscribing to two different topics each with ...
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 ...
0
votes
1
answer
15
views
Race conditions in callbacks
Hi, there!
I've been using ROS for a while and I just faced a possible bug. A service is called about the same time a topic got published and that topic is subscribed by the same node that implements ...
0
votes
3
answers
13
views
Subscribing 2 topics of different types in a callback function
I would like to ask, How do I subscribe 2 topics with different message types (say one is LaserScan and another is Pose) using a callback function? How to realize this in a better way? Could someone ...
0
votes
1
answer
13
views
Callback Problem with Multiple Subscribers
Hi,
I am working on a project which scans rooms and builds the complete map of the room.
The ros code that I wrote requires multiple subscribers (eg for Pose and Obstacles).
I want the subscription to ...
0
votes
1
answer
4
views
How to deliver arguments to a callback function?
Hello All,
I am relatively new user of ROS, and would be grateful if you could answer to my question.
I work with Linux and C, and I want to deliver arguments to my callback function.
Lets say I want ...
0
votes
1
answer
20
views
Gathering Wheel Encoder data and publishing on the /odom topic
So far I have rosserial up and running. It's feeding Vector3's back to my main computer where Vector3.x = right encoder ticks and Vector3.y is left encoder ticks. I'm getting the data back on that ...