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

bvaningen's profile - activity

2023-07-24 03:02:13 -0500 commented answer [ROS2] Best Practices: /rosout versus /diagnostics

on the diagnostics side: are those nodes only hardware nodes as the ROS wiki suggests ? on the rosout side: we have gon

2023-07-24 02:58:52 -0500 marked best answer [ROS2] Best Practices: /rosout versus /diagnostics

I want to monitor the status of my different ROS2 nodes and act accordingly if something happens. Some of these nodes are hardware drivers, while others are not, working on things such as image processing, data upload, etc.

One way of monitoring the status is to subscribe to /rosout and filter messages on severity, and filtering further on message string if needed. This filtering then determines how the system responds.

Another approach that i am entertaining is to use the diagnostics system to monitor status.

From the ROS wiki I quote:

The diagnostics system is designed to collect information from hardware drivers and robot hardware to users and operators for analysis, troubleshooting, and logging.

Furthermore when looking at the message definition that both use, DiagnosticStatus and Log, their definitions seem very similar.

Considering the above information, I find it difficult to determine which to use. This has lead to two questions:

  1. Do I use /diagnostics only for hardware drivers as suggested and subscribe to /rosout for the rest?

  2. Is it bad practice to subscribe to /rosout for status monitoring?
    from q33503, it states that subscribing to /rosout

    might lead to many socket connections to all the nodes running on your system.

    However I wonder if this is still the case with the DDS system that ROS2 uses .

2023-07-20 00:54:30 -0500 marked best answer waitForMessage ROS2 equivalent?

In ROS1 there was the useful function ros::topic::waitForMessage(..). Is there an equivalent for ROS2 yet?

I have found the following question from a while ago: https://answers.ros.org/question/3073...

but maybe there is an easier solution available now.

2023-07-05 06:31:59 -0500 received badge  Good Question (source)
2023-05-16 17:57:00 -0500 received badge  Nice Question (source)
2023-05-16 12:44:27 -0500 received badge  Famous Question (source)
2023-02-16 16:12:04 -0500 received badge  Self-Learner (source)
2023-02-14 07:25:31 -0500 received badge  Nice Question (source)
2023-02-08 03:41:11 -0500 received badge  Nice Question (source)
2022-10-04 10:06:30 -0500 received badge  Popular Question (source)
2022-10-04 10:06:30 -0500 received badge  Notable Question (source)
2022-09-19 17:51:34 -0500 marked best answer Inverse Dynamic library implementation in ROS?

I want to use Inverse Dynamics to implement a hybrid Torque/Position on an exoskeleton. My intitial plan is to use a detailed URDF of my robot and then a software tool that can take it and solve for the torque that needs to be generated by a joint to follow the path. The system will have to run on ubuntu 16.04.5 LTS with ROS kinetic

I found a large list of different solvers that can be used, found here

I have focussed my search on the following four solvers:

  • Open Dynamic Engine
  • DART
  • Pybullet
  • Rigid Body Dynamics Library

It seems that all of these methods do pretty much the same thing. Which of the inverse dynamics solver is best supported by ROS? What solver is generally used by ROS users? What are important aspects to take into account when choosing a solver?

2022-08-17 05:06:48 -0500 commented question How can I make ROS2 launch quit on node crash?

have you been able to find an answer to your question?

2022-02-17 09:44:28 -0500 commented answer Select topics with search pattern (regex) in rosbag2

To get this to work in a python launch file for ROS2 Foxy use the following: launch.actions.ExecuteProcess(

2022-02-16 09:37:16 -0500 commented answer Select topics with search pattern (regex) in rosbag2

how would I get this to work in a python launch file ?

2022-01-30 08:03:27 -0500 received badge  Famous Question (source)
2022-01-27 08:56:15 -0500 marked best answer [ROS2] Best practice for catching all exceptions for logging

I am creating a robot with ROS2 foxy that is in the field, and therefore not monitored all the time.
To help with debugging any eventual bugs/crashes that are unaccounted for, I was thinking of logging any tracebacks that occur. There are two approaches that I am considering:

Catch and except rclpy.spin

original post code

import rclpy
import traceback
from .example_node import NodeClass

def main(args=None):
    rclpy.init(args=args)

    node_class = NodeClass()

    try:
        rclpy.spin(node_class)
    except Exception:
        node_class.get_logger().error(traceback.format_exc())
    finally:
        # Destroy the node explicitly
        # (optional - otherwise it will be done automatically
        # when the garbage collector destroys the node object)
        node_class.destroy_node()
        rclpy.shutdown()

update post code after @Geoff comment

import rclpy
import traceback
from .example_node import NodeClass

def main(args=None):
    rclpy.init(args=args)
    traceback_logger = rclpy.logging.get_logger('node_class_traceback_logger')

    try:
        node_class = NodeClass()
        rclpy.spin(node_class)
    except Exception as exception:  
        traceback_logger.error(traceback.format_exc())
        raise exception

    finally:
        # Destroy the node explicitly
        # (optional - otherwise it will be done automatically
        # when the garbage collector destroys the node object)
        node_class.destroy_node()
        rclpy.shutdown()

Create a custom logger in launch file

from the example launch found here, a custom event handler can be created. This could potentially catch tracebacks.

# Setup a custom event handler for all stdout/stderr from processes.
# Later, this will be a configurable, but always present, extension to the LaunchService.
def on_output(event: launch.Event) -> None:
    for line in event.text.decode().splitlines():
        print('[{}] {}'.format(
            cast(launch.events.process.ProcessIO, event).process_name, line))

ld.add_action(launch.actions.RegisterEventHandler(launch.event_handlers.OnProcessIO(
    # this is the action     ^              and this, the event handler ^
    on_stdout=on_output,
    on_stderr=on_output,
)))

Which of these would be considered better practice? Or is there a better approach builtin ROS2?

Thanks in advance!

2022-01-27 08:56:03 -0500 answered a question [ROS2] Best practice for catching all exceptions for logging

After some time I think that my current approach is best, which I will explain here for anyone who else may need it! on

2022-01-27 05:28:28 -0500 received badge  Famous Question (source)
2022-01-14 16:19:09 -0500 received badge  Notable Question (source)
2022-01-14 14:02:41 -0500 received badge  Popular Question (source)
2022-01-13 07:56:59 -0500 edited question [ROS2] How to get multiple nodes under same namespace in yaml config file?

[ROS2] How to get multiple nodes under same namespace in yaml config file? Hello, I have a config yaml that looks as fo

2022-01-13 07:42:25 -0500 asked a question [ROS2] How to get multiple nodes under same namespace in yaml config file?

[ROS2] How to get multiple nodes under same namespace in yaml config file? Hello, I have a config yaml that looks as fo

2021-12-13 15:38:47 -0500 received badge  Notable Question (source)
2021-12-13 15:38:47 -0500 received badge  Famous Question (source)
2021-11-29 05:23:36 -0500 edited question [ROS2] Best Practices: /rosout versus /diagnostics

[ROS2] Best Practices: /rosout versus /diagnostics I want to monitor the status of my different ROS2 nodes and act accor

2021-11-29 05:20:32 -0500 asked a question [ROS2] Best Practices: /rosout versus /diagnostics

[ROS2] Best Practices: /rosout versus /diagnostics I want to monitor the status of my different ROS2 nodes and act accor

2021-11-10 17:06:49 -0500 received badge  Notable Question (source)
2021-11-10 04:57:40 -0500 received badge  Necromancer (source)
2021-11-10 04:38:23 -0500 answered a question VSCode debug/launch ROS2 node, preLaunchTask does not source the environment

My solution for this is to open a terminal, source the setup as normal (. install/setup.bash), and then run vscode throu

2021-11-10 04:36:00 -0500 commented answer VSCode debug/launch ROS2 node, preLaunchTask does not source the environment

this is not a useful answer. I understand that you may have the same problem, so you can either comment on the post or u

2021-11-10 04:33:10 -0500 commented answer [ROS2] Best practice for catching all exceptions for logging

good point! I have updated the original post with an updated version of the code that uses a separate logger. In a more

2021-11-10 04:20:51 -0500 edited question [ROS2] Best practice for catching all exceptions for logging

[ROS2] Best practice for catching all exceptions for logging I am creating a robot with ROS2 foxy that is in the field,

2021-11-10 04:18:26 -0500 edited question [ROS2] Best practice for catching all exceptions for logging

[ROS2] Best practice for catching all exceptions for logging I am creating a robot with ROS2 foxy that is in the field,

2021-11-09 03:30:25 -0500 received badge  Popular Question (source)
2021-11-08 10:43:41 -0500 asked a question [ROS2] Best practice for catching all exceptions for logging

[ROS2] Best practice for catching all exceptions for logging I am creating a robot with ROS2 foxy that is in the field,

2021-08-04 03:46:41 -0500 received badge  Nice Answer (source)
2021-07-20 10:50:34 -0500 received badge  Famous Question (source)
2021-06-28 08:30:22 -0500 received badge  Famous Question (source)
2021-06-24 10:07:18 -0500 commented question Best practice installing custom dependencies for ROS2?

the issue can be found here: https://github.com/ros-infrastructure/rosdep/issues/819

2021-06-24 06:43:07 -0500 commented question Best practice installing custom dependencies for ROS2?

alright, i will add it to the issue tracker of rosdep and see if I have time for the PR! Thanks for the help so far!

2021-06-23 03:55:56 -0500 commented answer Best practice installing custom dependencies for ROS2?

alright, changed my answer to reflect this

2021-06-23 03:55:56 -0500 received badge  Commentator
2021-06-23 03:55:18 -0500 edited answer Best practice installing custom dependencies for ROS2?

so I think that I have found the way by looking closely at q295471 and deducing some key commands that were missing. I a

2021-06-23 03:46:18 -0500 commented question Best practice installing custom dependencies for ROS2?

I did as you said and can confirm your hypothesis: It could be the full URL is considered the name of the package, w

2021-06-23 03:43:11 -0500 commented question Best practice installing custom dependencies for ROS2?

I did as you said and can confirm your hypothesis: It could be the full URL is considered the name of the package, w

2021-06-23 03:42:49 -0500 commented question Best practice installing custom dependencies for ROS2?

I did as you said and can confirm your hypothesis: It could be the full URL is considered the name of the package, w