How can I Set Home using SDK?

I am using following code on the .net SDK, trying to send the Phantom 3 simulator to a home point of lat/long/alt {0.0,0.0,0.0} before flying a mission.

 

Unfortunately, the UGCS emulator has a bug and will not return telemetry on Ubuntu when flying, and hence I have purchased a physical DJI drone to use its simulator instead.

 

The SDK documentation is unclear on what commands/parameter are available, and their structure, and hence I am guessing what I should be using. Will it be possible to publish a list of SDK commands/parameters, please, as they seem to be similar, but not identical to standard MAVLINK commands?

 

Until that is available, could you please advise on how to reset and fly to a new home location using the simulator, please.

 

Thanks.

 

 

            var sendCommandRequest = new SendCommandRequest

            {

                ClientId = clientId,

                Command = new UGCS.Sdk.Protocol.Encoding.Command

                {

                    Code = "set_home",

                    Subsystem = Subsystem.S_FLIGHT_CONTROLLER

                }

            };

 

            sendCommandRequest.Command.Arguments.AddRange(new CommandArgument[] {

                        new CommandArgument { Code = "latitude", Value = new Value { DoubleValue = 0.0 }},

                        new CommandArgument { Code = "longitude", Value = new Value { DoubleValue = 0.0 }},

                        new CommandArgument { Code = "altitude", Value = new Value { DoubleValue = 0.0 }}

            });

            sendCommandRequest.Vehicles.Add(new Vehicle { Id = vehicle.Id });

            var sendCommandResponse = messageExecutor.Submit<SendCommandResponse>(sendCommandRequest);

            sendCommandResponse.Wait();

 

 

            SendCommandRequest request = new SendCommandRequest

            {

                ClientId = clientId,

                Command = new UGCS.Sdk.Protocol.Encoding.Command

                {

                    Code = "return_to_launch",

                    Subsystem = Subsystem.S_FLIGHT_CONTROLLER,

                }

            };

            request.Vehicles.Add(new Vehicle() { Id = vehicle.Id });

            var rtlResponse = messageExecutor.Submit<SendCommandResponse>(request);

            rtlResponse.Wait()

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • Hello,

    In UgCS you can provide a new vehicle's home location only as part of a route.

    Here you can find info on how to create, process and upload a new route object: https://github.com/ugcs/ugcs-dotnet-sdk/wiki#working-with-routes
    A home location here can be set explicitly by setting:
    route.HomeLocationSource = HomeLocationSource.HLS_EXPLICIT;
    In this case you should also set HomeLatitude, HomeLongitude and HomeWgs84Altitude/HomeAglAltitude fields of the Route object.
    Or it can be derived implicitly from the first trajectory point:
    route.HomeLocationSource = HomeLocationSource.HLS_FIRST_WAYPOINT;

    Best regards,
    Anna Moshkova
    www.ugcs.com/support
    Video tutorials: YouTube.com/UgCS
    Latest news: FB.com/SPHEngineering
    ugcs/ugcs-dotnet-sdk
    Contribute to ugcs/ugcs-dotnet-sdk development by creating an account on GitHub.
This reply was deleted.