├── fig ├── vim.pdf ├── qr_mrs_github.png ├── qr_mrs_website.png └── qr_cheatsheet_pdf.png ├── .ci └── build.sh ├── README.md ├── .github └── workflows │ └── main.yml ├── LICENSE ├── .gitignore └── main.tex /fig/vim.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctu-mrs/mrs_cheatsheet/HEAD/fig/vim.pdf -------------------------------------------------------------------------------- /fig/qr_mrs_github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctu-mrs/mrs_cheatsheet/HEAD/fig/qr_mrs_github.png -------------------------------------------------------------------------------- /fig/qr_mrs_website.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctu-mrs/mrs_cheatsheet/HEAD/fig/qr_mrs_website.png -------------------------------------------------------------------------------- /fig/qr_cheatsheet_pdf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctu-mrs/mrs_cheatsheet/HEAD/fig/qr_cheatsheet_pdf.png -------------------------------------------------------------------------------- /.ci/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | distro=`lsb_release -r | awk '{ print $2 }'` 5 | [ "$distro" = "18.04" ] && ROS_DISTRO="melodic" 6 | [ "$distro" = "20.04" ] && ROS_DISTRO="noetic" 7 | 8 | sudo apt -y update 9 | sudo apt -y install texlive-latex-base texlive-latex-extra poppler-utils imagemagick 10 | 11 | pdflatex -interaction=nonstopmode main.tex 12 | pdftoppm -jpeg main.pdf thumbnail.jpg 13 | montage *.jpg -mode Concatenate -tile 3x2 montage.jpg 14 | convert montage.jpg -resize 1280 -quality 80 montage.jpg 15 | mkdir -p output 16 | mv main.pdf output/mrs_cheatsheet.pdf 17 | mv montage.jpg output/thumbnail.jpg 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MRS Cheatsheet [![Build Status](https://github.com/ctu-mrs/mrs_cheatsheet/workflows/CI/badge.svg)](https://github.com/ctu-mrs/mrs_cheatsheet/actions) 2 | 3 | Are you new to our lab? Or just a stranger from the internet? Print this cheatsheet and you will be happy! 4 | 5 | ## Click the thumbnail to download 6 | 7 | [![Cheatsheet PDF](https://github.com/ctu-mrs/mrs_cheatsheet/raw/gh-pages/thumbnail.jpg)](https://github.com/ctu-mrs/mrs_cheatsheet/raw/gh-pages/mrs_cheatsheet.pdf) 8 | 9 | ## The cheatsheet aims to help with the daily use of: 10 | * Linux terminal (Bash), 11 | * Tmux, 12 | * Vim, 13 | * Git, 14 | * .bashrc, 15 | * ROS in terminal, 16 | * ROS in C++ and Python, 17 | * Eigen, 18 | * basic Maths used in robotics, 19 | * and [Vim CheatSheet](http://vimcheatsheet.com/): please support the guy by buying his posters. 20 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | paths-ignore: 7 | - '**/README.md' 8 | pull_request: 9 | branches: [ master ] 10 | 11 | workflow_dispatch: 12 | 13 | jobs: 14 | 15 | cancel: 16 | 17 | name: Cancel Previous Runs 18 | runs-on: ubuntu-latest 19 | steps: 20 | - name: Cancel Previous Runs 21 | uses: styfle/cancel-workflow-action@0.8.0 22 | with: 23 | access_token: ${{ github.token }} 24 | 25 | docs: 26 | runs-on: ubuntu-20.04 27 | steps: 28 | 29 | - uses: actions/checkout@v2 30 | 31 | - name: Build 32 | run: ./.ci/build.sh 33 | 34 | - name: Deploy 35 | uses: peaceiris/actions-gh-pages@v3 36 | with: 37 | github_token: ${{ secrets.GITHUB_TOKEN }} 38 | publish_dir: ./output 39 | allow_empty_commit: true 40 | force_orphan: true 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2020, Multi-robot Systems (MRS) group at Czech Technical University in Prague 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | main.pdf 2 | *.swp 3 | *.swo 4 | 5 | build/ 6 | presentation/build 7 | poster/build 8 | 9 | ## Core latex/pdflatex auxiliary files: 10 | *.aux 11 | *.lof 12 | *.log 13 | *.lot 14 | *.fls 15 | *.out 16 | *.toc 17 | *.fmt 18 | *.fot 19 | *.cb 20 | *.cb2 21 | 22 | #Makefile created 23 | fig/.done 24 | 25 | ## Intermediate documents: 26 | *.dvi 27 | *-converted-to.* 28 | # these rules might exclude image files for figures etc. 29 | # *.ps 30 | # *.eps 31 | # *.pdf 32 | 33 | ## Bibliography auxiliary files (bibtex/biblatex/biber): 34 | *.bbl 35 | *.bcf 36 | *.blg 37 | *-blx.aux 38 | *-blx.bib 39 | *.brf 40 | *.run.xml 41 | 42 | ## Build tool auxiliary files: 43 | *.fdb_latexmk 44 | *.synctex 45 | *.synctex.gz 46 | *.synctex.gz(busy) 47 | *.pdfsync 48 | 49 | ## Auxiliary and intermediate files from other packages: 50 | # algorithms 51 | *.alg 52 | *.loa 53 | 54 | # achemso 55 | acs-*.bib 56 | 57 | # amsthm 58 | *.thm 59 | 60 | # beamer 61 | *.nav 62 | *.snm 63 | *.vrb 64 | 65 | # cprotect 66 | *.cpt 67 | 68 | # fixme 69 | *.lox 70 | 71 | #(r)(e)ledmac/(r)(e)ledpar 72 | *.end 73 | *.?end 74 | *.[1-9] 75 | *.[1-9][0-9] 76 | *.[1-9][0-9][0-9] 77 | *.[1-9]R 78 | *.[1-9][0-9]R 79 | *.[1-9][0-9][0-9]R 80 | *.eledsec[1-9] 81 | *.eledsec[1-9]R 82 | *.eledsec[1-9][0-9] 83 | *.eledsec[1-9][0-9]R 84 | *.eledsec[1-9][0-9][0-9] 85 | *.eledsec[1-9][0-9][0-9]R 86 | 87 | # glossaries 88 | *.acn 89 | *.acr 90 | *.glg 91 | *.glo 92 | *.gls 93 | *.glsdefs 94 | 95 | # gnuplottex 96 | *-gnuplottex-* 97 | 98 | # hyperref 99 | *.brf 100 | 101 | # knitr 102 | *-concordance.tex 103 | # TODO Comment the next line if you want to keep your tikz graphics files 104 | *.tikz 105 | *-tikzDictionary 106 | 107 | # listings 108 | *.lol 109 | 110 | # makeidx 111 | *.idx 112 | *.ilg 113 | *.ind 114 | *.ist 115 | 116 | # minitoc 117 | *.maf 118 | *.mlf 119 | *.mlt 120 | *.mtc 121 | *.mtc[0-9] 122 | *.mtc[1-9][0-9] 123 | 124 | # minted 125 | _minted* 126 | *.pyg 127 | 128 | # morewrites 129 | *.mw 130 | 131 | # mylatexformat 132 | *.fmt 133 | 134 | # nomencl 135 | *.nlo 136 | 137 | # sagetex 138 | *.sagetex.sage 139 | *.sagetex.py 140 | *.sagetex.scmd 141 | 142 | # sympy 143 | *.sout 144 | *.sympy 145 | sympy-plots-for-*.tex/ 146 | 147 | # pdfcomment 148 | *.upa 149 | *.upb 150 | 151 | # pythontex 152 | *.pytxcode 153 | pythontex-files-*/ 154 | 155 | # thmtools 156 | *.loe 157 | 158 | # TikZ & PGF 159 | *.dpth 160 | *.md5 161 | *.auxlock 162 | 163 | # todonotes 164 | *.tdo 165 | 166 | # xindy 167 | *.xdy 168 | 169 | # xypic precompiled matrices 170 | *.xyc 171 | 172 | # endfloat 173 | *.ttt 174 | *.fff 175 | 176 | # Latexian 177 | TSWLatexianTemp* 178 | 179 | ## Editors: 180 | # WinEdt 181 | *.bak 182 | *.sav 183 | 184 | # Texpad 185 | .texpadtmp 186 | 187 | # Kile 188 | *.backup 189 | 190 | # KBibTeX 191 | *~[0-9]* 192 | -------------------------------------------------------------------------------- /main.tex: -------------------------------------------------------------------------------- 1 | \documentclass[a4paper,landscape]{article} 2 | 3 | %%{ packages 4 | 5 | \usepackage[landscape]{geometry} 6 | \usepackage{url} 7 | \usepackage{multicol} 8 | \usepackage{amsmath} 9 | \usepackage{amsfonts} 10 | \usepackage{tikz} 11 | \usepackage{amsmath,amssymb} 12 | \usepackage{colortbl} 13 | \usepackage{xcolor} 14 | \usepackage{mathtools} 15 | \usepackage{amsmath,amssymb} 16 | \usepackage{listings} 17 | \usepackage{pdfpages} 18 | \lstset{ 19 | basicstyle=\ttfamily, 20 | frame=single 21 | } 22 | \usepackage{enumitem} 23 | \usepackage[english]{babel} 24 | \usepackage[utf8]{inputenc} 25 | \usetikzlibrary{decorations.pathmorphing} 26 | 27 | %%} 28 | 29 | \title{MRS lab ROS platform Cheat Sheet} 30 | 31 | \advance\topmargin-.8in 32 | \advance\textheight3in 33 | \advance\textwidth3in 34 | \advance\oddsidemargin-1.5in 35 | \advance\evensidemargin-1.5in 36 | \parindent0pt 37 | \parskip2pt 38 | 39 | \newcommand{\hr}{\centerline{\rule{3.5in}{1pt}}} 40 | 41 | %\colorbox[HTML]{e4e4e4}{\makebox[\textwidth-2\fboxsep][l]{texto} 42 | 43 | \begin{document} 44 | 45 | \begin{center}{\huge{\textbf{MRS lab ROS platform Cheat Sheet}}}\\ 46 | {\large by Tomas Baca @ Multi-robot Systems (MRS), v1.2.0} 47 | \end{center} 48 | 49 | \begin{multicols*}{2} 50 | 51 | \tikzstyle{mybox} = [draw=black, fill=white, very thick, 52 | rectangle, rounded corners, inner sep=10pt, inner ysep=10pt] 53 | \tikzstyle{fancytitle} =[fill=black, text=white, font=\bfseries] 54 | 55 | %%{ TERMINAL BASICS 56 | 57 | \begin{tikzpicture} 58 | \node [mybox] (box){% 59 | \begin{minipage}{0.47\textwidth} 60 | \begin{center} 61 | \scriptsize{ 62 | \textbf{Hitting $\langle\mathrm{Tab}\rangle$ autocompletes commands, filenames, etc.} 63 | \begin{tabular}{lp{6.0cm} r} 64 | \hline 65 | New terminal & \texttt{Ctrl+Alt+t} \\ \hline 66 | \textbf{Need help} & append \texttt{--help} after command\\ 67 | \textbf{Need more help!} & \texttt{:\$ man [command]} \\ \hline 68 | Change directory & \texttt{:\$ cd [path]} \\ \hline 69 | Path symbolic links & $\texttt{.}$ -- current directory \\ 70 | & $\texttt{..}$ -- previous directory \\ 71 | & $\texttt{$\sim$}$ -- home directory (also \texttt{\$HOME})\\ 72 | & $\texttt{/}$ -- root directory \\ \hline 73 | create a file & \texttt{:\$ touch [path]} \\ 74 | remove a file & \texttt{:\$ rm [path]} \\ 75 | move (also rename) a file & \texttt{:\$ mv [from] [to]} \\ 76 | copy a file & \texttt{:\$ cp [from] [to]} \\ 77 | print a file & \texttt{:\$ cat [path]} \\ 78 | edit a file & \texttt{:\$ vim [path]}, \texttt{:\$ nano [path]} \\ \hline 79 | set a variable & \texttt{:\$ VARIABLE="dog", VARIABLE=3.0} \\ 80 | print a variable & \texttt{:\$ echo "the content is: \$VARIABLE"} \\ \hline 81 | run a script or executable& \texttt{:\$ ./script.sh, ./program} \\ \hline 82 | output redirection & $\texttt{>}$ -- to a file (rewrite) \\ 83 | & $\texttt{>>}$ -- to a file (append) \\ 84 | & $\texttt{|}$ -- pipe to another command \\ 85 | redirect to /dev/null & $\texttt{> /dev/null 2>\&1}$ \\ \hline 86 | \end{tabular} 87 | } 88 | 89 | \vspace{0.2em} 90 | Would You Like to Know More? \url{http://google.com} 91 | \vspace{-1em} 92 | \end{center} 93 | \end{minipage} 94 | }; 95 | \node[fancytitle, right=10pt] at (box.north west) {Ubuntu terminal - GNU/Linux basics}; 96 | \end{tikzpicture} 97 | 98 | %%} 99 | 100 | %%{ TMUX 101 | 102 | \begin{tikzpicture} 103 | \node [mybox] (box){% 104 | \begin{minipage}{0.47\textwidth} 105 | \begin{center} 106 | \scriptsize{ 107 | \begin{tabular}{lp{4.0cm} r} 108 | \hline 109 | Run tmux & \texttt{:\$ tmux} \\ 110 | List all sessions & \texttt{:\$ tmux ls} \\ 111 | Attach to a session & \texttt{:\$ tmux a -t [session name]} \\ 112 | \hline 113 | New window (tab) & \texttt{Ctrl+t}\\ 114 | New horizontal split & \texttt{Ctrl+9}\\ 115 | New vertical split & \texttt{Ctrl+0}\\ 116 | Moving through windows (tabs) & \texttt{Shift+$\rightarrow$}, \texttt{Shift+$\leftarrow$} \\ 117 | Moving through panes (splits) & \texttt{Alt+$\rightarrow$}, \texttt{Alt+$\leftarrow$}, \texttt{Alt+$\uparrow$}, \texttt{Alt+$\downarrow$} \\ 118 | \hline 119 | \textbf{prefix} & \texttt{Ctrl+a}\\ 120 | \hline 121 | Killing window & \textbf{prefix} \texttt{x}, \texttt{:\$ exit}, \texttt{:\$ :q}\\ 122 | Killing session & \textbf{prefix} \texttt{k}\\ 123 | Detach from session & \textbf{prefix} \texttt{d}\\ 124 | Enter vim mode (scrolling, copying) & \texttt{F2}, \textbf{prefix} \texttt{$[$}\\ 125 | \hline 126 | \end{tabular} 127 | } 128 | 129 | \vspace{0.2em} 130 | Would You Like to Know More? \url{https://github.com/klaxalk/linux-setup/wiki/tmux} 131 | \vspace{-1em} 132 | \end{center} 133 | \end{minipage} 134 | }; 135 | \node[fancytitle, right=10pt] at (box.north west) {TMUX - Terminal multiplexer}; 136 | \end{tikzpicture} 137 | 138 | %%} 139 | 140 | %%{ VIM 141 | 142 | \begin{tikzpicture} 143 | \node [mybox] (box){% 144 | \begin{minipage}{0.47\textwidth} 145 | \scriptsize{ 146 | Vim is not a joke. Although you might not know how to exit it (yet), it is a very powerful tool. 147 | Our vim is filled with features, including code snippets, code completion (ROS aware), code formatting, syntax highlighting and tmux integration. 148 | Its control is completely mouse-less and it is fully usable over ssh, which makes it great for remote editing on a drone. 149 | Moreover, its modal editing paradigm is very intuitive. 150 | Lastly, when you learn how to control vim, you also learn to control other tools such as \emph{Linux manual pages}, \emph{ranger}, \emph{less} and much more. 151 | Even gmail uses vim-like controls natively. 152 | Run \texttt{:\$ vimtutor} to start learning vim using an interactive ``file tutorial''. 153 | Here are some simple commands: 154 | \begin{center} 155 | \begin{tabular}{lp{1cm} r lp{1cm} r} 156 | \hline 157 | switch to insert mode & \texttt{i} & jump a word/Word forwards & \texttt{w}/\texttt{W} \\ 158 | return to normal mode & \texttt{ESC} & jump a word/Word backwards & \texttt{b}/\texttt{B} \\ 159 | cut a line to clipboard & \texttt{dd} & change current word/Word & \texttt{ciw}/\texttt{ciW} \\ 160 | paste a clipboard & \texttt{p} & delete 3 lines down & \texttt{3dj} \\ 161 | \hline 162 | open a command line & \texttt{:} & substitute \emph{dog} for \emph{cat} & \texttt{:\%s/dog/cat/g} \\ 163 | save & \texttt{:w} & move cursor left/down/up/right & h/j/k/l\\ 164 | quit & \texttt{:q} & delete every line containing \emph{dog} & \texttt{:\%g/dog/normal dd} \\ 165 | \hline 166 | \end{tabular} 167 | 168 | \vspace{0.2em} 169 | Would You Like to Know More? \url{https://www.tutorialspoint.com/vim/} 170 | \vspace{-1em} 171 | \end{center} 172 | } 173 | \end{minipage} 174 | }; 175 | \node[fancytitle, right=10pt] at (box.north west) {Vim -- a modern modular text processor}; 176 | \end{tikzpicture} 177 | 178 | %%} 179 | 180 | %%{ GIT 181 | 182 | \begin{tikzpicture} 183 | \node [mybox] (box){% 184 | \begin{minipage}{0.47\textwidth} 185 | \scriptsize{Git is a distributed version control system. 186 | Repositories are equal, some are just used as a ``server'' (called \textbf{remote}). 187 | Git uses branches to isolate ongoing work on the same project. 188 | Branches can be merged to combine the work back into a single piece. 189 | Changes in the files should be \textbf{commited}. 190 | Only commit ``runnable'' code.} 191 | \begin{center} 192 | \scriptsize{ 193 | \begin{tabular}{lp{8.0cm} r} 194 | \hline 195 | Cloning a repository & over ssh \texttt{:\$ git clone git@mrs.felk.cvut.cz:uav/uav\_core} \\ 196 | & over https \texttt{:\$ git clone https://github.com/klaxalk/linux-setup} \\ 197 | \hline 198 | Update origin state & \texttt{:\$ git fetch} \\ 199 | Update current branch from remote & \texttt{:\$ git pull} \\ 200 | Update current branch to remote & \texttt{:\$ git push} \\ 201 | Commit ``patch'' -- interactive & \texttt{:\$ git commit -p} \\ 202 | Add files for commit & \texttt{:\$ git add [file]} \\ 203 | Commit changes & \texttt{:\$ git commit -m "commit message"} \\ 204 | \hline 205 | Checkout a branch & \texttt{:\$ git checkout [branch name]} \\ 206 | Create a branch & \texttt{:\$ git checkout -b [branch name]} \\ 207 | \hline 208 | unstage the file & \texttt{:\$ git reset [file name]} \\ 209 | undo all uncommited changes & \texttt{:\$ git reset --hard} \\ 210 | remove all new unstaged files & \texttt{:\$ git clean -fd} \\ 211 | \hline 212 | Merge a branch & \texttt{:\$ git merge [branch name]} \\ 213 | Rebase on a branch & \texttt{:\$ git rebase [branch name]} \\ 214 | \hline 215 | refactor branch history & \texttt{:\$ git filter-branch [lot of args]} \\ 216 | \hline 217 | show status & \texttt{:\$ git status} \\ 218 | show log & \texttt{:\$ git log} \\ 219 | show better log & \texttt{:\$ glog} \\ 220 | % & -- is an alias for \texttt{:\$ git log --graph --abbrev-commit --date=relative --pretty=format:'\%Cred\%h\%Creset -\%C(yellow)\%d\%Creset \%s \%Cgreen(\%cr) \%C(bold blue)<\%an>\%Creset'} \\ 221 | & -- is an alias for \texttt{:\$ git log} with more arguments\\ 222 | show super forest log & \texttt{:\$ flog} \\ 223 | & -- uses \texttt{~/.scripts/git-forest.sh} \\ 224 | \hline 225 | \end{tabular} 226 | 227 | \vspace{0.2em} 228 | Would You Like to Know More? \url{https://try.github.io/} 229 | \vspace{-1em} 230 | } 231 | \end{center} 232 | \end{minipage} 233 | }; 234 | \node[fancytitle, right=10pt] at (box.north west) {Git version control system}; 235 | \end{tikzpicture} 236 | 237 | %%} 238 | 239 | %%{ .bashrc 240 | 241 | \begin{tikzpicture} 242 | \node [mybox] (box){% 243 | \begin{minipage}{0.47\textwidth} 244 | \scriptsize{ 245 | When a new terminal is opened and an instance of bash is launched, the \texttt{$\sim$/.bashrc} file is \emph{sourced} (executed while its leftover variables, functions and aliases stay in the context). 246 | We use \texttt{.bashrc} heavily for setting context for ROS and our development environment. 247 | \texttt{.bashrc} sources ROS setup scripts, which are also generated by each workspace. 248 | If you change this file, source it (or open a new terminal) to activate the changes: \texttt{:\$ source $\sim$/.bashrc} or just \texttt{:\$ sb}. 249 | Here is an example of what should not be missing in the bottom of a healthy \texttt{.bashrc} file: 250 | \vspace{-1.5em} 251 | \begin{center} 252 | \begin{lstlisting} 253 | source /opt/ros/melodic/setup.bash 254 | source /usr/share/gazebo/setup.sh 255 | 256 | source ~/workspace/devel/setup.bash 257 | # source ~/other_workspace/devel/setup.bash 258 | 259 | export ROS_WORKSPACES="~/mrs_workspace ~/workspace" 260 | 261 | export GIT_PATH=$HOME/git 262 | 263 | export RUN_TMUX=true 264 | 265 | # VARIABLES TO CONFIGURE THE MRS ROS PIPELINE 266 | export UAV_NAME="uav1" 267 | ... 268 | export MRS_STATUS="readme" 269 | 270 | source $GIT_PATH/uav_core/miscellaneous/shell_additions/shell_additions.sh 271 | 272 | source $GIT_PATH/linux-setup/appconfig/bash/dotbashrc 273 | \end{lstlisting} 274 | \vspace{-1.5em} 275 | \end{center} 276 | } 277 | \end{minipage} 278 | 279 | }; 280 | \node[fancytitle, right=10pt] at (box.north west) {.bashrc -- Bash configuration}; 281 | \end{tikzpicture} 282 | 283 | %%} 284 | 285 | %%{ ROS IN LINUX TERMINAL 286 | 287 | \begin{tikzpicture} 288 | \node [mybox] (box){% 289 | \begin{minipage}{0.47\textwidth} 290 | \begin{center} 291 | \scriptsize{ 292 | \textbf{Please}, visit \url{http://wiki.ros.org/ROS/Tutorials} before starting work on a bigger project.\\ 293 | \textbf{Use $\langle\mathrm{Tab}\rangle$ to complete commands, topic names, message types and pre-fill message contents.} 294 | 295 | \begin{tabular}{lp{6.0cm} r} 296 | \hline 297 | Getting help & append \texttt{--help} after any following command\\ 298 | \hline 299 | Listing all ROS nodes & \texttt{:\$ rosnode list} \\ 300 | Listing all ROS topics & \texttt{:\$ rostopic list} \\ 301 | Listing all ROS services & \texttt{:\$ rosservice list} \\ 302 | Listing all ROS params & \texttt{:\$ rosparam list} \\ 303 | \hline 304 | Running a ROS binary & \texttt{:\$ rosrun package\_name binary\_name} \\ 305 | Running a launch file & \texttt{:\$ roslaunch package\_name launch\_file.launch} \\ 306 | \hline 307 | Showing a node info & \texttt{:\$ rosnode info /node/path} \\ 308 | Showing a topic info & \texttt{:\$ rostopic info /topic/path} \\ 309 | Showing a service info & \texttt{:\$ rosservice info /service/path} \\ 310 | \hline 311 | Showing a topic type & \texttt{:\$ rostopic type /topic/path} \\ 312 | Showing a service type & \texttt{:\$ rosservice type /topic/path} \\ 313 | \hline 314 | Showing a message type structure & \texttt{:\$ rosmsg show [msg type]} \\ 315 | Showing a service type structure & \texttt{:\$ rossrv show [srv type]} \\ 316 | \hline 317 | Showing topic messages & \texttt{:\$ rostopic echo /topic/path} \\ 318 | Showing a param value & \texttt{:\$ rosparam get /parm/path} \\ 319 | \hline 320 | Calling a service & \texttt{:\$ rosservice call /service/path [args]} \\ 321 | Publishing on a topic & \texttt{:\$ rostopic pub /topic/path [args]} \\ 322 | Setting a param value & \texttt{:\$ rosparam set /parm/path [args]} \\ 323 | \hline 324 | \end{tabular} 325 | } 326 | 327 | \vspace{0.2em} 328 | Would You Like to Know More? \url{http://wiki.ros.org/ROS/CommandLineTools} 329 | \vspace{-1em} 330 | \end{center} 331 | \end{minipage} 332 | }; 333 | \node[fancytitle, right=10pt] at (box.north west) {ROS in Linux terminal}; 334 | \end{tikzpicture} 335 | 336 | %%} 337 | 338 | %%{ ROS WORKSPACE STRUCTURE 339 | 340 | \begin{tikzpicture} 341 | \node [mybox] (box){% 342 | \begin{minipage}{0.47\textwidth} 343 | \subsubsection*{MRS lab main workspace} 344 | \begin{center} 345 | \scriptsize{ 346 | \begin{tabular}{lp{6.0cm} r} 347 | \hline 348 | path & \texttt{$\sim$/mrs\_workspace/}\\ 349 | contains & \texttt{src/uav\_core/} -- core MRS repository\\ 350 | & \texttt{src/uav\_modules/} -- modules MRS repository\\ 351 | \hline 352 | \end{tabular} 353 | } 354 | \end{center} 355 | \subsubsection*{MRS lab student workspace} 356 | \begin{center} 357 | \scriptsize{ 358 | \begin{tabular}{lp{6.0cm} r} 359 | \hline 360 | path & \texttt{$\sim$/workspace}\\ 361 | contains & \texttt{example\_packages/}\\ 362 | & -- \texttt{waypoint\_flier} -- general example\\ 363 | & -- \texttt{vision\_example} -- computer vision template\\ 364 | \hline 365 | \end{tabular} 366 | } 367 | \end{center} 368 | \subsubsection*{General ROS package structure} 369 | \begin{center} 370 | \scriptsize{ 371 | \begin{tabular}{lp{8.0cm} r} 372 | \hline 373 | \texttt{build} & generated makefiles and support files\\ 374 | & \textbf{do not modify}\\ 375 | \texttt{devel} & compiled binaries, libraries and installed headers\\ 376 | & \textbf{do not modify}\\ 377 | \texttt{src} & package source codes\\ 378 | & \textbf{place your stuff in here}\\ 379 | \hline 380 | \end{tabular} 381 | } 382 | 383 | \scriptsize{ 384 | \vspace{0.2em} 385 | \vspace{-1em} 386 | } 387 | \end{center} 388 | \end{minipage} 389 | }; 390 | \node[fancytitle, right=10pt] at (box.north west) {ROS workspace structure}; 391 | \end{tikzpicture} 392 | 393 | %%} 394 | 395 | %%{ NAVIGATING AND COMPILING ROS WORKSPACE 396 | 397 | \begin{tikzpicture} 398 | \node [mybox] (box){% 399 | \begin{minipage}{0.47\textwidth} 400 | \begin{center} 401 | \scriptsize{ 402 | \begin{tabular}{lp{5cm} r} 403 | \hline 404 | go to a package & \texttt{:\$ roscd [package name]}\\ 405 | \hline 406 | compile the whole workspace & \texttt{:\$ catkin build}\\ 407 | compile a particular package & \texttt{:\$ catkin build [package name]}\\ 408 | compile current package & \texttt{:\$ catkin bt}\\ 409 | clean the whole workspace & \texttt{:\$ catkin clean}\\ 410 | clean a particular package & \texttt{:\$ catkin clean [package name]}\\ 411 | \hline 412 | show workspace config & \texttt{:\$ catkin config}\\ 413 | show compilation profiles & \texttt{:\$ catkin profile list}\\ 414 | set a compilation profile & \texttt{:\$ catkin profile set [profile name]}\\ 415 | \hline 416 | create a new workspace & \texttt{:\$ catkin init}\\ 417 | set workspace extending & \texttt{:\$ catkin config --extend [path]}\\ 418 | \hline 419 | \end{tabular} 420 | 421 | \vspace{0.2em} 422 | Would You Like to Know More? \url{https://catkin-tools.readthedocs.io/en/latest/} 423 | \vspace{-1em} 424 | } 425 | \end{center} 426 | \end{minipage} 427 | }; 428 | \node[fancytitle, right=10pt] at (box.north west) {Navigating and compiling ROS workspace}; 429 | \end{tikzpicture} 430 | 431 | %%} 432 | 433 | %%{ ROS PACKAGE STRUCTURE 434 | 435 | \begin{tikzpicture} 436 | \node [mybox] (box){% 437 | \begin{minipage}{0.47\textwidth} 438 | \scriptsize {Some of the following items might be missing, depending on the package use case.} 439 | \begin{center} 440 | \scriptsize{ 441 | \begin{tabular}{lp{5.5cm} r} 442 | \hline 443 | \texttt{package.xml} & manifest, dependencies and plugins\\ 444 | \texttt{CMakeLists.txt} & description of compilation procedure\\ 445 | \texttt{src/} & \verb!C! and \verb!C++! source codes\\ 446 | \texttt{include/} & \verb!C! and \verb!C++! headers\\ 447 | \texttt{scripts/} & Python and bash scripts\\ 448 | \texttt{config/} & yaml config files\\ 449 | \texttt{cfg/} & dynamic reconfigure scripts\\ 450 | \texttt{launch/} & ROS launch files\\ 451 | \hline 452 | \end{tabular} 453 | } 454 | 455 | \vspace{0.2em} 456 | Would You Like to Know More? \url{http://wiki.ros.org/Packages} 457 | \vspace{-1em} 458 | \end{center} 459 | \end{minipage} 460 | }; 461 | \node[fancytitle, right=10pt] at (box.north west) {ROS package structure}; 462 | \end{tikzpicture} 463 | 464 | %%} 465 | 466 | %%{ ROS VISUALIZATION TOOLS 467 | 468 | \begin{tikzpicture} 469 | \node [mybox] (box){% 470 | \begin{minipage}{0.47\textwidth} 471 | \begin{center} 472 | \scriptsize{ 473 | \begin{tabular}{lp{6cm} r} 474 | \hline 475 | Rviz & 3-D visualization of data and models \\ 476 | & \texttt{:\$ rviz} \\ 477 | & \texttt{:\$ roslaunch mrs\_testing rviz\_uav1.launch} \\ \hline 478 | Rqt plot & simple and lightweight plotting \\ 479 | & \texttt{:\$ rqt\_plot} \\ \hline 480 | Rqt bag & visualizing contents of a rosbag \\ 481 | & \texttt{:\$ rqt\_bag} \\ \hline 482 | Plot juggler & complex and powerful plotting \\ 483 | & \texttt{:\$ rosrun plotjuggler PlotJuggler} \\ \hline 484 | Rqt reconfigure & online parameter setting \\ 485 | & \texttt{:\$ rosrun rqt\_reconfigure rqt\_reconfigure} \\ \hline 486 | Rqt image view & camera images visualization \\ 487 | & \texttt{:\$ rqt\_image\_view} \\ \hline 488 | Gazebo client & Gazebo GUI \\ 489 | & \texttt{:\$ gzclient} \\ \hline 490 | rqt & Integrates most of the \textit{rqt\_} tools \\ 491 | & \texttt{:\$ rqt} \\ \hline 492 | \end{tabular} 493 | } 494 | 495 | \vspace{0.2em} 496 | Would You Like to Know More? \url{http://wiki.ros.org/Tools} 497 | \vspace{-1em} 498 | \end{center} 499 | \end{minipage} 500 | }; 501 | \node[fancytitle, right=10pt] at (box.north west) {ROS visualization tools}; 502 | \end{tikzpicture} 503 | 504 | %%} 505 | 506 | %%{ USEFUL UAV ROS TOPICS AND SERVICES 507 | 508 | \begin{tikzpicture} 509 | \node [mybox] (box){% 510 | \begin{minipage}{0.47\textwidth} 511 | \scriptsize{ 512 | Following ROS services and topics allow for controlling the UAV from terminal. 513 | Each address contains a particular name of the UAV. 514 | } 515 | \subsubsection*{Informative topics (subscribe to know stuff)} 516 | \begin{center} 517 | \scriptsize{ 518 | \begin{tabular}{lp{6cm} r} 519 | \hline 520 | state estimate (rviz-able) & \texttt{/uav1/odometry/odom\_main}\\ 521 | control reference (rviz-able) & \texttt{/uav1/control\_manager/cmd\_odom}\\ 522 | control reference (full-state) & \texttt{/uav1/control\_manager/position\_cmd}\\ 523 | control manager diagnostics & \texttt{/uav1/control\_manager/diagnostics}\\ 524 | \hline 525 | \end{tabular} 526 | } 527 | \end{center} 528 | \subsubsection*{Control Services/Topics (call or publish to influence stuff)} 529 | \begin{center} 530 | \scriptsize{ 531 | The addresses for \emph{reference}, \emph{trajectory\_reference} are the same for both the topic and the service. 532 | \vspace{0.2em} 533 | \begin{tabular}{lp{8cm} r} 534 | \hline 535 | position+heading goal & \texttt{/uav1/control\_manager/reference}\\ 536 | \hline 537 | takeoff & \texttt{/uav1/uav\_manager/takeoff}\\ 538 | land & \texttt{/uav1/uav\_manager/land}\\ 539 | land home & \texttt{/uav1/uav\_manager/land\_home}\\ 540 | hover & \texttt{/uav1/uav\_manager/hover}\\ 541 | \hline 542 | switch controller & \texttt{/uav1/control\_manager/switch\_controller [Controller]}\\ 543 | switch tracker & \texttt{/uav1/control\_manager/switch\_tracker [Tracker]}\\ 544 | set tracker constraints & \texttt{/uav1/constraint\_manager/set\_constraints [Constraints]}\\ 545 | set SO(3) controller gains & \texttt{/uav1/gain\_manager/set\_gains [Gains]}\\ 546 | \hline 547 | load trajectory & \texttt{/uav1/control\_manager/trajectory\_reference}\\ 548 | trajectory goto start & \texttt{/uav1/control\_manager/goto\_trajectory\_start}\\ 549 | trajectory start tracking & \texttt{/uav1/control\_manager/start\_trajectory\_tracking}\\ 550 | \hline 551 | \end{tabular} 552 | 553 | \vspace{0.2em} 554 | \tiny Would You Like to Know More? \url{https://ctu-mrs.github.io/docs/api/uav_ros_api} 555 | \vspace{-1em} 556 | } 557 | \end{center} 558 | \end{minipage} 559 | }; 560 | \node[fancytitle, right=10pt] at (box.north west) {Useful UAV ROS topics and services}; 561 | \end{tikzpicture} 562 | 563 | %%} 564 | 565 | \clearpage 566 | 567 | %%{ SSH keys 568 | 569 | \begin{tikzpicture} 570 | \node [mybox] (box){% 571 | \begin{minipage}{0.47\textwidth} 572 | \scriptsize{ 573 | \begin{itemize} 574 | \setlength\itemsep{0.0em} 575 | \item Generate your SSH key by: \texttt{:\$ ssh-keygen -t rsa -b 4096 -C "your\_email@example.com"}. 576 | \item The keys are stored in \texttt{$\sim$/.ssh}. 577 | \item Show the content of the public key by: \texttt{:\$ cat $\sim$/.ssh/id\_rsa.pub} and copy it to Github or Gitlab. 578 | \item Copy your public key over ssh to another machine by: \texttt{:\$ ssh-copy-id user@machine}. 579 | \item Entries in the \texttt{$\sim$/.ssh/config} allow connecting to a machine via alias while using an ssh key: 580 | \end{itemize} 581 | \vspace{-2.8em} 582 | \begin{center} 583 | \begin{lstlisting} 584 | host mrs 585 | hostname mrs.felk.cvut.cz 586 | user git 587 | identityfile ~/.ssh/id_rsa 588 | \end{lstlisting} 589 | \end{center} 590 | \vspace{-3.0em} 591 | } 592 | \end{minipage} 593 | }; 594 | \node[fancytitle, right=10pt] at (box.north west) {SSH keys}; 595 | \end{tikzpicture} 596 | 597 | %%} 598 | 599 | %%{ UAV SPAWNING 600 | 601 | \begin{tikzpicture} 602 | \node [mybox] (box){% 603 | \begin{minipage}{0.47\textwidth} 604 | \scriptsize{ 605 | We use a ROS node called \texttt{mrs\_drone\_spawner} to dynamically load a UAV into the Gazebo/ROS simulator. 606 | By default, it starts automatically with Gazebo using \texttt{:\$ roslaunch mrs\_simulation simulation.launch}. \\ 607 | Spawn a drone by calling a service \texttt{:\$ rosservice call /mrs\_drone\_spawner/spawn "1 --enable-rangefinder"} \\ 608 | If the service does not exist, start the spawner by \texttt{:\$ roslaunch mrs\_simulation mrs\_drone\_spawner.launch} \\ 609 | Various arguments can be used to influence the type of the drone, its sensors, its starting location and additional onboard hardware. 610 | Run the command \texttt{:\$ rosrun mrs\_simulation mrs\_drone\_spawner.py} to see the complete list. Here are some notable examples: 611 | \begin{center} 612 | \begin{tabular}{lp{5cm} r} 613 | \hline 614 | use initial position from a CSV file (id, x, y, z, heading) & \texttt{--file [path\_to\_file]} \\ 615 | use initial position from an argument & \texttt{--pos [x y z heading]} \\ 616 | selecting UAV type (f450, f550, t650) & \texttt{--f450}, \texttt{--f550}, \texttt{--t650} \\ 617 | \hline 618 | add down-facing rangefinder & \texttt{--enable-rangefinder} \\ 619 | add front-facing camera & \texttt{--enable-bluefox-camera} \\ 620 | add front-facing RealSense & \texttt{--enable-realsense-front} \\ 621 | add 2-D rangefinder & \texttt{--enable-rplidar} \\ 622 | add 3-D rangefinder & \texttt{--enable-velodyne} \\ 623 | \hline 624 | add UV camera for UVDAR & \texttt{--enable-uv-camera} \\ 625 | add UV leds for UVDAR & \texttt{--enable-uv-leds} \\ 626 | set UV led frequencies (left) & \texttt{--uvled-fr-l [freq]} \\ 627 | \hline 628 | add super long pendulum & \texttt{--enable-pendulum} \\ 629 | add ball holder & \texttt{--enable-ball-holder} \\ 630 | \hline 631 | \end{tabular} 632 | \end{center} 633 | A typical simulation spawning looks like:\\ 634 | \texttt{:\$ rosservice call /mrs\_drone\_spawner/spawn "1 --f450 --enable-rangefinder"} 635 | \vspace{-1em} 636 | } 637 | \end{minipage} 638 | }; 639 | \node[fancytitle, right=10pt] at (box.north west) {Spawning a UAV in Gazebo simulator}; 640 | \end{tikzpicture} 641 | 642 | %%} 643 | 644 | %%{ ROS on a remote machine 645 | 646 | \begin{tikzpicture} 647 | \node [mybox] (box){% 648 | \begin{minipage}{0.47\textwidth} 649 | \begin{center} 650 | \scriptsize{ 651 | \begin{itemize} 652 | \setlength\itemsep{0.0em} 653 | \item Add your \textbf{local} machine hostname to the \textbf{remote} machine's hostname \texttt{/etc/hosts} and vice versa. 654 | \item Make sure the \textbf{robot's} \texttt{/etc/hosts} contains the '\texttt{127.0.1.1 }' entry. 655 | \item Make sure the machines can ping each other using their hostnames. 656 | \item Add \texttt{export ROS\_MASTER\_URI=http://localhost:11311} to the \textbf{remote}'s (robot's) .bashrc. 657 | \item Add \texttt{export ROS\_MASTER\_URI=http://:11311} to the \textbf{local}'s .bashrc, where \textbf{hostname} is the \textbf{remote}'s hostname. 658 | \item Add \texttt{export ROS\_IP=} to the \textbf{local}'s .bashrc, where the IP should be of the interface used to communicate with the robot. 659 | \item \textbf{Do NOT export ROS\_IP in the remote's (robot's) .bashrc} 660 | \item \textbf{Remove the remote's (robot's) own hostname in \texttt{/etc/hosts} except of \texttt{127.0.1.1}.} 661 | \item Run roscore only on the \textbf{remote} machine. 662 | \end{itemize} 663 | } 664 | \vspace{-0.8em} 665 | \end{center} 666 | \end{minipage} 667 | }; 668 | \node[fancytitle, right=10pt] at (box.north west) {ROS on a remote machine}; 669 | \end{tikzpicture} 670 | 671 | %%} 672 | 673 | %%{ THE MATH THAT EVERYBODY NEEDS, BUT NOBODY REMEMBERS 674 | 675 | \begin{tikzpicture} 676 | \node [mybox] (box){% 677 | \begin{minipage}{0.47\textwidth} 678 | \begin{multicols*}{2} 679 | \begin{minipage}{0.30\textwidth} 680 | \begin{center} 681 | \scriptsize{2-D rotational matrix:} 682 | \vspace{-0.5em} 683 | \small{ 684 | $$ 685 | \mathbf{R}\left(\phi\right) = \begin{bmatrix} 686 | \cos\phi & -\sin\phi \\ 687 | \sin\phi& \cos\phi 688 | \end{bmatrix} 689 | $$ 690 | } 691 | \end{center} 692 | \end{minipage} 693 | \begin{minipage}{0.65\textwidth} 694 | \begin{center} 695 | \scriptsize{ 696 | Degrees-to-radian conversion table with values of $\sin$ and $\cos$:\\ 697 | \begin{tabular}{c|ccccccc} 698 | \hline 699 | deg & 0 & 30 & 45 & 60 & 90 & 120 & 180 \\ 700 | rad & 0 & 0.523 & 0.785 & 1.047 & 1.57 & 2.09 & 3.14 \\ 701 | \hline 702 | $\sin$ & 0.0 & 0.500 & 0.707 & 0.866 & 1.0 & 0.866 & 0.0\\ 703 | $\cos$ & 1.0 & 0.866 & 0.707 & 0.500 & 0.0 & -0.50 & -1.0 704 | \end{tabular} 705 | } 706 | \end{center} 707 | \end{minipage} 708 | \end{multicols*} 709 | \end{minipage} 710 | }; 711 | \node[fancytitle, right=10pt] at (box.north west) {The math that everybody needs, but nobody remembers}; 712 | \end{tikzpicture} 713 | 714 | %%} 715 | 716 | %%{ QR CODE 717 | 718 | % \begin{minipage}{0.40\textwidth} 719 | % \vspace{2.5em} 720 | % \begin{left} 721 | % \includegraphics[height=3.0cm]{./fig/qr.png} 722 | % \end{left} 723 | % \end{minipage} 724 | 725 | %%} 726 | 727 | \vspace{10em} 728 | 729 | %%{ QUATERNIONS 730 | 731 | \begin{tikzpicture} 732 | \node [mybox] (box){% 733 | \begin{minipage}{0.47\textwidth} 734 | \begin{center} 735 | \scriptsize{ 736 | ``Complex'' numbers with three imaginary parts: $i$, $j$, $k$ and $\|\cdot\| = 1$. 737 | \begin{tabular}{lp{8cm} r} 738 | \hline 739 | By axis $\left[x, y, z\right]$ and angle $\phi$ & $q = \cos\frac{\phi}{2} + \left(xi + yj + zk\right)\sin\frac{\phi}{2}$ \\ 740 | Component-wise & $q_w = \cos\frac{\phi}{2}$, $q_x = x\sin\frac{\phi}{2}$, $q_y = y\sin\frac{\phi}{2}$, $q_z = z\sin\frac{\phi}{2}$ \\ 741 | Inverse quaternion & $q^{-1} = \cos\frac{-\phi}{2} + \left(xi + yj + zk\right)\sin\frac{-\phi}{2} = \frac{q_w - q_xi - q_yj - q_zk}{q_w^2 + q_x^2 + q_y^2 + q_z^2}$ \\ 742 | Transforming the vector $\left[1, 2, 3\right]$ & $u = 0 + 1i + 2j + 3k$, $v = quq^{-1}$ \\ 743 | \hline 744 | \end{tabular} 745 | \\ 746 | \vspace{1em} 747 | Converting various representations of rotation using \texttt{mrs\_lib::AttitudeConverter}: 748 | \vspace{-0.5em} 749 | \begin{lstlisting} 750 | # every combination is possible 751 | tf2::Quaternion tf2_quat = AttitudeConverter(roll, pitch, yaw); 752 | tf2::Matrix3x3 tf2_matrix = AttitudeConverter(tf2_quat); 753 | geometry_msgs::Quaternion quaternion = AttitudeConverter(tf2_matrix); 754 | Eigen::Quaterniond eig_quat = AttitudeConverter(guaternion); 755 | Eigen::AngleAxis eig_angle_axis = AttitudeConverter(eig_quat); 756 | Eigen::Matrix3d eig_matrix = AttitudeConverter(eig_angle_axis); 757 | auto [roll2, pitch2, yaw2] = AttitudeConverter(eig_matrix); 758 | tie(roll2, pitch2, yaw2) = AttitudeConverter(roll2, pitch2, yaw2); 759 | double heading1 = AttitudeConverter(tf2_quat).getHeading(); 760 | \end{lstlisting} 761 | Would You Like to Know More? \url{https://eater.net/quaternions} \\ 762 | \vspace{-1em} 763 | } 764 | \end{center} 765 | \end{minipage} 766 | }; 767 | \node[fancytitle, right=10pt] at (box.north west) {Quaternions (unit quaternions)}; 768 | \end{tikzpicture} 769 | 770 | %%} 771 | 772 | %%{ COMMON ROS HANDLERS IN C++ 773 | 774 | \begin{tikzpicture} 775 | \node [mybox] (box){% 776 | \begin{minipage}{0.47\textwidth} 777 | \begin{center} 778 | \scriptsize{ 779 | \begin{tabular}{lp{10cm} r} 780 | \hline 781 | node handler & \texttt{ros::NodeHandle nh = ros::NodeHandle("$\sim$");} \\ 782 | nodelet handler & \texttt{ros::NodeHandle nh = nodelet::Nodelet::getMTPrivateNodeHandle();} \\ 783 | \hline 784 | subscriber & \texttt{ros::Subscriber subscriber = nh.subscribe("name", 1, callback, this, ros::TransportHints().tcpNoDelay());} \\ 785 | publisher & \texttt{ros::Publisher publisher = nh.advertise("name", 1);} \\ 786 | \hline 787 | service client & \texttt{ros::ServiceClient client = nh.serviceClient("name");} \\ 788 | service server & \texttt{ros::ServiceServer server = nh.advertiseService("name", callback, this);} \\ 789 | \hline 790 | timer & \texttt{ros::Timer timer = nh.createTimer(ros::Rate(30), callback, this);} \\ 791 | \hline 792 | \end{tabular} 793 | 794 | \vspace{0.2em} 795 | Would You Like to Know More? \url{http://wiki.ros.org/ROS/Tutorials} 796 | \vspace{-1em} 797 | } 798 | \end{center} 799 | \end{minipage} 800 | }; 801 | \node[fancytitle, right=10pt] at (box.north west) {Common ROS handlers in \verb!C++!}; 802 | \end{tikzpicture} 803 | 804 | %%} 805 | 806 | %%{ COMMON ROS HANDLERS IN Python 807 | 808 | \begin{tikzpicture} 809 | \node [mybox] (box){% 810 | \begin{minipage}{0.47\textwidth} 811 | \begin{center} 812 | \scriptsize{ 813 | \begin{tabular}{lp{10cm} r} 814 | \hline 815 | node handler & \texttt{rospy.init\_node('node\_name', anonymous=True)} \\ 816 | \hline 817 | subscriber & \texttt{subscriber = rospy.Subscriber('$\sim$topic\_name', MessageClass, callback, queue\_size=1)} \\ 818 | publisher & \texttt{publisher = rospy.Publisher('$\sim$topic\_name', MessageClass, queue\_size=1)} \\ 819 | \hline 820 | service client & \texttt{client = rospy.ServiceProxy('$\sim$service\_name', MessageClass)}\\ 821 | service server & \texttt{server = rospy.Service('$\sim$service\_name', MessageClass, callback)} \\ 822 | \hline 823 | timer & \texttt{timer = rospy.Timer(rospy.Duration(1/30.0), callback)} \\ 824 | \hline 825 | \end{tabular} 826 | 827 | \vspace{0.2em} 828 | Would You Like to Know More? \url{http://wiki.ros.org/ROS/Tutorials} 829 | \vspace{-1em} 830 | } 831 | \end{center} 832 | \end{minipage} 833 | }; 834 | \node[fancytitle, right=10pt] at (box.north west) {Common ROS handlers in Python}; 835 | \end{tikzpicture} 836 | 837 | %%} 838 | 839 | %%{ COMMON EIGEN OPERATIONS IN \VERB!C++! 840 | 841 | \begin{tikzpicture} 842 | \node [mybox] (box){% 843 | \begin{minipage}{0.47\textwidth} 844 | \begin{center} 845 | \scriptsize{ 846 | \begin{tabular}{ll|ll} 847 | Fixed matrix & \texttt{Matrix A;} & element-wise product & \texttt{P.cwiseProduct(Q)} \\ 848 | Dynamic matrix & \texttt{MatrixXd A;} & Norm & \texttt{v.norm()}\\ 849 | Dynamic vector & \texttt{VectorXd v;} & Squred norm & \texttt{v.squaredNorm()} \\ 850 | Zero matrix & \texttt{MatrixXd::Zero(rows, cols)} & Dot product & \texttt{v.dot(u)}\\ 851 | Identity matrix & \texttt{MatrixXd::Identity(n, n)} & Cross product & \texttt{v.cross(v)}\\ 852 | Vector element & \texttt{v(n)} & Solve Ax=b & \texttt{x = A.qr().solve(b);} \\ 853 | Matrix element & \texttt{A(row, column)} & Eigen-decomposition & \texttt{EigenSolver eig(A);}\\ 854 | Matrix inversion & \texttt{A.inverse()} & Matrix transposition & \texttt{A.transpose()} \\ 855 | Matrix column & \texttt{A.col(n)} & \tiny\texttt{\#include } & for everything\\ 856 | no. of rows and cols & \texttt{A.rows()}, \texttt{A.cols()} & \tiny\texttt{\#include } & for cross\\ 857 | Sub-matrix & \texttt{A.block(i, j, rows, cols)} & \tiny\texttt{\#include } & for QR decomposition\\ 858 | \hline 859 | \end{tabular} 860 | \vspace{0.2em} 861 | Would You Like to Know More? \url{https://eigen.tuxfamily.org/dox/AsciiQuickReference.txt} 862 | \vspace{-1em} 863 | } 864 | \end{center} 865 | \end{minipage} 866 | }; 867 | \node[fancytitle, right=10pt] at (box.north west) {Common Eigen operations in \verb!C++!}; 868 | \end{tikzpicture} 869 | 870 | %%} 871 | 872 | \clearpage 873 | 874 | %%{ GDB 875 | 876 | \begin{tikzpicture} 877 | \node [mybox] (box){% 878 | \begin{minipage}{0.47\textwidth} 879 | \scriptsize{If you're experiencing crashes of your \verb!C!/\verb!C++! ROS node/nodelet or if your program is not behaving as expected in general and you want to inspect it, you can reach for a debugger. A debugger (namely GDB in our case) enables you to inspect the state of the program after a crash or at any point during the program runtime and is a very powerful tool for rooting out bugs.} 880 | \begin{center} 881 | \scriptsize{ 882 | \vspace{-1.5em} 883 | \begin{tabular}{lll} 884 | \hline 885 | \textbf{command} & \textbf{description} & \textbf{comment} \\ 886 | \hline 887 | \texttt{b filename.cpp:310} & breakpoint in \emph{filename.cpp} at line 310 & \\ 888 | \texttt{bt} & backtrace & \\ 889 | \texttt{f } & change to frame \texttt{} & \texttt{} = the number from bt \\ 890 | \texttt{s} & step in function & \\ 891 | \texttt{n} & step to the next line & \\ 892 | \texttt{fin} & finish function & in case you accidentaly step into \\ 893 | \texttt{c} & continue & resume program until breakpoint or crash \\ 894 | \texttt{p } & print variable & \texttt{} = variable name \\ 895 | \texttt{wh} & open window with code (tui) & actually sets window height \\ 896 | \texttt{tui enable/disable} & open/close window with code (tui) & the official way of wh \\ 897 | \texttt{focus cmd/src} & changes focus in gdb tui & if you want to use arrows for cmd hist. \\ 898 | \texttt{up/down} & jumps in the frames ip/down & \\ 899 | \texttt{} & repeats the last command & \\ 900 | \texttt{u } & continue until line \texttt{} & \texttt{} = the line number in the current file \\ 901 | \texttt{ref} & refresh the screen & in case of some visual problems \\ 902 | \texttt{run} & run the executable & \\ 903 | \texttt{thread apply all \#} & apply command \# to all threads & \\ 904 | \hline 905 | the \emph{.gdbinit} file & put pre-start settings in here & an example is in the file \\ 906 | --args exec arg1 ... & running executable with args & \\ 907 | \hline 908 | \end{tabular} 909 | } 910 | 911 | \vspace{0.2em} 912 | Would You Like to Know More? \url{https://ctu-mrs.github.io/docs/software/gdb.html} 913 | \vspace{-1em} 914 | \end{center} 915 | \end{minipage} 916 | }; 917 | \node[fancytitle, right=10pt] at (box.north west) {GDB - GNU Debugger}; 918 | \end{tikzpicture} 919 | 920 | %%} 921 | 922 | %%{ mrs_lib::Transformer 923 | 924 | \begin{tikzpicture} 925 | \node [mybox] (box){% 926 | \begin{minipage}{0.47\textwidth} 927 | \scriptsize{ 928 | Although \emph{ros::tf2} library provides options for transforming data between frames of reference, it is far from friendly-to-use. 929 | Therefore, we have built a wrapper that simplifies most of the tasks.} 930 | \begin{center} 931 | \scriptsize{ 932 | \begin{tabular}{ll} 933 | \hline 934 | \verb!include ! & include this \\ 935 | \verb!mrs_lib::Transformer transformer_;! & declare \\ 936 | \verb!transformer_ = mrs_lib::Transformer();! & initialize \\ 937 | \hline 938 | \end{tabular} 939 | 940 | \vspace{-0.5em} 941 | \begin{itemize} 942 | \setlength\itemsep{0.0em} 943 | \item \texttt{mrs\_lib::Transformer} is capable of inferring full name of a UAV: \texttt{gps\_origin -> uav3/gps\_origin} (after enabling by \verb!transformer_.setDefaultPrefix();!. 944 | \item \texttt{mrs\_lib::Transformer} finds the latest available \texttt{} if there is none available for \texttt{