Material for the ros2 crash course

Overview

ROS2 Crash course

Task 1 Create your new workspace

mkdir -p /home/usr/ros2/workspaces/ros2_crash_ws/src
cd /home/usr/ros2/workspaces/ros2_crash_ws/src

Task 2 Get teleop ros package and modify it

1) Clone the ros package repo
	cd /home/usr/ros2/workspaces/ros2_crash_ws/src/
	git clone [email protected]:ros2/teleop_twist_keyboard.git
	source /opt/ros/foxy/setup.bash
2) Compile the workspace
	cd /home/usr/ros2/workspaces/ros2_crash_ws/
	colcon build
3) Run the binary teleop_twist_keyboard.py and play with it! 
	ros2 run teleop_twist_keyboard teleop_twist_keyboard

Q1: How can we test our program? Hint: ros topics!

4) Add a customized print message in the file teleop_twist_keyboard.py and run it again

Q2: What happened? Hint: underlay vs overlay

5) Modify the binary teleop_twist_keyboard.py to generate the following motions:

	Linear motions: 

	u: left-front
	i: front
	o: right-front
	j: left
	k: stop
	l: right
	m: left-back
	,: back
	.: right-back

	Angular Motions:
	w: counter-clockwise
	e: stop
	r: clock-wise

	Speed:

	+ increase linear speed +0.1
	- decrease linear speed -0.1
	* increase angular speed +0.1
	/ decrease angular speed -0.1

6) Test your new binary
	Open a new terminal and source your workspace
	cd /home/usr/ros2/workspaces/ros2_crash_ws/
	source install/setup.bash
	ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args --remap /cmd_vel:=turtle_twist

Q3: Does it work?

Task 3 Create a new ros2 cpp package named "turtle_msg"

1) Use the ros2 create package function 
	cd /home/usr/ros2/workspaces/ros2_crash_ws/src
	ros2 pkg create --build-type ament_cmake turtle_msgs
2) Compile the workspace
	colcon build --symlink-install --merge-install --cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=1

Q4: Any problems? Do you notice any difference with the additional compiling arguments?

3) Add msg/TurtleState.msg and modify CMakeLists.txt, package.xml
4) Compile your workspace
5) Verify that your new message has been created, using ros2 interface.

Q5: Can you find your new message? Hint: overlay

Task 4 Create a new ros2 cpp package "turtle_ctrl"

1) Use the ros2 create package function 
	cd /home/dean/ros2/workspaces/ros2_crash_ws/src
	ros2 pkg create --build-type ament_cmake turtle_ctrl
2) Compile your workspace
3) Copy the TurtleVis class files TurtleVis.h and TurtleVis.cpp to their corresponding folders
4) Modify the CMakeFile to create a shared library with the TurtleVis class
5) Copy the application file turtle_vis.cpp
6) Modify the CMakeFile to create a new binary (Exec)
7) Compile your workspace (or single ros package)
8) Copy the file "turtle.rviz" into turtle_ctr/rviz/turtle.rviz
9) Test your application. You will need 3 terminals
	T1) Run the turtle visualization 
		ros2 run turtle_ctrl turtle_vis
	T2) Run rviz
		ros2 run rviz2 rviz2 -d src/turtle_ctrl/rviz/turtle.rvi
	T3) Publish a TurtleState message and check the rviz window
		ros2 topic pub --rate 1 /turtle_pose turtle_msgs/msg/TurtleStateStamped "{pose: {x: 1, y: 1, theta: 0}}"

Q6: What can you see?

Task 5 Let's create a lunch file to automate the above process

1) Copy the file "turtle_vis_test_launch.py" into the folder turtle_ctrl/launch/
2) Run the new launch file
	ros2 launch turtle_ctrl turtle_vis_test_launch.py

Q7: Does it work? What happened?

Task 6 Create the controller

1) Copy the class files  TurtleCtrl.cpp and TurtleCtrl.h to its corresponding folders
2) Modify the CMakeFile to create a shared library with the control class
3) Copy the application file turtle_control.cpp
4) Modify the CMakeFile to create a new binary (Exec)
5) Compile your workspace (or single ros package) 
6) Test your application
	T1) Copy the launch file turtle_vis_test_launch.py and renamed as turtle_test_launch.py
		Modify the new launch file to include the control node

Q8: How can you test your application?

Task 7 Trajectory generator

We will implement two methods to generate the commanded turtle pose for the controller.
First, transform the Twist (turtle velocity) message generated from the node teleop_twist_keyboard to continuous 
commanded turtle poses. 
Second, we will create a node that provides a service to request a desired turtle pose. This node will use the
requested turtle pose and generate a continuous smooth trajectory for the commanded turtle pose. 
The output of both nodes is a TurtleStateStamped message, which is connected to the controller to change the 
pose of the turtle
1) Create a new ros python package "turtle_trajectory_generator"
	ros2 pkg create --build-type ament_python turtle_trajectory_generator
2) Fix the ros package configuration files to use the new package, e.g. package.xml, resource, setup.py, etc.
3) Copy the file teleop_twist_keyboard.py from the ros package teleop_twist_keyboard to this new package
4) Compile the workspace. This is needed to create the symbolic links to the python files. 
	colcon build --symlink-install --merge-install --cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=1
5) Create the trajectory generator module. Use the file trajectory_generator_class.py 
6) Compile again the workspace
7) Create the application nodes
	a) applications/poly_trajectories.py: Generates the smooth trajectory for the commanded turtle pose (TurtleStateStamped message)
	b) applications/twist2cmd.py: Converts from Twist message to commanded turtle pose (TurtleStateStamped message)
8) Compile your workspace 
7) Test your applications

Q9: How can you test the trajectory generator nodes only? Hint: ros2 run rqt_plot rqt_plot Q9: Does it work? Hint: did you configure your setup.py file?

Running Demo

Turtle Ctrl + Vis

T1) cd /home/dean/ros2/workspaces/ros2_crash_ws/

source install/setup.bash

ros2 launch turtle_ctrl turtle_test_launch.py

T2) ros2 topic pub --rate 1 /turtle_pose turtle_msgs/msg/TurtleStateStamped "{pose: {x: 0, y: 1, theta: 0}}"

Turtle Trajectory + Ctrl + Vis

ros2 launch turtle_ctrl turtle_test_launch.py

Keyboard commands (Velocity reference)

T1) ros2 run turtle_trajectory_generator twist2cmd

T2) ros2 run turtle_trajectory_generator teleop_twist_keyboard --ros-args --remap /cmd_vel:=turtle_twist

Spline (Smooth Position Commands)

T1) ros2 run turtle_trajectory_generator poly_trajectory

T2) ros2 service call /set_desired_pose turtle_msgs/srv/SetDesiredPose "{ turtle_d:{x: 1, y: 0, theta: 0}, time: 1}"

You might also like...
ped-crash-techvol: Texas Ped Crash Tech Volume Pack

ped-crash-techvol: Texas Ped Crash Tech Volume Pack In conjunction with the Final Report "Identifying Risk Factors that Lead to Increase in Fatal Pede

Course material for the Multi-agents and computer graphics course

TC2008B Course material for the Multi-agents and computer graphics course. Setup instructions Strongly recommend using a custom conda environment. Ins

JimShapedCoding Python Crash Course 2021

Python CRASH Course by JimShapedCoding - Click Here to Start! This Repository includes the code and MORE exercises on each section of the entire cours

Material related to the Principles of Cloud Computing course.

CloudComputingCourse Material related to the Principles of Cloud Computing course. This repository comprises material that I use to teach my Principle

Repositori untuk menyimpan material Long Course STMKGxHMGI tentang Geophysical Python for Seismic Data Analysis
Repositori untuk menyimpan material Long Course STMKGxHMGI tentang Geophysical Python for Seismic Data Analysis

Long Course "Geophysical Python for Seismic Data Analysis" Instruktur: Dr.rer.nat. Wiwit Suryanto, M.Si Dipersiapkan oleh: Anang Sahroni Waktu: Sesi 1

πŸ¦• NanoSaur is a little tracked robot ROS2 enabled, made for an NVIDIA Jetson Nano

πŸ¦• nanosaur NanoSaur is a little tracked robot ROS2 enabled, made for an NVIDIA Jetson Nano Website: nanosaur.ai Do you need an help? Discord For tech

linorobot2 is a ROS2 port of the linorobot package
linorobot2 is a ROS2 port of the linorobot package

linorobot2 is a ROS2 port of the linorobot package. If you're planning to build your own custom ROS2 robot (2WD, 4WD, Mecanum Drive) using accessible parts, then this package is for you. This repository contains launch files to easily integrate your DIY robot with Nav2 and a simulation pipeline to run and verify your experiments on a virtual robot in Gazebo.

This is an example manipulation package of for a robot manipulator based on Drake with ROS2.

This is an example manipulation package of for a robot manipulator based on Drake with ROS2.

Doosan robotic arm, simulation, control, visualization in Gazebo and ROS2 for Reinforcement Learning.
Doosan robotic arm, simulation, control, visualization in Gazebo and ROS2 for Reinforcement Learning.

Robotic Arm Simulation in ROS2 and Gazebo General Overview This repository includes: First, how to simulate a 6DoF Robotic Arm from scratch using GAZE

ROS2 Docker tutorial with VSCode

ROS2-Docker-tutorial I made this repository using athackst/vscode_ros2_workspace templete with foxy-nvidia branch. You could see more information abov

YouTube Video publisher using youtube-dl & ROS2🐒
YouTube Video publisher using youtube-dl & ROS2🐒

YouTube-publisher-ROS2 Publish sensor_msgs/Image by "YouTube" πŸ€— πŸ€— πŸ€— ! You don't have to use webcamera or your video to check demos. Purpose Quick d

Fener ROS2 package version 2

Fener's ROS2 codes that runs on the vehicle. This node contains basic sensing and actuation nodes for vehicle control. Also example applications will be added.

ROS2 + PyQt5 Example
ROS2 + PyQt5 Example

ROS2 + PyQt5 Example

ROS2 nodes for Waveshare Alphabot2-Pi mobile robot.

ROS2 for Waveshare Alphabot2-Pi This repo contains ROS2 packages for the Waveshare Alphabot2-Pi mobile robot: alphabot2: it contains the nodes used to

YOLOv5 + ROS2 object detection package

YOLOv5-ROS YOLOv5 + ROS2 object detection package This program changes the input of detect.py (ultralytics/yolov5) to sensor_msgs/Image of ROS2. Requi

All Tools In One is a Script Developed with Python3. It gathers a total of 14 Discord tools (including a RAT, a Raid Tool, a Token Grabber, a Crash Video Maker, etc). It has a pleasant and intuitive interface to facilitate the use of all with help and explanations for each of them.
rTorrent Crash Prevention

rTorrent Disk Checker This program is capable of the following when: - a torrent is added by any program (autodl-irssi, RSS Downloader et

Translating symbolicated Apple JSON format crash log into our old friends :)

CrashTranslation Translating symbolicated Apple JSON format crash log into our old friends :) Usage python3 translation.py -i {input_sybolicated_json_

Python3 parser for Apple's crash reports

pyCrashReport in intended for analyzing crash reports from Apple devices into a clearer view, without all the thread listing and loaded images, just the actual data you really need to debug the problem 😎 .

Owner
Emmanuel Dean
Emmanuel Dean
A Material Design theme for MkDocs

A Material Design theme for MkDocs Create a branded static site from a set of Markdown files to host the documentation of your Open Source or commerci

Martin Donath 12.3k Jan 4, 2023
Software engineering course project. Secondhand trading system.

PigeonSale Software engineering course project. Secondhand trading system. Documentation API doumenatation: list of APIs Backend documentation: notes

Harry Lee 1 Sep 1, 2022
Course Materials for Math 340

UBC Math 340 Materials This repository aims to be the one repository for which you can find everything you about Math 340. Lecture Notes Lecture Notes

null 2 Nov 25, 2021
Members: Thomas Longuevergne Program: Network Security Course: 1DV501 Date of submission: 2021-11-02

Mini-project report Members: Thomas Longuevergne Program: Network Security Course: 1DV501 Date of submission: 2021-11-02 Introduction This project was

null 1 Nov 8, 2021
An introduction course for Python provided by VetsInTech

Introduction to Python This is an introduction course for Python provided by VetsInTech. For every "boot camp", there usually is a pre-req, but becaus

Vets In Tech 2 Dec 2, 2021
Portfolio project for Code Institute Full Stack software development course.

Comic Sales tracker This project is the third milestone project for the Code Institute Diploma in Full Stack Software Development. You can see the fin

null 1 Jan 10, 2022
Coursera learning course Python the basics. Programming exercises and tasks

HSE_Python_the_basics Welcome to BAsics programming Python! You’re joining thousands of learners currently enrolled in the course. I'm excited to have

PavelRyzhkov 0 Jan 5, 2022
Contains the assignments from the course Building a Modern Computer from First Principles: From Nand to Tetris.

Contains the assignments from the course Building a Modern Computer from First Principles: From Nand to Tetris.

Matheus Rodrigues 1 Jan 20, 2022
Ros2-voiceroid2 - ROS2 wrapper package of VOICEROID2

ros2_voiceroid2 ROS2 wrapper package of VOICEROID2 Windows Only Installation Ins

Nkyoku 1 Jan 23, 2022
Socorro is the Mozilla crash ingestion pipeline. It accepts and processes Breakpad-style crash reports. It provides analysis tools.

Socorro Socorro is a Mozilla-centric ingestion pipeline and analysis tools for crash reports using the Breakpad libraries. Support This is a Mozilla-s

Mozilla Services 552 Dec 19, 2022