I configured a cube orange on a quad with IRLock, beacon on the ground and lidar. IRBeacon is mounted on a rover driving around, the quad is supposed to follow. It works. But I experiebce the quad making drasric moves when the rover is moving. So seems that PID tuning is to improve. The quad itself flyes very good. What parameters do I have to change that the quad is moving, following smooth?
A few questions. First, how fast is the rover moving? Second, at what rate would you estimate the locations updates are reaching the copter?
If you have a rover or other target moving at roughly walking speed (1-2 m/s) and you have a copter following it in Guided mode with a cruise speed set to substantially higher than that and your location-update rate is around 1Hz, then the copter will tend to jerk as it moves, since it’s essentially cruising to the new location from its current location at its configured cruise speed and acceleration settings. At best, you’ll see a visible “twitch” as the copter follows. At worst, it looks ridiculous as the copter flails around.
A trick to make this smoother is to flood the copter with very tiny location updates when following at low speeds. I have some code in place that sets a 20ms timer. It receives location updates from the source at whatever input rate (eg 1Hz). Each update, it remembers the last location it had and computes the heading from the last one to the current one, and the speed (distance from last to current/time since last location). It generates a string of location updates from the last location to the current one at 50Hz along the heading from last-to-current such that the jump distance for each one is what it would be if locations were arriving at 50Hz (20ms timer handling location updates at 1Hz). It’s essentially predicting the path of the target based on where it’s known to be currently going and how fast. This results in a ton of really tiny updates of a few cm each. These are sent to the copter, which follows. Since the rate is so high, the copter doesn’t have time to accelerate toward the new location before it gets another location and heads toward that one. The effect is that at low speeds (slow walking, etc) the copter will float along at the desired speed without jerking. The fact that it’s having location updates shoved down its throat at fire-hose rates isn’t noticeable. If the target changes heading, there will be a short pause (interval is whatever the real location update rate is) before the copter changes direction to follow. In that instance, sometimes it will jerk, but it’s better than doing so constantly. This approach works at higher speeds as well, since the generated locations are more “spread out” as the target speed increases. The “Follow me” code in Solex works like this. When you turn it on you can see the blue “I am here” marker on the map, and there’s also a black one that follows the same path, but more smoothly. That’s the one being updated by the code I describe above, and it’s these locations which are being sent to the vehicle.
A variant of this can be seen in the Solo’s follow code, if memory serves. It works.
Hi, what parameters can we adjust in the pixhawk or IRlock to achieve this?
The rover is controlled manually and is going really slow.
I would like to avoid having additional code as it is always a pain when updates come up. Aren’t there some parameters to check and to adjust?
I have done this before (drone following a person holding a beacon) and it worked well with Copter 3.5.7. I did not have to make any adjustment to parameters. Are you using
PLND_EST_TYPE = 1 or 0?
PLND_EST_TYPE is set to 0 (Raw Sensor)
You should be able to make the position corrections less aggressive by changing the Position Control parameters:
Also, if you are using Precision Loiter mode, then the Loiter parameters might also affect it (not sure):
Probably the most important parameters are
PSC_VELXY_*. You might only need to change these.
These are PIDs that is set for PSC_VELXY_*. Should I follow the PID tuning method to change the paramters?
PSC_VELXY_D 0.5 0.00 1.00 PSC_VELXY_D_FILT 5 Hz 0 100 PSC_VELXY_FILT 5 Hz 0 100 PSC_VELXY_I 1 0.02 1.00 PSC_VELXY_IMAX 1000 cm/s/s 0 4500 PSC_VELXY_P 2 0.1 6.0 PSC_VELZ_P 5 1.000 8.000
VELXY_I in half. That will probably produce a noticeable effect and will give you an idea if changing these parameters is the right thing to do.