Introduction To Mechatronics: Discover Robots With The Lego Mindstorms
Introduction To Mechatronics: Discover Robots With The Lego Mindstorms
Introduction To Mechatronics: Discover Robots With The Lego Mindstorms
Introduction to Mechatronics
1 / 97
You are free to copy, to modify, to adapt and distribute this document. Latex sources of this document should be available on the authors webpage. LEGO and Mindstorms NXT are trademarks of the LEGO Group, which does not sponsor, authorize or endorse this document.
Introduction to Mechatronics
2 / 97
Bluetooth communication
Introduction to Mechatronics
3 / 97
Bluetooth communication
Outline
NXT Programming with NBC/NXC NBC/NXC basics NXC structure and statements NXC I/O API
Bluetooth communication Bluetooth Protocol Bluetooth communication with PC Bluetooth communication between NXT
Introduction to Mechatronics
4 / 97
Bluetooth communication
Outline
Lego Mindstorms Hardware Overview NXT Brick Hard/Firm-ware NXT Programming with NBC/NXC NBC/NXC basics NXC structure and statements NXC I/O API Bluetooth communication Bluetooth Protocol Bluetooth communication with PC Bluetooth communication between NXT
Introduction to Mechatronics
5 / 97
Bluetooth communication
References
NXC Programming [NXC07] J.C. Hansen, NXT Power Programming, Variant Press, 2007 [NXC] J.C Hansen, Not eXactly C Programmers Guide, http://bricxcc.sourceforge.net/nbc/ [NXCT] D. Benedettelli. , Programming LEGO NXT Robots using NXC, http://bricxcc.sourceforge.net/nbc/nxcdoc/NXC_tutorial.pdf NXT Bluetooth and USB communication [LINXT] Lego Mindstorms NXT brick in Linux via USB, http://sourceforge.net/projects/linxt/ [BLUE] J. Schultz, Lego, Bluetooth and Linux, http://www.cs.uleth.ca/ benkoczi/3720/data/NXT_Bluetooth_handout-jeremy.pdf [NXTLIBC] Lego Mindstorms NXT Bluetooth library in C, http://www.quietearth.us/nxtlibc.htm
Introduction to Mechatronics 6 / 97
Bluetooth communication
References
LEGO resources and documentation [LEGO] Bluetooth Developer Kit and Hardware Developer Kit, http://mindstorms.lego.com/eng/Overview/NXTreme.aspx
Introduction to Mechatronics
7 / 97
Bluetooth communication
Outline
Lego Mindstorms Hardware Overview NXT Brick Hard/Firm-ware NXT Programming with NBC/NXC NBC/NXC basics NXC structure and statements NXC I/O API Bluetooth communication Bluetooth Protocol Bluetooth communication with PC Bluetooth communication between NXT
Introduction to Mechatronics
8 / 97
Bluetooth communication
NXT Inputs
NXT Outputs Servo Motors
Touch Sensor
(contact switch)
with Bluetooth
Sound Sensor
(pressure in dB)
Ultrasonic Sensor
(distance in cm)
Light Sensor
(light intensity in %)
Introduction to Mechatronics 9 / 97
Bluetooth communication
NXT brick
Servo outputs bluetooth indicator
B : ON, invisible B< : ON, visible B<> : ON, connected
OUT_A
OUT_B
OUT_C
Sensor port
S1
S2
S3
S4
10 / 97
Introduction to Mechatronics
Bluetooth communication
saved in
NXT files
Motor rotation
On/off
Delete Files
Sound files
Sound dBA
Connections
Volume
Visability
Introduction to Mechatronics
11 / 97
Bluetooth communication
NXT-G (LabView)
advance graphical interface for programming NXT functional block and control ow
Introduction to Mechatronics
12 / 97
Bluetooth communication
NXTway GS by Y. Yamamoto
Introduction to Mechatronics
13 / 97
Bluetooth communication
Outline
Lego Mindstorms Hardware Overview NXT Brick Hard/Firm-ware NXT Programming with NBC/NXC NBC/NXC basics NXC structure and statements NXC I/O API Bluetooth communication Bluetooth Protocol Bluetooth communication with PC Bluetooth communication between NXT
Introduction to Mechatronics
14 / 97
Bluetooth communication
Hardware specication
USB 2.0 connector LB1930 & LB1836 single and double Hbridge (OUT_A and OUT_BC)
AT91SAM7S256 Amtel 32 bit ARM Processor 48MHz, 64KB RAM 256KB FLASH I2C interface with AVR proc. and digital sensor (ultrasonic)
8bit AVR CoProcessor PWM signal generator A/D converter for analogic sensor (light,sound,touch )
RS485 UART high speed communication line on Port S4 (for future use)
Introduction to Mechatronics
15 / 97
Bluetooth communication
Hardware specication
I2C: Inter-Integrated Communication need 3 lines (data,clock,ground) UART: Universal Asynchronous Receiver Transmitter (serial line/port) Note: -each sensor port (S1-4) can be used with digital or analog sensor. -6 wires by port: 3 for I2C + 3 for analog signals
Introduction to Mechatronics
16 / 97
Bluetooth communication
NXT Firmware
Boot code/loader initialization of the hardware load the rmware
Running executables RAM 64K
Firmware : a basic operating system multi-thread (thread: light task) provides an API for I/O (displays the menus)
LEGO firmware
Executables (.rxe)
ROM
interprets ByteCode executables (.rxe) rmware and les stored in FLASH memory BOOT CODE stored in RAM allow to update rmware
Introduction to Mechatronics 17 / 97
Processor
Software
Bluetooth communication
Outline
Lego Mindstorms Hardware Overview NXT Brick Hard/Firm-ware NXT Programming with NBC/NXC NBC/NXC basics NXC structure and statements NXC I/O API Bluetooth communication Bluetooth Protocol Bluetooth communication with PC Bluetooth communication between NXT
Introduction to Mechatronics
18 / 97
Bluetooth communication
Outline
Lego Mindstorms Hardware Overview NXT Brick Hard/Firm-ware NXT Programming with NBC/NXC NBC/NXC basics NXC structure and statements NXC I/O API Bluetooth communication Bluetooth Protocol Bluetooth communication with PC Bluetooth communication between NXT
Introduction to Mechatronics
19 / 97
Bluetooth communication
NBC/NXC
NBC: Next Byte Codes name of an assembly language name of an open source assembler available under MPL license produce executable code for the native LEGO rmware NXC: Not eXactly C high level programming language: C-like syntax compiler built upon nbc produce ByteCode executables (.rxe) NBC and NXC available for Linux, MAC OS, Windows custom Firmwares to replace LEGO rmwares are available : LeJOS (JAVA-VM) for Java programming
Introduction to Mechatronics
20 / 97
Bluetooth communication
4Execution
Introduction to Mechatronics 21 / 97
Bluetooth communication
USB Upload
Detection of the NXT brick lsusb: listing of connected USB device Bus 002 Device 004: ID 0694:0002 Lego Group via NXC need complex conguration of linux device manager (udev) upload command nbc -d -S=usb toto.rxe via LiNXT (prefered method, [LINXT]) LiNXT: Perl script with automatic search of the brick command to upload, download and get NXT information to get help linxt -h to upload a le (as root user): linxt -u toto.rxe
Introduction to Mechatronics 22 / 97
Bluetooth communication
Outline
Lego Mindstorms Hardware Overview NXT Brick Hard/Firm-ware NXT Programming with NBC/NXC NBC/NXC basics NXC structure and statements NXC I/O API Bluetooth communication Bluetooth Protocol Bluetooth communication with PC Bluetooth communication between NXT
Introduction to Mechatronics
23 / 97
Bluetooth communication
Statements 1
comments: //This is a comment /*This is a comment*/ variables bool, byte, unsigned char, char unsigned int, short, int unsigned long, long string struct Arrays declaration of variable int i; int x=0x10; // 16 in hexadecimal int y=10; // 10 string msg=toto;
8 bit 16 bit 32bit Array of byte User dene Array of any type
Introduction to Mechatronics
24 / 97
Bluetooth communication
Statements 2
assignment x=y+2; x+=y; // equivalent to x=x+y; arrays (no pointers) byte myvector[2]; // 2 byte array int myarray[]; // int array (no dimension) ArrayInit(myarray,0,10); // alocation of 10 null entries myarray[0]= 15; conditions = equal != not equal true false Expr && || True if Expr!=0 logical AND between conditions logical OR between conditions
Introduction to Mechatronics
25 / 97
Bluetooth communication
Control structures
if, if . . . else if (x==1) {x=2; z=3;} else y=4; for for (i=1; i<10; i++) { ;}
while while (x<10) { x++ ; // something needed !! } do.. while do { x++ ;} while (x<10)
Introduction to Mechatronics
26 / 97
Bluetooth communication
Control structures
switch switch (x) { case 1 : z=3; break; case 2 : // some code break; default: // some code break; } repeat and until control structure available but not C standard
Introduction to Mechatronics
27 / 97
Bluetooth communication
multithreading in NXT =concurrent execution of tasks number of task and function must be < 256 at least an init task called main needed
Introduction to Mechatronics
28 / 97
Bluetooth communication
parameter passed by value return for non-void function void foo (int x) { x++; } task main { int y=1; foo(y); //y still equal to 1 }
task main { int y=1; foo(y); //y now equal to 2 foo(2); // ERROR (one-variable) }
Introduction to Mechatronics
29 / 97
Bluetooth communication
Preprocessor
Preprocessor directive include les #include foo.h #include <foo.h> //error no libray path macro and dene (recommended!) #define TIMEOUT 200 //0.2 ms timeout #define NORMAL_SPEED 50
Introduction to Mechatronics
30 / 97
Bluetooth communication
Outline
Lego Mindstorms Hardware Overview NXT Brick Hard/Firm-ware NXT Programming with NBC/NXC NBC/NXC basics NXC structure and statements NXC I/O API Bluetooth communication Bluetooth Protocol Bluetooth communication with PC Bluetooth communication between NXT
Introduction to Mechatronics
31 / 97
Bluetooth communication
Timings wait(2000); // sleep for 2s x=CurrentTick(); // sys time in ms Math Functions -Cos, Sin, Abs, Acos in degree -returns 100 times the value x=cos(60); //returns 50
Strings msg=numToStr(i) // convert number in string msg=StrCat(str1,str2) // concatenation Sound Play tone (440,500); //440: frequency //500: duration
Introduction to Mechatronics
32 / 97
Bluetooth communication
LCD API
task main () { int i=1; TextOut(0,LCD_LINE1,"toto:"); // display toto on line 1 NumOut(20,LCD_LINE1,i); //display i on line 1 and column 20 Wait(3000); ClearScreen(); LineOut(40,40,60,60); //plot a line from (40,40) to (60,50) coordinates Wait(3000); }
Introduction to Mechatronics
33 / 97
Bluetooth communication
Unregulated mode no regulation (speed can vary according to the load) reference = power in % , output selection= OUT_A, OUT_BC, OUT_ABC ... task main() { OnFwd(OUT_AC,85); //motor AC fwd at 85% of power Wait(1500); // run for 1.5 s OnRev(OUT_A,90); //motor A reverse at 90%, //C still going fwd at 85% Float(OUT_C); //motot C power off, free deceleration Wait(1500); Off(OUT_ABC); //motor ABC power off with braking }
Introduction to Mechatronics
34 / 97
Bluetooth communication
Bluetooth communication
50, 0); //same as OnFwd, no regulation 40 , 50); //motor A stop 40 , 100); opposite of C
Introduction to Mechatronics
36 / 97
Bluetooth communication
Position-based mode regulation of rotation position in degree #define degree 180 task main() { RotateMotor(OUT_AC,56, degree); //rotation of 180 degree at 56% of power }
Introduction to Mechatronics
37 / 97
Bluetooth communication
Bluetooth communication
TYPE Description SENSOR_TYPE_TOUCH SENSOR_TYPE_LIGHT_ACTIVE light sensor with LED on light sensor with LED off SENSOR_TYPE_LIGHT_INACTIVE sound pressure in dB SENSOR_TYPE_SOUND_DB SENSOR_TYPE_TOUCH I2C sensor (Ultrasonic) MODE Description SENSOR_MODE_RAW value between 0 < x < 1024 SENSOR_TYPE_BOOL 0 if x<512, else 1 SENSOR_TYPE_PERCENT value between 0 < x < 100 count number of transition SENSOR_TYPE_EDGE SENSOR_TYPE_TOUCH count number of level change
Introduction to Mechatronics
39 / 97
Bluetooth communication
Default conguration of the input ports high-level functions with the default mode : SetSensorXXXX(port)
task main() { SetSensorType(S1,SENSOR_TYPE_TOUCH); SetSensorMode(S1,SENSOR_MODE_BOOL) SetSensorTouch(S1); //idem than the 2 previous line SetSensorSound(S3); //Sound sensor on port 3, default pourcent? SetSensorLight(S4); // port 4, default mode : percent SetSensorLowSpeed(S2); // I2C sensor (Ultrasonic,..) on port 2 }
Introduction to Mechatronics
40 / 97
Bluetooth communication
Bluetooth communication
#define NEAR 15 //cm task main(){ SetSensorLowspeed(S4); while(true){ OnFwd(OUT_AC,50); if (SensorUS(S4)<NEAR) Off(OUT_AC); OnRev(OUT_C,40); Wait(800); } } }
Bluetooth communication
Multiple tasks running in concurrency mutex: mutual exclusion =prevent the 2 tasks to control motors simultaneously a task block on Acquire(), if another has already Acquire the mutex must wait for the Release
Introduction to Mechatronics
43 / 97
Bluetooth communication
Outline
Lego Mindstorms Hardware Overview NXT Brick Hard/Firm-ware NXT Programming with NBC/NXC NBC/NXC basics NXC structure and statements NXC I/O API Bluetooth communication Bluetooth Protocol Bluetooth communication with PC Bluetooth communication between NXT
Introduction to Mechatronics
44 / 97
Bluetooth communication
Outline
Lego Mindstorms Hardware Overview NXT Brick Hard/Firm-ware NXT Programming with NBC/NXC NBC/NXC basics NXC structure and statements NXC I/O API Bluetooth communication Bluetooth Protocol Bluetooth communication with PC Bluetooth communication between NXT
Introduction to Mechatronics
45 / 97
Bluetooth communication
Bluetooth
wireless protocol for electronics (phone headset), computer peripherals (WiiMote, keyboard) 2.4 GHz short-range radio frequency bandwidth : unlicensed frequency Class class 1: 100 mW 100meters class 2: 2.5 mW 10 meters (LEGO NXT) Search and Pairing search service available to nd new Bluetooth device pairing: trust communication by learning of a common passkey -input of the passkey on both device -key used to encrypt communication
Introduction to Mechatronics
46 / 97
Bluetooth communication
Bluetooth piconet
Master and slaves devices (max: 7 slaves) on master by piconet (slaves synchronized on his clock) slaves can not initiate a data packet transfer slaves can send a response packet right after the master one (synchronous communication) slaves can not communicate between them
Introduction to Mechatronics
47 / 97
Bluetooth communication
command code (Ex: 0x0B=GetBatteryLevel 0x03=PlayTone) parameters of the command, or return value
byte 1
Length, LSB
byte 2
Length, MSB
byte 3
Command Type
byte 4
Command
byte 5
byte 6
byt..
Parameters..................
48 / 97
Introduction to Mechatronics
Bluetooth communication
Outline
Lego Mindstorms Hardware Overview NXT Brick Hard/Firm-ware NXT Programming with NBC/NXC NBC/NXC basics NXC structure and statements NXC I/O API Bluetooth communication Bluetooth Protocol Bluetooth communication with PC Bluetooth communication between NXT
Introduction to Mechatronics
49 / 97
Bluetooth communication
Get NXT Bluetooth address each Bluetooth as an unique address on 6 bytes (MAC address)
1
command hcitool : give name and Bluetooth address of available device >hcitool scan Scanning ... 00:16:53:04:B3:46 NXT
LiNXT -i , while NXT connected by USB >sudo ./linxt -i Device information: NXT name: NXT02 Bluetooth address: 00:16:53:02:f3:31
Introduction to Mechatronics
50 / 97
Bluetooth communication
set the key in the pop-up when using the following connect program use NXT search and Linux Bluetooth-applet:
Linux: right click on the Bluetooth-applet > preferences set a Bluetooth name for the PC dongle NXT: menu Bluetooth > search select your PC name and validate validate the default passkey Linux: a pop-up ask for the passkey, give the same
it is a one time operation, NXT now appears in Bluetooth-applet > preferences > known devices
Introduction to Mechatronics
51 / 97
Bluetooth communication
Bluetooth communication
play_tone.c
#include <stdio.h> #include <stdlib.h> #include <sys/socket.h> //socket lib #include <sys/types.h> #include <bluetooth/bluetooth.h> //bluettoh lib #include <bluetooth/rfcomm.h> #define max_message_size 59 int nxtsocket; //on declare la socket void init_bluetooth(char *btAddress) { struct sockaddr_rc addr={0};//structure du type sockaddr_rc int status; nxtsocket = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
Bluetooth communication
play_tone.c
void nxt_tone(void) { /**0x06 0x00 : length =6 bytes 0x00 : direct command with response 0x03 : Playtone commande 0x5B 0x1C : parameter 1 - 7259 (200-14000Hz) 0x88 0x13 : parameter 2 - 0x1388=5000 (ms)**/ char cmd[8]={0x06, 0x00, 0x00, 0x03,0x5B ,0x1C ,0x88,0x13}; char reply[max_message_size]; write(nxtsocket, cmd, 8); //send PlayTone command read(nxtsocket, reply, 5); //read response // if if if }
check response (reply[2] != 0x02) fprintf(stderr, "not a response datagramm"); (reply[3] != 0x03) fprintf(stderr, "not the reply to play tone"); (reply[4] != 0x00) fprintf(stderr, "status not ok");
Introduction to Mechatronics
54 / 97
Bluetooth communication
play_tone.c
int main (void) { int blevel; char btaddress[18] = "00:16:53:02:f3:31"; //NXT adress init_bluetooth(btaddress); //open connection nxt_tone(); //direct command close(nxtsocket); return 0; }
Introduction to Mechatronics
55 / 97
Bluetooth communication
NXTlibC
A simple library to perform Direct Command wrap the previous code in nice function compilation: gcc -lm -lbluetooth -lnxtlibc test.c -o test API of NXTlibC : samples nxt_bluetooth_initialize() , nxt_bluetooth_done() get_battery_level(),play_tone() set_touch_sensor(), get_touch_value() message_write(), message_read() (see next section)
Introduction to Mechatronics
56 / 97
Bluetooth communication
Bluetooth communication
Outline
Lego Mindstorms Hardware Overview NXT Brick Hard/Firm-ware NXT Programming with NBC/NXC NBC/NXC basics NXC structure and statements NXC I/O API Bluetooth communication Bluetooth Protocol Bluetooth communication with PC Bluetooth communication between NXT
Introduction to Mechatronics
58 / 97
Bluetooth communication
Master Channel 0
Nxt Piconet
Up to 3 slaves Channel 13
Introduction to Mechatronics 59 / 97
Bluetooth communication
Via the Bluetooth menu 10 mailbox on each NXT to exchange messages if there is no read program while sending = message lost direct commands available to control the slave Example of message exchange master : check slave connection, send message to mailbox 5 on slave, read again message in mailbox 1 on slave, slave : check master connection, read its mailbox 5, put an message in its mailbox 1
Introduction to Mechatronics
60 / 97
Bluetooth communication
Message exchange
//MASTER #define INBOX 1 #define OUTBOX 5 sub BTCheck(int conn){ if (!BluetoothStatus(conn)==NO_ERR){ TextOut(5,LCD_LINE2,"Error"); Wait(1000); Stop(true); } } task main(){ string in,out="hello from master!"; BTCheck(1); //check slave connection TextOut(10,LCD_LINE1,"Master Test"); SendRemoteString(BT_CONN,OUTBOX,out); while (1) { ReceiveRemoteString(INBOX, true, in); TextOut(10,LCD_LINE3,in); } }
Introduction to Mechatronics 61 / 97
Bluetooth communication
Message exchange
//SLAVE #define INBOX 5 #define OUTBOX 1 sub BTCheck(int conn){ if (!BluetoothStatus(conn)==NO_ERR){ TextOut(5,LCD_LINE2,"Error"); Wait(1000); Stop(true); } } task main(){ string in,out="thanks, master!"; BTCheck(0); //check slave connection TextOut(10,LCD_LINE1,"Slave Test"); while(1) { ReceiveRemoteString(INBOX, true, in); SendResponseString(OUTBOX,out); // Not SendRemote !! TextOut(10,LCD_LINE3,in); } }
Introduction to Mechatronics 62 / 97
Bluetooth communication
Example of Direct Command master : check slave connection, send play_tone command, wait for response status, send reset position on motor A wait for response status, send full speed command on motor A with speed regulation
Introduction to Mechatronics
63 / 97
Bluetooth communication
Mobile robots
Navigation
Introduction to Mechatronics
65 / 97
Mobile robots
Navigation
Outline
Wheeled Mobile Robots Technology Mechanical architecture Embedded system Actuators Sensors
Introduction to Mechatronics
66 / 97
Mobile robots
Navigation
Outline
Mobile robots Classication and applications Issues Wheeled Mobile Robots Technology Mechanical architecture Embedded system Actuators Sensors Navigation Localization Mapping Planning Control
Introduction to Mechatronics
67 / 97
Navigation
Outline
Mobile robots Classication and applications Issues Wheeled Mobile Robots Technology Mechanical architecture Embedded system Actuators Sensors Navigation Localization Mapping Planning Control
Introduction to Mechatronics
68 / 97
Navigation
Wheeled robots
Introduction to Mechatronics
69 / 97
Navigation
Legged robots
Introduction to Mechatronics
69 / 97
Navigation
Legged robots
Introduction to Mechatronics
69 / 97
Navigation
Introduction to Mechatronics
70 / 97
Navigation
Introduction to Mechatronics
71 / 97
Navigation
Introduction to Mechatronics
71 / 97
Navigation
Khepera II , K-team
http://www.k-team.com
Introduction to Mechatronics
71 / 97
Navigation
Introduction to Mechatronics
71 / 97
Navigation
Inspection
http://crasar.csee.usf.edu
Introduction to Mechatronics
71 / 97
Navigation
Outline
Mobile robots Classication and applications Issues Wheeled Mobile Robots Technology Mechanical architecture Embedded system Actuators Sensors Navigation Localization Mapping Planning Control
Introduction to Mechatronics
72 / 97
Navigation
Issues
Technology Issues: mechanical architecture embedded system actuators sensors
Mobile robots
Navigation
Outline
Mobile robots Classication and applications Issues Wheeled Mobile Robots Technology Mechanical architecture Embedded system Actuators Sensors Navigation Localization Mapping Planning Control
Introduction to Mechatronics
74 / 97
Navigation
Outline
Mobile robots Classication and applications Issues Wheeled Mobile Robots Technology Mechanical architecture Embedded system Actuators Sensors Navigation Localization Mapping Planning Control
Introduction to Mechatronics
75 / 97
Navigation
Lego Tribot: a simple differential drive mobile robot simple to build: 2 xed wheels, with 2 independent actuators differential drive locomotion nonholonomic, nonlinear. . . not so simple
Introduction to Mechatronics
76 / 97
Navigation
Lego Tribot: a simple differential drive mobile robot simple to build: 2 xed wheels, with 2 independent actuators differential drive locomotion nonholonomic, nonlinear. . . not so simple
Introduction to Mechatronics
76 / 97
Navigation
vr vl
= =
r r = ( + L) r l = ( L)
and then: v = = vr + vl 2 r (r + l ) 2L
vl v vr
L r x
Introduction to Mechatronics
77 / 97
Navigation
Outline
Mobile robots Classication and applications Issues Wheeled Mobile Robots Technology Mechanical architecture Embedded system Actuators Sensors Navigation Localization Mapping Planning Control
Introduction to Mechatronics
78 / 97
Navigation
NXT Inputs
NXT Outputs Servo Motors
Touch Sensor
(contact switch)
with Bluetooth
Sound Sensor
(pressure in dB)
Ultrasonic Sensor
(distance in cm)
Light Sensor
(light intensity in %)
Introduction to Mechatronics
79 / 97
Navigation
Outline
Mobile robots Classication and applications Issues Wheeled Mobile Robots Technology Mechanical architecture Embedded system Actuators Sensors Navigation Localization Mapping Planning Control
Introduction to Mechatronics
80 / 97
Navigation
ON & REGULATED:
speed regulation use of position sensor signals closed loop with PID controller
Introduction to Mechatronics
81 / 97
Navigation
+Vcc In2
Direction and braking H-bridge with DC motors IN1 IN2 Action H L Forward L H Reverse L L Brake
M
In2 0V In1
In1
In2 0V
In1=Low, In2=High
In1=High, In2=Low
Introduction to Mechatronics
82 / 97
Navigation
Electronic braking
e : back e.m.f
i
R
: motor torque
= Ki
= Ke
1 2
motor motion: e = 0
e short circuit current i R
in opposition
Introduction to Mechatronics
83 / 97
Navigation
Outline
Mobile robots Classication and applications Issues Wheeled Mobile Robots Technology Mechanical architecture Embedded system Actuators Sensors Navigation Localization Mapping Planning Control
Introduction to Mechatronics
84 / 97
Navigation
Ultrasonic Telemeters
Properties: alternate emission/reception sounds not heard by human ear (ultrasound=20kHz to 200kHz) minimal measurement distance and variable maximal frequency=f(maximal distance) different drawbacks (directivity, reectivity, ambient conditions sensitivity)
http://www.pages.drexel.edu/ kws23/tutorials/ultrasonic/ultrasonic.html
Introduction to Mechatronics
85 / 97
Navigation
Introduction to Mechatronics
86 / 97
Mobile robots
Navigation
Outline
Mobile robots Classication and applications Issues Wheeled Mobile Robots Technology Mechanical architecture Embedded system Actuators Sensors Navigation Localization Mapping Planning Control
Introduction to Mechatronics
87 / 97
Navigation
Outline
Mobile robots Classication and applications Issues Wheeled Mobile Robots Technology Mechanical architecture Embedded system Actuators Sensors Navigation Localization Mapping Planning Control
Introduction to Mechatronics
88 / 97
Navigation
Dead reckoning
Odometry Computation of the conguration by velocities integration: Z t Z t Z t x(t) = x( )d, y (t) = y ( )d, (t) = ( )d.
0 0 0
The TriBot example, with a Te sampling period: x(k + 1) y (k + 1) (k + 1) = = = x(k ) + v (k )Te cos (k ) y (k ) + v (k )Te sin (k ) (k ) + (k )Te
Introduction to Mechatronics
89 / 97
Navigation
Outline
Mobile robots Classication and applications Issues Wheeled Mobile Robots Technology Mechanical architecture Embedded system Actuators Sensors Navigation Localization Mapping Planning Control
Introduction to Mechatronics
90 / 97
Navigation
Environment mapping
Occupancy grid: discrete map of the environment Cell decomposition, with probability of collision from sensors measurements. The simplest case: binary grid, without ltering, trusting the odometry localization.
Introduction to Mechatronics
91 / 97
Navigation
Outline
Mobile robots Classication and applications Issues Wheeled Mobile Robots Technology Mechanical architecture Embedded system Actuators Sensors Navigation Localization Mapping Planning Control
Introduction to Mechatronics
92 / 97
Navigation
Conguration space
Denition Conguration space = set of all the accessible congurations of the robot: robot represented as a point: obstacles augmentation robot with complex shapes and kinematics: more difcult problem. Over pessimistic obstacle augmentation can close doors !
Introduction to Mechatronics
93 / 97
Navigation
Roadmaps
Visibility roadmap Graph capturing the environment topology from the polygonal obstacles vertices. link initial point and goal to visible vertices
Introduction to Mechatronics
94 / 97
Navigation
Roadmaps
Visibility roadmap Graph capturing the environment topology from the polygonal obstacles vertices. apply the same to the new vertices
Introduction to Mechatronics
94 / 97
Navigation
Roadmaps
Visibility roadmap Graph capturing the environment topology from the polygonal obstacles vertices. search for a path in the graph
Introduction to Mechatronics
94 / 97
Navigation
Outline
Mobile robots Classication and applications Issues Wheeled Mobile Robots Technology Mechanical architecture Embedded system Actuators Sensors Navigation Localization Mapping Planning Control
Introduction to Mechatronics
95 / 97
Navigation
a O d
P xr r Or x
O C
Introduction to Mechatronics
96 / 97
Navigation
Consequence If a, v et k (d, e ) > 0: |d| decreases along any path. Restrictions No control of the orientation. Can be solve at the planning step.
Introduction to Mechatronics 97 / 97