Presentation is loading. Please wait.

Presentation is loading. Please wait.

Robotics Coordinates, position, orientation kinematics. HTML5 reading file. Homework: Prepare for lab. Postings.

Similar presentations


Presentation on theme: "Robotics Coordinates, position, orientation kinematics. HTML5 reading file. Homework: Prepare for lab. Postings."— Presentation transcript:

1 Robotics Coordinates, position, orientation kinematics. HTML5 reading file. Homework: Prepare for lab. Postings

2 Coordinate 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.

3 Polar d a x y x = d * cos(a) y = d * sin (a) a= atan(y/x) need to specify quadrant—computer atan function may do this. d = sqr(x*x+y*y)

4 Note 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.

5 Addition (of moves) Robot moved … and moved again. Adding [cartesian] vectors –(x1, y1) + (x2,y2) IS (x1+x2, y1+y2) 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!

6 Position … of what? Robot wheel base Robot ultrasonic sensor Robot bumper or touch sensor itself Robot light sensor

7 Orientation Where is robot facing? Plane: 2 positional degrees of freedom and 1 angle Space: 3 positional degrees of freedom and 3 angles.

8 Reference Neat Flash animation on vectors –Ocean, bottle, current http://ephysics.physics.ucla.edu/newkin/html/pos ition_velocity_ship.htm

9 Kinematics For linked/jointed structures, calculating the position of the end-point, given the position/angle of each joint. Easy (easier) problem

10 Inverse 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.

11 Challenge: 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. HTML5 program draws points. (Later) send file (single position is 2 numbers) to other robot using Bluetooth (Later) automatically upload file to computer

12 HTML5 JavaScript reads in whole file –HTML5 file API. More general / more features than used for this example. –Note: asynchronous action. Set up function for the event of indicating the file AND set up function for the event of reading in the text data. –program detects line breaks –program converts from text to number draws on canvas –blue dot is the center –red dots are calculated positions Note: draws based on standard, not upside down!, coordinates.

13 testpairs.txt file 0 50 20 60 120 35 200 60 300 40

14

15 HTML5 program drawing positions http://faculty.purchase.edu/jeanine.meyer/r obotics/mapdata.htmlhttp://faculty.purchase.edu/jeanine.meyer/r obotics/mapdata.html Works in Firefox Two sample files: –textpairs.txt –textpairs3.txt

16 HTML5 functions init readInData receivedText drawpositions drawdot

17 HTML5 outline …. Name the file: The browser does not recognize canvas.

18 global data and init function var ctx; var center = [450,300]; var rad = 5; var data; function init() { ctx = document.getElementById("canvas").getContext("2d"); drawdot(center[0],center[1],"blue"); document.getElementById("fileinput").addEventListener(' change',readInData,false); }

19 function readInData(ev) { var input = document.getElementById("fileinput"); if (!input.files) { alert("browser doesn't seem to support files "); return; } else if (!input.files[0]) { alert("please select a file"); return; } else { file = input.files[0]; fr = new FileReader(); fr.onload = receivedText; fr.readAsText(file); }

20 function receivedText() { var i; data = fr.result.split("\n"); for (i=0;i<data.length;i++) { data[i] = Number(data[i]); } drawpositions(); }

21 function drawpositions() { //uses info in data array var i; var angle; var dist; var x; var y; for(i=0;i<data.length;i=i+2) { angle = (data[i]/180)*Math.PI; dist = data[i+1]; x = center[0]+dist*Math.cos(angle); y = center[1]-dist*Math.sin(angle); drawdot(x,y,"red"); }

22 function drawdot(x,y,color) { ctx.fillStyle = color; ctx.beginPath(); ctx.arc(x,y,rad,0,2* Math.PI,true); ctx.fill(); ctx.closePath(); }

23 Lab: 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.

24 Homework Postings Start/Continue work on mapping strategy / strategies –What sensor(s)? –How to specify origin? –Amount of travel versus walls versus ????


Download ppt "Robotics Coordinates, position, orientation kinematics. HTML5 reading file. Homework: Prepare for lab. Postings."

Similar presentations


Ads by Google