\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{FLL Tech Tacos (flltech2019)} \pdfinfo{ /Title (pybricks-cheatsheet-by-fll-techtacos-sugarland.pdf) /Creator (Cheatography) /Author (FLL Tech Tacos (flltech2019)) /Subject (pybricks cheatsheet By FLL TechTacos SugarLand Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{45BFBF} \definecolor{LightBackground}{HTML}{F3FBFB} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{pybricks cheatsheet By FLL TechTacos SugarLand Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{FLL Tech Tacos (flltech2019)} via \textcolor{DarkBackground}{\uline{cheatography.com/94480/cs/20710/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}FLL Tech Tacos (flltech2019) \\ \uline{cheatography.com/flltech2019} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 6th October, 2019.\\ Updated 6th October, 2019.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{3} \begin{tabularx}{5.377cm}{x{0.84609 cm} x{4.13091 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Package}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{pybricks} & {\bf{pybricks}} is a python package which contains all the modules to interact with EV3 Brick and associated hardware \tn % Row Count 4 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{0.9954 cm} x{3.9816 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Module}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{ev3brick} & {\bf{ev3brick}} is a module which contains {\emph{mehods}} and {\emph{class methods}} to deal with EV3 brick \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \seqsplit{ev3devices} & {\bf{ev3devices}} is a module that deals with {\emph{Motor}} and {\emph{Sensor}} classes \tn % Row Count 6 (+ 3) % Row 2 \SetRowColor{LightBackground} \seqsplit{parameters} & Special kind of Module which deals with constants (Ex: color BLUE, Post.A etc). Also some static sound file names etc., \tn % Row Count 10 (+ 4) % Row 3 \SetRowColor{white} tools & Used for dealing with Timing and Datalogging. Provides ability print output to terminal, wait and stop watch etc., \tn % Row Count 14 (+ 4) % Row 4 \SetRowColor{LightBackground} \seqsplit{robotics} & Provides drivebase functionality. This is the module that makes your EV3 Move in different dicrection. \tn % Row Count 18 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{ev3Brick}} \tn % Row 0 \SetRowColor{LightBackground} buttons() & {\emph{Method}} that get a {\bf{List}} of buttons pressed \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} light\{\{nl\}\}(Color) & {\emph{Method}} that sets a back color on the brick. Refer to {\emph{parameters}} module for Color constants \tn % Row Count 8 (+ 5) % Row 2 \SetRowColor{LightBackground} {\bf{sound}}.beep(frequency,duration,volume) & {\emph{classmethod}} using {\bf{sound}} class. Play a beep/tone \tn % Row Count 11 (+ 3) % Row 3 \SetRowColor{white} {\bf{sound}}.beeps\{\{nl\}\}(number) & {\emph{classmethod}} using {\bf{sound}} class. Play a number of default beeps with a brief pause in between. \tn % Row Count 16 (+ 5) % Row 4 \SetRowColor{LightBackground} {\bf{sound}}.file\{\{nl\}\}(file\_name,volume) & {\emph{classmethod}} using {\bf{sound}} class. Play a sound file. \tn % Row Count 19 (+ 3) % Row 5 \SetRowColor{white} {\bf{display}}.clear() & {\emph{classmethod}} of display on the brick.\{\{nl\}\}Clear everything on the display. \tn % Row Count 23 (+ 4) % Row 6 \SetRowColor{LightBackground} {\bf{display}}.text(text,cordinate) & {\emph{classmethod}} of display.\{\{nl\}\} Takes inputs and displays on the brick LCD panel \tn % Row Count 27 (+ 4) % Row 7 \SetRowColor{white} {\bf{battery}}.voltage & {\emph{classmethod}} of battery.\{\{nl\}\} Get the voltage of the battery \tn % Row Count 31 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{ev3Brick (cont)}} \tn % Row 8 \SetRowColor{LightBackground} {\bf{battery}}.current & {\emph{classmethod}} of battery.\{\{nl\}\} Get the current supplied by the brick \tn % Row Count 4 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{ev3devices}} \tn % Row 0 \SetRowColor{LightBackground} Motor\{\{nl\}\}(port, \seqsplit{direction=Direction.CLOCKWISE}, gears=None) & Class that provides dealing with each Motor \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} {\bf{TouchSensor(port)}} & Deals with Touch \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} {\bf{ColorSensor(port)}} & Reads Color \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} {\bf{InfraredSensor(port)}} & Gets the distance using infrared light \tn % Row Count 9 (+ 2) % Row 4 \SetRowColor{LightBackground} {\bf{UltrasonicSensor\{\{nl\}\}(port)}} & Gets the distance using sound waves \tn % Row Count 11 (+ 2) % Row 5 \SetRowColor{white} {\bf{GyroSensor(port, direction=Direction.CLOCKWISE)}} & Used for measuring the robot's rotational motion. Helps in creating balncing Robots \tn % Row Count 16 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{{\bf{Motor Methods}}}} \tn % Row 0 \SetRowColor{LightBackground} angle() & Get the rotation angle of the motor. \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} reset\_angle\{\{nl\}\}(angle) & Reset the angle of the motor \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} speed() & Get the speed (angular velocity) of the motor. \tn % Row Count 7 (+ 3) % Row 3 \SetRowColor{white} stop\{\{nl\}\}(stop\_type=Stop.COAST) & Stop the motor. Refer to {\emph{Stop}} in parameters to see available stop types \tn % Row Count 11 (+ 4) % Row 4 \SetRowColor{LightBackground} run(speed) & Keep the motor running at a constant speed (angular velocity). \tn % Row Count 15 (+ 4) % Row 5 \SetRowColor{white} run\_time\{\{nl\}\}(speed, time, \seqsplit{stop\_type=Stop.COAST}, wait=True) & Run the motor at a constant speed (angular velocity) for a given amount of time \tn % Row Count 19 (+ 4) % Row 6 \SetRowColor{LightBackground} run\_angle\{\{nl\}\}(speed, rotation\_angle, \seqsplit{stop\_type=Stop.COAST}, wait=True) & Run the motor at a constant speed (angular velocity) by a given angle. \tn % Row Count 23 (+ 4) % Row 7 \SetRowColor{white} run\_target\{\{nl\}\}(speed, target\_angle, \seqsplit{stop\_type=Stop.COAST}, wait=True) & Run the motor at a constant speed (angular velocity) towards a given target angle. \tn % Row Count 28 (+ 5) % Row 8 \SetRowColor{LightBackground} track\_target\{\{nl\}\}(target\_angle) & Track a target angle that varies in time.\{\{nl\}\}This method is useful in fast loops where the motor target changes continuously. \tn % Row Count 35 (+ 7) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{{\bf{Motor Methods}} (cont)}} \tn % Row 9 \SetRowColor{LightBackground} stalled() & Check whether the motor is currently stalled. \tn % Row Count 3 (+ 3) % Row 10 \SetRowColor{white} run\_until\_stalled\{\{nl\}\}(speed, \seqsplit{stop\_type=Stop.COAST}, \seqsplit{duty\_limit=default)} & Run the motor at a constant speed (angular velocity) until it stalls. The motor is considered stalled when it cannot move even with the maximum torque. \tn % Row Count 11 (+ 8) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Motor Methods ...}} \tn % Row 0 \SetRowColor{LightBackground} set\_dc\_settings\{\{nl\}\}(duty\_limit, duty\_offset) & Configure the settings to adjust the behavior of the dc() command. This also affects all of the run commands, which use the dc() method in the background. \tn % Row Count 8 (+ 8) % Row 1 \SetRowColor{white} set\_run\_settings\{\{nl\}\}(max\_speed, acceleration) & Configure the maximum speed and \seqsplit{acceleration/deceleration} of the motor for all run commands. This applies to the {\bf{run}}, {\bf{run\_time}}, {\bf{run\_angle}}, {\bf{run\_target}}, or {\bf{run\_until\_stalled}} commands you give the motor. See also the default parameters for each motor. \tn % Row Count 22 (+ 14) % Row 2 \SetRowColor{LightBackground} set\_pid\_settings\{\{nl\}\}(kp, ki, kd, tight\_loop\_limit, angle\_tolerance, speed\_tolerance, stall\_speed, stall\_time) & Configure the settings of the position and speed controllers. See also pid and the default parameters for each motor. \tn % Row Count 28 (+ 6) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{0.94563 cm} x{4.03137 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{TouchSensor}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{pressed} & Returns {\bf{true}} or {\bf{false}} \tn % Row Count 1 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.14471 cm} x{3.83229 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{ColorSensor}} \tn % Row 0 \SetRowColor{LightBackground} color() & Measures the color of surface \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \seqsplit{ambient()} & Measures the ambient light intensity \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \seqsplit{reflection()} & Measure the reflection of a surface using a red light. \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} rgb() & Measure the reflection of a surface using a red, green, and then a blue light. \tn % Row Count 8 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.74195 cm} x{3.23505 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{InfraredSensor}} \tn % Row 0 \SetRowColor{LightBackground} distance() & Measure the relative distance between the sensor and an object using infrared light. \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} beacon\{\{nl\}\}(channel) & Measure the relative distance and angle between the remote and the infrared sensor. \tn % Row Count 8 (+ 4) % Row 2 \SetRowColor{LightBackground} buttons\{\{nl\}\}(channel) & Check which buttons on the infrared remote are pressed. \tn % Row Count 11 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.9908 cm} x{2.9862 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Ultrasonic Sensor}} \tn % Row 0 \SetRowColor{LightBackground} distance\{\{nl\}\}silent=False) & Measure the distance between the sensor and an object using ultrasonic sound waves. \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} presence() & Check for the presence of other ultrasonic sensors by detecting ultrasonic sounds. \tn % Row Count 8 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.89126 cm} x{3.08574 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Gyroscopic Sensor}} \tn % Row 0 \SetRowColor{LightBackground} speed() & Get the speed (angular velocity) of the sensor. \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} angle() & Get the accumulated angle of the sensor. \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} reset\_angle\{\{nl\}\}(angle) & Set the rotation angle of the sensor to a desired value. \tn % Row Count 7 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{0.89586 cm} x{4.08114 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{parameters}} \tn % Row 0 \SetRowColor{LightBackground} Port & ... \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \seqsplit{Direction} & ... \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} Stop & ... \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} Color & ... \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} Button & ... \tn % Row Count 6 (+ 1) % Row 5 \SetRowColor{white} Align & ... \tn % Row Count 7 (+ 1) % Row 6 \SetRowColor{LightBackground} \seqsplit{ImageFile} & Information, LEGO, Objects and Eyes \tn % Row Count 9 (+ 2) % Row 7 \SetRowColor{white} \seqsplit{SoundFile} & Expressions (CHEERING etc.,), Information, Communication, Movements, Color, Mechanical, Animals, Numbers and System \tn % Row Count 13 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Tools}} \tn % Row 0 \SetRowColor{LightBackground} print\{\{nl\}\}(value, ..., sep, end, file, flush) & Print values on the terminal or a stream. \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} wait(time) & Pause the user program for a specified amount of time. \tn % Row Count 6 (+ 3) % Row 2 \SetRowColor{LightBackground} {\bf{StopWatch}} Class & A stopwatch to measure time intervals. Similar to the stopwatch feature on your phone.\{\{nl\}\}{\bf{Supported Methods:}}\{\{nl\}\}time, pause, resume, reset \tn % Row Count 14 (+ 8) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{robotics}} \tn % Row 0 \SetRowColor{LightBackground} DriveBase\{\{nl\}\}(left\_motor, right\_motor, wheel\_diameter, axle\_track) & Class representing a robotic vehicle with two powered wheels and optional wheel caster(s). \tn % Row Count 5 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.43873 cm} x{2.53827 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{robotics Methods}} \tn % Row 0 \SetRowColor{LightBackground} drive\{\{nl\}\}(speed, steering) & Start driving at the specified speed and turnrate, both measured at the center point between the wheels of the robot. \tn % Row Count 6 (+ 6) % Row 1 \SetRowColor{white} drive\_time\{\{nl\}\}(speed, steering, time) & Drive at the specified speed and turnrate for a given amount of time, and then stop. \tn % Row Count 11 (+ 5) % Row 2 \SetRowColor{LightBackground} stop\{\{nl\}\}(stop\_type=Stop.COAST) & Stop the robot. \tn % Row Count 13 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}