New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to get the flight state? #326
Comments
Agent comment from yating.liao in Zendesk ticket #107011: °°° |
Thanks a lot for you clear answer. The problem with the KeyFlightMode is that there isn't any enum member indicating that the aircraft is ready to land. |
Agent comment from yating.liao in Zendesk ticket #107011: °°° |
Thank you for your reply. Could you please tell me if we can get the drone status using KeyGoHomeStatus even it's flying indoors ?(meaning that the GPS would not function entirely) |
Agent comment from yating.liao in Zendesk ticket #107011: °°° |
Actually, I'm trying to know when the drone has finished taking off, not when it has finished landing. In TakeOffWidgetModel.kt I've seen there is a variable called takeOffLandingState which type is an enum class and inside we can find 10 states. What I wanted to do is to monitor the value and when takeOffLandingState would be in the state "READY_TO_LAND, make it do an action like going forward for example. |
Agent comment from yating.liao in Zendesk ticket #107011: The height of the drone relative to the takeoff point can be monitored and obtained using °°° |
Thanks a lot for your reply. So from I've understood (correct me if i'm wrong) in order to check if the drone can land I can either try to read the takeOffLandingState by adding an interface or I can read KeyAreMotorsOn and KeyRcMachineMode ? |
Agent comment from yating.liao in Zendesk ticket #107011: °°° |
Thank for your reply. I'll try the height solution afterwards. Actually the truth is that I've made a small program in VirtualStickFragment.kt for a button I create. The goal is to make the drone take off and then go forward. The condition is that it should have finished taking off. We created an instance of the class VirtualStickFlightControlParam and set the parameters in order for the drone to go forward. Actually, what I'm trying to do is to check if the takeOffLandingState is equals to READY_TO_LAND. Here a part of the code
The problem here is that the code inside the if never executes, I'm not sure if this is the right method to get the TakeOffLandingState. Could you please help me with this matter ? Your help is very much appreciated. |
Agent comment from yating.liao in Zendesk ticket #107011: °°° |
Thank for you answer, but I really struggle creating an instance of TakeoffWidget as I didn't found any example which parameters to put in there. However, I managed to create an instance of the class TakeOffWidgetModel (I called it takeOffWidgetModelInstance) and as this class have a method to update the state, I was thinking about using this class instead. Afterwards, I subscribed to takeOffWidgetModelInstance.takeOffLandingState and put a condition for the drone to do a particular action when the state of takeOffLandingState is "READY_TO_LAND"
|
Agent comment from yating.liao in Zendesk ticket #107011: °°° |
I've forgotten to tell you but i'm actually working in the VirtualStickFragment page and I managed to instanciate the TakeOffWidgetModel class but not the TakeOffWidget class (I don't know how I can get the context). I've already created a new button in the layout frag_virtual_stick_page.xml so I can use the methods I want for the drone. The button is visible, there is no problem on this side. Is there a way to get the context of VirtualStickFragment so I can put it in the TakeOffWidget instance that I will create? |
Thank you very much for your answer, it's very clear and precise. I have another question. I tried to run a code that makes the drone go forward and I put it in a while loop. The drone goes forward but doesn't pay attention to the obstacles anymore. Should I add a perception widget (like you did for the take off widget) and find the function that update the sensors information inside that loop (and add the obstacle condition) or is it wrong to use the while loop as it monopolize all the program? |
Agent comment from yating.liao in Zendesk ticket #107011: Additionally, if you are using the Virtual Stick function to control the drone's movement, I do not recommend using a °°° |
Hello DJI,
I'm currently making a program to move the drone and as the program is also using the takeoff function, I need to know when the drone has finished taking off (check if the takeoff state is "READY_TO_LAND") so I can execute the other commands (go forward, etc..).
I've found the function checkAndUpdateTakeOffLandingState and updateTakeOffStatus but they are private
Thank you in advance.
The text was updated successfully, but these errors were encountered: