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}"

Owner
Emmanuel Dean
Emmanuel Dean
Some code that takes a pipe-separated input and converts that into a table!

tablemaker A program that takes an input: a | b | c # With comments as well. e | f | g h | i |jk And converts it to a table: ┌───┬───┬────┐ │ a │ b │

CodingSoda 2 Aug 30, 2022
Sane and flexible OpenAPI 3 schema generation for Django REST framework.

drf-spectacular Sane and flexible OpenAPI 3.0 schema generation for Django REST framework. This project has 3 goals: Extract as much schema informatio

T. Franzel 1.4k Jan 08, 2023
Beautiful static documentation generator for OpenAPI/Swagger 2.0

Spectacle The gentleman at REST Spectacle generates beautiful static HTML5 documentation from OpenAPI/Swagger 2.0 API specifications. The goal of Spec

Sourcey 1.3k Dec 13, 2022
Anomaly Detection via Reverse Distillation from One-Class Embedding

Anomaly Detection via Reverse Distillation from One-Class Embedding Implementation (Official Code ⭐️ ⭐️ ⭐️ ) Environment pytorch == 1.91 torchvision =

73 Dec 19, 2022
step by step guide for beginners for getting started with open source

Step-by-Step Guide for beginners for getting started with Open-Source Here The Contribution Begins 💻 If you are a beginner then this repository is fo

Arpit Jain 66 Jan 03, 2023
Que es S4K Builder?, Fácil un constructor de tokens grabbers con muchas opciones, como BTC Miner, Clipper, shutdown PC, Y más! Disfrute el proyecto. <3

S4K Builder Este script Python 3 de código abierto es un constructor del muy popular registrador de tokens que está en [mi GitHub] (https://github.com

SadicX 1 Oct 22, 2021
Literate-style documentation generator.

888888b. 888 Y88b 888 888 888 d88P 888 888 .d8888b .d8888b .d88b. 8888888P" 888 888 d88P" d88P" d88""88b 888 888 888

Pycco 808 Dec 27, 2022
An MkDocs plugin that simplifies configuring page titles and their order

MkDocs Awesome Pages Plugin An MkDocs plugin that simplifies configuring page titles and their order The awesome-pages plugin allows you to customize

Lukas Geiter 282 Dec 28, 2022
My solutions to the Advent of Code 2021 problems in Go and Python 🎄

🎄 Advent of Code 2021 🎄 Summary Advent of Code is an annual Advent calendar of programming puzzles. This year I am doing it in Go and Python. Runnin

Orfeas Antoniou 16 Jun 16, 2022
Gtech μLearn Sample_bot

Ser_bot Gtech μLearn Sample_bot Do Greet a newly joined member in a channel (random message) While adding a reaction to a message send a message to a

Jerin Paul 1 Jan 19, 2022
Tips for Writing a Research Paper using LaTeX

Tips for Writing a Research Paper using LaTeX

Guanying Chen 727 Dec 26, 2022
Simple yet powerful CAD (Computer Aided Design) library, written with Python.

Py-MADCAD it's time to throw parametric softwares out ! Simple yet powerful CAD (Computer Aided Design) library, written with Python. Installation

jimy byerley 124 Jan 06, 2023
Fast syllable estimation library based on pattern matching.

Syllables: A fast syllable estimator for Python Syllables is a fast, simple syllable estimator for Python. It's intended for use in places where speed

ProseGrinder 26 Dec 14, 2022
A simple XLSX/CSV reader - to dictionary converter

sheet2dict A simple XLSX/CSV reader - to dictionary converter Installing To install the package from pip, first run: python3 -m pip install --no-cache

Tomas Pytel 216 Nov 25, 2022
Spin-off Notice: the modules and functions used by our research notebooks have been refactored into another repository

Fecon235 - Notebooks for financial economics. Keywords: Jupyter notebook pandas Federal Reserve FRED Ferbus GDP CPI PCE inflation unemployment wage income debt Case-Shiller housing asset portfolio eq

Adriano 825 Dec 27, 2022
Automatically open a pull request for repositories that have no CONTRIBUTING.md file

automatic-contrib-prs Automatically open a pull request for repositories that have no CONTRIBUTING.md file for a targeted set of repositories. What th

GitHub 8 Oct 20, 2022
EasyModerationKit is an open-source framework designed to moderate and filter inappropriate content.

EasyModerationKit is a public transparency statement. It declares any repositories and legalities used in the EasyModeration system. It allows for implementing EasyModeration into an advanced charact

Aarav 1 Jan 16, 2022
Data Inspector is an open-source python library that brings 15++ types of different functions to make EDA, data cleaning easier.

Data Inspector Data Inspector is an open-source python library that brings 15 types of different functions to make EDA, data cleaning easier. Author:

Kazi Amit Hasan 38 Nov 24, 2022
Plotting and analysis tools for ARTIS simulations

Artistools Artistools is collection of plotting, analysis, and file format conversion tools for the ARTIS radiative transfer code. Installation First

ARTIS Monte Carlo Radiative Transfer 8 Nov 07, 2022
Some custom tweaks to the results produced by pytkdocs.

pytkdocs_tweaks Some custom tweaks for pytkdocs. For use as part of the documentation-generation-for-Python stack that comprises mkdocs, mkdocs-materi

Patrick Kidger 4 Nov 24, 2022