Connect to UgCS Server using .Net SDK

I'm completely new to this platform coding for drone flight management using .Net

But I'm not new to .Net. 

I tried to follow the steps mentioned in .Net SDK under the link provided below.

https://github.com/ugcs/ugcs-dotnet-sdk

I could see the pixhawk connected using UgCS client API and I could also see the telemetry values. When I try to code from visual studio as per the instructions, I could not see any data coming in. 

GetObjectListRequest getObjectListRequest = new GetObjectListRequest()
{
ClientId = clientId,
ObjectType = "Vehicle",
//ObjectId = 1,
RefreshDependencies = true
};
getObjectListRequest.RefreshExcludes.Add("Avatar");
getObjectListRequest.RefreshExcludes.Add("PayloadProfile");
getObjectListRequest.RefreshExcludes.Add("Route");
var task = messageExecutor.Submit<GetObjectListRequest>(getObjectListRequest);
task.Wait();

After executing this code, I get an exception saying task.value is null.

Also I checked the logs where I could see the below exception thrown.

ERROR [pool-9-thread-6] com.ugcs.ucs.hci.HciMessageListener - Error handling request
com.ugcs.ucs.service.NotAuthenticatedException: Not authenticated.
at com.ugcs.ucs.service.impl.HciSessionServiceImpl.checkAuthenticated(HciSessionServiceImpl.java:225)
at com.ugcs.ucs.hci.handler.GetObjectHandler.process(GetObjectHandler.java:31)
at com.ugcs.ucs.hci.HciMessageListener.handleRequest(HciMessageListener.java:94)
at com.ugcs.ucs.hci.HciMessageListener.messageReceived(HciMessageListener.java:48)
at com.ugcs.messaging.mina.MinaMessageSession.messageReceived(MinaMessageSession.java:156)
at com.ugcs.messaging.mina.MinaAdapter.messageReceived(MinaAdapter.java:92)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:854)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943)
at org.apache.mina.filter.logging.LoggingFilter.messageReceived(LoggingFilter.java:208)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943)
at org.apache.mina.core.filterchain.IoFilterEvent.fire(IoFilterEvent.java:74)
at org.apache.mina.core.session.IoEvent.run(IoEvent.java:63)
at com.ugcs.messaging.GroupingThreadPool$Worker.run(GroupingThreadPool.java:519)
at java.lang.Thread.run(Unknown Source)

What could be the cause? 

Also for the information, I didn't purchase UgCS pro application yet. I'm still on free version. Is there the limitation of access to telemetry values and vehicles using SDK with the UgCS Server?

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

Join diydrones

Replies are closed for this discussion.

Replies

  • Thanks for the reply.

    I was able to find that out when I was repeatedly testing my code with one client ON. 

    Now, I start the UGCS server manager and let the server ON and I tried to connect to the server from my code and it is working now. I could connect to the Server.



    Stevod said:

    Hi Priva, as I'm not using PIxhawk, I can't answer your technical question. However, the main restriction on both the Community and One version is that you cannot connect more than one client to the UGCS server simultaneously. The main impact of that is you can't use the standard UGCS GUI client to monitor what is going on in the server when you send commends from your own .Net client, which is a real shame, as that would be an invaluable debugging tool. Also, as the UCS server doesn't persist info by default (it's state is dependant on the client being connected, after which the state is wiped if you disconnect), you can't really swap between the two clients, as you lose all your flight info if you do - or at least that's my experience.

  • Hi Stevod, you are right regarding UgCS version. Only UgCS Pro and UgCS Entreprise allow more then 1 connection.

    BUT. If you are from university, we can propose free upgrade to UgCS Pro. Buy UgCS One, send us a request on the University's letterhead and we will send you Pro code. The same for training centers.

    Here is a list of dozens Uni's which use UgCS for education and R&D https://www.ugcs.com/en/pages/education-partners.

    Regarding state and flight info. Flight info stored to database independently of clients. But, to keep UCS in memory when you close client you should start UgCS service manager manually before client. It was made for user comfort - if you start UgCS client and it can't find running server, it will start server automatically. And if server was started automatically, UgCS client will terminate it on exit.

  • Hi Priva, as I'm not using PIxhawk, I can't answer your technical question. However, the main restriction on both the Community and One version is that you cannot connect more than one client to the UGCS server simultaneously. The main impact of that is you can't use the standard UGCS GUI client to monitor what is going on in the server when you send commends from your own .Net client, which is a real shame, as that would be an invaluable debugging tool. Also, as the UCS server doesn't persist info by default (it's state is dependant on the client being connected, after which the state is wiped if you disconnect), you can't really swap between the two clients, as you lose all your flight info if you do - or at least that's my experience.

This reply was deleted.