Quadcopter software. Flying - Contact me for more details or a copy of the PC ground station code
Dependencies: ConfigFile PID PPM MODSERIAL mbed-rtos mbed MaxbotixDriver TinyGPS filter
Revision 5:7b7db24ef6eb, committed 2014-09-22
- Comitter:
- joe4465
- Date:
- Mon Sep 22 10:16:31 2014 +0000
- Parent:
- 4:8609c71ac803
- Child:
- 6:4c207e7b1203
- Commit message:
- Testing with Euler angles instead of YPR
Changed in this revision
--- a/FreeIMU.lib Thu Sep 18 08:57:47 2014 +0000 +++ b/FreeIMU.lib Mon Sep 22 10:16:31 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/joe4465/code/FreeIMU/#2e61e49cc3f5 +http://mbed.org/users/tyftyftyf/code/FreeIMU/#ea86489d606b
--- a/Ping.lib Thu Sep 18 08:57:47 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/rosienej/code/Ping/#6996f66161d7
--- a/flightController.h Thu Sep 18 08:57:47 2014 +0000 +++ b/flightController.h Mon Sep 22 10:16:31 2014 +0000 @@ -182,7 +182,7 @@ void GetAttitude() { //Get raw data from IMU - _freeIMU.getYawPitchRoll(_ypr); + _freeIMU.getYawPitchRoll(_ypr); // try get euler to get full rotation in each axis _freeIMU.getRate(_gyroRate); //Take off zero values to account for any angle inbetween the PCB level and ground @@ -190,12 +190,17 @@ _ypr[2] = _ypr[2] - _zeroValues[2]; //Swap pitch and roll angle because IMU is mounted at a right angle to the board - //Rate does not need to be switched float pitch = _ypr[2]; float roll = -_ypr[1]; //Needs to be negative _ypr[1] = pitch; _ypr[2] = roll; + //Swap pitch and roll rate because IMU is mounted at a right angle to the board + pitch = _gyroRate[2]; + roll = -_gyroRate[1]; + _gyroRate[1] = pitch; + _gyroRate[2] = roll; + //Try swapping yaw //_ypr[0] = - _ypr[0]; }
--- a/serialPortMonitor.h Thu Sep 18 08:57:47 2014 +0000 +++ b/serialPortMonitor.h Mon Sep 22 10:16:31 2014 +0000 @@ -35,11 +35,11 @@ void SerialPortMonitorTask(void const *n) { + //Print to windows application int batt = 0; _wirelessSerial.printf("<%1.6f:%1.6f:%1.6f:%1.6f:%1.6f:%1.6f:%1.6f:%d:%1.6f:%1.6f:%1.6f:%1.6f:%1.6f:%1.6f:%d:%d:%d:%d:%1.6f:%1.6f:%1.6f:%1.2f:%1.2f:%1.2f:%1.2f:%1.8f:%1.8f:%1.8f:%1.8f:%1.8f:%1.8f:%1.8f:%1.8f:%1.8f:%1.8f:%1.8f:%1.8f:%1.8f:%1.8f:%1.8f:%1.8f:%1.8f:%1.8f:%1.8f:%1.8f:%1.8f:%1.8f:%1.8f:%d>", _motorPower[0], _motorPower[1], _motorPower[2], _motorPower[3], _ypr[0], _ypr[1], _ypr[2], batt, _ratePIDControllerOutputs[0], _ratePIDControllerOutputs[1], _ratePIDControllerOutputs[2], _stabPIDControllerOutputs[0], _stabPIDControllerOutputs[1], _stabPIDControllerOutputs[2], _armed, _initialised, _rate, _stab, _gyroRate[0], _gyroRate[1], _gyroRate[2], _rcMappedCommands[0], _rcMappedCommands[1], _rcMappedCommands[2], _rcMappedCommands[3], _yawRatePIDControllerP, _yawRatePIDControllerI, _yawRatePIDControllerD, _pitchRatePIDControllerP, _pitchRatePIDControllerI, _pitchRatePIDControllerD, _rollRatePIDControllerP, _rollRatePIDControllerI, _rollRatePIDControllerD, _yawStabPIDControllerP, _yawStabPIDControllerI, _yawStabPIDControllerD, _pitchStabPIDControllerP, _pitchStabPIDControllerI, _pitchStabPIDControllerD, _rollStabPIDControllerP, _rollStabPIDControllerI, _rollStabPIDControllerD, 0/*_gpsValues[0]*/, 0/* _gpsValues[1]*/, 0/*_gpsValues[2]*/, 0/*_gpsValues[3]*/, 0/*_gpsValues[4]*/, 0/*_gpsConnected*/); - //Check for wireless serial command if (_wirelessSerial.readable() > 0) { @@ -76,7 +76,7 @@ switch (c) { - case 60: // + case 60: // < _gpsSerialRxPos = 0; break; @@ -99,6 +99,7 @@ } //Checks for a valid command from the serial port and executes it +//<Command=Value> void CheckWirelessSerialCommand() { int length = _wirelessSerialRxPos; @@ -266,6 +267,7 @@ } //Checks for a valid command from the serial port and executes it +//<%.2f:%.2f:%.2f:%.2f:%.2f:%d>", latitude, longitude, GnssInfo.altitude.meters(), GnssInfo.course.deg(), GnssInfo.speed.kph(), _connectedFlag); /*void CheckGPSSerialCommand() { int length = _gpsSerialRxPos; @@ -279,6 +281,14 @@ printf("command\r\n"); + //Convert _gpsSerialBuffer to string + + //Split on : + + //Check it split into 6 parts + + //Convert to cirrect format and assign to vars + char command = _gpsSerialBuffer[0]; double value = 0; if(length > 1)