1
$\begingroup$

Rosanswers logo

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


Originally posted by screen33 on ROS Answers with karma: 122 on 2020-08-03

Post score: 4

$\endgroup$

2 Answers 2

1
$\begingroup$

Rosanswers logo

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
---
#feedback
int32[] sequence

rosed / roscd / rosls

In ROS 1 I think these were provided by rosbash: http://wiki.ros.org/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.sh  local_setup.zsh  msg  package.dsv  package.xml

Here's a brief intro to the command line tools. https://index.ros.org/doc/ros2/Tutorials/Introspection-with-command-line-tools/

If you'd like to contribute to them, most of the source code is in the ros2cli repo: https://github.com/ros2/ros2cli . Some tools are in other repos; for example ros2 launch is in the ros2/launch_ros repo: https://github.com/ros2/launch_ros/tree/master/ros2launch


Originally posted by sloretz with karma: 3061 on 2020-08-03

This answer was ACCEPTED on the original site

Post score: 4


Original comments

Comment by screen33 on 2020-08-05:
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.

Comment by Dirk Thomas on 2020-08-05:
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.

$\endgroup$
0
$\begingroup$

Rosanswers logo

An equivalent to roscd is provided by colcon-cd - see https://github.com/colcon/colcon-cd/


Originally posted by Dirk Thomas with karma: 16276 on 2020-08-03

This answer was NOT ACCEPTED on the original site

Post score: 2

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.