Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [callback]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
44 views

Arguments in ROS2 callback function

I want to create subscribers from a topic list, and therefor have to use a common callback I found the Lambda example for creating a common callback, but the issue is that the argument that ends up ...
Viktor T's user avatar
0 votes
2 answers
29 views

Multiple subscriptions in a single callback

I want to do parallel process of multiple subscriptions in a single callback. I have been looking for information, but there is barely any information regarding this in ROS 2 Humble. I found callback ...
paul's user avatar
  • 1
1 vote
1 answer
54 views

How to add an additional argument in a ROS2 cpp callback

I want to add an additional argument in a callback function for rclcpp, e.g. callback(msg, additional_argument). I can do it in ...
gab's user avatar
  • 113
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
1 answer
257 views

How to wait for an action to be complete inside a callback?

I'm controlling a mobile robot and I'd like to set up an action (call it back_and_forth) that commands the robot to move forward 1 meter, then move backwards one meter. The interface that I'm using (...
Carter Sifferman's user avatar
0 votes
0 answers
20 views

When will subscriber status callbacks be available in ROS2?

What are the plans for implementing rclcpp subscriber status callbacks (connect/disconnect) in ROS2? I found this ROS1 feature quite handy. Note that this question has been asked before but since that ...
Bernd Pfrommer's user avatar
1 vote
0 answers
82 views

Read topic message from subscription without executing callback

"Reading data from subscription without executing callback" is considered to be one of the common use cases of ROS 2. However, I wonder why there is less description about this use case in ...
takamine's user avatar
0 votes
1 answer
246 views

what is executors, and callbackgroup in ROS2?

I am learning ROS2 Humble and would like to learn more about executors, and callbackgroup. my first question is: "What if we use basic spin and executor? How would it affect things?" example ...
Hem92j's user avatar
  • 86
0 votes
1 answer
273 views

How to get a topic name in a callback function (Python, Ros2)

I have two cameras subscribing camera1/image_raw and camera2/image_raw respectively. And both subscribers call image_callback when they received any topic. I want to show camera1 image in window1 and ...
suhjw2762's user avatar
0 votes
0 answers
63 views

While loop is blocking callback function

My goal is to stop while loop if return value from callback function ui_listener_callback will return False (stop) value ...
reinzler's user avatar
0 votes
2 answers
74 views

Where is the preffered position to put a simple control loop in a ROS2 Node (C++) for obstacle avoidance

I am working on a turtlebot simulation with ROS2, and I would like the robot to stop when it hits a wall. Where is the proper place to implement simple logic (for example, if distance < 10 then ...
p1unge's user avatar
  • 3
0 votes
1 answer
55 views

Trouble with creating an image_transport nodelet

I'm working in ROS noetic on ubuntu 20.04 I'm pretty new to the concepts of nodelets but I felt I needed them to more efficiently go through a process of taking uncompressed images and then ...
GShim23's user avatar
  • 23
0 votes
0 answers
22 views

Issues with asynchronously handling a Subscriber callback

I am trying to create a listener that sends a message through a Discord webhook to my Discord server. The issue that I am encountering at the moment is that I do not know how to create an asynchronous ...
Pogo's user avatar
  • 1
0 votes
1 answer
1k views

Actions in Humble: Cancel action in action client

for learning purposes I'm trying to play around with the tutorial (rclpy) for writing an action server + client. So, my action server is providing me with a fibonacci sequence up to n items and ...
robin_rob96's user avatar
0 votes
1 answer
67 views

Is it bad practice to declare the node as a global variable to call a service from an external callback?

I want to call a service SendError from a registered callback from an external library. The only way I see I can do this is by having the node declared as a global ...
Adria Subirana Perez's user avatar
1 vote
0 answers
189 views

ROS2 Humble service call within a timer callback

I have a system in which there are 2 component nodes in a single process. Both of them have a dedicated single-threaded executor (2 separate node containers). The first node needs to make a service ...
Vladimir Kostic's user avatar
0 votes
0 answers
62 views

How to handle cascaded service calls in ROS2 node integration tests with gtest (C++)

I want to write some integration tests for my ROS2 node (Humble) that provides an service which in turn calls a service. While during runtime this works perfectly fine, when I try to create a unit ...
Tijs van der Smagt's user avatar
0 votes
3 answers
668 views

Whats the common way to setup a websocket client in ROS2 robot?

Design Concept Questions As stated in the title, I am working on a robot that required to send out it state information (safety and monitoring purpose) to a remote backend server. Meanwhile, maintain ...
tcluk624's user avatar
1 vote
1 answer
266 views

If i use a lambda function when creating a subscription, when it will be evaluated?

I use a lambda function to add a parameter to my callback function, but this new parameter does not have the value expected. Here a code to reproduce my pb: ...
SebL's user avatar
  • 51
0 votes
1 answer
260 views

ROS2 node unable to receive new service calls after first call

I'm currently working on a node that has a service that calls other services within that service. Something like this: Node A: Service A Calls service B of Node B waits for service B to complete (...
Eric's user avatar
  • 1
0 votes
1 answer
105 views

Ros2, undefined reference to `message_filters::Connection::disconnect()

Hello, I am trying to build a node that subscribes to two topics using message_filters::Synchronizer with approximate policy. Here is the relevant part of my code: ...
user avatar
0 votes
1 answer
56 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
1 answer
24 views

Subscriber callback function with additional arguments using ShapeShifter

Hello everyone, I have multiple subscribers that share the same callback function. Since they subscribe to different previously unknown topics, I am using the ShapeShifter class. This is how one of ...
user avatar
0 votes
1 answer
49 views

Callback function is executed more than one time

I'm learning multithreaded-spinning on the website. I'm confused why the second callback function is invoked two times after the previous callback is stuck for a few seconds. In my understanding, each ...
user avatar
0 votes
1 answer
10 views

ROS Action with no Subscriber

Iam creating an action server and the process is just rotating turtlesim depending on how many times the goal is set to. As far as I researched, the sample codes for ROS Action have their main ...
user avatar
0 votes
1 answer
68 views

Dynamically create subcription callback functions (Python)

Hello, I am trying to generalize one of my nodes to subscribe to not just a different set of topics, but a different number of topics, depending on the situation. Specifically I want it to republish ...
user avatar
0 votes
1 answer
54 views

Dynamic publishers, subscribers and callbacks

I am trying to create a multi-robot system (MRS), where multiple robots are communicating with each other over ROS2, Galactic, Ubuntu 20.04. Currently, I'm only running this in simulation, but I have ...
user avatar
0 votes
1 answer
15 views

Run a launch script in subscriber callback

I want to spawn a robot B when robot A pass certain location. Currently, my implementation is having a subscriber subscribe to odom of robot A. When robot A odom msg.pose.pose.position>1, run the ...
user avatar
0 votes
1 answer
303 views

Wait for subscriber callback to receive message - best practice

Hello, I am wondering what is the best practice in python to wait for a subscribed topic to start publishing, before using its messages in the spin method. An simplified example of what I am doing ...
user avatar
0 votes
1 answer
6 views

Subscriber providing condition for another subscriber to subscribe a topic

I'm trying to generate a node which subscribes 2 topics and uses one topic as a condition to subscribe another topic: ...
user avatar
0 votes
1 answer
17 views

The parameter arrangement of a simple done callback function for an action client

What is really the difference between this: ...
user avatar
0 votes
1 answer
3 views

MessageFilter ApproximateTime doesn't call callback function

Hello, I'm trying to implement MessageFilter in a class. I'm using ROS1 Melodic on Ubuntu 18.04. The code compiles without any errors but when I play my bag file, the callback function aren't called. ...
Mehmet Emin's user avatar
0 votes
1 answer
22 views

Pointcloud2 vs PointCloud2Ptr

Hi, the message i am subscribing to from a topic is PointCloud2, whereas my subscriber callback routine looks like this ...
user avatar
0 votes
1 answer
28 views

How to use move_base Action API with a navigation goals subscriber

I try to get the navigation goal points from a subscriber that identifies them through lidar. In particular I use the lidar to get the corners of a wall and my aim is to navigate close to the corner. ...
user avatar
0 votes
1 answer
11 views

std_msgs::string compare in a callback cpp node

Hi all, I'm trying to create a node with rosserial on Arduino. It should publish some sensor information and acts when I publish a command through a command topic. I wrote a cpp node with a callback ...
Iftahnaf's user avatar
0 votes
2 answers
622 views

Create wall timer using callback with parameters - ROS2, C++

Hi. I have two image msg synchronized as follows: ...
user avatar
0 votes
2 answers
20 views

publish after processing data from 2 synced subscribers (rospy)

I want to make one node to subscribe 2 topics synchronously, process those data, and publish it. I know that publishing and subscribing data with single node is possible, but have never seen any ...
user avatar
0 votes
1 answer
7 views

does ROS support callback-on-subscription?

My basic problem is that there is a chain of nodes all doing heavy computational work and all publishing the results to lots of intermediate topics. At any one time, only a small number of the final ...
user avatar
0 votes
1 answer
400 views

ROS2/create_subscription: How to pass callback arguments

In ROS 1, I was able to pass arguments to the callback function of a subscriber: rospy.Subscriber(topic_name, type, call_back, call_back_arg) How can I do this in ROS2? My goal is to pass the name of ...
user avatar
0 votes
1 answer
5 views

ROS1 Subscriber callback

I have a simple class as follows: ...
user avatar
0 votes
1 answer
72 views

Subscriber callback not triggering while in a while loop

Hi, I would like to create a subscriber that uses the callback to get the data, but that is also able to do things with that data in the main loop (where the node is declared). Here is a simple ...
user avatar
0 votes
1 answer
5 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
2 answers
105 views

ROS2 Python: Add arguments to callback

Hi. I am using Python and ROS2 and I want to create two action clients: One for opening a gripper and one for closing it. The goal_response_callback is completely similar for both, and the result ...
user avatar
0 votes
1 answer
104 views

ROS2 QoS callback function

Hi everyone, First of all, I just learned about ROS2 so I am not so familiar with it. Also, I apologize for my bad English. I am now working on how to implement QoS in my subscription. I have a little ...
user avatar
0 votes
1 answer
8 views

ROS2 Subscription Callback not called with GAZEBO

Hello, I am having a problem on my first ROS2 node. I setup the turtlebot3 packages using this link (only Remote PC since I don't have a robot). Started the GAZEBO simulation using these instructions. ...
user avatar
0 votes
1 answer
20 views

How to use data from a callback function in another function

I'm trying to take the x, y, and yaw value from the callback function and use them in a different function. Although when I run the code I have below, all the variables below return a value of 0. ...
user avatar
0 votes
1 answer
4 views

subscriber callback in a python class is overwriting the class variables with the most recent data before the first callback processing finishes

I am on ROS Melodic. When a subscriber is receiving data at a faster rate than it could process, the class variables are being updated before the callback process is finished. For example, when I run ...
user avatar
0 votes
1 answer
32 views

How to subscribe to multiple topic that has no header or how to add header into topics?

ROS Kinetic Ubuntu 16.04 Python 3.5.2 I am trying to use following script to subscribe to 2 topics and combining their data into a json file. ...
user avatar
0 votes
2 answers
6 views

callback function doesnt printout the subscribe msg

hello guys iam new at ROS and iam trying to print the msg and some how it doesnt print it and i cant find where is the problem this is my code ...
user avatar
0 votes
1 answer
23 views

The problem about the double messages read from a rosbag file

I want to write the time stamps of rosbag in a .txt document. There, I use two kinds of methods to do that: Reference of C++ API link text. Use the callback fuction to subscribe the topics from the ...
user avatar

1
2 3 4 5 6