nameofuser1 / py-scurve

Planning s-curve trajectories with python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

v_max and a_max sometimes appear to be switched

idoria75 opened this issue · comments

First of all, thanks for the library, it is really useful.

Based on the examples given on the README, I changed the values of the script to make sense to my application:

from pyscurve import ScurvePlanner, plot_trajectory
import numpy as np

if __name__ == "__main__":
    q0 = [-2., 0.]
    q1 = [2., 5.]
    v0 = [0., 0.]
    v1 = [0., 0.]
    v_max = 0.5
    a_max = 2
    j_max = 10.

    p = ScurvePlanner()

    tr = p.plan_trajectory(q0, q1, v0, v1, v_max, a_max, j_max)
    plot_trajectory(tr, dt=0.01)

However, that is the result of plot_trajectory:
result

Note how my velocity limit is 0.5 and the speed profile on the left reaches values higher than 1. Also, the acceleration on the left saturates at 0.5, which is my velocity limit.

Do you have any clue on what could be causing this behavior?

I renamed the title because the use-case I had before had shown this issue on the 2nd trajectory. But on this case it happens on the 2nd trajectory:

from pyscurve import ScurvePlanner, plot_trajectory
import numpy as np

if __name__ == "__main__":
    q0 = [10., 0.]
    q1 = [4., 5.]
    v0 = [0., 0.]
    v1 = [0., 0.]
    v_max = 0.5
    a_max = 1
    j_max = 10.

    p = ScurvePlanner()

    tr = p.plan_trajectory(q0, q1, v0, v1, v_max, a_max, j_max)
    plot_trajectory(tr, dt=0.01)

scurve2

Fix merged