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

Views: 77

Attachments:

Replies to This Discussion

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,
};

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 :)



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.

Attachments:

RSS

© 2017   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service