Title: Robotics
1Robotics
- Coordinates, position, orientation kinematics
- Homework Prepare for lab. Postings
2Coordinate system
- Method of providing system for specifying points
/ positions / vectors in a given N-dimensional
space. - This space, typically, is a line (1D), plane
(2D), or space (3D). - The most common coordinate system is Cartesian 3
orthogonal, linear dimensions fixed origin - Position of origin needs to be specified
- Orientation of axes needs to be defined
- Right-hand rule is convention involving
relationship of x, y and z - Another common system for the plane is polar
(angle and distance), cylindrical (polar
height) or spherical (3D vector distance) for
space.
3Polar
x d cos(a) y d sin (a) a
atan(y/x) need to specify quadrantcomputer atan
function may do this. d sqr(xxyy)
d
y
a
x
4Note
- May be easier to collect positions in polar
coordinates and then convert them, as needed, to
something else. - REPEAT critical issue is defining the origin.
5Addition (of moves)
- Robot moved and moved again.
- Adding cartesian vectors
- (x1, y1) (x2,y2) IS (x1x2, y1y2)
- Need to be aware of when something is a position
and when it is a displacement - Adding polar coordinates
- Convert to cartesian and convert back!
6Position
- of what?
- Robot wheel base
- Robot ultrasonic sensor
- Robot bumper or touch sensor itself
- Robot light sensor
7Orientation
- Where is robot facing?
- Plane 2 positional degrees of freedom and 1
angle - Space 3 positional degrees of freedom and 3
angles.
8Reference
- Neat Flash animation on vectors
- Ocean, bottle, current
- http//ephysics.physics.ucla.edu/newkin/html/posi
tion_velocity_ship.htm
http//ephysics.physics.ucla.edu/newkin/html/posit
ion_velocity_ship.htm
9Kinematics
- For linked/jointed structures, calculating the
position of the end-point, given the
position/angle of each joint. - Easy (easier) problem
10Flash example
Inputs are incremental. Angles are degrees
clockwise.
11Arm
- 4 joints two degrees of linear motion moving
the base and 2 links (coupled) angular motion. - Is there more than one way to be at one position,
one orientation???
12function moveit () var xm parseInt(xmtext.tex
t) var ym -parseInt(ymtext.text) _root.upper
.x xm _root.lower.x xm _root.upper.y
ym _root.lower.y ym Note linear
movement moves each link the same.
Quick update to AS3
13var upperlength upper._width function
rotateupper() var angle parseInt(angleu) up
per._rotation angle var nangle
upper._rotation var angler nangleMath.PI/180
var endx upper._x upperlengthMath.cos(angl
er) var endy upper._y upperlengthMath.sin(an
gler) lower.x endx lower.y
endy lower.rotation angle
Determine absolute rotation angle
Trig in Flash requires radians
14- function rotatelower()
- lower._rotation parseInt(anglel)
-
15Inverse kinematics
- Given jointed/linked structure, what are
positions of joints/angles to make endpoint be at
a given point? - May be no answer or multiple answers
- Easy for IBM Box frame robot links were not
coupled. - For articulated mechanisms, various approaches,
often requiring iterative techniques.
16Challenge mapping
- Program the robot to provide map of the room
- More precisely, provide coordinates of positions
of walls/barriers/lines (points)(think about
connecting points later) - Upload using Mindstorms to Desktop. Flash program
draws points. - (Later) send file (single position is 2 numbers)
to other robot using Bluetooth - (Later) automatically upload file to computer
17Flash application
- Origin is indicated by center movie clip instance
(blue dot) - Found positions are duplicated movie clip of
seedw instance (red dots) - URLLoader and URLRequest objects
- Create marker movie clip and use Linkages to
connect it to a default class. Instances of
this class can be created dynamically - Older versions of Flash used duplicatemovieclip
and so-called seed instances.
18testpairs.txt file
- 0
- 50
- 20
- 60
- 120
- 35
- 200
- 60
- 300
- 40
19(No Transcript)
20Flash application
- Original file had line breaks and was all text,
used - escape
- split
- parseInt
- This code assumes polar coordinates just to show
you conversion. Can use x,y pairs stored in
successive positions. - Note negative sign for vertical coordinate
21ActionScript 3.0
- import flash.display.
- var requestURLRequest new URLRequest("testpairs
.txt") - var loadrobdataURLLoader new URLLoader()
- loadrobdata.addEventListener(Event.COMPLETE,
usedata) - try
- loadrobdata.load(request)
- catch (errorError)
- trace("Unable to load URL " error)
22function usedata(eventEvent)void var
loaderURLLoader URLLoader(event.target) var
readings escape(loader.data) var rarr new
Array() var rarrnums new Array() var rstg
"" var sep "0D0A" rarr
readings.split(sep) for (i0 iltrarr.length
i) if (rarri.lengthgt0) rarrnums.push(
parseInt(rarri)) for (i0
iltrarrnums.length ii2)
makewallmarker(rarrnumsi,rarrnumsi1)
23function makewallmarker(angledeg,r) var a
angledegMath.PI/180 var wallmSeedw new
Seedw() wallm.x center.x rMath.cos(a) wall
m.y center.y -rMath.sin(a) addChild(wallm)
24Lab Mapping
- One group of strategies is to generate any number
of points along walls. - Leave it to other program to connect dots
- Another strategy is to measure walls
- Walk along walls, mark points or lengths
- You can make assumptions (constraints) on shape
of room - "Build" room using books or other obstacles.
25Homework
- Postings
- Continue work on mapping strategy / strategies
- What sensor(s)?
- How to specify origin?
- Amount of travel versus walls versus ????