Ask Your Question

ROS2 equivalents to ROS1 roscd, rosmsg rossrv...

asked 2020-08-03 11:00:08 -0500

screen33 gravatar image

updated 2020-08-03 11:20:37 -0500

Are there equivalent commands for roscd, rosmsg and rossrv (especially for rosmsg show), rosed, rosls and rosmv?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2020-08-03 13:57:46 -0500

sloretz gravatar image

There are equivalents for some of them. In ROS 2 they're all under the ros2 command.

rosmsg / rossrv

The equivalent to rosmsg/rossrv is ros2 interface.

$ rosmsg show std_msgs/Bool
bool data

ROS 2 equivalent

$ ros2 interface show std_msgs/msg/Bool
bool data

and for services

$ rossrv show std_srvs/Trigger
bool success
string message

ROS 2 equivalent

$ ros2 interface show std_srvs/srv/Trigger
bool success   # indicate successful run of triggered service
string message # informational, e.g. for error messages

And ros2 interface also works with actions

$ ros2 interface show test_msgs/action/Fibonacci
#goal definition
int32 order
#result definition
int32[] sequence
int32[] sequence

rosed / roscd / rosls

In ROS 1 I think these were provided by rosbash:

$ rosls std_msgs
cmake  msg  package.xml

There's nothing equivalent in ROS 2 that I know of. Maybe you could make a bash alias around ros2 pkg prefix?

$ ls `ros2 pkg prefix --share std_msgs`
cmake  environment  local_setup.bash  local_setup.dsv  local_setup.zsh  msg  package.dsv  package.xml

Here's a brief intro to the command line tools.

If you'd like to contribute to them, most of the source code is in the ros2clirepo: . Some tools are in other repos; for example ros2 launchis in the ros2/launch_ros repo:

edit flag offensive delete link more


Yes alias ros2cd="ros2 pkg prefix" works but is not as handy as the original roscd: Autocompletion does not work and ros2cd alone either. Since we're in a Python subprocess, it can't work the same. Maybe opening a subshell? Not sure that would be nice though.

screen33 gravatar image screen33  ( 2020-08-05 19:54:35 -0500 )edit

ros2 pkg prefix <tab> does provide completion of all available package names. For a custom alias you will need to register the completion function yourself.

Dirk Thomas gravatar image Dirk Thomas  ( 2020-08-05 22:55:55 -0500 )edit

answered 2020-08-03 14:10:03 -0500

Dirk Thomas gravatar image

updated 2020-08-05 22:53:52 -0500

An equivalent to roscd is provided by colcon-cd- see

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2020-08-03 11:00:08 -0500

Seen: 283 times

Last updated: Aug 05 '20