-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Not arming after landing #1297
Comments
This indeed looks like it might be a bug, but I think some more information would be helpful.
Thanks! |
Another good test would be to enable more debug prints from the supervisor state machine by un-commenting the |
I am indeed running the Crazyflie from a python script and am only using the commander, not the high level commander. I am also not switching between the two. I'll create a minimal working example and see if I can print the console log. |
Here is a minimal working example.
I did not yet enable more debug prints but this is the console log:
|
I have looked at this and it turns out that it actually is two problems, one in your code and one that is related to this functionality but not really used by you at the moment. The first (and main) problem is related to a safety feature in the Crazyflie. When setpoints are received in the Crazyflie, there is a watch dog that checks that they are received continuously. If they stop for more than 0.5 seconds, the Crazyflie will assume the connection is broken and it will level out. After 2 seconds it will turn off the motors. The idea is that if you are flying remotely (with gamepad or script) and the connection is lost, the Crazyflie should stop. The solution is to continue to send set points, also when hovering and landed, something like # ...
def hover(scf, hover_time):
end_time = time.time() + hover_time
while time.time() < end_time:
scf.cf.commander.send_velocity_world_setpoint(0, 0, 0, 0)
time.sleep(0.1)
def wait_on_the_ground(scf, wait_time):
end_time = time.time() + wait_time
while time.time() < end_time:
scf.cf.commander.send_stop_setpoint()
time.sleep(0.1)
# ...
for i in range(4):
print("taking off")
take_off(scf)
print('Hover')
hover(scf, 2)
print("landing")
land(scf)
print('Landed')
wait_on_the_ground(scf, 5)
The other problem I found on the way is related to switching back and forth between the high level commander and low level set points, it is described in #1298 Please close this issue if you are satisfied with the solution. |
Thank you for the response. I see how this could be useful while the drone is in flight, but is there a way to disable this functionality when a send_stop_setpoint command is send? I don't want to constantly send stop commands to the drone after it is landed such that the bandwidth doesn't get crowded. Also if I understand the radiodriver correctly, when a safe link is established, the radio keeps sending commands to check if the drone is still connected. Wouldn't this already be enough to detect connection loss? Thanks |
At some point (a long time ago) it was decided to use set points for this, maybe it will change in the future?
The idea is that someone must always push in set points, and what might not be obvious is that the high level commander is doing this most of the time. If you turn the Crazyflie on, the high level commander will start to send null set points to the commander which will keep the watch dog happy. When you send in low level set points from your script, there is a priority functionality that will kick in and use your set points instead of the high level commander ones. The high level commander will be stopped which means that any running trajectory is terminated, and it will start to send null set points. Due to the lower priority these set points will be discarded at this point. If you want to lower the priority again and use the high level commander you can send a packet to tell the commander to reset the priority by calling the Your def land(scf):
global pos_z
cf = scf.cf
while pos_z > 0.07:
cf.commander.send_velocity_world_setpoint(0, 0, -0.3, 0)
time.sleep(0.1)
cf.commander.send_stop_setpoint()
# Hand control over to the high level commander again
cf.commander.send_notify_setpoint_stop() This is what was fixed in #1298 yesterday.
Unless you really need to send in your own set points, the high level commander is usually a better option to fly trajectories as it does not require packets to be sent all the time. Note that it is possible to re-plan trajectories that have been started as well. |
Oh ok, I fully understand now. This solution indeed fixes my problem. Thanks a lot! |
Since the last firmware update (2023.02 works fine) the drone disarms after landing and doesn't arm again afterwards.
During landing, I send a send_stop_setpoint command a few centimeters above the ground. The crazyflie lands and after about 1 second, the "is armed" state goes to zero. Then I wait for about 5 seconds, after which it is still zero. After sending a reboot command the drone is armed again and it will take off, until the next landing.
During testing I was reading out the supervisor.info parameter and got the following:
In flight: 00011110
One second after landing: 00000100
(still the same five seconds after landing)
After rebooting: 00001110
Sending an arming command myself also doesn't work (have tested this) as the first but of supervisor.info is zero.
From my tests, the hardness of the landing has no effect on this behaviour.
The text was updated successfully, but these errors were encountered: