First flight of ArduWot with Simulink in control!

Today we finally got bored of waiting for the windy weather to subside so we took ArduWot out anyway. In the couple of weeks since our last flight we've written an interface between APM and MATLAB/Simulink utilising the MAVLink protocol. For anyone not famliar with Simulink its basically a tool used by control engineers to prototype control systems in a (reasonbly) friendly graphical way. We've used Simulink to control helicopters (T-Rex 250) indoors using a Vicon visual tracking system to determine position/attitude at 100Hz and a conventional RC transmitter. By utilising APMs fly-by-wire mode as the inner loop controller we can command roll, pitch and thottle at a fairly low rate from Simulink over Zigbee. This functionality lets us move outdoors (where we don't have the luxury of a VTS to give us 0.1mm/deg resolution!) and conduct some more interesting research activities, such as optimal control, formation flying, target tracking, etc...

Todays flight was a simple proof of concept test where we used a Simulink based PID controller to perform heading hold. It worked remarkably well but it was too windy to perform any meaningful performance assessments. The biggest issue we have is that using the RC_CHANNELS_OVERRIDE message takes command away from the RC transmitter (in FBW mode) so when we terminate the Simulink model if APM doesn't receive the message to stop overriding (setting all commands to zero) then it freezes on the last signal it received. As we're currently using XBee modules with whip antennae we do regularly lose connection for short periods so occasionally can not get control back (without switching to manual mode, which is undesirable in strong winds!). However, it seems that APM times out after about 20-30s and defaults back to the RC transmitter.

We are using RC_CHANNELS_OVERRIDE at the moment because the SET_ROLL_PITCH_YAW_THRUST message doesn't seem to be implemented on APM. I think for our purposes we may implement this message instead as this would allow us to command the nav_pitch and nav_roll angles on APM directly and utilise the mixing of RC transmitter and APM control if we ever need to get out of trouble quickly!

If anyone is interested in control of APM from Simulink I'd be happy to release the code (after a bit more testing!). Also if anyone has an interest in sending attitude commands and implementing the relevant MAVLink messages, let me know and I'd be happy to help!

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • How do we measure the airspeed and thus, do the state estimation using APM 2. 5 + ? When are you releasing the code ? 

  • Hi there! Would it be good that you could share your Simulink diagram with me please? I'm currently working out on a quadcopter project, and it would be lovely to share some ideas with you too.

  • HELLO OWEN,

    i am intereste in control of APM from Simulink can you help me to release the code ?

    and  send me attitude commands and implementing the relevant MAVLink messages ??

    all what you can give me like simulink block or how to control APM2.5 with matlab ??

    thanks

  • Owen,

    I am fairly new to the APM world, and the only experience i've had with controls is using Matlab / Simulink. I see that you have done some great work. I was wondering if your work is compatible with the APM 2.5? 

    Also, I've had experience with doing some Sumilink simulations using Flight Gear. If you are not already doing this, I highly suggest you do because you can possible do some simulated testing on ground before ever taking off.

    Thanks again for the great work!

  • Owen, I'd be really interested in trying out your code

  • Hello:

      We are interested in use this system to test non linear controllers, but I´ve saw that you hace 0,3 second of delay, isn´t it? 

     Thanks

      Jesús

  • Great thanks!!! I going to start trying it!!!!

  • For anyone following this post, I've finally got round to putting our initial code online. So far its just stuffed into a couple of zip files but I'll move to git when we get some proper testing done!

    The current code is barely tested so I can't offer any guarentees but I figured I'd let you guys have a look anyway.

    There's a wiki page here which hopefully explains whats going on but feel free to ask questions.

    Once we get up and testing in the new year I'll pad out the wiki a bit and stick another blog up with some test results!

  • The weather has improved but unfortunately late last week we fried the ESC in Arduwot (nosed over on takeoff due to poorly fitted wheels!), so we've still not done any testing.

    Hopefully we'll get a replacement this week before everyone closes down for the holidays. But failing that we should have something for you guys in the new year!

  • Nice work ! I'd love to see the simulink implementation, too. Anyway, since this seems to be dependent on good weather in the UK, I guess we are going to wait a bit  ;o)

     

    good luck !

This reply was deleted.