/// <summary> /// Send a state /// </summary> /// <param name="state"></param> public void SendState(UGVState state, byte id = 1) { double timestamp = (DateTime.Now - UnixTime).TotalMilliseconds; //id, longitude, latitude, altitude, x_speed, y_speed, z_speed NGCP.VehicleGlobalPosition vgp = new NGCP.VehicleGlobalPosition((byte)NodeID, (float)state.Longitude, (float)state.Latitude, 0); Node.Send(vgp, id); }
public int VehicleGlobalPositionCallback(Comnet.Header header, Comnet.ABSPacket packet, Comnet.CommNode node) { //validate who the packet is from 1 is gcs if (header.GetSourceID() == 7) { NGCP.VehicleGlobalPosition vgp = Comnet.ABSPacket.GetValue <NGCP.VehicleGlobalPosition>(packet); GPS_X_Box.Text = vgp.latitude.ToString(); GPS_Y_Box.Text = vgp.longitude.ToString(); } //make sure you return this way to declare succes and destory the pointer(c++) return((Int32)(Comnet.CallBackCodes.CALLBACK_SUCCESS | Comnet.CallBackCodes.CALLBACK_DESTROY_PACKET)); }