We used iNav for the purpose of flight planning. This blog post is a summary of what we learned about iNav, why we decided to use this and how we planned to implement it.
Designed primarily for racing iNAv runs on the flight controller and helps the device fly faster with more control.One of the required features was modern GPS flight modes, so we could have solid GPS Hold (where it sits in the sky) and GPS Return to Home (where it flies back to us automatically) as well as improved fail safe to give us a chance of not losing the model when we have a radio, receiver or wiring problem. That’s where iNav comes in. It’s a version of Clean flight that provides completely new GPS flight capabilities running on top of that well-developed software and supports both multi rotor and fixed wing too. We can now add full GPS flight modes to our aircraft using modern, inexpensive flight controller and software. iNav runs on inexpensive, easily available flight controllers and connects to an external GPS to monitor ground speed, position and altitude. It uses an external GPS unit and compass to monitor the position of the model and support the pilot with anything from simple gyro stabilization up to autonomous flying and fail safe ‘return to home’. The flight controller running iNav sits between the radio receiver and the servos and ESC in the airplane. We fly the model just like we would traditionally where the flight controller is passive or we can ask the flight controller to provide full stabilization and auto level.
Setup- We got a lot of help from other online resources for the setup- we almost followed the instructions to a T. We have summarized them briefly below and also posted the links at the end of these posts. Show those blog posts some love.
For the GPS modes to work correctly, a GPS, a magnetometer(compass), and a barometer is required. The barometer must already be built into the FC. The GPS will also have a magnetometer built into it.The GPS/compass has 6 wires coming out of it. From the GPS a GND, 5V(or 3V), TX, and RX wire. Connect those up to a free UART port on our flight controller. From the serial receiver, then there will be two free UARTs – the receiver will use up one of the three. GND goes to GND, 5V or 3V goes to the respective port. TX from the GPS goes to the RX on the board, and RX from the GPS goes to TX on the board. This is because TX transmits, and RX receives – so it has to go out of one and into the next. F3 and F4 boards have 3 UARTs. Some boards have a virtual UART for the USB – to see if this is the case, we have to connect it to the configurator, go to the “Ports” tab, and see if the first port is a USB VCP. If it isn’t then we only have 1 free UART after USB and our receiver. This means we’ll have to have some means of disconnecting whatever we’ve hooked up to the UART that uses USB whenever we want to connect to the computer. The compass will plug into the I2C pins – labeled SCL and SDA. In this case, the wires will match – SCL goes to SCL and SDA goes to SDA. Under pre-arming checks, we’ll notice that Accelerometer calibration is red – this is because iNav has a special type of calibration that must be carried out. The peripherals are assigned to whatever UARTs we soldered them up to. One UART for Serial RX and one UART for GPS. If we’re using an F3 board and wish to use a Bluetooth module, there is a stone age way to go about it. As we saw earlier, we’ll use up the UART that is shared by I2C when we hook up our compass, so we won’t have the 3rd UART free – unless we use a PPM receiver, in which case the UART used by the serial receiver will be freed up. For our GPS, choose “GPS” from the sensors drop down in the correct UART we’ve attached our GPS to. Once we enable GPS, the icon at the top will go red or blue. If it’s red, it means our FC has not found the GPS yet – this simply indicates that we’ve either wired it incorrectly, or have not set it up properly – which we’ll get to in the Configuration screen next. The GPS tab will show the stats of our GPS lock. Here, we can check if we’ve actually configured our GPS properly. If the “Total messages” value under GPS Statistics is increasing constantly, that means our GPS is working. In the top box, where it says GPS, the Sats value will indicate how many GPS satellites our chip has locked on to. The more our craft can lock on to, the more accurate it’s position holding capability will be. The motors tab is where we’ll calibrate our ESCs, find min throttle, and check that the motor directions are okay. To calibrate ESCs, make sure the propellers are off, raise Master to full value, and plug in our battery. The ESCs will go through their tones. Once the tones are done, lower master to zero, and the ESCs will finish their tones. Before flying, two vital calibrations are needed: the accelerometer calibration and the magnetometer calibration.
Accelerometer calibration-
To calibrate the accelerometer in iNav, a six step process has to be carried out
- To start, keep the copter flat on the ground, and press the “Calibrate Accelerometer” button on the Setup screen. Once it’s done, there will be a SUCCESS message at the top of the screen in green text.
- Now flip the copter upside down and press the “Calibrate Accelerometer” button again. Wait for success confirmation.
- Now hold the copter perpendicular to the ground with the front of the copter facing right. Click the button, wait for confirmation.
- Continuing to hold it perpendicular, now face the copter straight towards the sky. Click the button, wait for confirmation.
- Now face the copter towards the left, continuing to hold it perpendicular to the ground. Click the button, wait for confirmation.
- Finally, keeping it perpendicular, face the copter to the ground, click the button, wait for confirmation.
Magnetometer calibration-
- To calibrate the magnetometer, click the Calibrate magnetometer button, and within 30 seconds, rotate the copter 360 degrees along all 3 axes. It doesn’t have to be exact!
- Just make sure you are doing this far away from magnetic interferance(large metal objects, high levels of electric current).
- To confirm, head over to the CLI, type dump
- And look for the values magzero_x, magzero_y and magzero_z are no longer “0”
As usual, like with every element of our project we are iteratively trying to perfect this aspect too. Trial and error is our modus-operandi at this point. (Good thing its a pretty long term project. Phew!) Anyways, stay tuned for some cooler updates soon.
REFERENCES:
- github.com/iNavFlight/inav/wiki
- fpvfrenzy.com/how-to-setup-inavflight/