View Full Version : general question on real time control and continuous motion

10-14-2011, 01:09 PM
hi, I decided to build a bioloid hexapod in C++, I managed to make a function that moves a leg to a given position in a given time. now I try to control it contiuously: the leg tip moves left if I keep pressing a certain key, same for right, up etc... I tried to do it this way:

while key pressed -> increment position 1mm -> move leg -> check moving done -> loop

however it doesn't work since the leg stops at each increment. I couldn't find any resource about this, how is it done in programming? does it concern timers? thanks!

10-17-2011, 03:43 PM
well, I found a solution by building the function for moving the leg like this:

move leg to position in t seconds:

compute angles with IK -> pause for t seconds -> move leg in t seconds

this way, if the function is looped, the function is paused while the leg still moves. that would really really help if you could tell me if it's the right way to do it. just to be sure, I tried to check the time the angle computation took by using the function time() at different stages of the program, but it always returns 0. do you know why?