Hi heli group!
Allow myself to introduce.. myself..
I'm Chris. I work in a controls research lab at UT San Antonio as an undergrad researcher. I'm currently doing research to apply fuzzy logic as a replacement for PID feedback control in complex systems such as traditional helicopters. ArduCopter is something that looks to be very promising in helping me solve the numerous problems of system integration that stand in the way of having a working testbed for my control algorithms.
The only thing standing in the way of progress for me is having hardware-in-the-loop simulation working for traditional helicopters. Our lab runs a Thunder Tiger Raptor 90 as its testbed, and to be blunt, I'm scared to death of trying to test a brand spanking new control method on a 90 series nitro heli.
I'm new to the open-source community, but I've got a huge vested interest in seeing this feature added to ArduCopter. This project is something that I can most likely devote not only my own time to, but also the time of my fellow researchers, as well as the time of the members of the IEEE Student Chapter Robotics team that I currently chair.
If I don't hear back from anyone in the next couple of weeks, I'll assume that nobody is working it, and I'll start the project on my own. But if you are currently working the project and need help, I'd gladly accept any guidance that you might have, so that I can help the effort along.
What's the default speed of the port? It was at 115200 before, but the arduino's defaulting to 9600 now. Would it be good or bad if I arbitrarily bumped that back up to the faster rates (or does it matter)?
I haven't had a lot of luck with the rudder control while using the joystick. The inputs are coming in, but the APM software isn't translating it to a control signal.
It's not a big deal, since all I'm doing is manual takeoff to start testing waypoint following, but still. It would be nice to have if it's possible.
Also, another thing I've noticed is that the autopilot doesn't use much rudder as it flies, and doesn't turn the heli in the direction it's traveling. Is that just part of how the control laws are set up, or am I doing something wrong?
for stabilise, simple and loiter the code doesn't modify the heading (it just does heading hold). For RTL (when you're more than 3m away from home) and waypoints you'll find it does.
I have been thinking for simple mode it would be good if it modify the yaw if the pilot put in a roll or pitch command > some number. So if you gave it a really hard roll or pitch command it would rotate to face the correct direction. It would need to be smart enough to realise though that you're not pulling back to slowing down quickly..certainly wouldn't want the heli to suddenly turn backwards!
When you say "simple", that means basic waypoint following mode when you give it the command to go automatic, correct?
Because I'd like for it to fly with a heading using the tangent vector of the craft as it's flying, basically just having it fly straight with its direction of travel. Later on, I plan to make the controller better by giving it roll stabilization to maintain coordinated turns, but just getting it to fly straight is the first major goal.
I've added a Simulation page to the wiki that details the set-up instructions. I'll include a couple of nice screenshots as well in the near future.
Please tell me if you think it's unclear or need more details added. I've given it a go just now on my new computer and it certainly seems to work!
Thanks a lot Michael Oborne!
I've had a problem uploading the code through the arduino libraries.
I'm still using an Arduino Mega as the platform until my AP2 hardware comes in, so I have to disable CLI and logging. Therefore, I need to flash through the Arduino software instead of the planner.
I downloaded the latest arducopter software and loaded it into the arduino environment, but when I try to flash it, the compiler loses its mind and can't find any of the AP library files. I've changed the sketchbook folder in preferences, and it's still not working.
I know I'm probably just making a stupid noob mistake, but it wasn't happening when I was working the setup before, so if anyone could help, that would be great.
I'm no expert but I've had this problem before. I usually fix it by:
1) Copying the libraries that go with the code you are uploading into the arduino/libraries folder of your arduino installation.
If that doesn't work, you have to exercise the nuclear option:
2)Delete the entire arduino/libraries folder, and paset the libraries folder for your code in it's place.
I don't know if there's a better way to do this, but it's what has worked for me.
Also remember that you will likely need to use the arduino with the "relax patch" if you're compiling the trunk code for the 2560. You can find it in the download area. Have a look for arduino-0022-relaxpatch.zip.
Looks like that works for the stock download as is. However, since I'm using an arduino mega instead of the ardupilot (for testing until my actual hardware comes in), the extra code that I've been adding by Mick's instructions previously in this thread kick back one error.
Here's what I pasted:
#define HIL_MODE HIL_MODE_ATTITUDE
#define ALLOW_RC_OVERRIDE ENABLED
#define AUTO_RESET_LOITER 0
#define FRAME_CONFIG HELI_FRAME
#define CLI_ENABLED DISABLED
#define LOGGING_ENABLED DISABLED
And here's the error:
ArduCopter:31: error: 'void motors_output_enable()' used but never defined
I haven't been able to track down where this error is coming from. I probably need to switch to eclipse so I can run around in the source better than the base Arduino software (I'm not the best coder).
Also keep in mind that on version 2.0.49, none of those commands had a problem compiling.
What do I need to do to get rid of the error?
Turns out there is no motors_output_enable function in the heli code. Looking at the other airframes, it looks like there's something to do with setting up where output channels are used to control motors.
Since we're controlling the motor speed through the receiver, and not through the ardupilot at all, I went ahead and created this function and left it blank. It looks like it solved the problem in the short term. Just give me a heads up if I need to put anything in there in the future.
Now to my other problem that I'm continuing to have. I'm still trying to get auto mode to function in the simulation. It seems to follow waypoints well enough, but it doesn't seem to want to control its own altitude at all. Is auto mode supposed to have built in altitude control?
And since you did that pat hickey's made a change in trunk to fill out the function. To be honest, I'm not sure exactly what that's for but I guess for a moment the heli code was overlooked.
Hey guys! Here's an update!
The simulator works great, but there's a little problem taking it out of HiL mode. When I set the code up to run the APM2 hardware, and turn off HIL, it doesn't look like the accelerometer data is being used. I get super bad gyro drift that won't correct its self. The artificial horizon slowly drifts around, and eventually doesn't reflect the actual attitude of the APM at all.