Sample program 1 (UAV in Auto mode)
Description
This sample application performs the following operations:
- Sets the copter to AUTO mode
- Listens on UDP port 12345 for messages from MAVProxy
- Reads the GPS data that is generated by SITL and forwarded by MAVProxy. Saves this raw data to a file every 5 seconds
Source code
Place this file in a directory named 'program_1'.
Sample program 2 (UAV in Guided mode)
Description
This sample application performs the following operations:
- Listens on UDP port 12345 for messages from MAVProxy
- Reads the file that has been generated by the first sample application, converts each reading to a waypoint and guides the UAV to that waypoint. This process is repeated for each reading in the file every 5 seconds. Once all the entries in the file are read, the UAV is set to ‘Return to Launch (RTL)’ mode.
Source code
Place this file in a directory named 'program_2'.
Getting MCP library and sample code
- Download this file and extract the contents.
- Place mcp.py, mcp_common.py and mcp_enum.py in 'lib' directory.
- Place mission_manager.py, mcp_handler_ground.py and the .txt files (sample files for the challenge) in 'mission_manager' directory. 'mission_manager' directory should be in the same directory where 'lib' resides.
- Place mcp_mission_controller.py and mcp_handler_uav.py in a directory 'program_3a' under sample_prog_mavutil/
Dependent modules
FTL_util and mavlink_apm are used by the sample applications. Create a directory named 'lib' in the same directory in which program_1 and program_2 were created. Place mavlink_apm.py and FTL_util.py in the lib directory for the sample applications to work without the need of any changes.
Generating mavlink_apm.py
- Get MAVLink (skip this step if you have already checked out mavlink for sitl).
git clone git://github.com/mavlink/mavlink.git cd mavlink git checkout d6337dc669c3c4cb9a8d70c20828abb114d7a9f5
- Run mavgen.py (ignore any generated warnings)
cd pymavlink/generator/ ./mavgen.py -o mavlink_apm.py ../../message_definitions/v1.0/ardupilotmega.xml
- Copy the generated mavlink_apm.py and the 'generator' directory in mavlink to 'lib' directory. We need the 'generator' directory as mavlink_apm depends on that.
cp mavlink/pymavlink/generator/mavlink_apm.py lib/ cp -rf mavlink/pymavlink/generator/ lib/
- Edit mavlink_apm.py in lib folder to correct the path for generator. Replace the following line
from ...generator.mavcrc import x25crc
with
from generator.mavcrc import x25crc
Getting FTL_util
Place this file in 'lib' directory
Last modified 21 months ago
Last modified on Mar 8, 2014, 9:04:27 AM
Attachments (1)
-
mcp_module_and_sample_code.zip
(15.1 KB) -
added by rmarmav 21 months ago.
MCP module and sample code
Download all attachments as: .zip