Skip to main content

Questions tagged [callbacks]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
8 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 ...
Alexander's user avatar
0 votes
0 answers
9 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 ...
NotARobot's user avatar
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 ...
RobotBramhana's user avatar
0 votes
0 answers
22 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: ...
Juan Miguel Sequeira Da Silva's user avatar
0 votes
1 answer
241 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: ...
user avatar
0 votes
1 answer
46 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 ...
user avatar
0 votes
2 answers
3 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 ...
user avatar
0 votes
1 answer
46 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:...
user avatar
0 votes
1 answer
3 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 ...
user avatar
0 votes
1 answer
7 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 ...
user avatar
0 votes
1 answer
296 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 ...
user avatar
0 votes
1 answer
14 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 ...
user avatar
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 ...
user avatar
0 votes
1 answer
100 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 ...
user avatar
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 ...
user avatar
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 . ...
user avatar
0 votes
1 answer
7 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 ...
user avatar
0 votes
1 answer
8 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. ...
user avatar
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 ...
user avatar
0 votes
1 answer
28 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) ...
user avatar
0 votes
1 answer
2 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 ...
user avatar
0 votes
1 answer
3 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. ...
user avatar
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,...
user avatar
0 votes
1 answer
5 views

Problem with image_transport callback

I have the next scenario, ...
user avatar
0 votes
1 answer
31 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 ...
user avatar
0 votes
1 answer
33 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 ...
user avatar
0 votes
2 answers
42 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 ...
user avatar
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
user avatar
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. ...
user avatar
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 ...
user avatar
0 votes
1 answer
7 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 ...
user avatar
0 votes
2 answers
18 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 ...
user avatar
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 ...
user avatar
0 votes
1 answer
9 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 ...
user avatar
0 votes
1 answer
44 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 ...
user avatar
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 ...
user avatar
0 votes
1 answer
31 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 ...
user avatar
0 votes
1 answer
10 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 ...
user avatar
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. ...
user avatar
0 votes
1 answer
2 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 ...
user avatar
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 ...
user avatar
0 votes
1 answer
5 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
12 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 ...
user avatar
0 votes
3 answers
9 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 ...
user avatar
0 votes
1 answer
9 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 ...
user avatar
0 votes
1 answer
2 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 ...
user avatar
0 votes
1 answer
11 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 ...
user avatar
0 votes
1 answer
3 views

What's the meaning of global in getGlobalCallbackQueue()?

Hi there! Does the getGlobalCallbackQueue function return a pointer to a queue shared by all the nodes? or does it return a pointer to a queue intended global within the node? Thanks a lot. ...
user avatar
0 votes
1 answer
2 views

Callback never called on c++

Hi! I have a little project on C++. When it was very simple (take frame from Kinect, convert to cv::Mat and show it in window), everything works well. Some days ago I add classificator and after it, ...
user avatar
0 votes
1 answer
8 views

Subscribe to a topic using an overloaded callback function

I get a compilation error when trying to subscribe to a ROS topic using an overloaded callback function. Look like the compiler doesn't know what function to pick. Is there any way to solve it? At ...
user avatar