GPS NAV
Posted: Fri Aug 30, 2013 10:20 pm
Hi All !
The time has come, so I'm releasing the navigation code for MultiWii. I would call it first public beta. It was flight tested several times, and I flown dozens of missions with it, plus a couple hundred simulated ones. BUT as we know all program contains at least one cycle, one branch and one error.
I rely on the community (as usual) to test it and find out the possible bugs. Currently the capabilities of the mission editor and the navigation engine is somehow limited if we compare it to other UAV software. The reason for it is that I would like to build a solid foundation what can be extended. We all know what happens when developers started to pursue new features instead of making existing ones to work. (ArduCopter anyone ?)
I got lot's of feedbacks and recommendations and many of them are very valuable, eventually they will make it into the code, but first make is solid.
This version works with AtMega2560 based board and serial GPS. (Ublox or MTK19 is recommended). Please make sure that your copter is well tuned, ANGLE mode, MAG and BARO works correctly. Navigation relies on these functions.
Three components are released today.
WinGUI 2.3pre4 - Contains the mission editor
MultiWII 2.3-navi-b1 - MultiWii 2.3 software extended with navigation capabilities
SiK-mW 2.3 - A customized firmware for 3DR radio telemetry modules to use with MultiWii.
LATES VERSION AVAILABLE from http://eosbandi.com/downloads
Here is the initial draft for the user guide, I hope it's enough to get started, but do not hesitate to ask.
HAPPY FLYING !
(And if you like it and willing to donate (so I can buy new gadgets) don't forget to click on the donate button at http://code.google.com/p/mw-wingui/ )
Changes is WinGUI2.3pre4 and MultiWii 2.3-navi-b1
The serial communication is now not happening in bursts. Queries are sent in timeslots. This allows effective use of half duplex communication channels and avoid flooding of the link.
TABS are reorganized to support telemetry connections (sensor graph moved to a separated tab)
FLIGHT DECK
- New gauges added to the Flight Deck tab (Vertical speed and Altitude)
- Sent and received packet counts are displayed and telemetry link quality is calculated from these values.
- If telemetry uses 3dr radios with Sik-mw 2.3 firmware, radio link RSSI and Noise figures are also displayed
- BIND Spektrum button now available
- Default refresh rate is now 5Hz (can go to 10Hz with direct link)
FLIGHT TUNING
- Contains all common parameters (PID’s EXPO’s)
FC Config
- Contains additional parameters (Servo config, Mag Decl. etc.)
- Magnetic delineation can be entered in degree-minutes format
MISSION TAB
On the mission tab, you can see your copters actual position on the satellite map at the left, and the list of the mission steps on the right.
At the left bottom you can get information of the navigation engine. GPSMODE is the current nav mode determined by the RCOptions. NAV_STATE is the current state of the navigation engine.
To create a mission, you have to put down mission steps on the map, you can do it by shift+left click on the desired position. Mission steps are added to le list automatically.
At this moment you can use five type of steps. (I call them steps, but in fact these are commands that tells the copter what to do.)
The first and most widely used command is a waypoint command. This tells the copter to go to a specified location and altitude. The next step is executed once the copter reached the desired position. The copter will not wait for reaching the desired altitude, it will continue the mission once the waypoint is reached.
When you shift+left click on the map the newly created step always will be a waypoint. You can edit it later by changing the drop down selection in the action field.
The second type of command is a timed poshold. This is just like the waypoint command tells the copter to go to a specified location AND wait there for a given amount of time. The next step is executed after the given time elapsed.
The third type of command is called the unlimited poshold. It commands the copter to go to a location and stay there. This command ends the mission.
The fourth type of command is the Return to Home. This also means the end of the mission. The RTH altitude is controlled by defines in the config.h, the altitude setting in the RTH step is not used.
The fifth type of command is a JUMP command. With this we can create loops in the mission. There are two parameters for JUMP command. A mission step number to jump to, and the number of repeats. The -1 value of the number of repeats means infinite loop.
There are two restrictions with the JUMP command, first for safety reasons you can jump only backwards (step number is less than the JUMP command) not forward, and second you cannot create nested loops.
Once you created you mission, you can save it to a file, or upload to the flight controller. For your and your copters safety it is recommended to download your mission from the FC after you uploaded it, to make sure that it is correctly uploaded.
If you want use WinGUI on the field without internet connection, you can cache satellite map images for a given region. To do that, zoom out to show your planned flight zone, then with ALT+left click mark the area you want to cache, then click on the FETCH MAP button. The satellite images for all zoom level are cached to the disk and available offline.
Go to Click function
It is possible to control your copter via the GUI directly. First enable the GoToClick (GtC) function by clicking the button on the left bottom of the MISSION tab. When GtC is enabled, the button turns RED.
When your copter is in positon hold (GSPMODE : PosHold, NAV_STATE: Poshold infinit) if you right click on the map, a temporary waypoint is created and the copter will navigate there. If the “Send GtC alt” checkbox is selected then the altitude in the GtC altitude box is sent to the copter along with the new position.
When the copter started to navigate to the GtC location you cannot set new location until it reaches the previous one. If you want to cancel GtC before the location is reached, simply disable PosHold momentarily.
Executing a mission
When your mission is successfully uploaded and checked, you can start it by switching ON the MISSION rcOption. It is your responsibility to enable ANGLE, MAG and BARO too.
An ongoing mission can be aborted by disabling the MISSION rcOption or enable RTH rcOption.
Switching GPSHOLD rcOption ON during a mission pauses it. Mission will continue when GPSHOLD is switched off (MISSION must be ON).
Navigation parameters in Config.h
GPS_WP_RADIUS
If we are closer than this distance to a waypoint, then it considered as reached. (in centimeters)
SAFE_WP_DISTANCE
This defines the maximum distance in meters that can be flown by the copter between to waypoints. If a Waypoint is farer than this, the mission will be aborted and copter switched to GPSHOLD. This also true for the distance between the home position and the first waypoint, so your copter will not go away if your mission programmed for a different location.
MAX_NAV_ALTITUDE
This defines the maximum allowed altitude what can be reached during navigation. If a waypoint sets altitude above this limit then navigation will ignore it and uses the defined value (in meters)
NAV_SPEED_MIN, NAV_SPEED_MAX, NAV_SLOW_NAV
These parameters governs the copters speed during navigation. MAX is the maximum speed that the copter can reach. MIN is the minimum speed to slow down to when approaching waypoint. When SLOW_NAV is true then the SPEED_MIN is ignored and copter slows down as much as possible when approaching waypoint (it allows to reduce speed to zero). The unit is cm/sec for both SPEED parameter
CROSSTRACK_GAIN
It controls the how the weight of the crosstrack error in the navigation calculations. (Do not touch it, unless you understands the navigation code)
NAV_BANK_MAX
It limits the maximum banking that navigation control gives to the copter. (unit 100=1deg)
RTH_ALTITUDE
It defines the RTH altitude in meters, it is 0 it means that no current altitude will be kept.
WAIT_FOR_RTH_ALT
If it 1 copter will hold position until it reaches RTH altitude then start coming home. If it 0 copter will start coming home as soon as RTH is engaged.
The time has come, so I'm releasing the navigation code for MultiWii. I would call it first public beta. It was flight tested several times, and I flown dozens of missions with it, plus a couple hundred simulated ones. BUT as we know all program contains at least one cycle, one branch and one error.
I rely on the community (as usual) to test it and find out the possible bugs. Currently the capabilities of the mission editor and the navigation engine is somehow limited if we compare it to other UAV software. The reason for it is that I would like to build a solid foundation what can be extended. We all know what happens when developers started to pursue new features instead of making existing ones to work. (ArduCopter anyone ?)
I got lot's of feedbacks and recommendations and many of them are very valuable, eventually they will make it into the code, but first make is solid.
This version works with AtMega2560 based board and serial GPS. (Ublox or MTK19 is recommended). Please make sure that your copter is well tuned, ANGLE mode, MAG and BARO works correctly. Navigation relies on these functions.
Three components are released today.
WinGUI 2.3pre4 - Contains the mission editor
MultiWII 2.3-navi-b1 - MultiWii 2.3 software extended with navigation capabilities
SiK-mW 2.3 - A customized firmware for 3DR radio telemetry modules to use with MultiWii.
LATES VERSION AVAILABLE from http://eosbandi.com/downloads
Here is the initial draft for the user guide, I hope it's enough to get started, but do not hesitate to ask.
HAPPY FLYING !
(And if you like it and willing to donate (so I can buy new gadgets) don't forget to click on the donate button at http://code.google.com/p/mw-wingui/ )
Changes is WinGUI2.3pre4 and MultiWii 2.3-navi-b1
The serial communication is now not happening in bursts. Queries are sent in timeslots. This allows effective use of half duplex communication channels and avoid flooding of the link.
TABS are reorganized to support telemetry connections (sensor graph moved to a separated tab)
FLIGHT DECK
- New gauges added to the Flight Deck tab (Vertical speed and Altitude)
- Sent and received packet counts are displayed and telemetry link quality is calculated from these values.
- If telemetry uses 3dr radios with Sik-mw 2.3 firmware, radio link RSSI and Noise figures are also displayed
- BIND Spektrum button now available
- Default refresh rate is now 5Hz (can go to 10Hz with direct link)
FLIGHT TUNING
- Contains all common parameters (PID’s EXPO’s)
FC Config
- Contains additional parameters (Servo config, Mag Decl. etc.)
- Magnetic delineation can be entered in degree-minutes format
MISSION TAB
On the mission tab, you can see your copters actual position on the satellite map at the left, and the list of the mission steps on the right.
At the left bottom you can get information of the navigation engine. GPSMODE is the current nav mode determined by the RCOptions. NAV_STATE is the current state of the navigation engine.
To create a mission, you have to put down mission steps on the map, you can do it by shift+left click on the desired position. Mission steps are added to le list automatically.
At this moment you can use five type of steps. (I call them steps, but in fact these are commands that tells the copter what to do.)
The first and most widely used command is a waypoint command. This tells the copter to go to a specified location and altitude. The next step is executed once the copter reached the desired position. The copter will not wait for reaching the desired altitude, it will continue the mission once the waypoint is reached.
When you shift+left click on the map the newly created step always will be a waypoint. You can edit it later by changing the drop down selection in the action field.
The second type of command is a timed poshold. This is just like the waypoint command tells the copter to go to a specified location AND wait there for a given amount of time. The next step is executed after the given time elapsed.
The third type of command is called the unlimited poshold. It commands the copter to go to a location and stay there. This command ends the mission.
The fourth type of command is the Return to Home. This also means the end of the mission. The RTH altitude is controlled by defines in the config.h, the altitude setting in the RTH step is not used.
The fifth type of command is a JUMP command. With this we can create loops in the mission. There are two parameters for JUMP command. A mission step number to jump to, and the number of repeats. The -1 value of the number of repeats means infinite loop.
There are two restrictions with the JUMP command, first for safety reasons you can jump only backwards (step number is less than the JUMP command) not forward, and second you cannot create nested loops.
Once you created you mission, you can save it to a file, or upload to the flight controller. For your and your copters safety it is recommended to download your mission from the FC after you uploaded it, to make sure that it is correctly uploaded.
If you want use WinGUI on the field without internet connection, you can cache satellite map images for a given region. To do that, zoom out to show your planned flight zone, then with ALT+left click mark the area you want to cache, then click on the FETCH MAP button. The satellite images for all zoom level are cached to the disk and available offline.
Go to Click function
It is possible to control your copter via the GUI directly. First enable the GoToClick (GtC) function by clicking the button on the left bottom of the MISSION tab. When GtC is enabled, the button turns RED.
When your copter is in positon hold (GSPMODE : PosHold, NAV_STATE: Poshold infinit) if you right click on the map, a temporary waypoint is created and the copter will navigate there. If the “Send GtC alt” checkbox is selected then the altitude in the GtC altitude box is sent to the copter along with the new position.
When the copter started to navigate to the GtC location you cannot set new location until it reaches the previous one. If you want to cancel GtC before the location is reached, simply disable PosHold momentarily.
Executing a mission
When your mission is successfully uploaded and checked, you can start it by switching ON the MISSION rcOption. It is your responsibility to enable ANGLE, MAG and BARO too.
An ongoing mission can be aborted by disabling the MISSION rcOption or enable RTH rcOption.
Switching GPSHOLD rcOption ON during a mission pauses it. Mission will continue when GPSHOLD is switched off (MISSION must be ON).
Navigation parameters in Config.h
GPS_WP_RADIUS
If we are closer than this distance to a waypoint, then it considered as reached. (in centimeters)
SAFE_WP_DISTANCE
This defines the maximum distance in meters that can be flown by the copter between to waypoints. If a Waypoint is farer than this, the mission will be aborted and copter switched to GPSHOLD. This also true for the distance between the home position and the first waypoint, so your copter will not go away if your mission programmed for a different location.
MAX_NAV_ALTITUDE
This defines the maximum allowed altitude what can be reached during navigation. If a waypoint sets altitude above this limit then navigation will ignore it and uses the defined value (in meters)
NAV_SPEED_MIN, NAV_SPEED_MAX, NAV_SLOW_NAV
These parameters governs the copters speed during navigation. MAX is the maximum speed that the copter can reach. MIN is the minimum speed to slow down to when approaching waypoint. When SLOW_NAV is true then the SPEED_MIN is ignored and copter slows down as much as possible when approaching waypoint (it allows to reduce speed to zero). The unit is cm/sec for both SPEED parameter
CROSSTRACK_GAIN
It controls the how the weight of the crosstrack error in the navigation calculations. (Do not touch it, unless you understands the navigation code)
NAV_BANK_MAX
It limits the maximum banking that navigation control gives to the copter. (unit 100=1deg)
RTH_ALTITUDE
It defines the RTH altitude in meters, it is 0 it means that no current altitude will be kept.
WAIT_FOR_RTH_ALT
If it 1 copter will hold position until it reaches RTH altitude then start coming home. If it 0 copter will start coming home as soon as RTH is engaged.