Alexinparis wrote:reference version to compile sketch
- MultiWii sketch : windows version of Arduino IDE 1.6.1
- MultiWiiConf : processing 1.5.1 with modified verison of ControlP5 to remove blue triangles in value box
willow609 wrote:Hi all. Will this work with a crius aiopro v2 board. Many thanks.
TheBum wrote:Alexinparis wrote:reference version to compile sketch
- MultiWii sketch : windows version of Arduino IDE 1.6.1
- MultiWiiConf : processing 1.5.1 with modified verison of ControlP5 to remove blue triangles in value box
Is the Mac version of Arduino 1.6.1 excluded because it's broken? I upgraded to 1.6.1 and had to go back to 1.6.0 because 1.6.1 was spewing error messages when attempting to build from my svn sandbox. I haven't updated my sandbox with 2.4 final yet.
zed_thirteen wrote:Are the stored parameters compatible with 2.3 or do I need to erase the EPROM space?
if (!AccInflightCalibrationActive && !AccInflightCalibrationMeasurementDone){
InflightcalibratingA = 50;
}
if (!AccInflightCalibrationActive && !AccInflightCalibrationMeasurementDone){
InflightcalibratingA = 50; AccInflightCalibrationActive = 1;
}
analog.amperage = ((uint32_t)powerValue * conf.pint2ma) / 100; // [100mA] //old (will overflow for 65A: powerValue * conf.pint2ma; // [1mA]
analog.amperage = ((uint32_t)powerValue * conf.pint2ma) / 10; // [10mA]
Of course, I don't.Hamburger wrote:Do you really see accurate measurements with 10mA steps from your sensor all the way through the adc?
analog.amperage = (((uint32_t)powerValue * conf.pint2ma) + 50) / 100; // [100mA] //old (will overflow for 65A: powerValue * conf.pint2ma; // [1mA]
pMeter[PMOTOR_SUM] += ((currentTime-lastRead) * (uint32_t)((uint32_t)powerValue*conf.pint2ma))/100000; // [10 mA * msec]
TheBum wrote:I'll add my $0.02 to the amperage discussion. I chose to go with a 50A Hall effect sensor for my mini quad and the resolution works out to 61.25mA (80mV/A). I don't think you'll get much lower than that, and higher rated sensors will be even worse. Therefore, 100mA resolution on the display should be more than sufficient.
TheBum wrote:There's a documentation typo in 2.4 that was there in 2.3 and, being the anal-retentive person I am, it's driving me nuts.
In MultiWii.cpp, the comment at the end of the following line is wrong:
- Code: Select all
pMeter[PMOTOR_SUM] += ((currentTime-lastRead) * (uint32_t)((uint32_t)powerValue*conf.pint2ma))/100000; // [10 mA * msec]
It should be 100 mA * msec based on the equation. The unscaled units are mA * µsec. To get 10 mA * msec, you'd have to divide by 10 and 1000, i.e. 10000.
Hamburger wrote:I do not think it would justify a recall of v2.4, but I will take a closer look for v2.5. Thanks.
#define GYRO_I_MAX 256
#define ACC_I_MAX 256
prop = min(max(abs(rcCommand[PITCH]), abs(rcCommand[ROLL])), 500); // range [0;500]
//----------PID controller----------
for (axis = 0; axis < 3; axis++) {
//-----Get the desired angle rate depending on flight mode
//if ((f.ANGLE_MODE || f.HORIZON_MODE) && axis < 2) { // MODE relying on ACC
// // calculate error and limit the angle to 50 degrees max inclination
// // errorAngle = constrain((rcCommand[axis] << 1) + GPS_angle[axis], -500, +500) - att.angle[axis] + conf.angleTrim[axis]; //16 bits is ok here
//}
if (axis == 2) {//YAW is always gyro-controlled (MAG correction is applied to rcCommand)
AngleRateTmp = (((int32_t) (conf.yawRate + 27) * rcCommand[2]) >> 5);
}
else {
// calculate error and limit the angle to 50 degrees max inclination
#if GPS
//errorAngle = constrain((rcCommand[axis] << 1) + GPS_angle[axis], -500, +500) - att.angle[axis] + conf.angleTrim[axis]; //16 bits is ok here
errorAngle = constrain(2 * rcCommand[axis] + GPS_angle[axis], -500, +500) - att.angle[axis] + conf.angleTrim[axis]; //16 bits is ok here
#else
errorAngle = constrain(2 * rcCommand[axis], -500, +500) - att.angle[axis] + conf.angleTrim[axis]; //16 bits is ok here
#endif
if (!f.ANGLE_MODE) {//control is GYRO based (ACRO and HORIZON - direct sticks control is applied to rate PID
AngleRateTmp = ((int32_t) (conf.rollPitchRate + 27) * rcCommand[axis]) >> 4;
if (f.HORIZON_MODE) {
//mix up angle error to desired AngleRateTmp to add a little auto-level feel
AngleRateTmp += ((int32_t) errorAngle * conf.pid[PIDLEVEL].I8) >> 8;
}
}
else {//it's the ANGLE mode - control is angle based, so control loop is needed
AngleRateTmp = ((int32_t) errorAngle * conf.pid[PIDLEVEL].P8) >> 4;
}
}
//--------low-level gyro-based PID. ----------
//Used in stand-alone mode for ACRO, controlled by higher level regulators in other modes
//-----calculate scaled error.AngleRates
//multiplication of rcCommand corresponds to changing the sticks scaling here
RateError = AngleRateTmp - imu.gyroData[axis];
//-----calculate P component
PTerm = ((int32_t) RateError * conf.pid[axis].P8) >> 7;
//-----calculate I component
//there should be no division before accumulating the error to integrator, because the precision would be reduced.
//Precision is critical, as I prevents from long-time drift. Thus, 32 bits integrator is used.
//Time correction (to avoid different I scaling for different builds based on average cycle time)
//is normalized to cycle time = 2048.
errorGyroI[axis] += (((int32_t) RateError * cycleTime) >> 11) * conf.pid[axis].I8;
//limit maximum integrator value to prevent WindUp - accumulating extreme values when system is saturated.
//I coefficient (I8) moved before integration to make limiting independent from PID settings
errorGyroI[axis] = constrain(errorGyroI[axis], (int32_t) -GYRO_I_MAX << 13, (int32_t) +GYRO_I_MAX << 13);
ITerm = errorGyroI[axis] >> 13;
//-----calculate D-term
delta = RateError - lastError[axis]; // 16 bits is ok here, the dif between 2 consecutive gyro reads is limited to 800
lastError[axis] = RateError;
//Correct difference by cycle time. Cycle time is jittery (can be different 2 times), so calculated difference
// would be scaled by different dt each time. Division by dT fixes that.
delta = ((int32_t) delta * ((uint16_t) 0xFFFF / (cycleTime >> 4))) >> 6;
//add moving average here to reduce noise
deltaSum = delta1[axis] + delta2[axis] + delta;
delta2[axis] = delta1[axis];
delta1[axis] = delta;
//DTerm = (deltaSum*conf.pid[axis].D8)>>8;
//Solve overflow in calculation above...
DTerm = ((int32_t) deltaSum * conf.pid[axis].D8) >> 8;
//-----calculate total PID output
axisPID[axis] = PTerm + ITerm + DTerm;
}
jaysonragasa wrote:I made a small changes in AlexK PID_CONTRORLLER based on cleanflight's "ReWrite"
Alexinparis wrote:- heading is computed even with no mag
RCvertt wrote:Good work on 2.4Alexinparis wrote:- heading is computed even with no mag
What does this mean? We now have some heading hold using just a gyro and accel as an option? If so how do we activate this feature or is it on all the time?
Sure about that? I've never heard of heading hold with GPS only. GPS is rather inaccurate so I can't imagine that being the case?TheBum wrote:The only method I can think of without a mag sensor is GPS, and then only when the model is moving.
ttcorse wrote:the ide does not compile if activate:
#define SERVO TILT
Errore durante la compilazione
No, you can't and you have to use the additional i2c_gps_nav module.m.homayoun wrote:I want to know if i want to use ublox gps with srf04 sonar Do I still have to use MWC I2C-GPS NAV module board with I2C_GPS_NAV code on multiwii 2.4
Fredasss wrote:Hi everybody,
I stuck in the same way with my MTK GPS.
I've just bought a HK multiwii pro, and updated it to 2.4,
I tried these settings:
#define SERIAL2_COM_SPEED 57600 //also tried standart baudrate
#define GPS_SERIAL 2
#define GPS_BAUD 57600
#define NMEA
#define INIT_MTK_GPS
tried to change baud rate, but nothing appened in the GUI.
can you please help me to find a way to make it work ?
thanks by advance.
Fred
Leo wrote:@Alex: r1771 "replace some pinMode() by direct DDR port manipulation"
What is the advantage?
Leo wrote:@Alex: r1771 "replace some pinMode() by direct DDR port manipulation"
What is the advantage?
void pinMode(uint8_t pin, uint8_t mode)
{
uint8_t bit = digitalPinToBitMask(pin);
uint8_t port = digitalPinToPort(pin);
volatile uint8_t *reg, *out;
if (port == NOT_A_PIN) return;
// JWS: can I let the optimizer do this?
reg = portModeRegister(port);
out = portOutputRegister(port);
if (mode == INPUT) {
uint8_t oldSREG = SREG;
cli();
*reg &= ~bit;
*out &= ~bit;
SREG = oldSREG;
} else if (mode == INPUT_PULLUP) {
uint8_t oldSREG = SREG;
cli();
*reg &= ~bit;
*out |= bit;
SREG = oldSREG;
} else {
uint8_t oldSREG = SREG;
cli();
*reg |= bit;
SREG = oldSREG;
}
}
Return to Software development
Users browsing this forum: Google [Bot] and 3 guests