hovering by functions of crazyflie_ros

Firmware/software/electronics/mechanics
Post Reply
RyanMco
Expert
Posts: 159
Joined: Tue Apr 09, 2019 6:15 am

hovering by functions of crazyflie_ros

Post by RyanMco »

Hi guys !
I'm trying to let my crazyflie drone fly by scripts of crazyflie_ros which I use takeoff function .. but my crazyflie goes crazy and shake like crazy .. any help how do I let my crazyflie hover by using scripts/function from crazyflie_ros?
I used this scripts to let my drone fly to specific height:
import rospy
import crazyflie
import time
import uav_trajectory

if __name__ == '__main__':
rospy.init_node('test_high_level')

cf = crazyflie.Crazyflie("crazyflie", "/vicon/crazyflie/crazyflie")

cf.setParam("commander/enHighLevel", 1)
cf.setParam("stabilizer/estimator", 2) # Use EKF
cf.setParam("stabilizer/controller", 2) # Use mellinger controller

# reset kalman
cf.setParam("kalman/resetEstimation", 1)

cf.takeoff(targetHeight = 0.5, duration = 2.0)
time.sleep(40.0) // hovering 40sec on specific height

cf.land(targetHeight = 0.0, duration = 2.0)


it doesn't work and my crazyflie goes crazy and not hovering on specific height .. any help? maybe there's other script that I can use in order to tell my drone to hover on specific height?
also what's "duration" parameter mean? I didn't get the idea why that parameter "duration" found on the function!

here's the script that I took it from: https://github.com/whoenig/crazyflie_ro ... h_level.py
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: hovering by functions of crazyflie_ros

Post by tobias »

A follow up question, what positioning system are you using?

The duration parameter is the time it should take to reach the setpoint.
RyanMco
Expert
Posts: 159
Joined: Tue Apr 09, 2019 6:15 am

Re: hovering by functions of crazyflie_ros

Post by RyanMco »

PID
Post Reply