ROS Simulation Basic 1


System check


source ~/.bashrc # like sys append path
export TURTLEBOT3_MODEL=burger
cd ~/catkin_ws # the default workplace to store 
catkin_make # make sure compile 100%
    

Remote Control

roslaunch <package_name> <launch_file> is to launch a ROS program.


roscore # connect client with server
roslaunch turtlebot3_gazebo turtlebot3_empty_world.launch # initialize the gazebo world
roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
    

Navigate to packages


roscd turtlebot3_teleop
    

Structures:

Create packages

Get into the workspace's source folder catkin_ws/src/, create the package via,


catkin_create_pkg my_package rospy
# format
# catkin_create_pkg <package_name> <package_dependencies>
    

List packages


rospack list | grep my_package
    

Command to Publish Topic

Without writing a script to control, we can use a command prompt to directly control action.


roscore
roslaunch hector_quadrotor_demo outdoor_flight_gazebo.launch
rosservice call /enable_motors "enable: true"
rostopic pub -r 10 /cmd_vel geometry_msgs/Twist  '{linear:  {x: 0, y: 0.0, z: 1.0}, angular: {x: 0.0,y: 0.0,z: 0.0}}' # publish topic
#rosrun teleop_twist_keyboard teleop_twist_keyboard.py # alternative to remotely control
    

Create new workspace


mkdir -p ~/my_ws/src
cd ~/my_ws/
catkin_make
source devel/setup.bash
    

References


  1. Quadrotor outdoor flight demo