/// <summary> /// Creates new mission /// </summary> /// <param name="name">Mission name</param> /// <returns></returns> public Mission CreateNewMission(String name = "TestMission") { var missionName = string.Format("{0} {1}", name, DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString()); Mission mission = new Mission { CreationTime = ServiceHelpers.CreationTime(), Name = missionName, Owner = _connect.LoginResponce.User }; return(_saveUpdatedMission(mission)); }
/// <summary> /// Example how to create route on server with route parameters /// Minimum parameters is specified /// </summary> /// <param name="mission">Mission where create route</param> /// <param name="vehicleProfile">Profile for route</param> /// <param name="name">Route name</param> /// <returns></returns> public Route CreateNewRoute(Mission mission, VehicleProfile vehicleProfile, String name = "TestRoute") { var routeName = string.Format("{0} {1}", name, DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString()); Route route = new Route { CreationTime = ServiceHelpers.CreationTime(), Name = routeName, Mission = mission }; ChangeRouteVehicleProfileRequest request = new ChangeRouteVehicleProfileRequest { ClientId = _connect.AuthorizeHciResponse.ClientId, Route = route, NewProfile = new VehicleProfile { Id = vehicleProfile.Id } }; MessageFuture <ChangeRouteVehicleProfileResponse> future = _connect.Executor.Submit <ChangeRouteVehicleProfileResponse>(request); future.Wait(); route = future.Value.Route; route.Mission = mission; route.TrajectoryType = TrajectoryType.TT_STAIR; route.MaxAltitude = 50.0; route.SafeAltitude = 3.0; route.CheckAerodromeNfz = false; route.CheckAerodromeNfzSpecified = true; route.InitialSpeed = 0.0; route.MaxSpeed = 0.0; route.CheckCustomNfz = false; route.CheckCustomNfzSpecified = true; route.Failsafes.Add(new Failsafe() { Action = FailsafeAction.FA_GO_HOME, ActionSpecified = true, Reason = FailsafeReason.FR_RC_LOST, ReasonSpecified = true, }); route.Failsafes.Add(new Failsafe() { Action = FailsafeAction.FA_LAND, ActionSpecified = true, Reason = FailsafeReason.FR_LOW_BATTERY, ReasonSpecified = true }); route.Failsafes.Add(new Failsafe() { Action = FailsafeAction.FA_WAIT, ActionSpecified = true, Reason = FailsafeReason.FR_GPS_LOST, ReasonSpecified = true }); route.Failsafes.Add(new Failsafe() { Action = FailsafeAction.FA_GO_HOME, ActionSpecified = true, Reason = FailsafeReason.FR_DATALINK_LOST, ReasonSpecified = true }); return(SaveUpdatedRoute(route)); }