~~NOTOC~~ ====== Czech-Taiwan-Germany Robotics Workshop 2024 ====== * Welcome to the [[https://comrob.fel.cvut.cz/|Computational Robotics Laboratory]], part of the [[https://www.aic.fel.cvut.cz/|Artificial Intelligence Center]] at the [[https://cs.fel.cvut.cz|Computer Science Department]], at the [[https://fel.cvut.cz/cs|Faculty of Electrical Engineering, Czech Technical University in Prague]]. * Today, we shall create a simple behavior for a simulated hexapod walking robot, which would allow the robot to reactively avoid obstacles while pursuing given goal waypoint. (See the picture below.) * You can access this webpage and its contents also from home: [[https://cw.fel.cvut.cz/wiki/courses/crl-courses/aed23|cw.fel.cvut.cz/wiki/courses/crl-courses/ctg24]]. {{ :courses:crl-courses:aed23:t1b-react.gif?nolink&600 |}} ===== Robotics ===== * Mechanics + Electronics + Perception (Sensing) + Control + AI + ... = Robotics * AI may be used to * plan robot actions, * prioritize tasks, * detect or distinguish data, * learn, self-improve, * cooperate, * react, * decide, ... etc. * A robot consists of * actuators (motors, servomotors, valves, optics, ...), * sensors (accelerometers, cameras, pressure, laser scanners, ...), * brains (Raspberry PI, Intel NUC, Arduino, ...), * energy source (batteries, external supply, solar panels, ...), * body (LEGO, 3D Printing, ...). {{ :courses:crl-courses:aed23:cras-robots.jpg?nolink&800 }} * A robot state description may be abstracted into its **position** and **orientation** described by coordinates in a reference frame. * We shall use 2D coordinates, i.e., X, Y and the angle measured from positive direction of the X axis. * Thus, having a suitable controller, a generalized **velocity command** may be used to control any robot. * Such a command comprises the desired linear and angular velocity. * In our case, we have a 6-legged robot with 3 actuators per leg, thus in fact the controller needs to produce 18 control signals based on the two values in the velocity command. The controller itself may be implemented by various aproaches, e.g., by the //Central Pattern Generator// (CPG). The controller computes desired joint angles such that the leg is raised, moved forward, lowered and then moved backward. The CPG produces such movements for all 6 legs, synchronizing the phases to keep always three legs on the ground. This makes the 6-legged (or hexapod) robot stable as the center of mass is supported at least by a triangular //support polygon//. ===== Simulation ===== * The computers in the classroom run Ubuntu OS with all the required software installed. * Please, log in via the credentials provided on the paper strip. * We shall use the [[https://www.coppeliarobotics.com/|CoppeliaSim]] app. * The simulator can be downloaded and run at home as well. * Open a terminal by ''Actr+Alt+T''. * Run the simulator by issuing ''/opt/CoppeliaSim_Edu_V4_3_0_Ubuntu20_04/coppeliaSim.sh'' command. * Download the simulation resource pack: {{ :courses:crl-courses:aed23:aed23_resource_pack.zip |}}. * The resource pack contains robot model, scene and driving scripts in Python. * Unzip the resource pack. * Load the scene from the resource pack. (''Files'' -> ''Open scene...'' -> ''~/Downloads/aed23_resource_pack/scenes/aed23.ttt''.) * Robot is driven by a set of [[https://www.python.org/|jazyce Python]] scripts. * Open another terminal instance (''Ctrl+Alt+T''). * Run ''cd ~/Downloads/aed23_resource_pack; ./main.py''. * Robot should now tread in place. ===== Blind locomotion ===== * We want the robot to navigate towards two ++ waypoints |, which can be given by some high-level mission or exploration planner++, depicted as green spheres in the simulator. * Robot knows its current pose and its current goal waypoint from which it needs to compute the velocity command. * Edit the script which controls the robot. * ''/opt/VSCode-linux-x64/code ~/Downloads/aed23_resource_pack/hexapod_robot/HexapodController.py'' * First, delete the ''return result_command'' statement on line 28. * Robot needs to turn towards the target. Implement the desired heading as * ''desired_heading_radian = math.atan2(dy,dx)'' {{ :courses:crl-courses:aed23:clash.png?nolink&600 |}} ===== Obstacle avoidance ===== * Open the ''main.py'' and switch the controller to ''goto_reactive''. * This controller implements the [[https://mitpress.mit.edu/books/vehicles|Braitenberg vehicle]] concept. ^ ^ Vehicle 2a ^ Vehicle 2b ^ Vehicle 3a ^ Vehicle 3b ^ | | {{:courses:uir:labs:breitenberg_2a.jpg?nolink&100}} | {{:courses:uir:labs:breitenberg_2b.jpg?nolink&100}} | {{:courses:uir:labs:breitenberg_3a.jpg?nolink&100}} | {{:courses:uir:labs:breitenberg_3b.jpg?nolink&100}} | | **Spojení** | excitation | excitation | inhibition | inhibition | | **Chování** | fear | aggression | love | explore | | **Vlastnosti** | Avoids object. | Assaults object. | Stops facing the object. | Stops facing away. | * We use the ++ LiDAR | (we can imagine a LiDAR as a source of dense laser beams with known direction; LiDAR measures distance traveled, e.g., via time-of-flight or the phase-shift calculations) ++ as the source of the stimulus. * We measure laser beams to the both sides of the robot centerline and use them to virtually repel the robot the closer it gets to an obstacle. ===== Extra Tasks ===== * Process the LiDAR scans into 2D occupancy map. * Tweak walking or obstacle avoidance parameters and functions. * Play with the obstacles, play with the robot a bit. * Try some assignments from * [[https://cw.fel.cvut.cz/b231/courses/uir/start]] or * [[https://cw.fel.cvut.cz/wiki/courses/crl-courses/redcp/start]] /* ===== By the Way ===== This page was originally prepared for the "AI Expert for a Day" event, which aimed to expose some of the robotics for enthusiastic high-schoolers. */