Questions tagged [callback]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
34 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
38 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
29 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
0 votes
0 answers
18 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
210 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
29 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
70 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
33 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
207 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
0 answers
96 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
  • 31
0 votes
0 answers
93 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
30 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
9 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
7 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
16 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
4 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
20 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
14 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
3 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
49 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
4 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
3 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
2 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
15 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
6 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
3 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
149 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
9 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
3 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
47 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
4 views

ROS1 Subscriber callback

I have a simple class as follows: ...
user avatar
0 votes
1 answer
13 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
1 view

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
37 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
20 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
2 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
8 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
3 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
16 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
1 view

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
7 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
0 votes
1 answer
7 views

if condition for approximate time subscriber

In my current code I subscribe to two topics using the Approximate time policy and suppose the callback is called callbackTwoTopics. Now there's this third that ...
user avatar
0 votes
1 answer
1 view

How to get publisher and callback to talk to one another (python)

Hello, I am trying to get my code (python)to publish a simple sequence in form of a Twist message, and then get the timestamp of when those messages are executed with the callback function. This is ...
user avatar
0 votes
1 answer
1 view

hokuyo subscriber callback delay?

Hi! I am trying to subscribe to a laser scan of the hokuyo_node. (UTM-30LX) I have checked that the rostopic(/scan) satisfied 40Hz. $rostopic hz /scan However, msg(/scan) callback is not satisfied ...
user avatar
0 votes
2 answers
2 views

Cannot save data Callback function

What I am really looking for is a way to save all value's message that a node receives (in a list, CSV file..) in a way that I can later do something with this values. So this is data received : I ...
user avatar
0 votes
1 answer
24 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
1 answer
5 views

Executing two callbacks of two subscribers parallelly. How?

If one sub1.callback is on execution and meanwhile msg arrives on other sub2. I want to process sub2.callback parallely. Is it possible? How? ...
user avatar
0 votes
2 answers
7 views

Gazebo segfaults when Lidar senses an obstacle

I am using Ros Kinetic on Ubuntu 16.04. I am trying to simulate a quadrotor with lidar attached to it. I have found the Rotors_Simulator repository and manually added a Hokuyo lidar for simulation in ...
user avatar
0 votes
1 answer
2 views

Subscribing multiple topics with different rate

Hey there, I´m currently new at ROS but made yet all the beginner tutorials at the ROS homepage. First I implemented a simple publisher and subscriber and it worked. Now I want to create something ...
user avatar
0 votes
1 answer
7 views

subscribe to callback which takes arguments and transport hints

Hi all, I'm subscribing to a callback which takes arguments by using the boost::bind structure: ...
user avatar

1
2 3 4 5