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
Your Project with Great Documentation.

Read Latest Documentation - Browse GitHub Code Repository The only thing worse than documentation never written, is documentation written but never di

Timothy Edmund Crosley 809 Dec 28, 2022
script to calculate total GPA out of 4, based on input gpa.csv

gpa_calculator script to calculate total GPA out of 4 based on input gpa.csv to use, create a total.csv file containing only one integer showing the t

Mohamad Bastin 1 Feb 07, 2022
Fastest Git client for Emacs.

EAF Git Client EAF Git is git client application for the Emacs Application Framework. The advantages of EAF Git are: Large log browse: support 1 milli

Emacs Application Framework 31 Dec 02, 2022
100 Days of Code Learning program to keep a habit of coding daily and learn things at your own pace with help from our remote community.

100 Days of Code Learning program to keep a habit of coding daily and learn things at your own pace with help from our remote community.

Git Commit Show by Invide 41 Dec 30, 2022
FxBuzzly - Buzzly.art links do not embed in Discord, this fixes them (rudimentarily)

fxBuzzly Buzzly.art links do not embed in Discord, this fixes them (rudimentaril

Dania Rifki 2 Oct 27, 2022
An interview engine for businesses, interview those who are actually qualified and are worth your time!

easyInterview V0.8B An interview engine for businesses, interview those who are actually qualified and are worth your time! Quick Overview You/the com

Vatsal Shukla 1 Nov 19, 2021
API spec validator and OpenAPI document generator for Python web frameworks.

API spec validator and OpenAPI document generator for Python web frameworks.

1001001 249 Dec 22, 2022
Course materials and handouts for #100DaysOfCode in Python course

#100DaysOfCode with Python course Course details page: talkpython.fm/100days Course Summary #100DaysOfCode in Python is your perfect companion to take

Talk Python 1.9k Dec 31, 2022
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
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 04, 2023
Workbench to integrate pyoptools with freecad, that means basically optics ray tracing capabilities for FreeCAD.

freecad-pyoptools Workbench to integrate pyoptools with freecad, that means basically optics ray tracing capabilities for FreeCAD. Requirements It req

Combustión Ingenieros SAS 12 Nov 16, 2022
Searches a document for hash tags. Support multiple natural languages. Works in various contexts.

ht-getter Searches a document for hash tags. Supports multiple natural languages. Works in various contexts. This package uses a non-regex approach an

Rairye 1 Mar 01, 2022
:blue_book: Automatic documentation from sources, for MkDocs.

mkdocstrings Automatic documentation from sources, for MkDocs. Features - Python handler - Requirements - Installation - Quick usage Features Language

1.1k Jan 04, 2023
Fun interactive program to sort a list :)

LHD-Build-Sort-a-list Fun interactive program to sort a list :) Inspiration LHD Build Write a script to sort a list. What it does It is a menu driven

Ananya Gupta 1 Jan 15, 2022
💻An open-source eBook with 101 Linux commands that everyone should know

This is an open-source eBook with 101 Linux commands that everyone should know. No matter if you are a DevOps/SysOps engineer, developer, or just a Linux enthusiast, you will most likely have to use

Ashfaque Ahmed 0 Oct 29, 2022
Yet Another MkDocs Parser

yamp Motivation You want to document your project. You make an effort and write docstrings. You try Sphinx. You think it sucks and it's slow -- I did.

Max Halford 10 May 20, 2022
Types that make coding in Python quick and safe.

Type[T] Types that make coding in Python quick and safe. Type[T] works best with Python 3.6 or later. Prior to 3.6, object types must use comment type

Contains 17 Aug 01, 2022
Quick tutorial on orchest.io that shows how to build multiple deep learning models on your data with a single line of code using python

Deep AutoViML Pipeline for orchest.io Quickstart Build Deep Learning models with a single line of code: deep_autoviml Deep AutoViML helps you build te

Ram Seshadri 6 Oct 02, 2022
A Power BI/Google Studio Dashboard to analyze previous OTC CatchUps

OTC CatchUp Dashboard A Power BI/Google Studio dashboard analyzing OTC CatchUps. File Contents * ├───data ├───old summaries ─── *.md ├

11 Oct 30, 2022
Mozilla Campus Club CCEW is a student committee working to spread awareness on Open Source software.

Mozilla Campus Club CCEW is a student committee working to spread awareness on Open Source software. We organize webinars and workshops on different technical topics and making Open Source contributi

Mozilla-Campus-Club-Cummins 8 Jun 15, 2022