I can't get the altitude_mode to work with coding. I am able to search and connect to the Crazyflie and send setpoints and making it takeoff, but I am unable to go into altitdehold_mode.
This is my code, why doesnt it work?
Code: Select all
        print "sending initial thrust of 50 000"
      
        cf.commander.send_setpoint(0,0,0,50000);
        time.sleep(0.5);
        
        print "putting in althold"
        cf.param.set_value("flightmode.althold","True")
        
        print "Stay in althold for 7s"
        
        it=0
        
        while it<700:
            cf.commander.send_setpoint(0,0,0,32767)
            cf.param.set_value("flightmode.althold","True")
            time.sleep(0.01)
            it+=1
        
        print "Close connection"
        cf.commander.send_setpoint(0,0,0,0)
        cf.close_link();
When using a PS3-controller I can use the hovermode, but you have to hold the button, therefore it would make sense to set the altholdmode to "True" every 10ms a sort of "digital hold". I guess the error lies in the loop but Im really lost and could use some help.
Thank you