1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

Merge branch 'next' into revo

Conflicts:
	androidgcs/src/org/openpilot/uavtalk/uavobjects/FlightStatus.java
	androidgcs/src/org/openpilot/uavtalk/uavobjects/HwSettings.java
	androidgcs/src/org/openpilot/uavtalk/uavobjects/ManualControlSettings.java
	androidgcs/src/org/openpilot/uavtalk/uavobjects/SystemAlarms.java
	androidgcs/src/org/openpilot/uavtalk/uavobjects/UAVObjectsInitialize.java
This commit is contained in:
James Cotton 2012-09-12 02:44:04 -05:00
commit 0f4a0526ac
14 changed files with 572 additions and 17 deletions

View File

@ -113,6 +113,8 @@ public class ActuatorSettings extends UAVDataObject {
ChannelTypeEnumOptions.add("MK");
ChannelTypeEnumOptions.add("ASTEC4");
ChannelTypeEnumOptions.add("PWM Alarm Buzzer");
ChannelTypeEnumOptions.add("Arming led");
ChannelTypeEnumOptions.add("Info led");
fields.add( new UAVObjectField("ChannelType", "", UAVObjectField.FieldType.ENUM, ChannelTypeElemNames, ChannelTypeEnumOptions) );
List<String> ChannelAddrElemNames = new ArrayList<String>();
@ -262,7 +264,7 @@ public class ActuatorSettings extends UAVDataObject {
}
// Constants
protected static final long OBJID = 0x7D555646l;
protected static final long OBJID = 0x1441DC6El;
protected static final String NAME = "ActuatorSettings";
protected static String DESCRIPTION = "Settings for the @ref ActuatorModule that controls the channel assignments for the mixer based on AircraftType";
protected static final boolean ISSINGLEINST = 1 > 0;

View File

@ -82,7 +82,6 @@ public class FlightBatterySettings extends UAVDataObject {
List<String> SensorTypeElemNames = new ArrayList<String>();
SensorTypeElemNames.add("BatteryCurrent");
SensorTypeElemNames.add("BatteryVoltage");
SensorTypeElemNames.add("BoardVoltage");
List<String> SensorTypeEnumOptions = new ArrayList<String>();
SensorTypeEnumOptions.add("Disabled");
SensorTypeEnumOptions.add("Enabled");
@ -139,9 +138,8 @@ public class FlightBatterySettings extends UAVDataObject {
getField("SensorCalibrations").setValue(1,1);
getField("Type").setValue("LiPo");
getField("NbCells").setValue(3);
getField("SensorType").setValue("Disabled",0);
getField("SensorType").setValue("Disabled",1);
getField("SensorType").setValue("Disabled",2);
getField("SensorType").setValue("Enabled",0);
getField("SensorType").setValue("Enabled",1);
}
@ -170,7 +168,7 @@ public class FlightBatterySettings extends UAVDataObject {
}
// Constants
protected static final long OBJID = 0x94AC6AD2l;
protected static final long OBJID = 0x9D0F3FCEl;
protected static final String NAME = "FlightBatterySettings";
protected static String DESCRIPTION = "Flight Battery configuration.";
protected static final boolean ISSINGLEINST = 1 > 0;

View File

@ -66,6 +66,7 @@ public class FlightStatus extends UAVDataObject {
FlightModeEnumOptions.add("Stabilized1");
FlightModeEnumOptions.add("Stabilized2");
FlightModeEnumOptions.add("Stabilized3");
FlightModeEnumOptions.add("Autotune");
FlightModeEnumOptions.add("AltitudeHold");
FlightModeEnumOptions.add("VelocityControl");
FlightModeEnumOptions.add("PositionHold");
@ -146,7 +147,7 @@ public class FlightStatus extends UAVDataObject {
}
// Constants
protected static final long OBJID = 0x884FEF66l;
protected static final long OBJID = 0x30079F4El;
protected static final String NAME = "FlightStatus";
protected static String DESCRIPTION = "Contains major flight status information for other modules.";
protected static final boolean ISSINGLEINST = 1 > 0;

View File

@ -102,7 +102,7 @@ public class GPSSettings extends UAVDataObject {
*/
public void setDefaultFieldValues()
{
getField("DataProtocol").setValue("NMEA");
getField("DataProtocol").setValue("UBX");
}

View File

@ -194,6 +194,7 @@ public class HwSettings extends UAVDataObject {
USB_HIDPortElemNames.add("0");
List<String> USB_HIDPortEnumOptions = new ArrayList<String>();
USB_HIDPortEnumOptions.add("USBTelemetry");
USB_HIDPortEnumOptions.add("RCTransmitter");
USB_HIDPortEnumOptions.add("Disabled");
fields.add( new UAVObjectField("USB_HIDPort", "function", UAVObjectField.FieldType.ENUM, USB_HIDPortElemNames, USB_HIDPortEnumOptions) );
@ -213,10 +214,12 @@ public class HwSettings extends UAVDataObject {
OptionalModulesElemNames.add("Altitude");
OptionalModulesElemNames.add("Airspeed");
OptionalModulesElemNames.add("TxPID");
OptionalModulesElemNames.add("Autotune");
OptionalModulesElemNames.add("VtolPathFollower");
OptionalModulesElemNames.add("FixedWingPathFollower");
OptionalModulesElemNames.add("Battery");
OptionalModulesElemNames.add("Overo");
OptionalModulesElemNames.add("Radio");
List<String> OptionalModulesEnumOptions = new ArrayList<String>();
OptionalModulesEnumOptions.add("Disabled");
OptionalModulesEnumOptions.add("Enabled");
@ -271,13 +274,13 @@ public class HwSettings extends UAVDataObject {
public void setDefaultFieldValues()
{
getField("CC_RcvrPort").setValue("PWM");
getField("CC_MainPort").setValue("Disabled");
getField("CC_MainPort").setValue("Telemetry");
getField("CC_FlexiPort").setValue("Disabled");
getField("RV_RcvrPort").setValue("PWM");
getField("RV_AuxPort").setValue("Disabled");
getField("RV_AuxSBusPort").setValue("Disabled");
getField("RV_FlexiPort").setValue("Disabled");
getField("RV_TelemetryPort").setValue("Telemetry");
getField("RV_TelemetryPort").setValue("Disabled");
getField("RV_GPSPort").setValue("GPS");
getField("TelemetrySpeed").setValue("57600");
getField("GPSSpeed").setValue("57600");
@ -295,6 +298,8 @@ public class HwSettings extends UAVDataObject {
getField("OptionalModules").setValue("Disabled",8);
getField("OptionalModules").setValue("Disabled",9);
getField("OptionalModules").setValue("Disabled",10);
getField("OptionalModules").setValue("Disabled",11);
getField("OptionalModules").setValue("Disabled",12);
getField("DSMxBind").setValue(0);
}
@ -324,7 +329,7 @@ public class HwSettings extends UAVDataObject {
}
// Constants
protected static final long OBJID = 0x5D950E50l;
protected static final long OBJID = 0x97398142l;
protected static final String NAME = "HwSettings";
protected static String DESCRIPTION = "Selection of optional hardware configurations.";
protected static final boolean ISSINGLEINST = 1 > 0;

View File

@ -151,6 +151,8 @@ public class ManualControlSettings extends UAVDataObject {
Stabilization1SettingsEnumOptions.add("AxisLock");
Stabilization1SettingsEnumOptions.add("WeakLeveling");
Stabilization1SettingsEnumOptions.add("VirtualBar");
Stabilization1SettingsEnumOptions.add("RelayRate");
Stabilization1SettingsEnumOptions.add("RelayAttitude");
fields.add( new UAVObjectField("Stabilization1Settings", "", UAVObjectField.FieldType.ENUM, Stabilization1SettingsElemNames, Stabilization1SettingsEnumOptions) );
List<String> Stabilization2SettingsElemNames = new ArrayList<String>();
@ -164,6 +166,8 @@ public class ManualControlSettings extends UAVDataObject {
Stabilization2SettingsEnumOptions.add("AxisLock");
Stabilization2SettingsEnumOptions.add("WeakLeveling");
Stabilization2SettingsEnumOptions.add("VirtualBar");
Stabilization2SettingsEnumOptions.add("RelayRate");
Stabilization2SettingsEnumOptions.add("RelayAttitude");
fields.add( new UAVObjectField("Stabilization2Settings", "", UAVObjectField.FieldType.ENUM, Stabilization2SettingsElemNames, Stabilization2SettingsEnumOptions) );
List<String> Stabilization3SettingsElemNames = new ArrayList<String>();
@ -177,6 +181,8 @@ public class ManualControlSettings extends UAVDataObject {
Stabilization3SettingsEnumOptions.add("AxisLock");
Stabilization3SettingsEnumOptions.add("WeakLeveling");
Stabilization3SettingsEnumOptions.add("VirtualBar");
Stabilization3SettingsEnumOptions.add("RelayRate");
Stabilization3SettingsEnumOptions.add("RelayAttitude");
fields.add( new UAVObjectField("Stabilization3Settings", "", UAVObjectField.FieldType.ENUM, Stabilization3SettingsElemNames, Stabilization3SettingsEnumOptions) );
List<String> FlightModeNumberElemNames = new ArrayList<String>();
@ -195,6 +201,7 @@ public class ManualControlSettings extends UAVDataObject {
FlightModePositionEnumOptions.add("Stabilized1");
FlightModePositionEnumOptions.add("Stabilized2");
FlightModePositionEnumOptions.add("Stabilized3");
FlightModePositionEnumOptions.add("Autotune");
FlightModePositionEnumOptions.add("AltitudeHold");
FlightModePositionEnumOptions.add("VelocityControl");
FlightModePositionEnumOptions.add("PositionHold");
@ -347,7 +354,7 @@ public class ManualControlSettings extends UAVDataObject {
}
// Constants
protected static final long OBJID = 0xBA39E41Al;
protected static final long OBJID = 0x4BD7CF5Al;
protected static final String NAME = "ManualControlSettings";
protected static String DESCRIPTION = "Settings to indicate how to decode receiver input by @ref ManualControlModule.";
protected static final boolean ISSINGLEINST = 1 > 0;

View File

@ -0,0 +1,195 @@
/**
******************************************************************************
*
* @file uavobjecttemplate.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief Template for an uavobject in java
* This is a autogenerated file!! Do not modify and expect a result.
* A waypoint command the pathplanner is to use at a certain waypoint
*
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.openpilot.uavtalk.uavobjects;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
import org.openpilot.uavtalk.UAVObjectManager;
import org.openpilot.uavtalk.UAVObject;
import org.openpilot.uavtalk.UAVDataObject;
import org.openpilot.uavtalk.UAVObjectField;
/**
A waypoint command the pathplanner is to use at a certain waypoint
generated from pathaction.xml
**/
public class PathAction extends UAVDataObject {
public PathAction() {
super(OBJID, ISSINGLEINST, ISSETTINGS, NAME);
List<UAVObjectField> fields = new ArrayList<UAVObjectField>();
List<String> ModeParametersElemNames = new ArrayList<String>();
ModeParametersElemNames.add("0");
ModeParametersElemNames.add("1");
ModeParametersElemNames.add("2");
ModeParametersElemNames.add("3");
fields.add( new UAVObjectField("ModeParameters", "", UAVObjectField.FieldType.FLOAT32, ModeParametersElemNames, null) );
List<String> ConditionParametersElemNames = new ArrayList<String>();
ConditionParametersElemNames.add("0");
ConditionParametersElemNames.add("1");
ConditionParametersElemNames.add("2");
ConditionParametersElemNames.add("3");
fields.add( new UAVObjectField("ConditionParameters", "", UAVObjectField.FieldType.FLOAT32, ConditionParametersElemNames, null) );
List<String> ModeElemNames = new ArrayList<String>();
ModeElemNames.add("0");
List<String> ModeEnumOptions = new ArrayList<String>();
ModeEnumOptions.add("FlyEndpoint");
ModeEnumOptions.add("FlyVector");
ModeEnumOptions.add("FlyCircleRight");
ModeEnumOptions.add("FlyCircleLeft");
ModeEnumOptions.add("DriveEndpoint");
ModeEnumOptions.add("DriveVector");
ModeEnumOptions.add("DriveCircleLeft");
ModeEnumOptions.add("DriveCircleRight");
ModeEnumOptions.add("FixedAttitude");
ModeEnumOptions.add("SetAccessory");
ModeEnumOptions.add("DisarmAlarm");
fields.add( new UAVObjectField("Mode", "", UAVObjectField.FieldType.ENUM, ModeElemNames, ModeEnumOptions) );
List<String> EndConditionElemNames = new ArrayList<String>();
EndConditionElemNames.add("0");
List<String> EndConditionEnumOptions = new ArrayList<String>();
EndConditionEnumOptions.add("None");
EndConditionEnumOptions.add("TimeOut");
EndConditionEnumOptions.add("DistanceToTarget");
EndConditionEnumOptions.add("LegRemaining");
EndConditionEnumOptions.add("AboveAltitude");
EndConditionEnumOptions.add("PointingTowardsNext");
EndConditionEnumOptions.add("PythonScript");
EndConditionEnumOptions.add("Immediate");
fields.add( new UAVObjectField("EndCondition", "", UAVObjectField.FieldType.ENUM, EndConditionElemNames, EndConditionEnumOptions) );
List<String> CommandElemNames = new ArrayList<String>();
CommandElemNames.add("0");
List<String> CommandEnumOptions = new ArrayList<String>();
CommandEnumOptions.add("OnConditionNextWaypoint");
CommandEnumOptions.add("OnNotConditionNextWaypoint");
CommandEnumOptions.add("OnConditionJumpWaypoint");
CommandEnumOptions.add("OnNotConditionJumpWaypoint");
CommandEnumOptions.add("IfConditionJumpWaypointElseNextWaypoint");
fields.add( new UAVObjectField("Command", "", UAVObjectField.FieldType.ENUM, CommandElemNames, CommandEnumOptions) );
List<String> JumpDestinationElemNames = new ArrayList<String>();
JumpDestinationElemNames.add("0");
fields.add( new UAVObjectField("JumpDestination", "waypoint", UAVObjectField.FieldType.UINT8, JumpDestinationElemNames, null) );
List<String> ErrorDestinationElemNames = new ArrayList<String>();
ErrorDestinationElemNames.add("0");
fields.add( new UAVObjectField("ErrorDestination", "waypoint", UAVObjectField.FieldType.UINT8, ErrorDestinationElemNames, null) );
// Compute the number of bytes for this object
int numBytes = 0;
ListIterator<UAVObjectField> li = fields.listIterator();
while(li.hasNext()) {
numBytes += li.next().getNumBytes();
}
NUMBYTES = numBytes;
// Initialize object
initializeFields(fields, ByteBuffer.allocate(NUMBYTES), NUMBYTES);
// Set the default field values
setDefaultFieldValues();
// Set the object description
setDescription(DESCRIPTION);
}
/**
* Create a Metadata object filled with default values for this object
* @return Metadata object with default values
*/
public Metadata getDefaultMetadata() {
UAVObject.Metadata metadata = new UAVObject.Metadata();
metadata.flags =
UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT |
UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT |
0 << UAVOBJ_TELEMETRY_ACKED_SHIFT |
0 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT |
UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_PERIODIC) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT |
UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_MANUAL) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT;
metadata.flightTelemetryUpdatePeriod = 4000;
metadata.gcsTelemetryUpdatePeriod = 0;
metadata.loggingUpdatePeriod = 1000;
return metadata;
}
/**
* Initialize object fields with the default values.
* If a default value is not specified the object fields
* will be initialized to zero.
*/
public void setDefaultFieldValues()
{
}
/**
* Create a clone of this object, a new instance ID must be specified.
* Do not use this function directly to create new instances, the
* UAVObjectManager should be used instead.
*/
public UAVDataObject clone(long instID) {
// TODO: Need to get specific instance to clone
try {
PathAction obj = new PathAction();
obj.initialize(instID, this.getMetaObject());
return obj;
} catch (Exception e) {
return null;
}
}
/**
* Static function to retrieve an instance of the object.
*/
public PathAction GetInstance(UAVObjectManager objMngr, long instID)
{
return (PathAction)(objMngr.getObject(PathAction.OBJID, instID));
}
// Constants
protected static final long OBJID = 0x34595F1Cl;
protected static final String NAME = "PathAction";
protected static String DESCRIPTION = "A waypoint command the pathplanner is to use at a certain waypoint";
protected static final boolean ISSINGLEINST = 0 > 0;
protected static final boolean ISSETTINGS = 0 > 0;
protected static int NUMBYTES = 0;
}

View File

@ -223,9 +223,9 @@ public class PipXStatus extends UAVDataObject {
UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READONLY) << UAVOBJ_GCS_ACCESS_SHIFT |
0 << UAVOBJ_TELEMETRY_ACKED_SHIFT |
0 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT |
UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_MANUAL) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT |
UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_PERIODIC) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT |
UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_MANUAL) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT;
metadata.flightTelemetryUpdatePeriod = 0;
metadata.flightTelemetryUpdatePeriod = 1000;
metadata.gcsTelemetryUpdatePeriod = 0;
metadata.loggingUpdatePeriod = 1000;

View File

@ -0,0 +1,146 @@
/**
******************************************************************************
*
* @file uavobjecttemplate.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief Template for an uavobject in java
* This is a autogenerated file!! Do not modify and expect a result.
* The input to the relay tuning.
*
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.openpilot.uavtalk.uavobjects;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
import org.openpilot.uavtalk.UAVObjectManager;
import org.openpilot.uavtalk.UAVObject;
import org.openpilot.uavtalk.UAVDataObject;
import org.openpilot.uavtalk.UAVObjectField;
/**
The input to the relay tuning.
generated from relaytuning.xml
**/
public class RelayTuning extends UAVDataObject {
public RelayTuning() {
super(OBJID, ISSINGLEINST, ISSETTINGS, NAME);
List<UAVObjectField> fields = new ArrayList<UAVObjectField>();
List<String> PeriodElemNames = new ArrayList<String>();
PeriodElemNames.add("Roll");
PeriodElemNames.add("Pitch");
PeriodElemNames.add("Yaw");
fields.add( new UAVObjectField("Period", "ms", UAVObjectField.FieldType.FLOAT32, PeriodElemNames, null) );
List<String> GainElemNames = new ArrayList<String>();
GainElemNames.add("Roll");
GainElemNames.add("Pitch");
GainElemNames.add("Yaw");
fields.add( new UAVObjectField("Gain", "(deg/s)/output", UAVObjectField.FieldType.FLOAT32, GainElemNames, null) );
// Compute the number of bytes for this object
int numBytes = 0;
ListIterator<UAVObjectField> li = fields.listIterator();
while(li.hasNext()) {
numBytes += li.next().getNumBytes();
}
NUMBYTES = numBytes;
// Initialize object
initializeFields(fields, ByteBuffer.allocate(NUMBYTES), NUMBYTES);
// Set the default field values
setDefaultFieldValues();
// Set the object description
setDescription(DESCRIPTION);
}
/**
* Create a Metadata object filled with default values for this object
* @return Metadata object with default values
*/
public Metadata getDefaultMetadata() {
UAVObject.Metadata metadata = new UAVObject.Metadata();
metadata.flags =
UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT |
UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT |
0 << UAVOBJ_TELEMETRY_ACKED_SHIFT |
0 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT |
UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_PERIODIC) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT |
UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_MANUAL) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT;
metadata.flightTelemetryUpdatePeriod = 1000;
metadata.gcsTelemetryUpdatePeriod = 0;
metadata.loggingUpdatePeriod = 0;
return metadata;
}
/**
* Initialize object fields with the default values.
* If a default value is not specified the object fields
* will be initialized to zero.
*/
public void setDefaultFieldValues()
{
}
/**
* Create a clone of this object, a new instance ID must be specified.
* Do not use this function directly to create new instances, the
* UAVObjectManager should be used instead.
*/
public UAVDataObject clone(long instID) {
// TODO: Need to get specific instance to clone
try {
RelayTuning obj = new RelayTuning();
obj.initialize(instID, this.getMetaObject());
return obj;
} catch (Exception e) {
return null;
}
}
/**
* Static function to retrieve an instance of the object.
*/
public RelayTuning GetInstance(UAVObjectManager objMngr, long instID)
{
return (RelayTuning)(objMngr.getObject(RelayTuning.OBJID, instID));
}
// Constants
protected static final long OBJID = 0xF6EE61BEl;
protected static final String NAME = "RelayTuning";
protected static String DESCRIPTION = "The input to the relay tuning.";
protected static final boolean ISSINGLEINST = 1 > 0;
protected static final boolean ISSETTINGS = 0 > 0;
protected static int NUMBYTES = 0;
}

View File

@ -0,0 +1,171 @@
/**
******************************************************************************
*
* @file uavobjecttemplate.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief Template for an uavobject in java
* This is a autogenerated file!! Do not modify and expect a result.
* Setting to run a relay tuning algorithm
*
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.openpilot.uavtalk.uavobjects;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
import org.openpilot.uavtalk.UAVObjectManager;
import org.openpilot.uavtalk.UAVObject;
import org.openpilot.uavtalk.UAVDataObject;
import org.openpilot.uavtalk.UAVObjectField;
/**
Setting to run a relay tuning algorithm
generated from relaytuningsettings.xml
**/
public class RelayTuningSettings extends UAVDataObject {
public RelayTuningSettings() {
super(OBJID, ISSINGLEINST, ISSETTINGS, NAME);
List<UAVObjectField> fields = new ArrayList<UAVObjectField>();
List<String> RateGainElemNames = new ArrayList<String>();
RateGainElemNames.add("0");
fields.add( new UAVObjectField("RateGain", "", UAVObjectField.FieldType.FLOAT32, RateGainElemNames, null) );
List<String> AttitudeGainElemNames = new ArrayList<String>();
AttitudeGainElemNames.add("0");
fields.add( new UAVObjectField("AttitudeGain", "", UAVObjectField.FieldType.FLOAT32, AttitudeGainElemNames, null) );
List<String> AmplitudeElemNames = new ArrayList<String>();
AmplitudeElemNames.add("0");
fields.add( new UAVObjectField("Amplitude", "", UAVObjectField.FieldType.FLOAT32, AmplitudeElemNames, null) );
List<String> HysteresisThreshElemNames = new ArrayList<String>();
HysteresisThreshElemNames.add("0");
fields.add( new UAVObjectField("HysteresisThresh", "deg/s", UAVObjectField.FieldType.UINT8, HysteresisThreshElemNames, null) );
List<String> ModeElemNames = new ArrayList<String>();
ModeElemNames.add("0");
List<String> ModeEnumOptions = new ArrayList<String>();
ModeEnumOptions.add("Rate");
ModeEnumOptions.add("Attitude");
fields.add( new UAVObjectField("Mode", "", UAVObjectField.FieldType.ENUM, ModeElemNames, ModeEnumOptions) );
List<String> BehaviorElemNames = new ArrayList<String>();
BehaviorElemNames.add("0");
List<String> BehaviorEnumOptions = new ArrayList<String>();
BehaviorEnumOptions.add("Measure");
BehaviorEnumOptions.add("Compute");
BehaviorEnumOptions.add("Save");
fields.add( new UAVObjectField("Behavior", "", UAVObjectField.FieldType.ENUM, BehaviorElemNames, BehaviorEnumOptions) );
// Compute the number of bytes for this object
int numBytes = 0;
ListIterator<UAVObjectField> li = fields.listIterator();
while(li.hasNext()) {
numBytes += li.next().getNumBytes();
}
NUMBYTES = numBytes;
// Initialize object
initializeFields(fields, ByteBuffer.allocate(NUMBYTES), NUMBYTES);
// Set the default field values
setDefaultFieldValues();
// Set the object description
setDescription(DESCRIPTION);
}
/**
* Create a Metadata object filled with default values for this object
* @return Metadata object with default values
*/
public Metadata getDefaultMetadata() {
UAVObject.Metadata metadata = new UAVObject.Metadata();
metadata.flags =
UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT |
UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT |
1 << UAVOBJ_TELEMETRY_ACKED_SHIFT |
1 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT |
UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_ONCHANGE) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT |
UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_ONCHANGE) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT;
metadata.flightTelemetryUpdatePeriod = 0;
metadata.gcsTelemetryUpdatePeriod = 0;
metadata.loggingUpdatePeriod = 0;
return metadata;
}
/**
* Initialize object fields with the default values.
* If a default value is not specified the object fields
* will be initialized to zero.
*/
public void setDefaultFieldValues()
{
getField("RateGain").setValue(0.3333);
getField("AttitudeGain").setValue(0.2);
getField("Amplitude").setValue(0.25);
getField("HysteresisThresh").setValue(5);
getField("Mode").setValue("Attitude");
getField("Behavior").setValue("Compute");
}
/**
* Create a clone of this object, a new instance ID must be specified.
* Do not use this function directly to create new instances, the
* UAVObjectManager should be used instead.
*/
public UAVDataObject clone(long instID) {
// TODO: Need to get specific instance to clone
try {
RelayTuningSettings obj = new RelayTuningSettings();
obj.initialize(instID, this.getMetaObject());
return obj;
} catch (Exception e) {
return null;
}
}
/**
* Static function to retrieve an instance of the object.
*/
public RelayTuningSettings GetInstance(UAVObjectManager objMngr, long instID)
{
return (RelayTuningSettings)(objMngr.getObject(RelayTuningSettings.OBJID, instID));
}
// Constants
protected static final long OBJID = 0xEA358166l;
protected static final String NAME = "RelayTuningSettings";
protected static String DESCRIPTION = "Setting to run a relay tuning algorithm";
protected static final boolean ISSINGLEINST = 1 > 0;
protected static final boolean ISSETTINGS = 1 > 0;
protected static int NUMBYTES = 0;
}

View File

@ -78,6 +78,8 @@ public class StabilizationDesired extends UAVDataObject {
StabilizationModeEnumOptions.add("AxisLock");
StabilizationModeEnumOptions.add("WeakLeveling");
StabilizationModeEnumOptions.add("VirtualBar");
StabilizationModeEnumOptions.add("RelayRate");
StabilizationModeEnumOptions.add("RelayAttitude");
fields.add( new UAVObjectField("StabilizationMode", "", UAVObjectField.FieldType.ENUM, StabilizationModeElemNames, StabilizationModeEnumOptions) );
@ -152,7 +154,7 @@ public class StabilizationDesired extends UAVDataObject {
}
// Constants
protected static final long OBJID = 0xDE1EAAD6l;
protected static final long OBJID = 0x4FDBFEEAl;
protected static final String NAME = "StabilizationDesired";
protected static String DESCRIPTION = "The desired attitude that @ref StabilizationModule will try and achieve if FlightMode is Stabilized. Comes from @ref ManaulControlModule.";
protected static final boolean ISSINGLEINST = 1 > 0;

View File

@ -131,6 +131,10 @@ public class StabilizationSettings extends UAVDataObject {
GyroTauElemNames.add("0");
fields.add( new UAVObjectField("GyroTau", "", UAVObjectField.FieldType.FLOAT32, GyroTauElemNames, null) );
List<String> DerivativeGammaElemNames = new ArrayList<String>();
DerivativeGammaElemNames.add("0");
fields.add( new UAVObjectField("DerivativeGamma", "", UAVObjectField.FieldType.FLOAT32, DerivativeGammaElemNames, null) );
List<String> WeakLevelingKpElemNames = new ArrayList<String>();
WeakLevelingKpElemNames.add("0");
fields.add( new UAVObjectField("WeakLevelingKp", "(deg/s)/deg", UAVObjectField.FieldType.FLOAT32, WeakLevelingKpElemNames, null) );
@ -162,6 +166,10 @@ public class StabilizationSettings extends UAVDataObject {
VbarMaxAngleElemNames.add("0");
fields.add( new UAVObjectField("VbarMaxAngle", "deg", UAVObjectField.FieldType.UINT8, VbarMaxAngleElemNames, null) );
List<String> DerivativeCutoffElemNames = new ArrayList<String>();
DerivativeCutoffElemNames.add("0");
fields.add( new UAVObjectField("DerivativeCutoff", "Hz", UAVObjectField.FieldType.UINT8, DerivativeCutoffElemNames, null) );
List<String> MaxAxisLockElemNames = new ArrayList<String>();
MaxAxisLockElemNames.add("0");
fields.add( new UAVObjectField("MaxAxisLock", "deg", UAVObjectField.FieldType.UINT8, MaxAxisLockElemNames, null) );
@ -263,6 +271,7 @@ public class StabilizationSettings extends UAVDataObject {
getField("VbarYawPI").setValue(0.002,1);
getField("VbarTau").setValue(0.5);
getField("GyroTau").setValue(0.005);
getField("DerivativeGamma").setValue(1);
getField("WeakLevelingKp").setValue(0.1);
getField("RollMax").setValue(55);
getField("PitchMax").setValue(55);
@ -270,6 +279,7 @@ public class StabilizationSettings extends UAVDataObject {
getField("VbarGyroSuppress").setValue(30);
getField("VbarPiroComp").setValue("FALSE");
getField("VbarMaxAngle").setValue(10);
getField("DerivativeCutoff").setValue(20);
getField("MaxAxisLock").setValue(15);
getField("MaxAxisLockRate").setValue(2);
getField("MaxWeakLevelingRate").setValue(5);
@ -302,7 +312,7 @@ public class StabilizationSettings extends UAVDataObject {
}
// Constants
protected static final long OBJID = 0xBBC337D4l;
protected static final long OBJID = 0x3D03DE86l;
protected static final String NAME = "StabilizationSettings";
protected static String DESCRIPTION = "PID settings used by the Stabilization module to combine the @ref AttitudeActual and @ref AttitudeDesired to compute @ref ActuatorDesired";
protected static final boolean ISSINGLEINST = 1 > 0;

View File

@ -71,6 +71,11 @@ public class TaskInfo extends UAVDataObject {
StackRemainingElemNames.add("Com2UsbBridge");
StackRemainingElemNames.add("Usb2ComBridge");
StackRemainingElemNames.add("OveroSync");
StackRemainingElemNames.add("ModemRx");
StackRemainingElemNames.add("ModemTx");
StackRemainingElemNames.add("ModemStat");
StackRemainingElemNames.add("EventDispatcher");
StackRemainingElemNames.add("Autotune");
fields.add( new UAVObjectField("StackRemaining", "bytes", UAVObjectField.FieldType.UINT16, StackRemainingElemNames, null) );
List<String> RunningElemNames = new ArrayList<String>();
@ -93,6 +98,11 @@ public class TaskInfo extends UAVDataObject {
RunningElemNames.add("Com2UsbBridge");
RunningElemNames.add("Usb2ComBridge");
RunningElemNames.add("OveroSync");
RunningElemNames.add("ModemRx");
RunningElemNames.add("ModemTx");
RunningElemNames.add("ModemStat");
RunningElemNames.add("EventDispatcher");
RunningElemNames.add("Autotune");
List<String> RunningEnumOptions = new ArrayList<String>();
RunningEnumOptions.add("False");
RunningEnumOptions.add("True");
@ -118,6 +128,11 @@ public class TaskInfo extends UAVDataObject {
RunningTimeElemNames.add("Com2UsbBridge");
RunningTimeElemNames.add("Usb2ComBridge");
RunningTimeElemNames.add("OveroSync");
RunningTimeElemNames.add("ModemRx");
RunningTimeElemNames.add("ModemTx");
RunningTimeElemNames.add("ModemStat");
RunningTimeElemNames.add("EventDispatcher");
RunningTimeElemNames.add("Autotune");
fields.add( new UAVObjectField("RunningTime", "%", UAVObjectField.FieldType.UINT8, RunningTimeElemNames, null) );
@ -192,7 +207,7 @@ public class TaskInfo extends UAVDataObject {
}
// Constants
protected static final long OBJID = 0xB81CD2AEl;
protected static final long OBJID = 0x21BD254Al;
protected static final String NAME = "TaskInfo";
protected static String DESCRIPTION = "Task information";
protected static final boolean ISSINGLEINST = 1 > 0;

View File

@ -83,6 +83,7 @@ public class UAVObjectsInitialize {
objMngr.registerObject( new ObjectPersistence() );
objMngr.registerObject( new OveroSyncSettings() );
objMngr.registerObject( new OveroSyncStats() );
objMngr.registerObject( new PathAction() );
objMngr.registerObject( new PathDesired() );
objMngr.registerObject( new PathPlannerSettings() );
objMngr.registerObject( new PipXSettings() );
@ -90,6 +91,8 @@ public class UAVObjectsInitialize {
objMngr.registerObject( new PositionActual() );
objMngr.registerObject( new RateDesired() );
objMngr.registerObject( new ReceiverActivity() );
objMngr.registerObject( new RelayTuning() );
objMngr.registerObject( new RelayTuningSettings() );
objMngr.registerObject( new RevoCalibration() );
objMngr.registerObject( new RevoSettings() );
objMngr.registerObject( new SonarAltitude() );