Questions tagged [callback]
The callback tag has no usage guidance.
259
questions
0
votes
1
answer
20
views
ROS2-Same callback for multiple topics types
I would like to use the same callback for subscriptions to different topics with different types. I have searched on the internet and could not a wokring approach.
My idea was to templetize the ...
0
votes
0
answers
12
views
Understanding custom callback group implementation / why do I need a timer to implement time-based logic?
I'm trying to adjust this example for a throttled callback group: https://github.com/ros2/examples/blob/humble/rclpy/executors/examples_rclpy_executors/custom_callback_group.py
While adjusting the ...
0
votes
0
answers
15
views
Using message_lost_callbacks with wait sets
I have a lot of messages and have implemented a wait set subscriber based on the example found here: https://github.com/ros2/examples/blob/rolling/rclcpp/wait_set/src/wait_set.cpp.
For my subscription ...
0
votes
0
answers
15
views
How to assign array values in rosmsg result part of message in actionlib in Rospy (ROS 1 in python)
Good day all,
I'm trying to create an action server that sends three float64 vectors each containing the x, y and z coordinates of a point following this tutorial: https://www.youtube.com/watch?v=...
0
votes
0
answers
47
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 ...
0
votes
2
answers
52
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 ...
1
vote
1
answer
101
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 ...
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
2
answers
479
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 (...
0
votes
1
answer
28
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 ...
1
vote
0
answers
107
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 ...
0
votes
1
answer
378
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 ...
0
votes
1
answer
409
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 ...
0
votes
0
answers
68
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
...
0
votes
2
answers
83
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 ...
0
votes
1
answer
66
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 ...
0
votes
0
answers
24
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 ...
0
votes
1
answer
2k
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 ...
0
votes
1
answer
83
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 ...
1
vote
0
answers
251
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 ...
0
votes
3
answers
824
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 ...
1
vote
1
answer
306
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:
...
0
votes
1
answer
324
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 (...
0
votes
1
answer
134
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:
...
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
1
answer
31
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 ...
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 ...
0
votes
1
answer
11
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 ...
0
votes
1
answer
73
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 ...
0
votes
1
answer
63
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 ...
0
votes
1
answer
17
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 ...
0
votes
1
answer
410
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 ...
0
votes
1
answer
7
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:
...
0
votes
1
answer
22
views
The parameter arrangement of a simple done callback function for an action client
What is really the difference between this:
...
0
votes
1
answer
5
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. ...
0
votes
1
answer
23
views
Pointcloud2 vs PointCloud2Ptr
Hi, the message i am subscribing to from a topic is PointCloud2, whereas my subscriber callback routine looks like this
...
0
votes
1
answer
40
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.
...
0
votes
1
answer
15
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 ...
0
votes
2
answers
829
views
Create wall timer using callback with parameters - ROS2, C++
Hi. I have two image msg synchronized as follows:
...
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 ...
0
votes
1
answer
11
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 ...
0
votes
1
answer
536
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 ...
0
votes
1
answer
7
views
ROS1 Subscriber callback
I have a simple class as follows:
...
0
votes
1
answer
85
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 ...
0
votes
1
answer
7
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 ...
0
votes
2
answers
126
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 ...
0
votes
1
answer
131
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 ...
0
votes
1
answer
11
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. ...
0
votes
1
answer
27
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.
...
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 ...