Hello,
I am Frank and I am trying to build an automated guidance system that utilizes parafoil, APM2.6, servo motors, and GPS. The basic idea is to have the unit guide the whole system to target location by pulling on the strings of the parafoil such that the system turn left or right in accordance to target location and current system location.
The problem I am facing is how to load my Arduino codes (written in C) into APM2.6. As far as I know, there is a modified version of Arduino specifically designed for ArduPilot boards. However, when I type up the codes in the modified Arduino and trys to upload it to the APM2.6, the compiler fails. (I have included the error messages at the very bottom)
The setting I am using is ArduPilot -> HAL Board -> ArduPilot Mega 2.x. Board type is Arduino Mega 2560 or Mega ADK.
The other settings are exactly as the “How to Build Ardupilot with Arduino.pdf” file found in the following link:
firmware.diydrones.com/Tools/Arduino/
The codes I have compile just fine in regular Arduino, but if I do simple servo control tests (from Arduino library) and upload it into APM2.6, I get no responses. (I attached the servo at output 1, and the code is below)
I don’t think it is a APM2.6 failure due to defect because APM2.6 responds correctly when I typed up some integer input and response code (when I input 1, the serial monitor returns 1, etc), the APM2.6 does it perfectly.
I have also made sure that the servo are receiving enough power for it to work.
So my questions are the following:
How can I get the modified Arduino to compile my codes?
Do I have to use the modified one or can I just use the regular Arduino?
If I can how can I get APM2.6 to control servo motors as well as getting GPS data through my Arduino code (because so far I got no responses)?
Can I use Mission Planner to achieve what I want it to do?
If all else fails, do I just need to get an Arduino Mega 2560 Board so that Arduino works straight up with it?
Thank you for your time and help!
I greatly appreciate it!
Sincerely,
Frank
Servo test code:
#include <Servo.h>
Servo myservo;
void setup()
{
myservo.attach(1);
}
void loop()
{
myservo.writeMicroseconds(1500);
delay(1000);
myservo.writeMicroseconds(2500);
delay(1000);
}
Error messages:
Compiling my code with modified Arduino gives me the follow error message:
“fatal error: Arduino.h: No such file or directory. Compilation terminated.”
If I include all the libraries included in ArduCopter sketchbook and then compile it, the error message is the following:
AP_HAL_AVR\AnalogIn_ADC.cpp.o: In function AP_HAL_AVR::ADCSource::voltage_average()': C:\GIT\ardupilot\libraries\AP_HAL_AVR/AnalogIn_ADC.cpp:51: undefined reference to
hal’
C:\GIT\ardupilot\libraries\AP_HAL_AVR/AnalogIn_ADC.cpp:51: undefined reference to hal' AP_HAL_AVR\AnalogIn_ADC.cpp.o: In function
AP_HAL_AVR::ADCSource::set_pin(unsigned char)’:
C:\GIT\ardupilot\libraries\AP_HAL_AVR/AnalogIn_ADC.cpp:98: undefined reference to hal' C:\GIT\ardupilot\libraries\AP_HAL_AVR/AnalogIn_ADC.cpp:98: undefined reference to
hal’
AP_HAL_AVR\AnalogIn_ADC.cpp.o: In function AP_HAL_AVR::ADCSource::voltage_latest()': C:\GIT\ardupilot\libraries\AP_HAL_AVR/AnalogIn_ADC.cpp:71: undefined reference to
hal’
AP_HAL_AVR\AnalogIn_ADC.cpp.o:C:\GIT\ardupilot\libraries\AP_HAL_AVR/AnalogIn_ADC.cpp:71: more undefined references to `hal’ follow
collect2.exe: error: ld returned 1 exit status