Can't upload route to EMU-COPTER using .Net SDK

I am using the SDK to implement a full mission, including uploading a new route. The attached code Program.cs is heavily based on the Console example in the SDK. however, when I try to upload the new route, I get the exception "Action requires exclusive vehicle control." even when I acquire a lock before hand. What do I need to change to get this working?

Here's the most relevant section of code from the attached file:

AcquireLockRequest acquireLockRequest = new AcquireLockRequest
{
    ClientId = clientId,
    ObjectType = "Route",
    ObjectId = updateRouteTask.Value.Object.Route.Id,

};
MessageFuture<AcquireLockResponse> acquireLockTask = messageExecutor.Submit<AcquireLockResponse>(acquireLockRequest);
acquireLockTask.Wait();

System.Console.WriteLine("Lock Acquired");


UploadRouteRequest uploadRequest = new UploadRouteRequest
{
    ClientId = clientId,
    ProcessedRoute = processedRoute,
    Vehicle = vehicle,
};
MessageFuture<UploadRouteResponse> uploadTask = messageExecutor.Submit<UploadRouteResponse>(uploadRequest);
uploadTask.Wait();

System.Console.WriteLine("Route uploaded");


Thanks,

David

Program.cs

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

Join diydrones

Email me when people reply –

Replies



  • Stevod said:

    That's great, thanks. Nir - that was the problem. I now have a fully operational mission at the console using EMU-COPTER.

    Stage 1 accomplished :). I have attached the file in case it helps anyone.

    Program.cs

    https://diydrones.com/group/ugcs/forum/comment/show?id=705844%3AComment%3A2391242&xn_out=json&first…
  • That's great, thanks. Nir - that was the problem. I now have a fully operational mission at the console using EMU-COPTER. Stage 1 accomplished :)

  • Hi David,

    Do you see something like "lock acquired by <User> admin" in your ucs.log?

    If not, instead of updateRouteTask.Value.Object.Route.Id try to use the vehicle ID. This worked for me:

    /* lock request */
    AcquireLockRequest ALRequest = new AcquireLockRequest
    {
    ClientId = clientId,
    ObjectType = "Vehicle",
    ObjectId = 3 // vehicle.Id,
    };

This reply was deleted.