yawing in specific height

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

yawing in specific height

Post by RyanMco » Tue Dec 17, 2019 1:53 pm

Hi guys!
Im facing a problem like this, Im trying to do square coordination path by my drone by using crazyflie_ros scripts, and takeoff is working, goto is working but something weird is happenning..
I run this code:

Code: Select all

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", 1) # Use mellinger controller

    cf.takeoff(targetHeight = 0.5, duration = 2.0)
    time.sleep(3.0)

    cf.goTo(goal = [0.5, 0.0, 0.0], yaw=0.0, duration = 2.0, relative = True)
    time.sleep(3.0)

    cf.goTo(goal = [-0.5, 0.0, 0.0], yaw=0.0, duration = 2.0, relative = True)
    time.sleep(3.0)

    cf.land(targetHeight = 0.0, duration = 2.0)
so my drone is hovering at height 0.5 and it's fine! but once he wants to go to 0.5 (0.5,0.0,0.0) what's happening that my drone goes there to that point and hovering there but it's not hovering in proper way it's like doing circle (not actually a circle but it's something like a circle) and he's not hovering steadily on [0.5,0,0] he's just going to that coordination but hovering there isn't steadily on that point, he's like going to that point and hover there like a circle manner(not steady) .. my yaw is 0.0 so it's weird why he's doing that once he goes to 0.5 0 0!

I tried to do

Code: Select all

cf.goTo(goal = [0.0, 0.0, 0.0], yaw=0.0, duration = 2.0, relative = True)
    time.sleep(3.0)
it works fine he actually hover on it's place in proper hovering and steady at all! but once I tell him to go to any point other than 0 0 0 by goTo then my crazyflie at the new goal setpoint(in my case it's 0.5 0 0 ) so will not hover there like its hovering on 0 0 0 .. any help what would be the problem?
I don't know why if I send by goTo a point other than 0 0 0 then he will not hover on that new point in proper and steady hovering but yeah he goes there but not hovering steady on that point!, my yaw is 0 so actually I don't know why he's doing like a circle on hovering to the new point!

any help? maybe I should put kp and kd as 0? I don't know how can I fix the problem, truly he goes to the required point that he gets by goTo but its hovering there isn't steady! although if I send him 0 0 0 by goTo then it's steady!

any help to solve the problem to be more steady on the new point that I give by goTo?!

the data that I send isn't from flowdeck it's from slam (ROS) , I verified the data that I get from slam and it's fine I get it correctly !

thanks alot



arnaud
Bitcraze
Posts: 2275
Joined: Tue Feb 06, 2007 12:36 pm

Re: yawing in specific height

Post by arnaud » Tue Dec 17, 2019 2:00 pm

Are you sure that your position measurement is working correctly?

One way to debug would be to try first with using only the flow deck as a reference.

If that works and you still get problem when using your own positioning input, there might be a problem with the position you are feeding to the Crazyflie.

RyanMco
Expert
Posts: 156
Joined: Tue Apr 09, 2019 6:15 am

Re: yawing in specific height

Post by RyanMco » Tue Dec 17, 2019 2:08 pm

Yup I debugged it!
but the problem that I get likely a deviation when I put any point in goTo other than 0 0 0
any suggestion?!

I dont think that problem with positioning if so then why my drone goes to 1 0 0 if I by goTo I told him to go to 1 0 0
yeah he goes there but not hovering there in steadily he's like doing circle with radios 0.1m alongside this point ..
if I send him 0 0 0 then he's not doing that ..he's hovering in steadily and perfectly hover !

arnaud
Bitcraze
Posts: 2275
Joined: Tue Feb 06, 2007 12:36 pm

Re: yawing in specific height

Post by arnaud » Tue Dec 17, 2019 2:12 pm

My suggestion is to test with a known-working positioning system understand where the problem is. I have tested very similar code (I was using absolute goto) without any problem using the flow as positioning sensor.

Since the high-level commander and controller have been proven to work in many positioning system, my assumption is that the problem lies is some instability in your position measurement. This can be verified by testing your script with the flow only.

RyanMco
Expert
Posts: 156
Joined: Tue Apr 09, 2019 6:15 am

Re: yawing in specific height

Post by RyanMco » Tue Dec 17, 2019 2:22 pm

but Im seeing that the data that I get from SLAM is working accordingly to real life I mean x y z is properly working!

and lets assume that its a problem in my positioning .. so why at goTo 0 0 0 which he gets data from SLAM is working correctly but once I run goTo 1 0 0 then the problem is happened and hovering on that point isn't stable?! maybe the problem with kalman/pid?

arnaud
Bitcraze
Posts: 2275
Joined: Tue Feb 06, 2007 12:36 pm

Re: yawing in specific height

Post by arnaud » Tue Dec 17, 2019 2:49 pm

I have no idea how slam work, so I do not know what could go wrong there.

On the other hand, I see no reason why the control or estimation would suddenly stop working so this is why my advice is: lets test and actually find out where the problem is.

Since you have a flow deck and the full chain has already been verified to work with the flow deck, you can get your movement working with the flow deck only.
- If it is not working with the flow deck, there is a problem somewhere and something has broken in your version of the firmware
- If it is working with the flow deck, the problem likely lies in position measurement. It may be a delay problem or that you are pushing the position measurement with a standard deviation that is too low.

RyanMco
Expert
Posts: 156
Joined: Tue Apr 09, 2019 6:15 am

Re: yawing in specific height

Post by RyanMco » Tue Dec 17, 2019 4:26 pm

I accept your idea and appreciate your effort!
but what's still not make a sense for me, if there's a deviation then why at 0 0 0 in goTo it hover fine? .. if I send 1 0 0 then it goes to 1 0 0 coordination and yeah it reaches this point and I see that but! once my drone arrive there then it start looks like he's not hovering on that point.. he's making a circle around it(like a deviation ..or something like that) , lets assume there's a deviation .. then what it could be from? I mean is it from delay of my positioning system(frames that I get from my camera to gimme the current coordination-SLAM)?

thanks alot

RyanMco
Expert
Posts: 156
Joined: Tue Apr 09, 2019 6:15 am

Re: yawing in specific height

Post by RyanMco » Tue Dec 17, 2019 4:31 pm

what should I use for external position data .. mellingerer or PID? and about filter kalman?
maybe that's the problem idk ..


Also what do you mean with standard deviation? it must be low ..no? because deviation means that how far Im from the goal .. so it must be low in order to get closer to the goal(coordination's point)

kimberly
Bitcraze
Posts: 214
Joined: Fri Jul 06, 2018 11:13 am

Re: yawing in specific height

Post by kimberly » Thu Dec 19, 2019 10:32 am

Hi,

Please use the default controller and state estimator. So this is the PID controller and the Kalman estimator and please do not change these.

With standard deviation, Arnaud means the standard deviation of the estimated noise of the position in the kalman filter. However, if this is something you are not familiar with the basics of, this is not something that you should touch until you have read up the basic material of probability theory and kalman filters.

RyanMco
Expert
Posts: 156
Joined: Tue Apr 09, 2019 6:15 am

Re: yawing in specific height

Post by RyanMco » Thu Dec 19, 2019 1:39 pm

Hi!
You mean in my make file to put controller:PID (remove any) and estimator: kalman(remove any)?

Thanks alot

Post Reply