How to eliminate time and for a period of time -> do something

asked 2022-06-11 04:22:28 -0500

NickRos gravatar image

updated 2022-06-11 08:37:11 -0500

lucasw gravatar image

Hello.I have a robot at point (0,0,0) and I want to rotate it using cubic polynomials something like that:

# for angular velocity
a1 + 2*a2*t + 3*a3*pow(t , 2)               
# for angle
a0 + a1*t + a2*pow(t , 2) + a3*pow(t , 3)

but I want to rotate it without exceeding angular velocity of 0.69 rad/sec So, in Octave I have computed the maximum angle that robot have to turn and also I have computed the the total time of that movement. So,in python now I have some functions to return angle and angular velocity with parameters: t and t_interm

  • t_interm is the total time of movement I said before
  • t is the time of simulation.

So I want to eliminate time (start_time = 0) and for 1.2 seconds (1.2 sec is the total time of movement aka rotation of the robot) to do the rotation Something like that:

start_time=0
while(start_time < start_time + 1.2):
     do rotation

But I want the parameter t to be 0 at the beginning (I dont want the current time of simulation) Example of functions:

def angular_velocity_1(t , t_interm):
    a1 = 0
    a2 = (3 / pow(t_interm , 2) ) * (orientation_interm - orientation_init)
    a3 = (-2 / pow(t_interm , 3) ) * (orientation_interm - orientation_init)
    return a1 + 2*a2*t + 3*a3*pow(t , 2)


def angle_1(t , t_interm):
    a0 = orientation_init
    a1 = 0
    a2 = (3 / pow(t_interm , 2) ) * (orientation_interm - orientation_init)
    a3 = (-2 / pow(t_interm , 3) ) * (orientation_interm - orientation_init)
    return a0 + a1*t + a2*pow(t , 2) + a3*pow(t , 3)
edit retag flag offensive close merge delete