im trying control robot sending positions 100hz. it's making shaking movement when sending positions. when send 1 position 50 mm start position moves smoothly. when use sensor steer,(so send every position 0 50mm) shaking. i'm sending x0-x1-x2-x1-x2-x3-x4-x5-x4-x5 , reason why might shake. how can solve making robot move smoothly when use mouse steer it?
- robot asking 125hz
- ir sensor sending 100hz
- otherwise 25hz makes diffrent?
here code.
while(true) // if sensor 1 recording ir light. if (listen1.newdata = true) { cox1 = (int) listen1.get1x(); // coy1 = (int) listen1.get1y(); newdata = true; } else { cox1 = 450; coy1 = 300; } if (listen2.newdata = true) { cox2 = (int) listen2.get1x(); coy2 = (int) listen2.get1y(); newdata = true; } else { coy2 = 150; } // if sensor gets further workspace, automaticly correct these // coordinates. if (newdata = true) { if (cox1< 200 || cox1> 680) { cox1 = 450; } if (coy1<200 || coy1> 680) { coy1 = 300; } if (coy2<80 || coy2> 300) { coy2 = 150; } } // command send robot. gcode = string.format( "movej(p[0.%d,-0.%d, 0.%d, -0.5121, -3.08, 0.0005])"+ "\n", cox1, coy1, coy2); //sends message server send(gcode, out); system.out.println(gcode); newdata = false; } } private static void send(string movel, printwriter out) { try { out.println(movel); /*writes server*/ // system.out.println("writing: "+ movel); // thread.sleep(250); } catch(exception e) { system.out.print("error connecting server\n"); } } }
@ edit
i discovered on wich way can this. via min , max. basicly think have is: * put every individual coordinate in array( 12 coordinates) * min , max out of array * output average of min , max
without knowing more robot characteristics , how control it, here general considerations:
to have smooth motion of robot, should control in speed designed pid controller algorithm.
if can control in position, best can monitoring position & waiting "near enough" targetted position before sending next position.
if want more detailed answer, please give more information on command send robot (movej
), suspect can more sending [x,y] coordinates.
Comments
Post a Comment