Friday, August 8, 2014

Flight mode and Hil simulation presentation 7-21

Flight mode

     In PX4, the flight mode of the system is controlled by switches on the remote control, the ground control station or via onboard parameters which set default values. If the remote control is configured to control a particular flight mode, it will override a conflicting request by the ground control station.

     The diagram below shows the main flight modes:

  
     There are four main mode in PX4 autopilot: MANUAL(manual mode), ATLCTL(attitude control), POSCTL(position control) and AUTO(auto mode). Since RC was calibrated, drones were able to be controlled through radio in both manual and attitude control mode. However, to switch into POSCTL and AUTO, GPS signal or PX4 optical flow input is required.

     This picture shows a UAV for indoor tests:



Simulation

     Roscopter was a ros node (software) used for communication between APM autopilot and computers. As it was not designed for PX4, the program was modified for adapting.



     
     Plane X 10 and FlightGear were used for PX4 HIL simulation as recommended. After researches and installation, it turns out that plane X 10 could not be launched due some graphic problems. FlightGear was used for testing arming/disarming commands from roscopter, it turned out that arming/disarming work after fixing the mavlink library. Also, PX4 was successfully switched into POSCTL and AUTO without sensors connected. However, FlightGear turned out that it is not a good simulator for further testing. Because FlightGear does not have the right model for those three UAVs assembled in the lab, it crashes as long as launching the UAV in simulation.

    As a result, for further testing, jMAVSim, a light-weight simulator, was used. As recommended, jMAVSim can work with the autopilot via serial port or UDP connection, directly using the MAVLink protocol, without any wrappers or ground control stations. Optional secondary port (e.g. UDP) can be configured for ground station connection. 


    Due to that jMAVSim is an open source software,  users can modify or make their codes according to their needs. The view can be changed to FPV, gimbal camera view or a fixed point. After fixing some coding problems and compiling, waypoint control was tested in AUTO:



(official simulation video)

Summary

      For further research, Hardware-in-loop simulation would be a very good tool for the following benefits:
 
     1. It helps to test and debug software/hardware interfacing of sensors such as optical flow.

     2. For safety reasons, it could be used for testing custom controllers. Behaviours of controllers could be observed from simulation before testing on multirotors to avoid unexpected accidents.
 
     3. Waypoint control test could observed in simulation before out-door testing. It can avoid losing UAVs due to lost connections or software errors

     4. Software required Auto mode could be tested in simulation, and it can lower the cost for software testing.






1 comment:

  1. This article is extremely useful and intersting,Thanks for sharing such a useful article with us.

    continue refreshing.
    Hardware in the loop testing

    HIL testing

    ReplyDelete