This is a repo with a live coding demo of ROS using the turtlesim and turtlebot gazebo simulation.
The live coding will take place in the move.py file. The ex_move_bot.py and ex_move_turtle.py files are completed examples.
- Install turlebot sim:
$ cd ~/catkin_ws/source
$ git clone -b noetic-devel https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git
-
Follow tutorial for Installing and Configuring Your ROS Environment
-
Create Package (see Creating a ROS Package tutorial):
$ catkin_create_pkg live_code std_msgs rospy roscpp geometry_msgs rostime
- Add scripts folder
$ mkdir live_code/scripts
-
Create file named
move.pyin scripts folder -
Add
move.pyto cmake by uncommenting lines and adding:
catkin_install_python(PROGRAMS
scripts/move.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
- Build
$ cd ~/catkin_ws
$ catkin build
- Source
$ source devel/setup.bash
Note: Adding source ~/catkin_ws/devel/setup.bash to your ~/.bashrc file is a good shortcut for this
Make sure roscore is running
$ rosrun turtlesim turtlesim_node
$ rosrun live_code ex_move_turtle.py
$ export TURTLEBOT3_MODEL=burger
$ roslaunch turtlebot3_gazebo turtlebot3_house.launch
$ rosrun live_code ex_move_bot.py
Note: export TURTLEBOT3_MODEL=burger can be added to the ~/.bashrc file