1 / 24

Robotics

Robotics. Coordinates, position, orientation kinematics. HTML5 reading file. Homework: Prepare for lab. Postings. Coordinate system. Method of providing system for specifying points / positions / vectors in a given N-dimensional space.

vlora
Download Presentation

Robotics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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 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) d y a x

  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/position_velocity_ship.htm http://ephysics.physics.ucla.edu/newkin/html/position_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. HTML5 program drawing positions • http://faculty.purchase.edu/jeanine.meyer/robotics/mapdata.html • Works in Firefox • Two sample files: • textpairs.txt • textpairs3.txt

  15. HTML5 functions • init • readInData • receivedText • drawpositions • drawdot

  16. HTML5 outline <html> <head><script>….</script></head> <body onload="init();"> Name the file: <input type="file" id="fileinput" " /> <canvas id="canvas" width="900" height="600"> The browser does not recognize canvas. </canvas> </body> </html>

  17. 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); }

  18. 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); } }

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

  20. 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"); } }

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

  22. 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.

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

More Related