|
Post by hakkus on May 4, 2017 6:35:43 GMT -7
Max Hi,
I'm new on Dobot and Open-Dobot. Firstly I want to thank you for this forum.
I need to know; how I can control my dobot's position. PS: I use photointterrupter to calibrate base.
For example;
By *.py file I can move to the point 100,100,100 in x,y,z coordinates which includes "" dobot.MoveWithSpeed (100.0, 100.0, 100.0, speed, acceleration) "" command. And If I want to move 100,100,120 I need to reset all the things, shutting down dobot moving before the calibration position and modify code to ""dobot.MoveWithSpeed (100.0, 100.0, 120.0, speed, acceleration)"" and start the code again.
So I need to know, how can I adjust the dobot's position by trying dobot.MoveWithSpeed function repeatly without starting from the beginning.
If I run modified *.py file in 100,100,100 position, dobot supposes it's home position, so it goes 200,200,220.
I hope I can explain my problem. Thanks...
|
|
|
Post by Max on May 4, 2017 19:52:30 GMT -7
I think what you mean is that you want to persist the state between script executions. There are several ways to do the kind of thing you want depending on what is the actual goal. Sounds like an XY-problem ( xyproblem.info ) I'll outline one way to accomplish this. DobotDriver has "GetCounters" and "SetCounters" functions. Those counters are also internally tracked by DobotSDK as "_baseSteps", "_rearSteps" and "_frontSteps". What you can do is persist those counters into a file at the end of your script and restore them in the other script. To restore you need to set "_baseSteps", "_rearSteps" and "_frontSteps" and call SetCounters on DobotDriver to set counters in Arduino Arduino is reset every time a script opens the serial port - hardware limitation/feature and SetCounters sets internal state. "_baseSteps", "_rearSteps" and "_frontSteps" are the actual counters that SDK uses as current pose and to compute the number of steps each motor has to do to get to the requested position.
|
|