I have a script that lets the robot move between 2 waypoints. Now, the speed for moving from wp1 to wp2 is very slow (180mm/minute, e.g. 3mm/sec). the user would like to increase or decrease this speed during moving. What is the preferred way of doing this? Should I use another command, instead of movel()? I could chop up the move toward wp2 into many intermediate waypoints and movel() each individual waypoint with an updated speed, but that feels like a hack.
Any ideas welcome!
Can you give us some sample code? If you need it to move faster, then perhaps change the velocity parameter of the
movel() command in script to the maximum velocity you would ever need to achieve, and then use the speed slider to control the speed?
Are you writing this as script or are you doing this via Polyscope? Also, what are you using to control the speed input from the user?
I’m using a simple script that reads waypoints over the ethernet. So, I send a waypoint request to the PC, it responds with 6 target motor positions and a velocity, to which the robot moves via a movel() instruction. Ideally, the user can give an updated velocity via the PC were the set point was send, or via an external control on the robot analog or digital inputs. How could this be achieved?
I’ve seen a code sample for adjusting the speed slider, but that feels awkward and in the future I may need to alter not only speed but other stuff, too. Guess it amounts to be able to interrupt the current move via thread or something and then simply do a new movel(). But can a thread abort an movel() in progress?
You could put your move into a continuously checked loop and then jump out of that loop based on a variable change in a thread (with a stopj after the loop to prevent a nasty jerk)… but I prefer the approach in this online_velocity_adjustment.zip (3.4 KB)
It breaks the path between two waypoints down into 0.1mm steps using pose_interpolate() and then streams those small movements to the servoj() command. The speed is adjusted by changing the amount of time each step is given to execute based on an analog output value. I have also used this approach to do x/y/z trajectory offsets along the path based on sensor inputs by transforming the intermediate points before passing them to servoj.