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

ed's profile - activity

2022-11-15 02:24:25 -0500 received badge  Necromancer (source)
2022-11-15 02:24:25 -0500 received badge  Self-Learner (source)
2022-11-15 02:24:23 -0500 received badge  Student (source)
2022-06-09 08:07:40 -0500 received badge  Famous Question (source)
2022-03-23 10:44:26 -0500 received badge  Notable Question (source)
2022-02-04 21:23:54 -0500 commented answer ROS2 accessing command line argument values in launch.py files

I just saw this package simple_lunch https://index.ros.org/p/simple_launch/ which seems to handle some of the things I w

2022-02-04 21:23:54 -0500 received badge  Commentator
2022-02-04 21:19:46 -0500 received badge  Popular Question (source)
2022-01-30 15:28:28 -0500 marked best answer ROS2 accessing command line argument values in launch.py files

using ROS2 Foxy

I have really been struggling how to do 2 seemly simply thing with a launch file. By launch file I mean launch.py not xml.

The 2 things I am trying to do are: 1 pass a command line argument the controls whether to launch a node or not. Recently I found 2 ways to do that see below. 2 pass in the name of a specific config file or world (the file name only not the full path) and have the launch file append the current package config or world folder and pass it on to a node as a parameter or argument

Maybe I am missing something and to help someone else I am including my understand of a launch.py. For ROS1 there were clear tutorials for this but I could find any for ROS2.

My understanding of how this works

First imports

import os ---import this so you can use os.path.join( function

from launch.actions import IncludeLaunchDescription --- import this if you want to include another launch.py file using IncludeLaunchDescription( function

from launch.conditions import IfCondition -- import this to conditional launch a node (only discovered this yesterday and answers my #1)) use on this function condition=IfCondition(LaunchConfiguration('use_rviz')) on a Node( statement

from ament_index_python.packages import get_package_share_directory -- allows pkg_gazebo_ros = get_package_share_directory('gazebo_ros') to get share folder so that you could then use os.path.join to point to the config or world folder

from launch import LaunchDescription -- required

from launch.actions import DeclareLaunchArgument --- needed to declare command line arguments

from launch.substitutions import LaunchConfiguration --- I think this is a way to access the argument??

from launch_ros.actions import Node -- required to use Node statement

Second functions

After you have the imports you need this line def generate_launch_description():

You also need return LaunchDescription([ alistofnodes ])

How to declare arguments

in order for commandline argument to work you need to use DeclareLaunchArgument.

DeclareLaunchArgument( 'use_rviz', default_value='false', description='Use rviz if true'),

Does this have to happen inside the LaunchDescription( function? If so that seem too late. I would think these are like variable declarations and you would want them well before the LaunchDescription( which is typically the last section.

How to access those values I think you use LaunchConfiguration use_rviz = LaunchConfiguration('use_rviz') But this actual returns a LaunchConfiguration object not the value see below

How to launch a node

apparently there are several options you can use Node()

Node( package='rviz2', executable='rviz2', name='rviz2', argument=[], paramters=[] output='screen')

there is ExecuteProcess( also

OpaqueFunction

This is a function that can bee called inside LaunchDescription( that calls a function you write. It can access argument by using LaunchConfiguration('use_rviz').perform(context). You can then use an if statement to build nodes and then return those nodes

Is my understanding correct? Does anyone see anything wrong with my statements above?

Now for the 2 things I am trying to do.

Conditionally create nodes based on command line argument. I figures out 2 ways to do this ... (more)

2022-01-30 15:27:57 -0500 answered a question ROS2 accessing command line argument values in launch.py files

Based on reviewing some other questions/messages I am using the opaquefunction.

2022-01-23 15:01:32 -0500 asked a question ROS2 accessing command line argument values in launch.py files

ROS2 accessing command line argument values in launch.py files using ROS2 Foxy I have really been struggling how to do

2021-04-24 02:50:46 -0500 received badge  Famous Question (source)
2021-04-11 14:14:33 -0500 answered a question print agruments in ROS 2 foxy launch files

ok Here I am again answering my own questions. I never did figure out how to print out the arguments inside a launchfile

2021-03-30 21:04:40 -0500 received badge  Notable Question (source)
2021-02-23 21:14:11 -0500 answered a question ros2 foxy setting parameters from a YAML file in a launch file

out of the launch turltebot3\turtlebot3_navigation2\launch\navigation.launch.py They create a launch configuration like

2021-02-20 19:47:21 -0500 answered a question Send goal waypoints to /FollowWaypoints as a yaml file?

you need to write a node to read to yaml send the waypoints. There were several packages that do that in ros1

2021-02-20 19:09:38 -0500 answered a question Turtlebot3 simulation on ROS2 Foxy, Ubuntu 20.4.1

I also am struggling with simulation using tburger i have found you need to set the 2nd position estimate as soon as yo

2021-02-17 19:15:09 -0500 received badge  Popular Question (source)
2021-02-14 16:43:58 -0500 asked a question print agruments in ROS 2 foxy launch files

print agruments in ROS 2 foxy launch files I am having issues with running navigation on simulating turtlebot3 through a

2021-01-01 10:29:12 -0500 answered a question LDS-01 Stopped working after installing Ros2

I think something is wrong with the lidar itself. I suspect it may be the wires rotate. I replaced the lidar with a rpli

2021-01-01 10:17:06 -0500 received badge  Famous Question (source)
2020-11-26 14:23:46 -0500 commented question How can I visualize a map on rviz2? (ros2 eloquent)

Stevemacenski, Thanks for pointing to a very generic article about QoS that was so generic to be not very helpful. and t

2020-10-07 23:40:17 -0500 received badge  Notable Question (source)
2020-10-07 23:40:17 -0500 received badge  Popular Question (source)
2020-08-26 18:55:06 -0500 received badge  Necromancer (source)
2020-08-22 17:07:50 -0500 received badge  Notable Question (source)
2020-08-05 16:08:44 -0500 received badge  Popular Question (source)
2020-08-02 22:10:15 -0500 asked a question LDS-01 Stopped working after installing Ros2

LDS-01 Stopped working after installing Ros2 I have had a turtlebot 3 for over a year. It was running ok. I decided to u

2020-01-02 22:08:06 -0500 answered a question how to create a circular trajectory for turtlebot 3

Since you are using turtlebot3 I assume you have installed turtlebot3_simulations package. This package has turtlebot3_g

2020-01-02 21:43:39 -0500 commented question Which Mapping and Navigation package should I use for opened Envi.

The way I would tackle this is by setting waypoints. There are a few waypoint packages out there that will read waypoint

2020-01-02 21:26:35 -0500 asked a question Start position in rviz off when using gazebo

Start position in rviz off when using gazebo I am trying to compare dwa_local_planner, base_local_planner, and teb_local

2020-01-02 21:17:06 -0500 commented question How to run turtlebot3_autorace

do you have the CV stuff working right? it has to recognize the image. I tried it in melodic but the cv library it uses

2019-12-19 19:44:00 -0500 answered a question Local planner behaves unordinary

I ran across you question because regardless of what I put in for min_vel_theta and min_vel_trans it always gets reset t

2019-12-19 11:32:39 -0500 answered a question Can a costmap's inscribed_radius and circumscribed_radius be set from the parameter server?

From my examination of the code move_base does grab local_costmap/inscribed_radius however as far as I can tell it is no

2019-12-07 08:53:41 -0500 answered a question How does DWA works in relation to global planner?

I am also trying to sort out how this is working because I am having issues with it. But to answer your questions specif

2019-12-04 02:43:25 -0500 marked best answer local costmap window slowly drifts over static global map

I recently purchased turtlebot3 burger. I am running kinetic. I created a map using gmapping and explorer_lite. Next I started navigation. In rviz I set a goal 1 meter behind and in a rotated 90 degrees to the right. The robot starts to move backwards which it does not do well. It starts to buck up and down. The robot then stopped but the local costmap slowly consistently drifted backwards. This is the 2nd time I saw this happen. The first time it was a smaller map. in both instances the robot was stopped. Eventually I get a errors about DWA planner failed to produce a path and scans being out of bounds. The scans shown in the cost map still look look correct for the location of the robot. It just does not match the static map. Any ideas?

2019-12-04 01:24:51 -0500 received badge  Necromancer (source)
2019-12-04 01:24:51 -0500 received badge  Self-Learner (source)
2019-12-04 01:24:51 -0500 received badge  Teacher (source)
2019-12-03 19:47:36 -0500 answered a question local costmap window slowly drifts over static global map

As mgruhler said to opencr stops sending cmd_vels to the motors but the raspberry pi is still up and publishing the odom

2019-12-03 19:27:02 -0500 commented question Costmap plan error using frontier_exploration with DWA planner

What are you expecting the square to look like. Doesn't the black represent unexplored space? I am getting the same fir

2019-11-27 19:40:14 -0500 commented question Local planner not correct

I also saw Parameter max_trans_vel is deprecated (and will not load properly). Use max_vel_trans instead. when my yaml

2019-11-27 18:54:35 -0500 commented question Local planner not correct

I also have changed values in the local planner yaml and the changes appear to be ignored. sim_time, max and min speeds.

2019-09-24 01:41:13 -0500 received badge  Famous Question (source)
2019-04-16 08:37:51 -0500 received badge  Notable Question (source)
2019-03-26 07:15:02 -0500 received badge  Popular Question (source)
2019-03-16 10:53:43 -0500 commented question local costmap window slowly drifts over static global map

Sorry I do not have a way to record. This is definitely only happens when the turtle3 burger battery gets low. I here a

2019-02-03 16:58:40 -0500 received badge  Enthusiast
2019-02-02 09:09:35 -0500 commented question local costmap window slowly drifts over static global map

I retried with a bag recording but of course is did not happen. It might be tied when the battery getting low.I will up