public bool setRallyPoint(byte index, PointLatLngAlt plla, short break_alt, UInt16 land_dir_cd, byte flags,
byte rallypointcount)
{
mavlink_rally_point_t rp = new mavlink_rally_point_t();
rp.idx = index;
rp.count = rallypointcount;
rp.lat = (int) (plla.Lat*t7);
rp.lng = (int) (plla.Lng*t7);
rp.alt = (short) plla.Alt;
rp.break_alt = break_alt;
rp.land_dir = land_dir_cd;
rp.flags = (byte) flags;
rp.target_component = MAV.compid;
rp.target_system = MAV.sysid;
int retry = 3;
while (retry > 0)
{
generatePacket((byte) MAVLINK_MSG_ID.RALLY_POINT, rp);
int counttemp = 0;
PointLatLngAlt newfp = getRallyPoint(rp.idx, ref counttemp);
if (newfp.Lat == plla.Lat && newfp.Lng == rp.lng)
{
Console.WriteLine("Rally Set");
return true;
}
retry--;
}
return false;
}