Skip to content

Latest commit

 

History

History
99 lines (86 loc) · 3.37 KB

ROS commands.md

File metadata and controls

99 lines (86 loc) · 3.37 KB

ROS commands

setup environment

Ros launch command not found

echo "source <catkin_ws_dir>/devel/setup.bash" >> ~/.bashrc
~/.bashrc

This solves Command 'roslaunch' not found.

list installed packages

How do I find the list of installed ROS packages?

rospack list-names

catkin_create_pkg

CreatingPackage

cd ~/catkin_ws/src # must cd here and then catkin_create_pkg!
catkin_create_pkg beginner_tutorials std_msgs rospy roscpp

remove package

catkin: move/remove package and workspace

Just delete the folder.

catkin_make && source devel/setup.bash

roscd: No such package/stack 'beginner_tutorials'

# in "catkin_ws" directory
# catkin_create_pkg learning_tf2 tf2 tf2_ros roscpp rospy turtlesim
catkin_make
source devel/setup.bash
# roscd learning_tf2

This solves roscd: No such package/stack 'learning_tf2'.

catkin_make specific package

How to build just one package using catkin_make?

catkin_make --only-pkg-with-deps <target_package>

/usr/bin/env: ‘python’: No such file or directory

Unable to broadcast the turtle position to tf2 , Tutorial: turtle_tf2_demo.launch and getting only one turtle

sudo ln -s /usr/bin/python3 /usr/bin/python

[ERROR] [1628307689.337043638]: [registerPublisher] Failed to contact master at [localhost:11311]. Retrying...

This can be solved by running:

roscore

roscore

roscore is a collection of nodes and programs that are pre-requisites of a ROS-based system. 
You must have a roscore running in order for ROS nodes to communicate. It is launched using the roscore command. 

Exception thrown:"turtle1" passed to lookupTransform argument source_frame does not exist.

In Writing a tf2 broadcaster (C++), when running:

roslaunch learning_tf2 start_demo.launch

It shows:

Failure at 1628308374.969766010
Exception thrown:"turtle" passed to lookupTransform argument source_frame does not exist. 
The current list of frames is:
Frame turtle1 exists with parent world.

It turns out that we should create a folder named launch and put start_demo.launch there.

# in catkin_ws/src/learning_tf2
mkdir launch
vim launch/start_demo.launch # fill it
# and then roslaunch again
roslaunch learning_tf2 start_demo.launch

It will successfully outputs:

At time 1628308379.856
- Translation: [6.698, 4.107, 0.000]
- Rotation: in Quaternion [0.000, 0.000, -0.606, 0.796]
            in RPY (radian) [0.000, 0.000, -1.301]
            in RPY (degree) [0.000, 0.000, -74.531]

rosbag info

Recording and playing back data

rosbag info xxx.bag