Intelligent Robotics I Servo Control Overview and example
Intelligent Robotics I: Servo Control Overview and example of robot control Jeff Allen
Robot Recipe • Sensors – Artificial (sonar, cameras, temp, light, water, . . . . you get the point) – Human (From a controller perceiving a worthy input) • Intelligence – Artificial (computational, search, genetic, NN, cellular automata, … too name a few) – Human (a controller intelligence varies in extremes, and is both time and subject variant) • Actuators – Artificial **(this is a requirement)
Robotic System The world and the boxes • Sensors – Can exist solely in either domain – Can exist in mix of both • Intelligence Sensors Input Intelligence Robo world Robot HW/SW State Actuators Output – Can exist solely in either domain – Can exist in mix • Robot State – Internal conditions used to represent actions • Actuators – The method the robot interacts, injects it’s will onto the real world
Robotic System: simplification • Input to Intelligence Sensors Input Intelligence Robo world Robot HW/SW State Actuators Output – Ignore all outside possibility as it is not in the system • Intelligence to Robot State to Output – Imply state as part of the connection
An Abridged Robotic System Transistions and related factors • Input to Intelligence Sensors Input Intelligence Robo world Actuators Output – Complexity of sensor input – Must travel in robot world even if remote controlled. • Intelligence to Actuators – Must travel in robot world
Sensor Information Complexity (Artificial) • Simple – – – – Touch Sonar IR Light Temp Engine and systems feedback Radio signal etc • Middle to Upper Complexity – – – Sonar Arrays/Radar Arrays LIDAR Camera(s) GPS Positioning Etc
Consequences of increased sensor information complexity • Information size • Processing difficulty • Usefulness of data may require many different processes • Yet another etc…. • All ultimately lead in one way or another to increased requirements of the robot system. Which usually means $$$$!
Information Traveling in the Robot World • Information and it’s communication must happen. If nothing is communicated how can it be a robot? • We all know how it is done. Electrical signals and representations sent to devices program to respond accordingly.
Some robot system methodologies • Single autonomous unit – All onboard system intelligence is onboard. With remote communications generally limited to system reprogramming or goal adjustments. Not direct actuator control. • Remotely controlled units – The controlling unit, human or artificial, is located at another location controlling the unit. • Mixed units – Remotely controlled units with certain automated subsumbtive responses controlled directly. Example robotic overrides, like your brakes
More about robot system methodologies • Single autonomous unit – Varying complexities based on onboard computational and sensing abilities as well as actuator device complexities. – Complexity increases are expensive and can create extremely difficult systems in situations where onboard requirements are stretched to limits – Excellent response times are possible • Remotely controlled units – Onboard equipment requirements are lessened with respect to computational devices. (less expensive) – Complexity increases due to sensors now increase bandwidth requirements, but are otherwise less expensive. – Natural lag in response related to communicated distance as well as bandwidth • Mixed units (see all above)
PC remote controlled systems Today’s example • Inexpensive. – PC (look at a Fry’s ad) – Servo controller board ($10 - $200 on average) • Potentially Powerful – Information communicated can be communicated along multiple channels: usb, serial, firewire, etc. . • Numerous programming languages to choose from. • Why do we use them? Look above
Review: Traveling in the Robot World. what did we say? • Information and it’s communication must happen. If nothing is communicated how can it be a robot? • We all know how it is done. In theory. Practically?
A communicating example: A PC controlled robot Communication Channel PC to Control: In this case RS 232 Our development environment: Input to PC: Visual Studio VB 6. 0 Predefined movement scripts / Sensors Actuator Control: ASC 16 Board
Communication channel: PC to RS 232 piece • MS Visual studio provides the MSComm object capable of: – Transmitting/ receiving / open / close to a comm port using rs 232. The requirement is only that the data be presented in the format it is to be sent according to receiving device. • ASC 16 has specific commands for each servo device. – Each servo is capable of 180 degrees of movement with a precision of 180/4000 degrees/point, . 045 Deg/point – The ASC 16 is capable of simple position commands , small loop programs as well as positional feedback (not in this example) – Commands are given in 1, 2, and 3 byte packages
Example goal • We need something to convert commands from the PC to appropriate ASC 16 commands, a translator.
Requirements • Each servo device will have a different range of motion and rarely will move all 180 degree. • Each device is a separate entity, interrelations can be calculated but otherwise do not exist
ASC 16 Commands • • • • ac (81 -96 DEC) (51 -60 HEX) Acceleration am (250 DEC) (FA HEX) Abort All Motion at (249 DEC) (F 9 HEX) Abort Triggers bt (124 DEC) (7 C HEX) Base Time en (121 DEC) (79 HEX) Enable Module f+ (251 DEC) (FB HEX) Freeze Motion f- (252 DEC) (FC HEX) Freeze Motion Off
ASC 16 Commands (cont. ) • • • • fp (21 -36 DEC) (15 -24 HEX) Flyby Position iv (112 DEC) (70 HEX) Invert Servo Coordinates la (242 DEC) (F 2 HEX) Load All ld (123 DEC) (7 B HEX) Load Default Position lm (253 DEC) (FD HEX) Loop Marker lp (254 DEC) (FE HEX) Loop mk (221 -228 DEC) (DD-E 4 HEX) Marker
ASC 16 Commands (cont. ) • • • • mr (41 -56 DEC) (29 -38 HEX) Move Relative mk (221 -228 DEC) (DD-E 4 HEX) Marker mr (41 -56 DEC) (29 -38 HEX) Move Relative mv (1 -16 DEC) (01 -0 F HEX) Move servo absolute no (0 DEC) (00 HEX) No Operation no no no (0, 0, 0 DEC) (00, 00 HEX) Terminate nv (113 DEC) (71 HEX) Non-invert Servo Positions
ASC 16 Commands (cont. ) • • • • op (110 DEC) (6 E HEX) Output pg (120 DEC) (78 HEX) Program Module address ra (141 -148 DEC) (8 D-94 HEX) Read Input as Analog rd (179 DEC) (63 HEX) Read Inputs as digital rp (116 DEC) (74 HEX) Report Position rs (117 DEC) (75 HEX) Report Speed s+ (245 DEC) (F 5 HEX) Servos On
ASC 16 Commands (cont. ) • • • • s- (246 DEC) (F 6 HEX) Servos Off sa (241 DEC) (F 1 HEX) Save All sp (61 -76 DEC) (3 D-4 C HEX) Speed st (151 - 168 DEC) (97 - A 8 HEX) Stop sv (122 DEC) (7 A HEX) Save Default Servo Position tl (119 DEC) (77 HEX) Trigger Level tm (181 -196 DEC) (65 -C 4 HEX) Trigger on Motion Completion tp (201 -216 DEC) (C 9 -D 8 HEX) Trigger on Servo Position
ASC 16 Information: Command Set Example mv (1 -16 DEC) (01 -0 F HEX) Move servo absolute Format: mv$ position mv$ = 1 -16 for servo 1(mv 1) to 16 (mv 16) position = 0 -4000 Description: Moves a servo to a new absolute position at the speed and acceleration rate set for the specified servo. Example: Mnemonic Numeric mv 2 1500 Move servo 2 to position 1500 2, 5, 220 mv 10 200 Move servo 10 to position 200 10, 0, 200
Translator specs • Class (single instance for each servo) – Provides separate initialization data to exist within each object – Separate variable data such as position and rates are stored with each object – Functions compute output string based on object data - Normalized control
Class local Variable 'local variable(s) to hold property value(s) Private mvarmin. Range As Integer 'local copy Private mvarmax. Range As Integer 'local copy Private mvarmultiplier As Single 'local copy Private mvarmark As Integer 'local copy Private mvarservo As Integer 'local copy Private mvarposition As Integer 'local copy Private mvarreverse As Boolean 'local copy Public outputstring As String Public value As Integer Private mvargood As Boolean 'local copy
Why private? • Private can help guarantee values are within appropriate ranges. This helps make sure the system doesn’t get bad information. • Provides protection to data from outside. • It just means a function is must be called to write data.
ASC 16 Information: Command Set Example ac (81 -96 DEC) (51 -60 HEX) Acceleration Format: ac$ accel ac$ = 81 -96 for servo 1 (ac 1) to 16 (ac 16) accel = 1 -255 Example: mnemonic Numeric tl 2 ‘ set trigger level to suspend processing 119, 2 ac 1 5 ‘set acceleration rate for servo 1 to 5 cnts/20 m. S 2 81, 0, 5
Accel command for servo object Public Function Accel(By. Val rate As Integer) As String Dim locservo = mvarservo + 80 Accel = Chr$(locserver) & Chr$(rate) End Function
ASC 16 Information: Command Set Example mv (1 -16 DEC) (01 -0 F HEX) Move servo absolute Format: mv$ position mv$ = 1 -16 for servo 1(mv 1) to 16 (mv 16) position = 0 -4000 Description: Moves a servo to a new absolute position at the speed and acceleration rate set for the specified servo. Example: Mnemonic Numeric mv 2 1500 Move servo 2 to position 1500 2, 5, 220 mv 10 200 Move servo 10 to position 200 10, 0, 200
Servo Movement as seen by PC • Movement are absolute otherwise: – Increased chance of leaving initialized range – Must poll often to stay up to date, therefore increasing communication
Move command Public Function Move(By. Val pos As Integer) As String Dim bigmove As Integer Dim litmove As Integer Dim overall As Integer If pos >= 0 And pos <= 255 Then If mvargood Then If mvarreverse Then overall = mvarmin. Range - (pos * mvarmultiplier) litmove = (overall Mod 256) bigmove = ((overall - litmove) / 256) Else overall = mvarmin. Range + (pos * mvarmultiplier) litmove = overall Mod 256 bigmove = ((overall - (litmove)) / 256) End If mvarposition = pos Move = Chr$(mvarservo) & Chr$(bigmove) & Chr$(litmove) End If End Function
Initialization function Public Sub makenew() 'this is surely ugly as but since cannot use new like. NET 'this will do. If (mvarservo >= 1) And (mvarservo <= 16) And (mvarmax. Range <= 4000) And (mvarmin. Range <= 4000) And _ (mvarmax. Range >= 0) And (mvarmin. Range >= 0) Then mvargood = True If mvarmax. Range > mvarmin. Range Then mvarreverse = False mvarmultiplier = (mvarmax. Range - mvarmin. Range) / 256 Else mvarreverse = True mvarmultiplier = (mvarmin. Range - mvarmax. Range) / 256 End If mvarposition = 127 End Sub
Using objects • Create instantiate an object for each servo device Dim eye. Lr As New asc 16 stringbuilder Dim eye. Du As New asc 16 stringbuilder Dim neck. LR As New asc 16 stringbuilder Dim neck. DU As New asc 16 stringbuilder Dim mouth As New asc 16 stringbuilder • Initialize eye. Lr. servo = 1 eye. Lr. min. Range = 1390 eye. Lr. max. Range = 2810 eye. Lr. makenew • Use MSComm. Output = eye. Lr. Move(value) ’value range 0 255
A trivial use example • Random eye movement Public Sub LRAnim. Eye() Dim randomx As Integer randomx = Int(10 * Rnd) - 5 randomx = randomx * 15 MSComm. Output = eye. Lr. Move(randomx + 127) End Sub
Questions Discussion ? ?
- Slides: 34