Title: Intelligent Robotics I: Servo Control
1Intelligent Robotics I Servo Control
- Overview and example of robot control
- Jeff Allen
2Robot 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)
3Robotic System The world and the boxes
- 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 its will
onto the real world
Robo world
Sensors Input
Intelligence
Robot HW/SW State
Actuators Output
Outside World Part of your system feedback
mechanism hopefully!?
4Robotic System simplification
- 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
Robo world
Sensors Input
Intelligence
Robot HW/SW State
Actuators Output
Outside World Part of your system feedback
mechanism hopefully!?
5An Abridged Robotic SystemTransistions and
related factors
- Input to Intelligence
- Complexity of sensor input
- Must travel in robot world even if remote
controlled. - Intelligence to Actuators
- Must travel in robot world
Robo world
Sensors Input
Intelligence
Actuators Output
Outside World Part of your system feedback
mechanism hopefully!?
6Sensor 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
7Consequences 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 !
8Information Traveling in the Robot World
- Information and its 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.
9Some 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
10More 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)
11PC remote controlled systemsTodays example
- Inexpensive.
- PC (look at a Frys 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
12Review Traveling in the Robot World. what
did we say?
- Information and its communication must happen.
If nothing is communicated how can it be a robot? - We all know how it is done. In theory.
Practically?
13A communicating exampleA PC controlled robot
Communication Channel PC to Control In this
case RS232 Our development environment Visual
Studio VB 6.0
Input to PC Predefined movement scripts /
Sensors
Actuator Control ASC 16 Board
14Communication channelPC 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
15Example goal
- We need something to convert commands from the PC
to appropriate ASC16 commands, a translator.
16Requirements
- 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
17ASC16 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
18ASC16 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
19ASC16 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
20ASC16 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
21ASC16 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
22ASC16 InformationCommand Set Example
- mv (1-16 DEC) (01-0F HEX) Move servo absolute
- Format mv position mv 1-16 for servo 1(mv1)
to 16 (mv16) - 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
- mv2 1500 Move servo 2 to position 1500 2, 5, 220
- mv10 200 Move servo 10 to position 200 10, 0,
200
23Translator 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
24Class local Variable
- 'local variable(s) to hold property value(s)
- Private mvarminRange As Integer 'local copy
- Private mvarmaxRange 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
25Why private?
- Private can help guarantee values are within
appropriate ranges. This helps make sure the
system doesnt get bad information. - Provides protection to data from outside.
- It just means a function is must be called to
write data.
26ASC16 InformationCommand 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
27Accel command for servo object
- Public Function Accel(ByVal rate As Integer) As
String - Dim locservo
- locservo mvarservo 80
- Accel Chr(locserver) Chr(rate)
- End Function
28ASC16 InformationCommand Set Example
- mv (1-16 DEC) (01-0F HEX) Move servo absolute
- Format mv position mv 1-16 for servo 1(mv1)
to 16 (mv16) - 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
- mv2 1500 Move servo 2 to position 1500 2, 5, 220
- mv10 200 Move servo 10 to position 200 10, 0,
200
29Servo 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
30Move command
- Public Function Move(ByVal pos As Integer) As
String - Dim bigmove As Integer
- Dim litmove As Integer
- Dim overall As Integer
- If pos gt 0 And pos lt 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)
31Initialization function
- Public Sub makenew()
- 'this is surely ugly as but since cannot use new
like .NET - 'this will do.
- If (mvarservo gt 1) And (mvarservo lt 16) And
(mvarmaxRange lt 4000) And (mvarminRange lt 4000)
And _ - (mvarmaxRange gt 0) And (mvarminRange
gt 0) Then - mvargood True
-
- If mvarmaxRange gt mvarminRange Then
- mvarreverse False
- mvarmultiplier (mvarmaxRange -
mvarminRange) / 256 - Else
- mvarreverse True
- mvarmultiplier (mvarminRange -
mvarmaxRange) / 256 - End If
-
- End If
- mvarposition 127
- End Sub
32Using 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
- Use
- MSComm.Output eyeLr.Move(value) value range
0 255
33A trivial use example
- Random eye movement
- Public Sub LRAnimEye()
- Dim randomx As Integer
- randomx Int(10 Rnd) - 5
- randomx randomx 15
- MSComm.Output eyeLr.Move(randomx 127)
- End Sub
34Questions Discussion