ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

nzlz's profile - activity

2022-04-01 11:50:30 -0500 received badge  Taxonomist
2020-04-26 09:12:59 -0500 received badge  Famous Question (source)
2019-08-19 04:19:03 -0500 received badge  Famous Question (source)
2019-08-19 04:19:03 -0500 received badge  Notable Question (source)
2019-04-26 08:53:27 -0500 received badge  Famous Question (source)
2019-04-25 10:24:36 -0500 received badge  Popular Question (source)
2019-04-17 22:31:21 -0500 commented question ROS2 Nodes occasionally dying using LaunchService in a subprocess

Yes, the process contains the node that is crashing, which usually is hros_congnition_mara_components. The node is launc

2019-04-17 22:30:52 -0500 commented question ROS2 Nodes occasionally dying using LaunchService in a subprocess

Yes, the process contains the node that is crashing, which usually is hros_congnition_mara_components. The node is launc

2019-04-15 05:40:19 -0500 asked a question ROS2 Nodes occasionally dying using LaunchService in a subprocess

ROS2 Nodes occasionally dying using LaunchService in a subprocess Hello Everyone, First of all, I am aware there is an

2019-04-10 21:14:34 -0500 marked best answer [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 using a simple while that loops until all callbacks have new values. Simplified code:

def __init__(self):
     rclpy.init(args=None)
     self.node = rclpy.create_node(self.__class__.__name__)
     self.sub1 = self.node.create_subscription( ... obs1)
     ...
     self.sub6 = self.node.create_subscription( ... obs6)

// callbacks
def obs1(self, message):
     self.obsJointStates[0] = message.position
...
def obs6(self, message):
     self.obsJointStates[5] = message.position

// This is the function that is called constantly in every new step (Reinforcement Learning)
def take_observation(self): 
    rclpy.spin_once(self.node)
    while None in self.obsJointStates:
        rclpy.spin_once(self.node)
    self.obsJointStates = np.array([None, None, None, None, None, None])

Inside take_observation function, the while loop waiting for complete callbacks can loop around 100 times currently. I believe there has to be a solution to get fast callbacks and not use this hacky code. Meaning one single call to spin_once() or whatever it is, should be enough.

Few things I tried with no success:

  1. Callback group
  2. Multithread executor
  3. Use timeout_sec in spin_once

Any idea which is the correct approach?

Thanks in advance,

Nestor

2019-04-10 21:14:34 -0500 received badge  Scholar (source)
2019-04-09 03:54:31 -0500 received badge  Notable Question (source)
2019-04-09 01:27:46 -0500 received badge  Commentator
2019-04-09 01:27:46 -0500 commented answer [ROS2] Correct usage of spin_once to receive multiple callbacks synchronized

Yes. However Im noticing the rclpy implementation of pub/sub is less stable than rclcpp, so this is turning to be a bigg

2019-04-08 21:59:51 -0500 commented answer [ROS2] Correct usage of spin_once to receive multiple callbacks synchronized

Thanks for the feedback William, I thought spin_until_future_complete was intended to be used in service calls, I will g

2019-04-08 21:59:13 -0500 commented answer [ROS2] Correct usage of spin_once to receive multiple callbacks synchronized

Thanks for the feedback William, I thought spin_until_future_complete was intended to be used in service calls, I will g

2019-04-08 18:31:20 -0500 received badge  Popular Question (source)
2019-04-06 06:05:28 -0500 asked a question [ROS2] Correct usage of spin_once to receive multiple callbacks synchronized

[ROS2] Correct usage of spin_once to receive multiple callbacks synchronized Hello everyone, I can't figure out which i

2019-02-22 09:22:58 -0500 received badge  Famous Question (source)
2019-02-19 10:56:15 -0500 received badge  Notable Question (source)
2019-01-11 18:20:58 -0500 received badge  Student (source)
2019-01-02 03:53:34 -0500 received badge  Famous Question (source)
2018-12-28 17:11:26 -0500 answered a question ROS 2 Crystal in 16.04 - failing

Ask Dirk-Thomas suggested, the failure of the source operation was related to some temporary env variable or bash profil

2018-12-28 17:07:11 -0500 commented answer ROS 2 Crystal in 16.04 - failing

Surely something happened with my bash profile. The source is working correctly after a simple reboot. Thanks!

2018-12-28 13:15:22 -0500 received badge  Notable Question (source)
2018-12-28 12:37:59 -0500 commented answer ROS 2 Crystal in 16.04 - failing

Default Linux bash.

2018-12-28 11:58:43 -0500 commented answer ROS 2 Crystal in 16.04 - failing

What I mean is, when I source the ros2 ws, I am getting some strange output. This is not the expected output. source ~/

2018-12-28 11:55:16 -0500 received badge  Popular Question (source)
2018-12-28 06:06:06 -0500 asked a question ROS 2 Crystal in 16.04 - failing

ROS 2 Crystal in 16.04 - failing Hi everyone, I am trying to install ros2 crystal from source in a clean Ubuntu 16.04 m

2018-12-21 02:52:54 -0500 received badge  Popular Question (source)
2018-12-21 02:27:31 -0500 edited question Errors running LaunchService unsing threading/multiprocessing.

Errors running LaunchService unsing threading/multiprocessing. Hi everyone, Im kind of replicating some examples (for i

2018-12-21 02:24:20 -0500 commented question Errors running LaunchService unsing threading/multiprocessing.

Thanks for your reply William, I am creating a new version of gym-gazebo that will use ROS2, info. I will update the ma

2018-12-20 10:30:54 -0500 asked a question Errors running LaunchService unsing threading/multiprocessing.

Errors running LaunchService unsing threading/multiprocessing. Hi everyone, Im kind of replicating some examples (for i

2018-12-14 09:25:03 -0500 received badge  Notable Question (source)
2018-12-14 05:53:55 -0500 received badge  Supporter (source)
2018-12-14 05:49:23 -0500 commented answer Cannot import module control_msgs

Hello Dirk, I submitted the issue but I got no answer. Since I have an old repo that I manage to build successfully, I

2018-12-14 05:46:14 -0500 edited question Cannot import module control_msgs

Cannot import module control_msgs Hi everyone, I am currently using ROS Crystal from source. I have a second workspace

2018-12-13 14:13:56 -0500 received badge  Popular Question (source)
2018-12-13 13:51:14 -0500 commented question Cannot import module control_msgs

2.7 and 3.6.7. But this must be an issue related to he control_msgs repo as @dirk-thomas has pointed.

2018-12-13 13:38:28 -0500 commented answer Cannot import module control_msgs

Okay, thanks!

2018-12-13 13:25:43 -0500 commented question Cannot import module control_msgs

not working with any, 2 or 3.

2018-12-13 11:12:24 -0500 asked a question Cannot import module control_msgs

Cannot import module control_msgs Hi everyone, I am currently using ROS Crystal from source. I have a second workspace

2017-01-19 12:30:40 -0500 received badge  Famous Question (source)
2016-10-18 16:45:07 -0500 received badge  Notable Question (source)
2016-09-20 06:28:18 -0500 received badge  Enthusiast
2016-09-13 10:12:58 -0500 received badge  Popular Question (source)
2016-09-12 01:51:20 -0500 asked a question Turtlebot spinning in place + not going straight when speeding up simulation

Hello, As I show in the videos above, the Turtlebot is spins around itself a bit, which could affect the direction when I try to go straight. When the real time factor (simulation speed) is normal the robot makes an acceptable straight line, but when the simulation is set to maximum the robot clearly turns to the right. This strange behaviour does not happen in empty worlds, just when the robot is inside a model. Any possible solution to this issue?

Nestor


Video1 - Spining around itself https://www.youtube.com/watch?v=LdImD...

Video 2 - Trying to go straight - in 0:40 normal speed is tested https://www.youtube.com/watch?v=ltf0e...

2016-07-04 06:36:59 -0500 edited answer error creating workspace/mavros error

Following these instructions shouldn't cause errors.

Make sure you copy the whole command here:

###Get rosinstall and some additional dependencies

sudo apt-get    install python-rosinstall          \
                        ros-indigo-octomap-msgs    \
                        ros-indigo-joy             \
                        ros-indigo-geodesy         \
                        ros-indigo-octomap-ros     \
                        ros-indigo-mavlink           \
                        ros-indigo-control-toolbox \
                        unzip

Regards,