DroneKit mission not sent to drone - dronekit

I'm trying to create simple mission using Drone-Kit android.
Mission myMission = new Mission();
myMission.clear();
Takeoff to = new Takeoff();
ReturnToLaunch rtl = new ReturnToLaunch();
//set Altitude in meters
rtl.setReturnAltitude(2);
to.setTakeoffAltitude(2);
myMission.addMissionItem(to);
myMission.addMissionItem(rtl);
MissionApi.getApi(this.drone).setMission(myMission,true);
The problem is that sometimes it works, and sometimes it's doesn't...
I don't know why it not working... I'm not getting any errors in the code.
I'm listening to the
AttributeEvent.MISSION_UPDATED
AttributeEvent.MISSION_SENT
AttributeEvent.MISSION_RECEIVED
but only the AttributeEvent.MISSION_UPDATED is fired when I run the code.
And even if its fired, this doesn't mean that the mission updated correctly.
I'm checking the mission with Mission Planer.
I just don't understand why it is working sometimes and sometimes not.
I did make sure that the drone connected to the app.
Also I made sure that the drone is OK and arm-able.
I really stuck here... and any help will be appreciated.

I have not tried dronekit-android before but I think it is better to open an issue here.
The source code for android project has not been updated for more than two years!
In general,there is a protocol to upload/download a mission. It is not easy to implement but you can implement it. I did that in c++. You should always check the acknowledgment from the drone before going in the next step. Check the protocol here.

I will answer my question, in case someone have the same problem.
I have contacted the developers, and it seems that I'm not the only one who have this BUG.
It seems that when you add ReturnToLaunch to Mission something happening in the API and the mission is not sent to the drone. As soon as I removed ReturnToLaunch object from the Mission all worked properly.
Work-Around: To overcome the issue, I am putting the drone in RTL mode, when the Mission is done.

Related

CPU Usage gradually increases in dotnet core webservice

I have a .net Core web service which seems to slowly increase its cpu usage.
meaning at the first day it won't go past 10%, the second day it can go up to 20% and so on.
Using the TOP command in linux, all my webservices seems to sometime be shown there (probably when a request is made) and afterward disappear.
This specific process after running for a while just stays there constantly consuming cpu even when no request has been made.
the API still working fine, it seems like there are some threads that just keeps hanging and consuming cpu. last time I checked I had 5 threads that consumed 3-4% cpu and didn't die for some reason.
My guess is that in some specific scenario a thread just stays alive consuming cpu.
The app runs on ubuntu machine, my first step was trying to create a dump file with ProcDump so I can analyze those threads and maybe find where they are hanging.
ProcDump generates a huge 21gb file, which trying to analyze with lldb throws out of memory exception. even tried transferring it to a windows machine to debug with windbg , no help there as it couldn't open the file.
As there is no specific exception or anything I can't really share any piece of code as I have no idea where the issue is... just kind a hoping for some suggestion that might help me get to a solution or at least understand where the problem is.
Thanks a lot for reading, cheers
You could try using something like jetBrains’ DotMemory, they also have a fairly high level but helpful guide https://www.jetbrains.com/help/dotmemory/How_to_Find_a_Memory_Leak.html it also worth checking your startup file and double checking the services you’ve registered are used in the correct way ie not added as scoped when they should be transient or even a singleton etc
so iv'e been at it for a while.
Eventually found out that my problem was with HttpClient
Probably some bad mix of static class and creating new instances of HttpClient that causes the issue Iv'e explained above.
Solved it by utilizing HttpClientFactory as explained here -
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/http-requests?view=aspnetcore-2.1
Lesson learned :)
A little late but Procdump for Linux just added .NET Core 3 support that generates much more managable sized core dumps. It automatically detects if the target process is .NET Core and does the right thing (i.e., no need to specify switches).

Can't use the Virtual Stick even though isVirtualStickControlModeAvailable returns true

I am having a problem with the virtual sticks, the following is the problem.
The Virtual sticks fire the notification, the listener sends the proper values to the roll, pitch, yaw and throttle, the isVirtualStickControlModeAvailable method from the sdk returns true, when it returns true I use the command from the flight controller send which returns the completion error nil, which means I can not do anything else from there, actually I do not need to do anything else. The virtual Sticks are working in a timer as the sample simulator from DJI.
What can I do in my app?
- Take off
- Land
- Give control back and forward to the RC
None of the list above brings me errors, including the process of the virtualStick.
What else did I try?
- Run the sample simulator app from DJI, linked above.
- Run the sample app on Android
- Run using the Bridge APP (Thats how i know the values are being passed correctly, even though i added labels on screen to debug without the Bridge APP)
- Update firmware from the aircraft and RC to the latest
- Sample simulator IOS
- Went back to previous working commits and branches on git
None of the things I have tried above worked.
Curious Stuf:
- The virtual Sticks worked fine till Yesterday, and before yesterday, in many diferent branches and commits in multiple branches.
- Reseting the Remote control, Executing Manual Linking and Linking through the DJI Official APP, and clearing the cache, memory sdcard made it work on Simulator Assistent DJI (Latest version) with a lot of interference, in the Sample apps on Android and IOS, and on my Swift 3 application. Then it had some interference, I tested outside on the real Aircraft, it was working beautifully.
- Today, the same thing happens. Already did the whole testing above mentioned, the Android sample apps, IOS Sample Apps, the Simulator, Bridge, My application, Reset remote etc. And it does not work.
I would be really glad if someone could point me out the problem.
On this thread I explain partially the problem and what I have tried. http://forum.dev.dji.com/forum.php?mod=viewthread&tid=32729
Already sent an email to DJI support, still no answer.
Aircraft: Phanton 4.
I have found the problem, it was the aircraft, I could get hands in a new aircraft, just pluged to the new RC linked to the new Aircraft, it worked with no problem.
Then I tested the new RC linking to the old aircraft, It did not work, then the Old RC with linked to the new Aircraft, it worked.
Glad you found the fix.
It might be worth it to update the firmware of the old aircraft.
You can do so using the DJIGo app or DJI Assistant software for desktop.

QSystemTrayIcon keeps creating new icons

I've created a notification system that makes use of QSystemTrayIcon to alert the user. My issue is that each time a user receives a notification it creates a new icon so the system tray ends up full of these icons.
I develop the program on a Linux machine and the issue doesn't occur here. However, I build the program on Windows 7 which is where the program is actually used and where the issue arises. This makes testing tricky for me as I have to go through quite a lengthy process to even run the program on Windows. So I'm kind of hoping someone can spot the issue and tell me exactly what is wrong but I appreciate any input so please if you have any idea do tell.
My code:
QSystemTrayIcon* notiTray = new QSystemTrayIcon(this);
notiTray->setIcon(QIcon(":/icon.png"));
notiTray->setVisible(true);
notiTray->showMessage("Notifications, "You have new notifications", QSystemTrayIcon::Information, 60000);
notiTray->show();
QApplication::alert(this, 1000);
This code is inside an if statement inside a function that gets called every 5 seconds to check for new notifications.
At a guess I'd say it might be because a new SystemTrayIcon is made everytime a notification arises but I'm not 100% and I was hoping anyone might be able to confirm this to save me from going through an awful process of testing it on Windows.
Thanks for any help!

GDK picture intent gets stuck on Tap to accept

Today the picture function on my Glass app stopped working. It was fine yesterday, but now it gets stuck on the Tap to Accept Picture. I think it may have something to do with the new (to me at least) way it handles pictures as well as the viewfinder. What I can find on the glass developers site is deprecated and doesn't work. My hope/belief is that the new idea is for the intent to go to the viewfinder and then take the picture. I'd prefer to still use the glass method, but I am aware of the android API camera method. Here's the code
startActivityForResult(new Intent(MediaStore.ACTION_IMAGE_CAPTURE), REQUEST_PIC);
and in onActivityResult
switch(requestCode)
{
case REQUEST_PIC:
String picturePath = data.getStringExtra(Intents.EXTRA_PICTURE_FILE_PATH);
processPictureWhenReady(picturePath);
break;
}
I have got the same problem since upgraded to XE18.3. Instead of spending time to look for a workaround, I've implemented the preview mode with SurfaceView. You could access the camera directly with Camera.Open(), the sample codes can be found at: (search for "camerasample.zip" in the page)
https://code.google.com/p/google-glass-api/issues/detail?id=351
Hope this helps.
This is a problem being experienced after the XE18.3 update. It has been logged in the google-glass-api issue tracker here.
You can try downgrading the firmware as mentioned in the comments, but be sure to note that doing that voids your warranty.
I have the same issue happening to me as well, however if you plug Glass into your computer that is running Eclipse and the adb is running the Intent will complete successfully. This is not a solution but hopefully it'll keep you from getting behind in work until there is an answer available.

Failed to resume in time Crashlog

I am trying to figure out a "Failed to resume in time" problem. In one of our testers devices (which is an iPhone 4S with the latest OS) it happens very frequently, whereas in my own device it doesn't seem to happen at all.
Anyway, I got a few crashlogs. I am unable to trace the root of the cause though. I understand that the issue might be
1.When a process is holding up the main thread for too long.
2.When there is a memory issue.
I don't think the memory is much of an issue since it seems to happen when the user leaves the main menu and comes back. Nothing much is happening in the main menu so it probably is a task that runs too long.
Here is an excerpt from the crash log:
Can somebody help me or guide me on who I can trace the cause of the issue? Is there anyway to turn off the watchdog timer(probably not huh?) Also, what does highlighted thread refer to?
I have already checked my applicationDidBecomeActive & applicationWillEnterForeground to make sure there is nothing going on there.
To my knowledge there are no synchronous calls being made at this point. Does Reachability use synchronous calls to check for internet? How can I check for that?
I am not making any large data transfers upon resume.
I notice that GameCenter automatically logs in or check for log in upon resuming your app. Is there anyway to prevent this? Could this possibly cause a time out issue?
I tried doing a time profile, but I am not able to understand how to use it to analyze. If you can provide a good resource for that, that would be amazing.
Thanks!!!
You're currently in "trying to find the issue mode". You should switch to "try to find out how much of an issue this really is" mode.
So go find another 4S (actually as many as you can) to rule out that it's a device-specific issue. If it happens on all 4S it should be easier to pinpoint. If not, have someone else look over it, discuss possible causes. The peer programming approach often helps when you're stuck in a dead-end situation.
If the issue is only on that one device, you might want to check if it's broken (or "jailbroken") or might simply need a hard reboot (hold power and home for 10+ seconds).
If it only happens on some devices but not all, try to find what they have in common. This could be language/locale, or dictation, practically any kind of setting the user might have changed. If necessary, write a logger that logs as many settings as possible to your (web) server so you can compare settings one-by-one and quickly discard those that aren't in synch.
If only very few devices are affected, you could also ignore the issue and hope that additional crash logs from users will reveal the key to the issue.
Finally, there's always the option to disable suspend on terminate and instead terminate the app when the home button is pressed (as it was pre iOS 4). Unless of course the app has to run in background.