Vehicle Path Following (API)
I have been using the FollowPathVehicle function from the external API in a Python script. Sometimes I am met with a ParameterOutOfRange exception; it is complaining about the parameter name speedMPS. However, I'm fairly certain the value I pass is well within the vehicle's maximum speed (Generic4x4). Are there any weird situations that could cause this error that I am not aware of?
Some further background:
I am trying to use the Human Controller for a vehicle, and then switch that vehicle to path following based on some user input. The parameter value for speed that I pass in is 25. Upon some further testing, it seems like if my vehicle is travelling below 15 MPS, and I try to switch to path following, the ParameterOutOfRange exception is raised. I don't think this is supposed to happen based on my understanding. If anybody could shine a light on this issue it would be much appreciated.
I have been playing around with this FollowPathVehicle function some more with the Generic4x4. If the parameter value for speed that I pass in is 35, then my vehicle must be traveling at 25 MPS or greater to be able to switch to path following. If the parameter value for speed that I pass in is 45, then my vehicle must be traveling at 35 MPS or greater to be able to switch to path following without errors. The allowable range for the speed parameter that is printed when I am met with the ParameterOutOfRange exception changes depending upon the value I pass in as well. If I am using a value of 25, the exception raised is "ParameterOutOfRange: ParameterOutofRange(parameterName=u'speedMPS', allowableParameterRange=u'0 - 15.6148')". If I am using a value of 35, the exception raised is the same when travelling under 15 MPS; however if my vehicle is travelling above 15 MPS and I attempt to call FollowPathVehicle, the exception becomes "ParameterOutOfRange: ParameterOutOfRange(parameterName=u'speedMPS', allowableParameterRange=u'0 - 27.8414')". If I am using a value of 45, the exceptions raised are the same when travelling under 15 MPS and 25 MPS respectively; however if my vehicle is travelling above 25 MPS and I attempt to call FollowPathVehicle, the exception becomes "ParameterOutOfRange: ParameterOutOfRange(parameterName=u'speedMPS', allowableParameterRange=u'0 - 43.3999')". I cannot make head nor tails of how this function behaves and the exceptions it raises make no sense to me.
I can get around these errors by restricting, based on vehicle speed, when the user can switch the control scheme for the vehicle from Human Controller to path following, so if the software is bugged I can make do for now. However, I would like to know how I can restrict the amount of drift from the prescribed path when the vehicle is attempting to follow it (my environment I am using is essentially a straight roadway but the vehicle drifts enough during path following to move out of its lane; I would like to restrict its movement further so that the vehicle stays within a certain distance from the path).
I would also like to know what units the speed of the vehicle is given in (I am getting vehicle speed by calling the AnvelCommand "GetVehicleState" through the external Python API function "SendStringCommand"). The documentation on the Wiki does not explicitly state the units. For now I am assuming it is MPS (meters per second); since the ParameterOutOfRange exception seems to expect speed in MPS, is it fair to assume that any other place speed is used is also in MPS? I would just like some confirmation that it is indeed MPS and not mph (miles per hour).
This issue is caused by a bug with how the API calls and handles top speed of the vehicle. Those varying top speeds in the range being displayed in the error are actually the top speeds(defined in the 4x4 vehicle definition file) for whatever gear the vehicle is currently in before it needs to shift.
As for the drift, I would need to see the path that you're trying to use. I would try to decrease the distance between way-points though. Actually getting to the way-point is more important to the vehicle controller than following the lines in between way-points.
And units of linear velocity is in meters per second, as shown in the ANVEL Properties tab.
Got it. Thanks for the help!