Intelligent Robotics I: Servo Control
description
Transcript of Intelligent Robotics I: Servo Control
![Page 1: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/1.jpg)
Intelligent Robotics I: Servo Control
Overview and example of robot control
Jeff Allen
![Page 2: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/2.jpg)
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)
![Page 3: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/3.jpg)
Robotic System The world and the boxes
Sensors Input Intelligence
Robot HW/SW State
Robo world
• Sensors– Can exist solely in
either domain– Can exist in mix of
both• Intelligence
– 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
Actuators Output
![Page 4: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/4.jpg)
Robotic System: simplification
Sensors Input Intelligence
Robot HW/SW State
Robo world
• Input to Intelligence– Ignore all outside
possibility as it is not in the system
• Intelligence to Robot State to Output– Imply state as
part of the connection
Actuators Output
![Page 5: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/5.jpg)
An Abridged Robotic SystemTransistions and related factors
Sensors Input Intelligence
Robo world
• Input to Intelligence– Complexity of
sensor input– Must travel in
robot world even if remote controlled.
• Intelligence to Actuators – Must travel in
robot world
Actuators Output
![Page 6: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/6.jpg)
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
![Page 7: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/7.jpg)
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 $$$$!
![Page 8: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/8.jpg)
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.
![Page 9: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/9.jpg)
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
![Page 10: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/10.jpg)
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)
![Page 11: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/11.jpg)
PC remote controlled systemsToday’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
![Page 12: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/12.jpg)
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?
![Page 13: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/13.jpg)
A communicating example:A PC controlled robot
Communication Channel PC to Control:
In this case RS232
Our development environment:
Visual StudioVB 6.0
Input to PC:
Predefined movement scripts / Sensors
Actuator Control:
ASC 16 Board
![Page 14: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/14.jpg)
Communication channel:PC to RS232 piece
• MS Visual studio provides the MSComm object capable of:– Transmitting/ receiving / open / close to a comm port using rs232.
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 ASC16 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
![Page 15: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/15.jpg)
Example goal
• We need something to convert commands from the PC to appropriate ASC16 commands, a translator.
![Page 16: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/16.jpg)
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
![Page 17: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/17.jpg)
ASC16 Commands• ac (81-96 DEC) (51-60 HEX)• Acceleration• am (250 DEC) (FA HEX)• Abort All Motion• at (249 DEC) (F9 HEX)• Abort Triggers• bt (124 DEC) (7C 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
![Page 18: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/18.jpg)
ASC16 Commands (cont.)• fp (21-36 DEC) (15-24 HEX) • Flyby Position• iv (112 DEC) (70 HEX)• Invert Servo Coordinates• la (242 DEC) (F2 HEX)• Load All• ld (123 DEC) (7B HEX)• Load Default Position• lm (253 DEC) (FD HEX)• Loop Marker• lp (254 DEC) (FE HEX)• Loop• mk (221-228 DEC) (DD-E4 HEX)• Marker
![Page 19: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/19.jpg)
ASC16 Commands (cont.)• mr (41-56 DEC) (29-38 HEX)• Move Relative• mk (221-228 DEC) (DD-E4 HEX)• Marker• mr (41-56 DEC) (29-38 HEX)• Move Relative• mv (1-16 DEC) (01-0F HEX)• Move servo absolute• no (0 DEC) (00 HEX)• No Operation• no no no (0,0,0 DEC) (00,00,00 HEX)• Terminate• nv (113 DEC) (71 HEX)• Non-invert Servo Positions
![Page 20: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/20.jpg)
ASC16 Commands (cont.)• op (110 DEC) (6E HEX)• Output• pg (120 DEC) (78 HEX)• Program Module address• ra (141-148 DEC) (8D-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) (F5 HEX)• Servos On
![Page 21: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/21.jpg)
ASC16 Commands (cont.)• s- (246 DEC) (F6 HEX)• Servos Off• sa (241 DEC) (F1 HEX)• Save All• sp (61-76 DEC) (3D-4C HEX)• Speed• st (151- 168 DEC) (97 - A8 HEX)• Stop• sv (122 DEC) (7A HEX)• Save Default Servo Position• tl (119 DEC) (77 HEX)• Trigger Level• tm (181-196 DEC) (65-C4 HEX)• Trigger on Motion Completion• tp (201-216 DEC) (C9-D8 HEX)• Trigger on Servo Position
![Page 22: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/22.jpg)
ASC16 Information:Command Set Example
mv (1-16 DEC) (01-0F HEX) Move servo absoluteFormat: mv$ position mv$ = 1-16 for servo 1(mv1) to 16
(mv16)position = 0-4000Description: Moves a servo to a new absolute position at
the speed and acceleration rate set for the specified servo.
Example:Mnemonic Numericmv2 1500 Move servo 2 to position 1500 2, 5, 220mv10 200 Move servo 10 to position 200 10, 0, 200
![Page 23: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/23.jpg)
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
![Page 24: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/24.jpg)
Class local Variable
'local variable(s) to hold property value(s)Private mvarminRange As Integer 'local copyPrivate mvarmaxRange As Integer 'local copyPrivate mvarmultiplier As Single 'local copyPrivate mvarmark As Integer 'local copyPrivate mvarservo As Integer 'local copyPrivate mvarposition As Integer 'local copyPrivate mvarreverse As Boolean 'local copyPublic outputstring As StringPublic value As IntegerPrivate mvargood As Boolean 'local copy
![Page 25: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/25.jpg)
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.
![Page 26: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/26.jpg)
ASC16 Information:Command Set Example
ac (81-96 DEC) (51-60 HEX)
Acceleration
Format: ac$ accel ac$ = 81-96 for servo 1 (ac1) to 16 (ac16)
accel = 1-255
Example:
mnemonic Numeric
tl 2 ‘ set trigger level to suspend processing 119, 2
ac1 5 ‘set acceleration rate for servo 1 to 5cnts/20mS2 81, 0, 5
![Page 27: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/27.jpg)
Accel command for servo object
Public Function Accel(ByVal rate As Integer) As StringDim locservo
locservo = mvarservo + 80Accel = Chr$(locserver) & Chr$(rate)
End Function
![Page 28: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/28.jpg)
ASC16 Information:Command Set Example
mv (1-16 DEC) (01-0F HEX) Move servo absoluteFormat: mv$ position mv$ = 1-16 for servo 1(mv1) to 16
(mv16)position = 0-4000Description: Moves a servo to a new absolute position at
the speed and acceleration rate set for the specified servo.
Example:Mnemonic Numericmv2 1500 Move servo 2 to position 1500 2, 5, 220mv10 200 Move servo 10 to position 200 10, 0, 200
![Page 29: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/29.jpg)
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
![Page 30: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/30.jpg)
Move commandPublic Function Move(ByVal pos As Integer) As StringDim bigmove As IntegerDim litmove As IntegerDim overall As Integer
If pos >= 0 And pos <= 255 Then
If mvargood Then If mvarreverse Then
overall = mvarminRange - (pos * mvarmultiplier) litmove = (overall Mod 256)
bigmove = ((overall - litmove) / 256)
Else overall = mvarminRange + (pos * mvarmultiplier) litmove = overall Mod 256 bigmove = ((overall - (litmove)) / 256) End If mvarposition = pos
Move = Chr$(mvarservo) & Chr$(bigmove) & Chr$(litmove)End If
End If
End Function
![Page 31: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/31.jpg)
Initialization functionPublic Sub makenew()'this is surely ugly as but since cannot use new like .NET'this will do. If (mvarservo >= 1) And (mvarservo <= 16) And (mvarmaxRange <= 4000) And (mvarminRange <=
4000) And _ (mvarmaxRange >= 0) And (mvarminRange >= 0) Then mvargood = True If mvarmaxRange > mvarminRange Then mvarreverse = False mvarmultiplier = (mvarmaxRange - mvarminRange) / 256 Else mvarreverse = True mvarmultiplier = (mvarminRange - mvarmaxRange) / 256 End If End If mvarposition = 127End Sub
![Page 32: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/32.jpg)
Using objects
• Create instantiate an object for each servo device
Dim eyeLr As New asc16stringbuilder
Dim eyeDu As New asc16stringbuilder
Dim neckLR As New asc16stringbuilder
Dim neckDU As New asc16stringbuilder
Dim mouth As New asc16stringbuilder
• Initialize eyeLr.servo = 1
eyeLr.minRange = 1390
eyeLr.maxRange = 2810
eyeLr.makenew
• UseMSComm.Output = eyeLr.Move(value) ’value range 0 255
![Page 33: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/33.jpg)
A trivial use example
• Random eye movementPublic Sub LRAnimEye()
Dim randomx As Integer
randomx = Int(10 * Rnd) - 5
randomx = randomx * 15
MSComm.Output = eyeLr.Move(randomx + 127)
End Sub
![Page 34: Intelligent Robotics I: Servo Control](https://reader036.fdocuments.us/reader036/viewer/2022062305/568150a8550346895dbeb4b2/html5/thumbnails/34.jpg)
Questions Discussion
??