# How to create robot acceleration profile given a certain average rate (math problem)

Hello, I have an interesting math question.

I want my robot to move 50 cm. I want its average speed to be 3.5 cm/s. However, I want my robot to accelerate at the beginning and slow down as it approaches 50 cm. In essence, a graph of robot’s speed vs. time should be a parabola that opens down. The average value of this graph should be 3.5 cm/s.

So I’m starting with the average rate that I want. How do I generate a parabola whose average value is the rate I want? Specifically, how do I figure out the peak speed my robot should achieve?

Untested proposal:

If the robot starts from rest from x=0 and travels to xmax then velocity V(x) is

`V = a*x^2 + b*x`

The acceleration A(x) is 0 at xmax/2, which gives you one equation for a and b

`A = a*xmax + b = 0`

The average velocity gives you the other equation you need to solve for a and b:

`Vavg = (1/xmax)*integral(a*x^2 + b*x) = (1/3)a*xmax^2 + (1/2)b*xmax`

Then solve for A(x) from V(x).

Most people use a trapezoidal velocity profile, which makes the problem a bit simpler since the acceleration during the increasing and decreasing velocity segments is constant.

1 Like

Much to your point, I think I should use a trapezoidal velocity profile on my robot.

How should I go about implementing this trapezoidal profile on my robot? One suggestion is:

Move at speed 100 for 1 second.
Move at speed 300 for 3 seconds.
Move at speed 100 for 1 second.

Is this the proper way to implement a trapezoidal velocity profile?

The speed profile you suggest is not trapezoidal, and the robot cannot instantaneously start moving at a particular speed.

A graph of a trapezoidal speed profile looks something like this:

The acceleration is constant for segments OP and QR, zero for PQ.

The parabolic speed profile you proposed looks like this, and the acceleration is always changing.

Regardless of which type of profile you choose, the details will depend on the desired average speed and the distance to travel. In some cases of a trapezoidal profile there may not be time or distance for a “flat top”, so some decision making is required.

1 Like