Community Forum
ANVEL Licensing Options

Desired speed in path follower function



  • I am noticing a pattern with vehicle pathfollower python API function.
    To recreate the problem, first create a circular path of radius say 30m in Large Parking Lot. Import "Generic 4x4" and make it follow the path with desired speed at 8 m/s. The forward speed of the vehicle is probably about 4 m/s on the circular path much less than the desired speed.

    Now, repeat the same sim as above but with the radius of circular path as 300m. The vehicle forward speed would approach 8 m/s.

    I don't know if the curve radius of the path should drop the vehicle forward speed. Shouldn't the vehicle try to run at the desired speed in either path. Is it something in the path follower algorithm in the API function or error on my part?
    Thank you.



  • Thank you for the question. As I'm sure you know, when a vehicle is following a path, its controller is set to SimpleAIController. The properties for this can be found in the Properties tree under Controllers.
    The properties of the AIController are documented here.

    The "Angular Tolerance" property seemed most relevant to me, so I did a bit of testing. I confirmed that changing this value from the default of .2 to a higher number (e.g. 1.2) allowed the vehicle to travel around the circular path at a greater distance from the path points, thus allowing it to maintain a higher speed around the curves.

    With a goal speed of 8 m/s, I found on the smaller path that my vehicle actually drove too fast, thus missing one of the points and causing it to turn around and around to re-attempt it. After a few loops it achieved the point that it had missed and continued on around the path. So while I was able to drive faster, my overall path time went down.

    To monitor my speed while manipulating the AIController values, I added the vehicle property "Forward Speed" to the Chart.

    Give this a try and let us know how it works out for you.



  • Thank you for the tip on increasing the Angular Tolerance. It did increase the vehicle speed towards desired level.
    Is there a way to set this "Angular Tolerance" from the Python code or better, is it possible to directly call "SimpleAIController" from Python code. That way, I will have more capability than the standard path follower API function.



  • Yes, you can set this value using python. It is simply a matter of using the SetProperty command.

    Here you will find a sample program.



  • Thank you for the program. It's working great. In general, even with the higher angular tolerance, the actual vehicle speed seems to be approximately 3% lower than the desired max speed specified in the path follower function. Perhaps that can be attributed to the pid algorithm used for maintaining vehicle speed or VTI?



  • Hi. I did some testing with both a circular path and a straight path, with speed specified at 14 and am getting 13.97. Perhaps there is something specific in your use case that is the key. Can you elaborate?



  • Hi,
    Here is the script I used:
    path = anv.CreatePath('Circle Path', waypointList)
    vehPos = Point3(0, 30.48, 0)
    veh = anv.CreateObject('Generic 4x4', 'Generic', 0, vehPos, Euler(0, 0, 0), True)
    anv.FollowPathVehicle(veh.id, path.id, 9)
    controller = anv.GetVehicleController(veh.id)
    anv.SetProperty(controller.id,"Angular Tolerance","1.5")
    anv.SetSimulationState(SimulationState.RUNNING_REALTIME)

    I realized the performance also depends on the vehicle.
    Thanks,
    Jai



  • Also, is there any info on "Look Ahead Scale" and "Curve Smoothing" parameters?
    Thanks,
    Jai



  • What values did you set for numWaypoints and radius?

    Also, can you send me your results from adding this to the end of your script:

    for step in xrange(100):
        anv.StepSimulation()
    
    numSteps = 1024
    times = np.empty([numSteps, 2])
    for step in xrange(numSteps):
        anv.StepSimulation()
        times[step, 0] = anv.GetProperty(veh.id, 'Forward Speed')
        times[step, 1] = anv.GetProperty(veh.id, 'Driven Distance')
    
    df = pd.DataFrame(times, columns=['Forward Speed', 'Driven Distance'])
    print(df.describe())
    

    I will check on the documentation you requested and get back to you.

    Thanks!



  • Regarding the AIController properties, "look ahead scale" tells it how far down the path to look. In testing, the greater this value, the slower my vehicle performed.

    The "curve smoothing" tells it how tight to take a corner. For example, with a 120 degree right-hand turn (following clockwise around the circle), I found that a higher number caused my vehicle to drive well beyond the point at the entry to the curve before starting the right turn. This caused it to miss the next point and have to go back for it. With the default value of "0.1", it closely followed the curve/path.



  • For MRZR
    Forward Speed Driven Distance
    count 2048.000000 2048.000000
    mean 7.804165 72.199432
    std 2.042793 49.372334
    min 0.010885 0.000047
    25% 8.618327 26.893950
    50% 8.622560 71.020150
    75% 8.635460 115.150500
    max 8.789160 159.804000

    For Generic 4X4
    Forward Speed Driven Distance
    count 2048.000000 2.048000e+03
    mean 8.338265 8.052948e+01
    std 1.771030 5.165587e+01
    min -0.013988 5.982210e-08
    25% 8.809410 3.506477e+01
    50% 8.810785 8.015345e+01
    75% 8.847030 1.252802e+02
    max 8.899910 1.707430e+02

    I used 120 waypoints for circle of radius 30.48m



  • Next, I tried bigger circle 60.48m radius with 240 way points

    Generic 4X4:
    Forward Speed Driven Distance
    count 4048.000000 4.048000e+03
    mean 8.655290 1.702442e+02
    std 1.297297 1.038200e+02
    min -0.014565 5.982210e-08
    25% 8.906070 7.996285e+01
    50% 8.906730 1.700755e+02
    75% 8.907310 2.601883e+02
    max 8.983810 3.503360e+02

    MRZR:
    Forward Speed Driven Distance
    count 4048.000000 4048.000000
    mean 8.369194 161.055822
    std 1.550400 102.014673
    min 0.010885 0.000047
    25% 8.810000 71.317775
    50% 8.810620 160.459000
    75% 8.810950 249.600000
    max 8.814180 338.755000



  • Hi. Thank you for providing your vehicle performance numbers. While this is not a constant speed and it only comes close to the desired speed, it is probably the best we can achieve using the path follower.

    Have you tried using the VehicleControl.py example script? It allows you to specify steering and throttle inputs.