byu-magicc / roscopter

*Under Development* - A fully-featured multirotor autopilot for ROS
http://scholarsarchive.byu.edu/cgi/viewcontent.cgi?article=2324&context=facpub
52 stars 38 forks source link

Fly away with pub /high_level_command #27

Closed ghost closed 4 years ago

ghost commented 7 years ago

Hi guys, first of all thanks for the hard work on this project. Sorry for the long post, but I don't want to miss anything:

I want to simulate the environment Naze32 10 DOF (running ROSflight) + Sonar in Gazebo. For that aim I am using the ROSflight branch "RC1.0". Right now I am ok simulating with the already existing xacro quadcopter. Steps I'm following to get everything running are:

1. Run "multirotor.launch" contained in rosflight_sim. 2. Run a "rosflight_io" node in order to start the SIL controller, with the udp parameter to true (set the MIXER parameter to 1, which is aimed for X quadrotors). 3. Run a "rc_joy" node. (I have a FlySky transmitter attached to the computer)

Up to here the system works nicely. I can control the quadrotor via the transmitter. However it shows me an error in the ROS console saying "Unhealthy parameter estimator", every time I flight (active sensors on the board are: baro, magnetometer and sonar), event hough I'm controlling the quadrotor pretty well I keep reading the error, and immediately after the recover error message.

At this point I wanted to autonomously hover the quad in the air (just to check how to interact with topics). I thought I could use the "mekf" node in "ROScopter" package, adding to what i ran before the following steps:

4. Load common multirotor parameters from /roscopter_sim/params/multirotor.yaml (previously to that I loaded the /rosflight_sim/params/multirotor.yaml). 5. Run roscopter node "mekf", remapping "baro/data" to "baro", "sonar/data" to /sonar" and "mag/data" to "magnetometer". 6. As I also needed a controller I also ran the node "controller". In order to hover at 2 meter height, I published a message in the /high_level_command with the following values (x=0,y=0,z=0,F=-2,mode=4).

I thought with these steps it would work but it doesn't, it flies away. I don't know what I am missing. I just want to set this environment up in order to be able to write my own navigation node (eventually I want to add also a camera to perform optical flow).

I am attaching the rosbag file of the simulation and the .launch, in case it helps.

Tank you very much! roscopter_sim.zip

superjax commented 7 years ago

Hey Pep!

Again, thanks for reporting this error!

Just real quick, let me explain the "UNHEALTHY ESTIMATOR" error. The estimator makes an "unaccelerated flight assumption" That is, it expects the norm of the acceleration vector to be approximately 9.8 m/s^2. In implementation, if acceleration is measured to be more than 15% away from that nominal value, it skips the accelerometer update step of the estimation and just integrates gyros. (This is the desired behavior, since that main assumption is being invalidated and doing the update would screw up the estimate.) However, if you undergo an accelerated motion for more than 0.5 seconds, it throws that error and immediately clears it when it runs an accelerometer update. It is nothing to be worried about, and clearly it's being thrown too often. Perhaps we should up the time to something like 3-5 seconds, because that actually would be a problem.

One of us will dig into the setup you have going and see if we can't figure out what's going on with the fly-away error.

superjax commented 7 years ago

Okay, I think the first thing is that you're not loading the roscopter parameters. (try the copter_sil.launch I just pushed)

The second thing is that the estimator defaults are tuned for a previous simulation which had far less noise on accelerometers. We need to tune this.

The third thing is that the controller has an issue if you get too far above your set point. The model inversion step ends up commanding a large acceleration because there's a big error, which maps into a big thrust. This turns into positive feedback if you get too high above your setpoint.

For now, copter_sil.launch flies on truth. As soon as the estimator is tuned for the SIL sensors, we will switch it over to estimates.

superjax commented 7 years ago

You might also want to pull down the latest for rosflight before you try again.

ghost commented 7 years ago

Hi guys,

thank you so much! James, I've done what you told me and it worked.

So, here what I understand is that we use the real position and not the estimated (remapped topics in the launch file). As soon as you do this tunning needed for flying with the estimate, please let me know.

I'll be aware on the changes in the repository.

Thanks for your help!