Skip to content

Instantly share code, notes, and snippets.

@nicholaskajoh
Last active November 21, 2019 10:25
Show Gist options
  • Save nicholaskajoh/44fe4ff7f0b7e58a5c0c110c1379f45d to your computer and use it in GitHub Desktop.
Save nicholaskajoh/44fe4ff7f0b7e58a5c0c110c1379f45d to your computer and use it in GitHub Desktop.
ROS build and run packages (Let's Build an Autonomous Toy Car! series)
# Source ROS env
source /opt/ros/melodic/setup.bash
# Create package (in path/to/workspace/src)
# NB: std_msgs and rospy are dependencies
# catkin_create_pkg my_package std_msgs rospy
# Create scripts directory in package root
# mkdir scripts
# Create python script(s) e.g:
# touch scripts/my_script.py
# Make script(s) executable
# chmod +x my_script.py
# Build packages (in path/to/workspace)
catkin_make
# Setup workspace env (in path/to/workspace)
source devel/setup.bash
# Start ROS
roscore
# Run package
rosrun my_package my_script.py
# Test a publisher node
# rostopic echo topic_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment