1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-15 07:29:15 +01:00

set all the min and max values to 554 and 2400 per the Arduino servo library

fix some cosmetic errors on the debug output
fix the Vtail mixer setting that caused channel 4 to go crazy due to being undefined. Servo would sit and shake for no reason.
This commit is contained in:
Kevin Finisterre 2014-05-25 16:05:13 -04:00
parent 4d250ff856
commit 4ebaa6f205
3 changed files with 60 additions and 7 deletions

View File

@ -52,7 +52,7 @@ void OutputCalibrationUtil::startChannelOutput(quint16 channel, quint16 safeValu
m_outputChannel = channel;
m_safeValue = safeValue;
qDebug() << "Starting output for channel " << m_outputChannel << "...";
qDebug() << "Starting output for channel " << m_outputChannel+1 << "...";
ActuatorCommand *actuatorCommand = ActuatorCommand::GetInstance(m_uavObjectManager);
Q_ASSERT(actuatorCommand);
@ -74,17 +74,17 @@ void OutputCalibrationUtil::startChannelOutput(quint16 channel, quint16 safeValu
actuatorCommand->setMetadata(metaData);
actuatorCommand->updated();
qDebug() << "Output for channel " << m_outputChannel << " started.";
qDebug() << "Output for channel " << m_outputChannel+1 << " started.";
}
}
void OutputCalibrationUtil::stopChannelOutput()
{
if (m_outputChannel >= 0) {
qDebug() << "Stopping output for channel " << m_outputChannel << "...";
qDebug() << "Stopping output for channel " << m_outputChannel+1 << "...";
// Stop output...
setChannelOutputValue(m_safeValue);
qDebug() << "Settings output for channel " << m_outputChannel << " to " << m_safeValue;
qDebug() << "Settings output for channel " << m_outputChannel+1 << " to " << m_safeValue;
// Restore metadata to what it was before
ActuatorCommand *actuatorCommand = ActuatorCommand::GetInstance(m_uavObjectManager);
@ -93,7 +93,7 @@ void OutputCalibrationUtil::stopChannelOutput()
actuatorCommand->setMetadata(m_savedActuatorCommandMetadata);
actuatorCommand->updated();
qDebug() << "Output for channel " << m_outputChannel << " stopped.";
qDebug() << "Output for channel " << m_outputChannel+1 << " stopped.";
m_outputChannel = -1;
}

View File

@ -161,6 +161,24 @@ void OutputCalibrationPage::setupVehicle()
m_actuatorSettings[6].channelNeutral = 1500;
m_actuatorSettings[7].channelNeutral = 1500;
// Arduino library defaults to 554 http://arduino.cc/en/Reference/ServoAttach,
// 600 is for HS85mg - http://www.servocity.com/html/hs-85mg__mighty_micro.html#.U4JEWhapKBU
// Same rules as above from the Arduino *generic* library and the servo city info for the 85mg
m_actuatorSettings[1].channelMin = 554;
m_actuatorSettings[1].channelMax = 2400;
m_actuatorSettings[2].channelMin = 554;
m_actuatorSettings[2].channelMax = 2400;
m_actuatorSettings[3].channelMin = 554;
m_actuatorSettings[3].channelMax = 2400;
m_actuatorSettings[4].channelMin = 554;
m_actuatorSettings[4].channelMax = 2400;
m_actuatorSettings[5].channelMin = 554;
m_actuatorSettings[5].channelMax = 2400;
m_actuatorSettings[6].channelMin = 554;
m_actuatorSettings[6].channelMax = 2400;
m_actuatorSettings[7].channelMin = 554;
m_actuatorSettings[7].channelMax = 2400;
getWizard()->setActuatorSettings(m_actuatorSettings);
break;
case SetupWizard::FIXED_WING_VTAIL:
@ -180,6 +198,24 @@ void OutputCalibrationPage::setupVehicle()
m_actuatorSettings[6].channelNeutral = 1500;
m_actuatorSettings[7].channelNeutral = 1500;
// Arduino library defaults to 554 http://arduino.cc/en/Reference/ServoAttach,
// 600 is for HS85mg - http://www.servocity.com/html/hs-85mg__mighty_micro.html#.U4JEWhapKBU
// Same rules as above from the Arduino *generic* library and the servo city info for the 85mg
m_actuatorSettings[1].channelMin = 554;
m_actuatorSettings[1].channelMax = 2400;
m_actuatorSettings[2].channelMin = 554;
m_actuatorSettings[2].channelMax = 2400;
m_actuatorSettings[3].channelMin = 554;
m_actuatorSettings[3].channelMax = 2400;
m_actuatorSettings[4].channelMin = 554;
m_actuatorSettings[4].channelMax = 2400;
m_actuatorSettings[5].channelMin = 554;
m_actuatorSettings[5].channelMax = 2400;
m_actuatorSettings[6].channelMin = 554;
m_actuatorSettings[6].channelMax = 2400;
m_actuatorSettings[7].channelMin = 554;
m_actuatorSettings[7].channelMax = 2400;
getWizard()->setActuatorSettings(m_actuatorSettings);
break;
default:
@ -255,7 +291,7 @@ void OutputCalibrationPage::setWizardPage()
ui->calibrationStack->setCurrentIndex(currentPageIndex);
int currentChannel = getCurrentChannel();
qDebug() << "Current channel: " << currentChannel;
qDebug() << "Current channel: " << currentChannel+1;
if (currentChannel >= 0) {
if (currentPageIndex == 1) {
ui->motorNeutralSlider->setValue(m_actuatorSettings[currentChannel].channelNeutral);

View File

@ -311,13 +311,16 @@ void VehicleConfigurationHelper::applyActuatorConfiguration()
{
ActuatorSettings::DataFields data = actSettings->getData();
qDebug() << "Override center pulse for fixed wing servos\n";
qDebug() << "Override center, min and max pulses for fixed wing servos\n";
// move all but first chan to 1500 center pluse
QList<actuatorChannelSettings> actuatorSettings = m_configSource->getActuatorSettings();
for (quint16 i = 1; i < ActuatorSettings::CHANNELMAX_NUMELEM; i++) {
data.ChannelType[i] = ActuatorSettings::CHANNELTYPE_PWM;
data.ChannelAddr[i] = i;
data.ChannelMin[i] = 554; // Arduino library defaults to 554 http://arduino.cc/en/Reference/ServoAttach,
// 600 is for HS85mg - http://www.servocity.com/html/hs-85mg__mighty_micro.html#.U4JEWhapKBU
data.ChannelNeutral[i] = 1500;
data.ChannelMax[i] = 2400; // Same rules as above from the Arduino *generic* library and the servo city info for the 85mg
}
qDebug() << "Save Fixed Wing Actuator Data\n";
actSettings->setData(data);
@ -1346,6 +1349,20 @@ void VehicleConfigurationHelper::setupVtail()
channels[2].pitch = -50;
channels[2].yaw = 0;
channels[3].type = MIXER_TYPE_SERVO;
channels[3].throttle1 = 0;
channels[3].throttle2 = 0;
channels[3].roll = 0;
channels[3].pitch = 0;
channels[3].yaw = 0;
channels[3].type = MIXER_TYPE_SERVO;
channels[3].throttle1 = 0;
channels[3].throttle2 = 0;
channels[3].roll = 0;
channels[3].pitch = 0;
channels[3].yaw = 0;
guiSettings.fixedwing.FixedWingThrottle = 1;
guiSettings.fixedwing.FixedWingRoll1 = 2;
guiSettings.fixedwing.FixedWingRoll2 = 3;