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
Proyecto - Desgaste y rendimiento de empleados de IBM HR Analytics

Acceder al código desde Google Colab para poder ver de manera adecuada todas las visualizaciones y poder interactuar con ellas. Links de acceso: Noteb

1 Jan 31, 2022
Ultimaker Cura 2 Mooraker Upload Plugin

Klipper & Cura - Cura2MoonrakerPlugin Allows you to upload Gcode directly from Cura to your Klipper-based 3D printer (Fluidd, Mainsailos etc.) using t

214 Jan 03, 2023
Yu-Gi-Oh! Master Duel translation script

Yu-Gi-Oh! Master Duel translation script

715 Jan 08, 2023
Dev Centric Tools for Mkdocs Based Documentation

docutools MkDocs Documentation Tools For Developers This repo is providing a set of plugins for mkdocs material compatible documentation. It is meant

Axiros GmbH 14 Sep 10, 2022
Grokking the Object Oriented Design Interview

Grokking the Object Oriented Design Interview

Tusamma Sal Sabil 2.6k Jan 08, 2023
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
Essential Document Generator

Essential Document Generator Dead Simple Document Generation Whether it's testing database performance or a new web interface, we've all needed a dead

Shane C Mason 59 Nov 11, 2022
SCTYMN is a GitHub repository that includes some simple scripts(currently only python scripts) that can be useful.

Simple Codes That You Might Need SCTYMN is a GitHub repository that includes some simple scripts(currently only python scripts) that can be useful. In

CodeWriter21 2 Jan 21, 2022
This tutorial will guide you through the process of self-hosting Polygon

Hosting guide This tutorial will guide you through the process of self-hosting Polygon Before starting Make sure you have the following tools installe

Polygon 2 Jan 31, 2022
The sarge package provides a wrapper for subprocess which provides command pipeline functionality.

Overview The sarge package provides a wrapper for subprocess which provides command pipeline functionality. This package leverages subprocess to provi

Vinay Sajip 14 Dec 18, 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
OpenAPI (f.k.a Swagger) Specification code generator. Supports C#, PowerShell, Go, Java, Node.js, TypeScript, Python

AutoRest The AutoRest tool generates client libraries for accessing RESTful web services. Input to AutoRest is a spec that describes the REST API usin

Microsoft Azure 4.1k Jan 06, 2023
Easy OpenAPI specs and Swagger UI for your Flask API

Flasgger Easy Swagger UI for your Flask API Flasgger is a Flask extension to extract OpenAPI-Specification from all Flask views registered in your API

Flasgger 3.1k Dec 24, 2022
🌱 Complete API wrapper of Seedr.cc

Python API Wrapper of Seedr.cc Table of Contents Installation How I got the API endpoints? Start Guide Getting Token Logging with Username and Passwor

Hemanta Pokharel 43 Dec 26, 2022
A comprehensive and FREE Online Python Development tutorial going step-by-step into the world of Python.

FREE Reverse Engineering Self-Study Course HERE Fundamental Python The book and code repo for the FREE Fundamental Python book by Kevin Thomas. FREE B

Kevin Thomas 7 Mar 19, 2022
An open-source script written in python just for fun

Owersite Owersite is an open-source script written in python just for fun. It do

大きなペニスを持つ少年 7 Sep 21, 2022
DocumentPy is a Python application that runs in a command-line interface environment, made for creating HTML documents.

DocumentPy DocumentPy is a Python application that runs in a command-line interface environment, made for creating HTML documents. Usage DocumentPy, a

Lotus 0 Jul 15, 2021
This contains timezone mapping information for when preprocessed from the geonames data

when-data This contains timezone mapping information for when preprocessed from the geonames data. It exists in a separate repository so that one does

Armin Ronacher 2 Dec 07, 2021
Documentation of the QR code found on new Austrian ID cards.

Austrian ID Card QR Code This document aims to be a complete documentation of the format used in the QR area on the back of new Austrian ID cards (Per

Gabriel Huber 9 Dec 12, 2022
A Python package develop for transportation spatio-temporal big data processing, analysis and visualization.

English 中文版 TransBigData Introduction TransBigData is a Python package developed for transportation spatio-temporal big data processing, analysis and

Qing Yu 251 Jan 03, 2023