diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/AHRSCalibration.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/AHRSCalibration.java new file mode 100644 index 000000000..a3096ad39 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/AHRSCalibration.java @@ -0,0 +1,243 @@ +/** + ****************************************************************************** + * + * @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. + * Contains the calibration settings for the @ref AHRSCommsModule + * + * @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; + +/** +Contains the calibration settings for the @ref AHRSCommsModule + +generated from ahrscalibration.xml + **/ +public class AHRSCalibration extends UAVDataObject { + + public AHRSCalibration() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List measure_varElemNames = new ArrayList(); + measure_varElemNames.add("0"); + List measure_varEnumOptions = new ArrayList(); + measure_varEnumOptions.add("SET"); + measure_varEnumOptions.add("MEASURE"); + fields.add( new UAVObjectField("measure_var", "", UAVObjectField.FieldType.ENUM, measure_varElemNames, measure_varEnumOptions) ); + + List accel_biasElemNames = new ArrayList(); + accel_biasElemNames.add("X"); + accel_biasElemNames.add("Y"); + accel_biasElemNames.add("Z"); + fields.add( new UAVObjectField("accel_bias", "m/s^2", UAVObjectField.FieldType.FLOAT32, accel_biasElemNames, null) ); + + List accel_scaleElemNames = new ArrayList(); + accel_scaleElemNames.add("X"); + accel_scaleElemNames.add("Y"); + accel_scaleElemNames.add("Z"); + fields.add( new UAVObjectField("accel_scale", "(m/s^2)/lsb", UAVObjectField.FieldType.FLOAT32, accel_scaleElemNames, null) ); + + List accel_varElemNames = new ArrayList(); + accel_varElemNames.add("X"); + accel_varElemNames.add("Y"); + accel_varElemNames.add("Z"); + fields.add( new UAVObjectField("accel_var", "(m/s^2)^2", UAVObjectField.FieldType.FLOAT32, accel_varElemNames, null) ); + + List gyro_biasElemNames = new ArrayList(); + gyro_biasElemNames.add("X"); + gyro_biasElemNames.add("Y"); + gyro_biasElemNames.add("Z"); + fields.add( new UAVObjectField("gyro_bias", "rad/s", UAVObjectField.FieldType.FLOAT32, gyro_biasElemNames, null) ); + + List gyro_scaleElemNames = new ArrayList(); + gyro_scaleElemNames.add("X"); + gyro_scaleElemNames.add("Y"); + gyro_scaleElemNames.add("Z"); + fields.add( new UAVObjectField("gyro_scale", "(rad/s)/lsb", UAVObjectField.FieldType.FLOAT32, gyro_scaleElemNames, null) ); + + List gyro_varElemNames = new ArrayList(); + gyro_varElemNames.add("X"); + gyro_varElemNames.add("Y"); + gyro_varElemNames.add("Z"); + fields.add( new UAVObjectField("gyro_var", "(rad/s)^2", UAVObjectField.FieldType.FLOAT32, gyro_varElemNames, null) ); + + List gyro_tempcompfactorElemNames = new ArrayList(); + gyro_tempcompfactorElemNames.add("X"); + gyro_tempcompfactorElemNames.add("Y"); + gyro_tempcompfactorElemNames.add("Z"); + fields.add( new UAVObjectField("gyro_tempcompfactor", "raw/raw", UAVObjectField.FieldType.FLOAT32, gyro_tempcompfactorElemNames, null) ); + + List mag_biasElemNames = new ArrayList(); + mag_biasElemNames.add("X"); + mag_biasElemNames.add("Y"); + mag_biasElemNames.add("Z"); + fields.add( new UAVObjectField("mag_bias", "mGau", UAVObjectField.FieldType.FLOAT32, mag_biasElemNames, null) ); + + List mag_scaleElemNames = new ArrayList(); + mag_scaleElemNames.add("X"); + mag_scaleElemNames.add("Y"); + mag_scaleElemNames.add("Z"); + fields.add( new UAVObjectField("mag_scale", "(mGau)/lsb", UAVObjectField.FieldType.FLOAT32, mag_scaleElemNames, null) ); + + List mag_varElemNames = new ArrayList(); + mag_varElemNames.add("X"); + mag_varElemNames.add("Y"); + mag_varElemNames.add("Z"); + fields.add( new UAVObjectField("mag_var", "mGau^2", UAVObjectField.FieldType.FLOAT32, mag_varElemNames, null) ); + + List vel_varElemNames = new ArrayList(); + vel_varElemNames.add("0"); + fields.add( new UAVObjectField("vel_var", "(m/s)^2", UAVObjectField.FieldType.FLOAT32, vel_varElemNames, null) ); + + List pos_varElemNames = new ArrayList(); + pos_varElemNames.add("0"); + fields.add( new UAVObjectField("pos_var", "m^2", UAVObjectField.FieldType.FLOAT32, pos_varElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.TRUE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_ONCHANGE; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.TRUE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_ONCHANGE; + metadata.flightTelemetryUpdatePeriod = 0; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_NEVER; + 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("measure_var").setValue(0); + getField("accel_bias").setValue(-73.5,0); + getField("accel_bias").setValue(-73.5,1); + getField("accel_bias").setValue(73.5,2); + getField("accel_scale").setValue(0.0359,0); + getField("accel_scale").setValue(0.0359,1); + getField("accel_scale").setValue(-0.0359,2); + getField("accel_var").setValue(0.0005,0); + getField("accel_var").setValue(0.0005,1); + getField("accel_var").setValue(0.0005,2); + getField("gyro_bias").setValue(23,0); + getField("gyro_bias").setValue(-23,1); + getField("gyro_bias").setValue(23,2); + getField("gyro_scale").setValue(-0.017,0); + getField("gyro_scale").setValue(0.017,1); + getField("gyro_scale").setValue(-0.017,2); + getField("gyro_var").setValue(0.0001,0); + getField("gyro_var").setValue(0.0001,1); + getField("gyro_var").setValue(0.0001,2); + getField("gyro_tempcompfactor").setValue(0,0); + getField("gyro_tempcompfactor").setValue(0,1); + getField("gyro_tempcompfactor").setValue(0,2); + getField("mag_bias").setValue(0,0); + getField("mag_bias").setValue(0,1); + getField("mag_bias").setValue(0,2); + getField("mag_scale").setValue(-2,0); + getField("mag_scale").setValue(-2,1); + getField("mag_scale").setValue(-2,2); + getField("mag_var").setValue(50,0); + getField("mag_var").setValue(50,1); + getField("mag_var").setValue(50,2); + getField("vel_var").setValue(0.4); + getField("pos_var").setValue(0.4); + + } + + /** + * 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(int instID) { + // TODO: Need to get specific instance to clone + try { + AHRSCalibration obj = new AHRSCalibration(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public AHRSCalibration GetInstance(UAVObjectManager objMngr, int instID) + { + return (AHRSCalibration)(objMngr.getObject(AHRSCalibration.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x30101BB2; + protected static final String NAME = "AHRSCalibration"; + protected static String DESCRIPTION = "Contains the calibration settings for the @ref AHRSCommsModule"; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 1 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/AHRSSettings.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/AHRSSettings.java new file mode 100644 index 000000000..a38915c28 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/AHRSSettings.java @@ -0,0 +1,178 @@ +/** + ****************************************************************************** + * + * @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. + * Settings for the @ref AHRSCommsModule to control the algorithm and what is updated + * + * @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; + +/** +Settings for the @ref AHRSCommsModule to control the algorithm and what is updated + +generated from ahrssettings.xml + **/ +public class AHRSSettings extends UAVDataObject { + + public AHRSSettings() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List AlgorithmElemNames = new ArrayList(); + AlgorithmElemNames.add("0"); + List AlgorithmEnumOptions = new ArrayList(); + AlgorithmEnumOptions.add("SIMPLE"); + AlgorithmEnumOptions.add("INSGPS_INDOOR_NOMAG"); + AlgorithmEnumOptions.add("INSGPS_INDOOR"); + AlgorithmEnumOptions.add("INSGPS_OUTDOOR"); + fields.add( new UAVObjectField("Algorithm", "", UAVObjectField.FieldType.ENUM, AlgorithmElemNames, AlgorithmEnumOptions) ); + + List DownsamplingElemNames = new ArrayList(); + DownsamplingElemNames.add("0"); + fields.add( new UAVObjectField("Downsampling", "", UAVObjectField.FieldType.UINT8, DownsamplingElemNames, null) ); + + List UpdatePeriodElemNames = new ArrayList(); + UpdatePeriodElemNames.add("0"); + fields.add( new UAVObjectField("UpdatePeriod", "ms", UAVObjectField.FieldType.UINT8, UpdatePeriodElemNames, null) ); + + List BiasCorrectedRawElemNames = new ArrayList(); + BiasCorrectedRawElemNames.add("0"); + List BiasCorrectedRawEnumOptions = new ArrayList(); + BiasCorrectedRawEnumOptions.add("TRUE"); + BiasCorrectedRawEnumOptions.add("FALSE"); + fields.add( new UAVObjectField("BiasCorrectedRaw", "", UAVObjectField.FieldType.ENUM, BiasCorrectedRawElemNames, BiasCorrectedRawEnumOptions) ); + + List YawBiasElemNames = new ArrayList(); + YawBiasElemNames.add("0"); + fields.add( new UAVObjectField("YawBias", "", UAVObjectField.FieldType.FLOAT32, YawBiasElemNames, null) ); + + List PitchBiasElemNames = new ArrayList(); + PitchBiasElemNames.add("0"); + fields.add( new UAVObjectField("PitchBias", "", UAVObjectField.FieldType.FLOAT32, PitchBiasElemNames, null) ); + + List RollBiasElemNames = new ArrayList(); + RollBiasElemNames.add("0"); + fields.add( new UAVObjectField("RollBias", "", UAVObjectField.FieldType.FLOAT32, RollBiasElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.TRUE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_ONCHANGE; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.TRUE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_ONCHANGE; + metadata.flightTelemetryUpdatePeriod = 0; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_NEVER; + 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("Algorithm").setValue(1); + getField("Downsampling").setValue(20); + getField("UpdatePeriod").setValue(1); + getField("BiasCorrectedRaw").setValue(0); + getField("YawBias").setValue(0); + getField("PitchBias").setValue(0); + getField("RollBias").setValue(0); + + } + + /** + * 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(int instID) { + // TODO: Need to get specific instance to clone + try { + AHRSSettings obj = new AHRSSettings(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public AHRSSettings GetInstance(UAVObjectManager objMngr, int instID) + { + return (AHRSSettings)(objMngr.getObject(AHRSSettings.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0xDEFC5548; + protected static final String NAME = "AHRSSettings"; + protected static String DESCRIPTION = "Settings for the @ref AHRSCommsModule to control the algorithm and what is updated"; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 1 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/ActuatorCommand.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/ActuatorCommand.java new file mode 100644 index 000000000..a5d6230ac --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/ActuatorCommand.java @@ -0,0 +1,158 @@ +/** + ****************************************************************************** + * + * @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. + * Contains the pulse duration sent to each of the channels. Set by @ref ActuatorModule + * + * @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; + +/** +Contains the pulse duration sent to each of the channels. Set by @ref ActuatorModule + +generated from actuatorcommand.xml + **/ +public class ActuatorCommand extends UAVDataObject { + + public ActuatorCommand() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List ChannelElemNames = new ArrayList(); + ChannelElemNames.add("0"); + ChannelElemNames.add("1"); + ChannelElemNames.add("2"); + ChannelElemNames.add("3"); + ChannelElemNames.add("4"); + ChannelElemNames.add("5"); + ChannelElemNames.add("6"); + ChannelElemNames.add("7"); + fields.add( new UAVObjectField("Channel", "us", UAVObjectField.FieldType.INT16, ChannelElemNames, null) ); + + List UpdateTimeElemNames = new ArrayList(); + UpdateTimeElemNames.add("0"); + fields.add( new UAVObjectField("UpdateTime", "ms", UAVObjectField.FieldType.UINT8, UpdateTimeElemNames, null) ); + + List MaxUpdateTimeElemNames = new ArrayList(); + MaxUpdateTimeElemNames.add("0"); + fields.add( new UAVObjectField("MaxUpdateTime", "ms", UAVObjectField.FieldType.UINT16, MaxUpdateTimeElemNames, null) ); + + List NumFailedUpdatesElemNames = new ArrayList(); + NumFailedUpdatesElemNames.add("0"); + fields.add( new UAVObjectField("NumFailedUpdates", "", UAVObjectField.FieldType.UINT8, NumFailedUpdatesElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.FALSE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.FALSE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.flightTelemetryUpdatePeriod = 1000; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_NEVER; + 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(int instID) { + // TODO: Need to get specific instance to clone + try { + ActuatorCommand obj = new ActuatorCommand(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public ActuatorCommand GetInstance(UAVObjectManager objMngr, int instID) + { + return (ActuatorCommand)(objMngr.getObject(ActuatorCommand.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0xE8E077D8; + protected static final String NAME = "ActuatorCommand"; + protected static String DESCRIPTION = "Contains the pulse duration sent to each of the channels. Set by @ref ActuatorModule"; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 0 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/ActuatorDesired.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/ActuatorDesired.java new file mode 100644 index 000000000..b81ca29da --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/ActuatorDesired.java @@ -0,0 +1,159 @@ +/** + ****************************************************************************** + * + * @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. + * Desired raw, pitch and yaw actuator settings. Comes from either @ref StabilizationModule or @ref ManualControlModule depending on FlightMode. + * + * @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; + +/** +Desired raw, pitch and yaw actuator settings. Comes from either @ref StabilizationModule or @ref ManualControlModule depending on FlightMode. + +generated from actuatordesired.xml + **/ +public class ActuatorDesired extends UAVDataObject { + + public ActuatorDesired() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List RollElemNames = new ArrayList(); + RollElemNames.add("0"); + fields.add( new UAVObjectField("Roll", "%", UAVObjectField.FieldType.FLOAT32, RollElemNames, null) ); + + List PitchElemNames = new ArrayList(); + PitchElemNames.add("0"); + fields.add( new UAVObjectField("Pitch", "%", UAVObjectField.FieldType.FLOAT32, PitchElemNames, null) ); + + List YawElemNames = new ArrayList(); + YawElemNames.add("0"); + fields.add( new UAVObjectField("Yaw", "%", UAVObjectField.FieldType.FLOAT32, YawElemNames, null) ); + + List ThrottleElemNames = new ArrayList(); + ThrottleElemNames.add("0"); + fields.add( new UAVObjectField("Throttle", "%", UAVObjectField.FieldType.FLOAT32, ThrottleElemNames, null) ); + + List UpdateTimeElemNames = new ArrayList(); + UpdateTimeElemNames.add("0"); + fields.add( new UAVObjectField("UpdateTime", "ms", UAVObjectField.FieldType.FLOAT32, UpdateTimeElemNames, null) ); + + List NumLongUpdatesElemNames = new ArrayList(); + NumLongUpdatesElemNames.add("0"); + fields.add( new UAVObjectField("NumLongUpdates", "ms", UAVObjectField.FieldType.FLOAT32, NumLongUpdatesElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.FALSE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.FALSE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.flightTelemetryUpdatePeriod = 1000; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_NEVER; + 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(int instID) { + // TODO: Need to get specific instance to clone + try { + ActuatorDesired obj = new ActuatorDesired(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public ActuatorDesired GetInstance(UAVObjectManager objMngr, int instID) + { + return (ActuatorDesired)(objMngr.getObject(ActuatorDesired.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0xD4516782; + protected static final String NAME = "ActuatorDesired"; + protected static String DESCRIPTION = "Desired raw, pitch and yaw actuator settings. Comes from either @ref StabilizationModule or @ref ManualControlModule depending on FlightMode."; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 0 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/ActuatorSettings.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/ActuatorSettings.java new file mode 100644 index 000000000..ebbfaeb17 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/ActuatorSettings.java @@ -0,0 +1,455 @@ +/** + ****************************************************************************** + * + * @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. + * Settings for the @ref ActuatorModule that controls the channel assignments for the mixer based on AircraftType + * + * @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; + +/** +Settings for the @ref ActuatorModule that controls the channel assignments for the mixer based on AircraftType + +generated from actuatorsettings.xml + **/ +public class ActuatorSettings extends UAVDataObject { + + public ActuatorSettings() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List FixedWingRoll1ElemNames = new ArrayList(); + FixedWingRoll1ElemNames.add("0"); + List FixedWingRoll1EnumOptions = new ArrayList(); + FixedWingRoll1EnumOptions.add("Channel1"); + FixedWingRoll1EnumOptions.add("Channel2"); + FixedWingRoll1EnumOptions.add("Channel3"); + FixedWingRoll1EnumOptions.add("Channel4"); + FixedWingRoll1EnumOptions.add("Channel5"); + FixedWingRoll1EnumOptions.add("Channel6"); + FixedWingRoll1EnumOptions.add("Channel7"); + FixedWingRoll1EnumOptions.add("Channel8"); + FixedWingRoll1EnumOptions.add("None"); + fields.add( new UAVObjectField("FixedWingRoll1", "channel", UAVObjectField.FieldType.ENUM, FixedWingRoll1ElemNames, FixedWingRoll1EnumOptions) ); + + List FixedWingRoll2ElemNames = new ArrayList(); + FixedWingRoll2ElemNames.add("0"); + List FixedWingRoll2EnumOptions = new ArrayList(); + FixedWingRoll2EnumOptions.add("Channel1"); + FixedWingRoll2EnumOptions.add("Channel2"); + FixedWingRoll2EnumOptions.add("Channel3"); + FixedWingRoll2EnumOptions.add("Channel4"); + FixedWingRoll2EnumOptions.add("Channel5"); + FixedWingRoll2EnumOptions.add("Channel6"); + FixedWingRoll2EnumOptions.add("Channel7"); + FixedWingRoll2EnumOptions.add("Channel8"); + FixedWingRoll2EnumOptions.add("None"); + fields.add( new UAVObjectField("FixedWingRoll2", "channel", UAVObjectField.FieldType.ENUM, FixedWingRoll2ElemNames, FixedWingRoll2EnumOptions) ); + + List FixedWingPitch1ElemNames = new ArrayList(); + FixedWingPitch1ElemNames.add("0"); + List FixedWingPitch1EnumOptions = new ArrayList(); + FixedWingPitch1EnumOptions.add("Channel1"); + FixedWingPitch1EnumOptions.add("Channel2"); + FixedWingPitch1EnumOptions.add("Channel3"); + FixedWingPitch1EnumOptions.add("Channel4"); + FixedWingPitch1EnumOptions.add("Channel5"); + FixedWingPitch1EnumOptions.add("Channel6"); + FixedWingPitch1EnumOptions.add("Channel7"); + FixedWingPitch1EnumOptions.add("Channel8"); + FixedWingPitch1EnumOptions.add("None"); + fields.add( new UAVObjectField("FixedWingPitch1", "channel", UAVObjectField.FieldType.ENUM, FixedWingPitch1ElemNames, FixedWingPitch1EnumOptions) ); + + List FixedWingPitch2ElemNames = new ArrayList(); + FixedWingPitch2ElemNames.add("0"); + List FixedWingPitch2EnumOptions = new ArrayList(); + FixedWingPitch2EnumOptions.add("Channel1"); + FixedWingPitch2EnumOptions.add("Channel2"); + FixedWingPitch2EnumOptions.add("Channel3"); + FixedWingPitch2EnumOptions.add("Channel4"); + FixedWingPitch2EnumOptions.add("Channel5"); + FixedWingPitch2EnumOptions.add("Channel6"); + FixedWingPitch2EnumOptions.add("Channel7"); + FixedWingPitch2EnumOptions.add("Channel8"); + FixedWingPitch2EnumOptions.add("None"); + fields.add( new UAVObjectField("FixedWingPitch2", "channel", UAVObjectField.FieldType.ENUM, FixedWingPitch2ElemNames, FixedWingPitch2EnumOptions) ); + + List FixedWingYawElemNames = new ArrayList(); + FixedWingYawElemNames.add("0"); + List FixedWingYawEnumOptions = new ArrayList(); + FixedWingYawEnumOptions.add("Channel1"); + FixedWingYawEnumOptions.add("Channel2"); + FixedWingYawEnumOptions.add("Channel3"); + FixedWingYawEnumOptions.add("Channel4"); + FixedWingYawEnumOptions.add("Channel5"); + FixedWingYawEnumOptions.add("Channel6"); + FixedWingYawEnumOptions.add("Channel7"); + FixedWingYawEnumOptions.add("Channel8"); + FixedWingYawEnumOptions.add("None"); + fields.add( new UAVObjectField("FixedWingYaw", "channel", UAVObjectField.FieldType.ENUM, FixedWingYawElemNames, FixedWingYawEnumOptions) ); + + List FixedWingThrottleElemNames = new ArrayList(); + FixedWingThrottleElemNames.add("0"); + List FixedWingThrottleEnumOptions = new ArrayList(); + FixedWingThrottleEnumOptions.add("Channel1"); + FixedWingThrottleEnumOptions.add("Channel2"); + FixedWingThrottleEnumOptions.add("Channel3"); + FixedWingThrottleEnumOptions.add("Channel4"); + FixedWingThrottleEnumOptions.add("Channel5"); + FixedWingThrottleEnumOptions.add("Channel6"); + FixedWingThrottleEnumOptions.add("Channel7"); + FixedWingThrottleEnumOptions.add("Channel8"); + FixedWingThrottleEnumOptions.add("None"); + fields.add( new UAVObjectField("FixedWingThrottle", "channel", UAVObjectField.FieldType.ENUM, FixedWingThrottleElemNames, FixedWingThrottleEnumOptions) ); + + List VTOLMotorNElemNames = new ArrayList(); + VTOLMotorNElemNames.add("0"); + List VTOLMotorNEnumOptions = new ArrayList(); + VTOLMotorNEnumOptions.add("Channel1"); + VTOLMotorNEnumOptions.add("Channel2"); + VTOLMotorNEnumOptions.add("Channel3"); + VTOLMotorNEnumOptions.add("Channel4"); + VTOLMotorNEnumOptions.add("Channel5"); + VTOLMotorNEnumOptions.add("Channel6"); + VTOLMotorNEnumOptions.add("Channel7"); + VTOLMotorNEnumOptions.add("Channel8"); + VTOLMotorNEnumOptions.add("None"); + fields.add( new UAVObjectField("VTOLMotorN", "channel", UAVObjectField.FieldType.ENUM, VTOLMotorNElemNames, VTOLMotorNEnumOptions) ); + + List VTOLMotorNEElemNames = new ArrayList(); + VTOLMotorNEElemNames.add("0"); + List VTOLMotorNEEnumOptions = new ArrayList(); + VTOLMotorNEEnumOptions.add("Channel1"); + VTOLMotorNEEnumOptions.add("Channel2"); + VTOLMotorNEEnumOptions.add("Channel3"); + VTOLMotorNEEnumOptions.add("Channel4"); + VTOLMotorNEEnumOptions.add("Channel5"); + VTOLMotorNEEnumOptions.add("Channel6"); + VTOLMotorNEEnumOptions.add("Channel7"); + VTOLMotorNEEnumOptions.add("Channel8"); + VTOLMotorNEEnumOptions.add("None"); + fields.add( new UAVObjectField("VTOLMotorNE", "channel", UAVObjectField.FieldType.ENUM, VTOLMotorNEElemNames, VTOLMotorNEEnumOptions) ); + + List VTOLMotorEElemNames = new ArrayList(); + VTOLMotorEElemNames.add("0"); + List VTOLMotorEEnumOptions = new ArrayList(); + VTOLMotorEEnumOptions.add("Channel1"); + VTOLMotorEEnumOptions.add("Channel2"); + VTOLMotorEEnumOptions.add("Channel3"); + VTOLMotorEEnumOptions.add("Channel4"); + VTOLMotorEEnumOptions.add("Channel5"); + VTOLMotorEEnumOptions.add("Channel6"); + VTOLMotorEEnumOptions.add("Channel7"); + VTOLMotorEEnumOptions.add("Channel8"); + VTOLMotorEEnumOptions.add("None"); + fields.add( new UAVObjectField("VTOLMotorE", "channel", UAVObjectField.FieldType.ENUM, VTOLMotorEElemNames, VTOLMotorEEnumOptions) ); + + List VTOLMotorSEElemNames = new ArrayList(); + VTOLMotorSEElemNames.add("0"); + List VTOLMotorSEEnumOptions = new ArrayList(); + VTOLMotorSEEnumOptions.add("Channel1"); + VTOLMotorSEEnumOptions.add("Channel2"); + VTOLMotorSEEnumOptions.add("Channel3"); + VTOLMotorSEEnumOptions.add("Channel4"); + VTOLMotorSEEnumOptions.add("Channel5"); + VTOLMotorSEEnumOptions.add("Channel6"); + VTOLMotorSEEnumOptions.add("Channel7"); + VTOLMotorSEEnumOptions.add("Channel8"); + VTOLMotorSEEnumOptions.add("None"); + fields.add( new UAVObjectField("VTOLMotorSE", "channel", UAVObjectField.FieldType.ENUM, VTOLMotorSEElemNames, VTOLMotorSEEnumOptions) ); + + List VTOLMotorSElemNames = new ArrayList(); + VTOLMotorSElemNames.add("0"); + List VTOLMotorSEnumOptions = new ArrayList(); + VTOLMotorSEnumOptions.add("Channel1"); + VTOLMotorSEnumOptions.add("Channel2"); + VTOLMotorSEnumOptions.add("Channel3"); + VTOLMotorSEnumOptions.add("Channel4"); + VTOLMotorSEnumOptions.add("Channel5"); + VTOLMotorSEnumOptions.add("Channel6"); + VTOLMotorSEnumOptions.add("Channel7"); + VTOLMotorSEnumOptions.add("Channel8"); + VTOLMotorSEnumOptions.add("None"); + fields.add( new UAVObjectField("VTOLMotorS", "channel", UAVObjectField.FieldType.ENUM, VTOLMotorSElemNames, VTOLMotorSEnumOptions) ); + + List VTOLMotorSWElemNames = new ArrayList(); + VTOLMotorSWElemNames.add("0"); + List VTOLMotorSWEnumOptions = new ArrayList(); + VTOLMotorSWEnumOptions.add("Channel1"); + VTOLMotorSWEnumOptions.add("Channel2"); + VTOLMotorSWEnumOptions.add("Channel3"); + VTOLMotorSWEnumOptions.add("Channel4"); + VTOLMotorSWEnumOptions.add("Channel5"); + VTOLMotorSWEnumOptions.add("Channel6"); + VTOLMotorSWEnumOptions.add("Channel7"); + VTOLMotorSWEnumOptions.add("Channel8"); + VTOLMotorSWEnumOptions.add("None"); + fields.add( new UAVObjectField("VTOLMotorSW", "channel", UAVObjectField.FieldType.ENUM, VTOLMotorSWElemNames, VTOLMotorSWEnumOptions) ); + + List VTOLMotorWElemNames = new ArrayList(); + VTOLMotorWElemNames.add("0"); + List VTOLMotorWEnumOptions = new ArrayList(); + VTOLMotorWEnumOptions.add("Channel1"); + VTOLMotorWEnumOptions.add("Channel2"); + VTOLMotorWEnumOptions.add("Channel3"); + VTOLMotorWEnumOptions.add("Channel4"); + VTOLMotorWEnumOptions.add("Channel5"); + VTOLMotorWEnumOptions.add("Channel6"); + VTOLMotorWEnumOptions.add("Channel7"); + VTOLMotorWEnumOptions.add("Channel8"); + VTOLMotorWEnumOptions.add("None"); + fields.add( new UAVObjectField("VTOLMotorW", "channel", UAVObjectField.FieldType.ENUM, VTOLMotorWElemNames, VTOLMotorWEnumOptions) ); + + List VTOLMotorNWElemNames = new ArrayList(); + VTOLMotorNWElemNames.add("0"); + List VTOLMotorNWEnumOptions = new ArrayList(); + VTOLMotorNWEnumOptions.add("Channel1"); + VTOLMotorNWEnumOptions.add("Channel2"); + VTOLMotorNWEnumOptions.add("Channel3"); + VTOLMotorNWEnumOptions.add("Channel4"); + VTOLMotorNWEnumOptions.add("Channel5"); + VTOLMotorNWEnumOptions.add("Channel6"); + VTOLMotorNWEnumOptions.add("Channel7"); + VTOLMotorNWEnumOptions.add("Channel8"); + VTOLMotorNWEnumOptions.add("None"); + fields.add( new UAVObjectField("VTOLMotorNW", "channel", UAVObjectField.FieldType.ENUM, VTOLMotorNWElemNames, VTOLMotorNWEnumOptions) ); + + List ChannelUpdateFreqElemNames = new ArrayList(); + ChannelUpdateFreqElemNames.add("0"); + ChannelUpdateFreqElemNames.add("1"); + ChannelUpdateFreqElemNames.add("2"); + ChannelUpdateFreqElemNames.add("3"); + fields.add( new UAVObjectField("ChannelUpdateFreq", "Hz", UAVObjectField.FieldType.UINT16, ChannelUpdateFreqElemNames, null) ); + + List ChannelMaxElemNames = new ArrayList(); + ChannelMaxElemNames.add("0"); + ChannelMaxElemNames.add("1"); + ChannelMaxElemNames.add("2"); + ChannelMaxElemNames.add("3"); + ChannelMaxElemNames.add("4"); + ChannelMaxElemNames.add("5"); + ChannelMaxElemNames.add("6"); + ChannelMaxElemNames.add("7"); + fields.add( new UAVObjectField("ChannelMax", "us", UAVObjectField.FieldType.INT16, ChannelMaxElemNames, null) ); + + List ChannelNeutralElemNames = new ArrayList(); + ChannelNeutralElemNames.add("0"); + ChannelNeutralElemNames.add("1"); + ChannelNeutralElemNames.add("2"); + ChannelNeutralElemNames.add("3"); + ChannelNeutralElemNames.add("4"); + ChannelNeutralElemNames.add("5"); + ChannelNeutralElemNames.add("6"); + ChannelNeutralElemNames.add("7"); + fields.add( new UAVObjectField("ChannelNeutral", "us", UAVObjectField.FieldType.INT16, ChannelNeutralElemNames, null) ); + + List ChannelMinElemNames = new ArrayList(); + ChannelMinElemNames.add("0"); + ChannelMinElemNames.add("1"); + ChannelMinElemNames.add("2"); + ChannelMinElemNames.add("3"); + ChannelMinElemNames.add("4"); + ChannelMinElemNames.add("5"); + ChannelMinElemNames.add("6"); + ChannelMinElemNames.add("7"); + fields.add( new UAVObjectField("ChannelMin", "us", UAVObjectField.FieldType.INT16, ChannelMinElemNames, null) ); + + List ChannelTypeElemNames = new ArrayList(); + ChannelTypeElemNames.add("0"); + ChannelTypeElemNames.add("1"); + ChannelTypeElemNames.add("2"); + ChannelTypeElemNames.add("3"); + ChannelTypeElemNames.add("4"); + ChannelTypeElemNames.add("5"); + ChannelTypeElemNames.add("6"); + ChannelTypeElemNames.add("7"); + List ChannelTypeEnumOptions = new ArrayList(); + ChannelTypeEnumOptions.add("PWM"); + ChannelTypeEnumOptions.add("MK"); + ChannelTypeEnumOptions.add("ASTEC4"); + fields.add( new UAVObjectField("ChannelType", "", UAVObjectField.FieldType.ENUM, ChannelTypeElemNames, ChannelTypeEnumOptions) ); + + List ChannelAddrElemNames = new ArrayList(); + ChannelAddrElemNames.add("0"); + ChannelAddrElemNames.add("1"); + ChannelAddrElemNames.add("2"); + ChannelAddrElemNames.add("3"); + ChannelAddrElemNames.add("4"); + ChannelAddrElemNames.add("5"); + ChannelAddrElemNames.add("6"); + ChannelAddrElemNames.add("7"); + fields.add( new UAVObjectField("ChannelAddr", "", UAVObjectField.FieldType.UINT8, ChannelAddrElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.TRUE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_ONCHANGE; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.TRUE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_ONCHANGE; + metadata.flightTelemetryUpdatePeriod = 0; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_NEVER; + 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("FixedWingRoll1").setValue(8); + getField("FixedWingRoll2").setValue(8); + getField("FixedWingPitch1").setValue(8); + getField("FixedWingPitch2").setValue(8); + getField("FixedWingYaw").setValue(8); + getField("FixedWingThrottle").setValue(8); + getField("VTOLMotorN").setValue(8); + getField("VTOLMotorNE").setValue(8); + getField("VTOLMotorE").setValue(8); + getField("VTOLMotorSE").setValue(8); + getField("VTOLMotorS").setValue(8); + getField("VTOLMotorSW").setValue(8); + getField("VTOLMotorW").setValue(8); + getField("VTOLMotorNW").setValue(8); + getField("ChannelUpdateFreq").setValue(50,0); + getField("ChannelUpdateFreq").setValue(50,1); + getField("ChannelUpdateFreq").setValue(50,2); + getField("ChannelUpdateFreq").setValue(50,3); + getField("ChannelMax").setValue(1000,0); + getField("ChannelMax").setValue(1000,1); + getField("ChannelMax").setValue(1000,2); + getField("ChannelMax").setValue(1000,3); + getField("ChannelMax").setValue(1000,4); + getField("ChannelMax").setValue(1000,5); + getField("ChannelMax").setValue(1000,6); + getField("ChannelMax").setValue(1000,7); + getField("ChannelNeutral").setValue(1000,0); + getField("ChannelNeutral").setValue(1000,1); + getField("ChannelNeutral").setValue(1000,2); + getField("ChannelNeutral").setValue(1000,3); + getField("ChannelNeutral").setValue(1000,4); + getField("ChannelNeutral").setValue(1000,5); + getField("ChannelNeutral").setValue(1000,6); + getField("ChannelNeutral").setValue(1000,7); + getField("ChannelMin").setValue(1000,0); + getField("ChannelMin").setValue(1000,1); + getField("ChannelMin").setValue(1000,2); + getField("ChannelMin").setValue(1000,3); + getField("ChannelMin").setValue(1000,4); + getField("ChannelMin").setValue(1000,5); + getField("ChannelMin").setValue(1000,6); + getField("ChannelMin").setValue(1000,7); + getField("ChannelType").setValue(0,0); + getField("ChannelType").setValue(0,1); + getField("ChannelType").setValue(0,2); + getField("ChannelType").setValue(0,3); + getField("ChannelType").setValue(0,4); + getField("ChannelType").setValue(0,5); + getField("ChannelType").setValue(0,6); + getField("ChannelType").setValue(0,7); + getField("ChannelAddr").setValue(0,0); + getField("ChannelAddr").setValue(1,1); + getField("ChannelAddr").setValue(2,2); + getField("ChannelAddr").setValue(3,3); + getField("ChannelAddr").setValue(4,4); + getField("ChannelAddr").setValue(5,5); + getField("ChannelAddr").setValue(6,6); + getField("ChannelAddr").setValue(7,7); + + } + + /** + * 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(int instID) { + // TODO: Need to get specific instance to clone + try { + ActuatorSettings obj = new ActuatorSettings(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public ActuatorSettings GetInstance(UAVObjectManager objMngr, int instID) + { + return (ActuatorSettings)(objMngr.getObject(ActuatorSettings.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x1BF864C2; + 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 == 1; + protected static final boolean ISSETTINGS = 1 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/AhrsStatus.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/AhrsStatus.java new file mode 100644 index 000000000..3ee8304ae --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/AhrsStatus.java @@ -0,0 +1,201 @@ +/** + ****************************************************************************** + * + * @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. + * Status for the @ref AHRSCommsModule, including communication errors + * + * @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; + +/** +Status for the @ref AHRSCommsModule, including communication errors + +generated from ahrsstatus.xml + **/ +public class AhrsStatus extends UAVDataObject { + + public AhrsStatus() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List SerialNumberElemNames = new ArrayList(); + SerialNumberElemNames.add("0"); + SerialNumberElemNames.add("1"); + SerialNumberElemNames.add("2"); + SerialNumberElemNames.add("3"); + SerialNumberElemNames.add("4"); + SerialNumberElemNames.add("5"); + SerialNumberElemNames.add("6"); + SerialNumberElemNames.add("7"); + fields.add( new UAVObjectField("SerialNumber", "", UAVObjectField.FieldType.UINT8, SerialNumberElemNames, null) ); + + List CPULoadElemNames = new ArrayList(); + CPULoadElemNames.add("0"); + fields.add( new UAVObjectField("CPULoad", "count", UAVObjectField.FieldType.UINT8, CPULoadElemNames, null) ); + + List RunningTimeElemNames = new ArrayList(); + RunningTimeElemNames.add("0"); + fields.add( new UAVObjectField("RunningTime", "ms", UAVObjectField.FieldType.UINT32, RunningTimeElemNames, null) ); + + List IdleTimePerCyleElemNames = new ArrayList(); + IdleTimePerCyleElemNames.add("0"); + fields.add( new UAVObjectField("IdleTimePerCyle", "10x ms", UAVObjectField.FieldType.UINT8, IdleTimePerCyleElemNames, null) ); + + List RunningTimePerCyleElemNames = new ArrayList(); + RunningTimePerCyleElemNames.add("0"); + fields.add( new UAVObjectField("RunningTimePerCyle", "10x ms", UAVObjectField.FieldType.UINT8, RunningTimePerCyleElemNames, null) ); + + List DroppedUpdatesElemNames = new ArrayList(); + DroppedUpdatesElemNames.add("0"); + fields.add( new UAVObjectField("DroppedUpdates", "count", UAVObjectField.FieldType.UINT8, DroppedUpdatesElemNames, null) ); + + List LinkRunningElemNames = new ArrayList(); + LinkRunningElemNames.add("0"); + List LinkRunningEnumOptions = new ArrayList(); + LinkRunningEnumOptions.add("FALSE"); + LinkRunningEnumOptions.add("TRUE"); + fields.add( new UAVObjectField("LinkRunning", "", UAVObjectField.FieldType.ENUM, LinkRunningElemNames, LinkRunningEnumOptions) ); + + List AhrsKickstartsElemNames = new ArrayList(); + AhrsKickstartsElemNames.add("0"); + fields.add( new UAVObjectField("AhrsKickstarts", "count", UAVObjectField.FieldType.UINT8, AhrsKickstartsElemNames, null) ); + + List AhrsCrcErrorsElemNames = new ArrayList(); + AhrsCrcErrorsElemNames.add("0"); + fields.add( new UAVObjectField("AhrsCrcErrors", "count", UAVObjectField.FieldType.UINT8, AhrsCrcErrorsElemNames, null) ); + + List AhrsRetriesElemNames = new ArrayList(); + AhrsRetriesElemNames.add("0"); + fields.add( new UAVObjectField("AhrsRetries", "count", UAVObjectField.FieldType.UINT8, AhrsRetriesElemNames, null) ); + + List AhrsInvalidPacketsElemNames = new ArrayList(); + AhrsInvalidPacketsElemNames.add("0"); + fields.add( new UAVObjectField("AhrsInvalidPackets", "count", UAVObjectField.FieldType.UINT8, AhrsInvalidPacketsElemNames, null) ); + + List OpCrcErrorsElemNames = new ArrayList(); + OpCrcErrorsElemNames.add("0"); + fields.add( new UAVObjectField("OpCrcErrors", "count", UAVObjectField.FieldType.UINT8, OpCrcErrorsElemNames, null) ); + + List OpRetriesElemNames = new ArrayList(); + OpRetriesElemNames.add("0"); + fields.add( new UAVObjectField("OpRetries", "count", UAVObjectField.FieldType.UINT8, OpRetriesElemNames, null) ); + + List OpInvalidPacketsElemNames = new ArrayList(); + OpInvalidPacketsElemNames.add("0"); + fields.add( new UAVObjectField("OpInvalidPackets", "count", UAVObjectField.FieldType.UINT8, OpInvalidPacketsElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.FALSE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.FALSE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.flightTelemetryUpdatePeriod = 1000; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + 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(int instID) { + // TODO: Need to get specific instance to clone + try { + AhrsStatus obj = new AhrsStatus(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public AhrsStatus GetInstance(UAVObjectManager objMngr, int instID) + { + return (AhrsStatus)(objMngr.getObject(AhrsStatus.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x37A5F7A2; + protected static final String NAME = "AhrsStatus"; + protected static String DESCRIPTION = "Status for the @ref AHRSCommsModule, including communication errors"; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 0 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/AttitudeActual.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/AttitudeActual.java new file mode 100644 index 000000000..714c18571 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/AttitudeActual.java @@ -0,0 +1,163 @@ +/** + ****************************************************************************** + * + * @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 updated Attitude estimation from @ref AHRSCommsModule. + * + * @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 updated Attitude estimation from @ref AHRSCommsModule. + +generated from attitudeactual.xml + **/ +public class AttitudeActual extends UAVDataObject { + + public AttitudeActual() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List q1ElemNames = new ArrayList(); + q1ElemNames.add("0"); + fields.add( new UAVObjectField("q1", "", UAVObjectField.FieldType.FLOAT32, q1ElemNames, null) ); + + List q2ElemNames = new ArrayList(); + q2ElemNames.add("0"); + fields.add( new UAVObjectField("q2", "", UAVObjectField.FieldType.FLOAT32, q2ElemNames, null) ); + + List q3ElemNames = new ArrayList(); + q3ElemNames.add("0"); + fields.add( new UAVObjectField("q3", "", UAVObjectField.FieldType.FLOAT32, q3ElemNames, null) ); + + List q4ElemNames = new ArrayList(); + q4ElemNames.add("0"); + fields.add( new UAVObjectField("q4", "", UAVObjectField.FieldType.FLOAT32, q4ElemNames, null) ); + + List RollElemNames = new ArrayList(); + RollElemNames.add("0"); + fields.add( new UAVObjectField("Roll", "degrees", UAVObjectField.FieldType.FLOAT32, RollElemNames, null) ); + + List PitchElemNames = new ArrayList(); + PitchElemNames.add("0"); + fields.add( new UAVObjectField("Pitch", "degrees", UAVObjectField.FieldType.FLOAT32, PitchElemNames, null) ); + + List YawElemNames = new ArrayList(); + YawElemNames.add("0"); + fields.add( new UAVObjectField("Yaw", "degrees", UAVObjectField.FieldType.FLOAT32, YawElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.FALSE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.FALSE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.flightTelemetryUpdatePeriod = 500; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_NEVER; + 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(int instID) { + // TODO: Need to get specific instance to clone + try { + AttitudeActual obj = new AttitudeActual(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public AttitudeActual GetInstance(UAVObjectManager objMngr, int instID) + { + return (AttitudeActual)(objMngr.getObject(AttitudeActual.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0xFC5B8CF4; + protected static final String NAME = "AttitudeActual"; + protected static String DESCRIPTION = "The updated Attitude estimation from @ref AHRSCommsModule."; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 0 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/AttitudeRaw.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/AttitudeRaw.java new file mode 100644 index 000000000..d28302b6a --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/AttitudeRaw.java @@ -0,0 +1,158 @@ +/** + ****************************************************************************** + * + * @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 raw attitude sensor data from @ref AHRSCommsModule. Not always updated. + * + * @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 raw attitude sensor data from @ref AHRSCommsModule. Not always updated. + +generated from attituderaw.xml + **/ +public class AttitudeRaw extends UAVDataObject { + + public AttitudeRaw() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List magnetometersElemNames = new ArrayList(); + magnetometersElemNames.add("X"); + magnetometersElemNames.add("Y"); + magnetometersElemNames.add("Z"); + fields.add( new UAVObjectField("magnetometers", "mGa", UAVObjectField.FieldType.INT16, magnetometersElemNames, null) ); + + List gyrosElemNames = new ArrayList(); + gyrosElemNames.add("X"); + gyrosElemNames.add("Y"); + gyrosElemNames.add("Z"); + fields.add( new UAVObjectField("gyros", "deg/s", UAVObjectField.FieldType.FLOAT32, gyrosElemNames, null) ); + + List gyrotempElemNames = new ArrayList(); + gyrotempElemNames.add("XY"); + gyrotempElemNames.add("Z"); + fields.add( new UAVObjectField("gyrotemp", "raw", UAVObjectField.FieldType.UINT16, gyrotempElemNames, null) ); + + List accelsElemNames = new ArrayList(); + accelsElemNames.add("X"); + accelsElemNames.add("Y"); + accelsElemNames.add("Z"); + fields.add( new UAVObjectField("accels", "m/s^2", UAVObjectField.FieldType.FLOAT32, accelsElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.FALSE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.FALSE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.flightTelemetryUpdatePeriod = 1000; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_NEVER; + 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(int instID) { + // TODO: Need to get specific instance to clone + try { + AttitudeRaw obj = new AttitudeRaw(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public AttitudeRaw GetInstance(UAVObjectManager objMngr, int instID) + { + return (AttitudeRaw)(objMngr.getObject(AttitudeRaw.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x37747DE6; + protected static final String NAME = "AttitudeRaw"; + protected static String DESCRIPTION = "The raw attitude sensor data from @ref AHRSCommsModule. Not always updated."; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 0 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/AttitudeSettings.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/AttitudeSettings.java new file mode 100644 index 000000000..482fc12ce --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/AttitudeSettings.java @@ -0,0 +1,159 @@ +/** + ****************************************************************************** + * + * @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. + * Settings for the @ref Attitude module used on CopterControl + * + * @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; + +/** +Settings for the @ref Attitude module used on CopterControl + +generated from attitudesettings.xml + **/ +public class AttitudeSettings extends UAVDataObject { + + public AttitudeSettings() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List AccelBiasElemNames = new ArrayList(); + AccelBiasElemNames.add("X"); + AccelBiasElemNames.add("Y"); + AccelBiasElemNames.add("Z"); + fields.add( new UAVObjectField("AccelBias", "lsb", UAVObjectField.FieldType.INT16, AccelBiasElemNames, null) ); + + List GyroGainElemNames = new ArrayList(); + GyroGainElemNames.add("0"); + fields.add( new UAVObjectField("GyroGain", "(rad/s)/lsb", UAVObjectField.FieldType.FLOAT32, GyroGainElemNames, null) ); + + List AccelKpElemNames = new ArrayList(); + AccelKpElemNames.add("0"); + fields.add( new UAVObjectField("AccelKp", "channel", UAVObjectField.FieldType.FLOAT32, AccelKpElemNames, null) ); + + List AccelKiElemNames = new ArrayList(); + AccelKiElemNames.add("0"); + fields.add( new UAVObjectField("AccelKi", "channel", UAVObjectField.FieldType.FLOAT32, AccelKiElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.TRUE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_ONCHANGE; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.TRUE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_ONCHANGE; + metadata.flightTelemetryUpdatePeriod = 0; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_NEVER; + 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("AccelBias").setValue(0,0); + getField("AccelBias").setValue(0,1); + getField("AccelBias").setValue(0,2); + getField("GyroGain").setValue(0.42); + getField("AccelKp").setValue(0.01); + getField("AccelKi").setValue(0.0001); + + } + + /** + * 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(int instID) { + // TODO: Need to get specific instance to clone + try { + AttitudeSettings obj = new AttitudeSettings(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public AttitudeSettings GetInstance(UAVObjectManager objMngr, int instID) + { + return (AttitudeSettings)(objMngr.getObject(AttitudeSettings.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x327BF29A; + protected static final String NAME = "AttitudeSettings"; + protected static String DESCRIPTION = "Settings for the @ref Attitude module used on CopterControl"; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 1 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/BaroAltitude.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/BaroAltitude.java new file mode 100644 index 000000000..a2c2c7e3d --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/BaroAltitude.java @@ -0,0 +1,147 @@ +/** + ****************************************************************************** + * + * @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 raw data from the barometric sensor with pressure, temperature and altitude estimate. + * + * @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 raw data from the barometric sensor with pressure, temperature and altitude estimate. + +generated from baroaltitude.xml + **/ +public class BaroAltitude extends UAVDataObject { + + public BaroAltitude() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List AltitudeElemNames = new ArrayList(); + AltitudeElemNames.add("0"); + fields.add( new UAVObjectField("Altitude", "m", UAVObjectField.FieldType.FLOAT32, AltitudeElemNames, null) ); + + List TemperatureElemNames = new ArrayList(); + TemperatureElemNames.add("0"); + fields.add( new UAVObjectField("Temperature", "C", UAVObjectField.FieldType.FLOAT32, TemperatureElemNames, null) ); + + List PressureElemNames = new ArrayList(); + PressureElemNames.add("0"); + fields.add( new UAVObjectField("Pressure", "kPa", UAVObjectField.FieldType.FLOAT32, PressureElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.FALSE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.FALSE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.flightTelemetryUpdatePeriod = 1000; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_NEVER; + 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(int instID) { + // TODO: Need to get specific instance to clone + try { + BaroAltitude obj = new BaroAltitude(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public BaroAltitude GetInstance(UAVObjectManager objMngr, int instID) + { + return (BaroAltitude)(objMngr.getObject(BaroAltitude.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0xED4424F6; + protected static final String NAME = "BaroAltitude"; + protected static String DESCRIPTION = "The raw data from the barometric sensor with pressure, temperature and altitude estimate."; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 0 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/BatterySettings.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/BatterySettings.java new file mode 100644 index 000000000..19e477b62 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/BatterySettings.java @@ -0,0 +1,163 @@ +/** + ****************************************************************************** + * + * @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. + * Battery configuration information. + * + * @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; + +/** +Battery configuration information. + +generated from batterysettings.xml + **/ +public class BatterySettings extends UAVDataObject { + + public BatterySettings() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List BatteryVoltageElemNames = new ArrayList(); + BatteryVoltageElemNames.add("0"); + fields.add( new UAVObjectField("BatteryVoltage", "V", UAVObjectField.FieldType.FLOAT32, BatteryVoltageElemNames, null) ); + + List BatteryCapacityElemNames = new ArrayList(); + BatteryCapacityElemNames.add("0"); + fields.add( new UAVObjectField("BatteryCapacity", "mAh", UAVObjectField.FieldType.UINT32, BatteryCapacityElemNames, null) ); + + List BatteryTypeElemNames = new ArrayList(); + BatteryTypeElemNames.add("0"); + List BatteryTypeEnumOptions = new ArrayList(); + BatteryTypeEnumOptions.add("LiPo"); + BatteryTypeEnumOptions.add("A123"); + BatteryTypeEnumOptions.add("LiCo"); + BatteryTypeEnumOptions.add("LiFeSO4"); + BatteryTypeEnumOptions.add("None"); + fields.add( new UAVObjectField("BatteryType", "", UAVObjectField.FieldType.ENUM, BatteryTypeElemNames, BatteryTypeEnumOptions) ); + + List CalibrationsElemNames = new ArrayList(); + CalibrationsElemNames.add("Voltage"); + CalibrationsElemNames.add("Current"); + fields.add( new UAVObjectField("Calibrations", "", UAVObjectField.FieldType.FLOAT32, CalibrationsElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.TRUE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_ONCHANGE; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.TRUE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_ONCHANGE; + metadata.flightTelemetryUpdatePeriod = 0; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_NEVER; + 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("BatteryVoltage").setValue(11.1); + getField("BatteryCapacity").setValue(2200); + getField("BatteryType").setValue(0); + getField("Calibrations").setValue(1,0); + getField("Calibrations").setValue(1,1); + + } + + /** + * 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(int instID) { + // TODO: Need to get specific instance to clone + try { + BatterySettings obj = new BatterySettings(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public BatterySettings GetInstance(UAVObjectManager objMngr, int instID) + { + return (BatterySettings)(objMngr.getObject(BatterySettings.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0xA5FF1D9A; + protected static final String NAME = "BatterySettings"; + protected static String DESCRIPTION = "Battery configuration information."; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 1 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/FirmwareIAPObj.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/FirmwareIAPObj.java new file mode 100644 index 000000000..493d6cd64 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/FirmwareIAPObj.java @@ -0,0 +1,258 @@ +/** + ****************************************************************************** + * + * @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. + * Firmware IAP + * + * @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; + +/** +Firmware IAP + +generated from firmwareiapobj.xml + **/ +public class FirmwareIAPObj extends UAVDataObject { + + public FirmwareIAPObj() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List CommandElemNames = new ArrayList(); + CommandElemNames.add("0"); + fields.add( new UAVObjectField("Command", "", UAVObjectField.FieldType.UINT16, CommandElemNames, null) ); + + List DescriptionElemNames = new ArrayList(); + DescriptionElemNames.add("0"); + DescriptionElemNames.add("1"); + DescriptionElemNames.add("2"); + DescriptionElemNames.add("3"); + DescriptionElemNames.add("4"); + DescriptionElemNames.add("5"); + DescriptionElemNames.add("6"); + DescriptionElemNames.add("7"); + DescriptionElemNames.add("8"); + DescriptionElemNames.add("9"); + DescriptionElemNames.add("10"); + DescriptionElemNames.add("11"); + DescriptionElemNames.add("12"); + DescriptionElemNames.add("13"); + DescriptionElemNames.add("14"); + DescriptionElemNames.add("15"); + DescriptionElemNames.add("16"); + DescriptionElemNames.add("17"); + DescriptionElemNames.add("18"); + DescriptionElemNames.add("19"); + DescriptionElemNames.add("20"); + DescriptionElemNames.add("21"); + DescriptionElemNames.add("22"); + DescriptionElemNames.add("23"); + DescriptionElemNames.add("24"); + DescriptionElemNames.add("25"); + DescriptionElemNames.add("26"); + DescriptionElemNames.add("27"); + DescriptionElemNames.add("28"); + DescriptionElemNames.add("29"); + DescriptionElemNames.add("30"); + DescriptionElemNames.add("31"); + DescriptionElemNames.add("32"); + DescriptionElemNames.add("33"); + DescriptionElemNames.add("34"); + DescriptionElemNames.add("35"); + DescriptionElemNames.add("36"); + DescriptionElemNames.add("37"); + DescriptionElemNames.add("38"); + DescriptionElemNames.add("39"); + DescriptionElemNames.add("40"); + DescriptionElemNames.add("41"); + DescriptionElemNames.add("42"); + DescriptionElemNames.add("43"); + DescriptionElemNames.add("44"); + DescriptionElemNames.add("45"); + DescriptionElemNames.add("46"); + DescriptionElemNames.add("47"); + DescriptionElemNames.add("48"); + DescriptionElemNames.add("49"); + DescriptionElemNames.add("50"); + DescriptionElemNames.add("51"); + DescriptionElemNames.add("52"); + DescriptionElemNames.add("53"); + DescriptionElemNames.add("54"); + DescriptionElemNames.add("55"); + DescriptionElemNames.add("56"); + DescriptionElemNames.add("57"); + DescriptionElemNames.add("58"); + DescriptionElemNames.add("59"); + DescriptionElemNames.add("60"); + DescriptionElemNames.add("61"); + DescriptionElemNames.add("62"); + DescriptionElemNames.add("63"); + DescriptionElemNames.add("64"); + DescriptionElemNames.add("65"); + DescriptionElemNames.add("66"); + DescriptionElemNames.add("67"); + DescriptionElemNames.add("68"); + DescriptionElemNames.add("69"); + DescriptionElemNames.add("70"); + DescriptionElemNames.add("71"); + DescriptionElemNames.add("72"); + DescriptionElemNames.add("73"); + DescriptionElemNames.add("74"); + DescriptionElemNames.add("75"); + DescriptionElemNames.add("76"); + DescriptionElemNames.add("77"); + DescriptionElemNames.add("78"); + DescriptionElemNames.add("79"); + DescriptionElemNames.add("80"); + DescriptionElemNames.add("81"); + DescriptionElemNames.add("82"); + DescriptionElemNames.add("83"); + DescriptionElemNames.add("84"); + DescriptionElemNames.add("85"); + DescriptionElemNames.add("86"); + DescriptionElemNames.add("87"); + DescriptionElemNames.add("88"); + DescriptionElemNames.add("89"); + DescriptionElemNames.add("90"); + DescriptionElemNames.add("91"); + DescriptionElemNames.add("92"); + DescriptionElemNames.add("93"); + DescriptionElemNames.add("94"); + DescriptionElemNames.add("95"); + DescriptionElemNames.add("96"); + DescriptionElemNames.add("97"); + DescriptionElemNames.add("98"); + DescriptionElemNames.add("99"); + fields.add( new UAVObjectField("Description", "", UAVObjectField.FieldType.UINT8, DescriptionElemNames, null) ); + + List BoardRevisionElemNames = new ArrayList(); + BoardRevisionElemNames.add("0"); + fields.add( new UAVObjectField("BoardRevision", "", UAVObjectField.FieldType.UINT16, BoardRevisionElemNames, null) ); + + List BoardTypeElemNames = new ArrayList(); + BoardTypeElemNames.add("0"); + fields.add( new UAVObjectField("BoardType", "", UAVObjectField.FieldType.UINT8, BoardTypeElemNames, null) ); + + List ArmResetElemNames = new ArrayList(); + ArmResetElemNames.add("0"); + fields.add( new UAVObjectField("ArmReset", "", UAVObjectField.FieldType.UINT8, ArmResetElemNames, null) ); + + List crcElemNames = new ArrayList(); + crcElemNames.add("0"); + fields.add( new UAVObjectField("crc", "", UAVObjectField.FieldType.UINT32, crcElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.TRUE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.TRUE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.flightTelemetryUpdatePeriod = 0; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_NEVER; + 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(int instID) { + // TODO: Need to get specific instance to clone + try { + FirmwareIAPObj obj = new FirmwareIAPObj(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public FirmwareIAPObj GetInstance(UAVObjectManager objMngr, int instID) + { + return (FirmwareIAPObj)(objMngr.getObject(FirmwareIAPObj.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x1A8ECC2; + protected static final String NAME = "FirmwareIAPObj"; + protected static String DESCRIPTION = "Firmware IAP"; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 0 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/FlightBatteryState.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/FlightBatteryState.java new file mode 100644 index 000000000..d9fba1de5 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/FlightBatteryState.java @@ -0,0 +1,165 @@ +/** + ****************************************************************************** + * + * @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. + * Battery status information. + * + * @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; + +/** +Battery status information. + +generated from flightbatterystate.xml + **/ +public class FlightBatteryState extends UAVDataObject { + + public FlightBatteryState() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List VoltageElemNames = new ArrayList(); + VoltageElemNames.add("0"); + fields.add( new UAVObjectField("Voltage", "V", UAVObjectField.FieldType.FLOAT32, VoltageElemNames, null) ); + + List CurrentElemNames = new ArrayList(); + CurrentElemNames.add("0"); + fields.add( new UAVObjectField("Current", "A", UAVObjectField.FieldType.FLOAT32, CurrentElemNames, null) ); + + List PeakCurrentElemNames = new ArrayList(); + PeakCurrentElemNames.add("0"); + fields.add( new UAVObjectField("PeakCurrent", "A", UAVObjectField.FieldType.FLOAT32, PeakCurrentElemNames, null) ); + + List AvgCurrentElemNames = new ArrayList(); + AvgCurrentElemNames.add("0"); + fields.add( new UAVObjectField("AvgCurrent", "A", UAVObjectField.FieldType.FLOAT32, AvgCurrentElemNames, null) ); + + List ConsumedEnergyElemNames = new ArrayList(); + ConsumedEnergyElemNames.add("0"); + fields.add( new UAVObjectField("ConsumedEnergy", "mAh", UAVObjectField.FieldType.FLOAT32, ConsumedEnergyElemNames, null) ); + + List EstimatedFlightTimeElemNames = new ArrayList(); + EstimatedFlightTimeElemNames.add("0"); + fields.add( new UAVObjectField("EstimatedFlightTime", "sec", UAVObjectField.FieldType.FLOAT32, EstimatedFlightTimeElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READONLY; + metadata.gcsTelemetryAcked = UAVObject.Acked.FALSE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.FALSE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.flightTelemetryUpdatePeriod = 1000; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_NEVER; + 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("Voltage").setValue(0); + getField("Current").setValue(0); + getField("PeakCurrent").setValue(0); + getField("AvgCurrent").setValue(0); + getField("ConsumedEnergy").setValue(0); + getField("EstimatedFlightTime").setValue(0); + + } + + /** + * 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(int instID) { + // TODO: Need to get specific instance to clone + try { + FlightBatteryState obj = new FlightBatteryState(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public FlightBatteryState GetInstance(UAVObjectManager objMngr, int instID) + { + return (FlightBatteryState)(objMngr.getObject(FlightBatteryState.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x791A50E; + protected static final String NAME = "FlightBatteryState"; + protected static String DESCRIPTION = "Battery status information."; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 0 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/FlightPlanControl.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/FlightPlanControl.java new file mode 100644 index 000000000..2e453eda5 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/FlightPlanControl.java @@ -0,0 +1,144 @@ +/** + ****************************************************************************** + * + * @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. + * Control the flight plan script + * + * @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; + +/** +Control the flight plan script + +generated from flightplancontrol.xml + **/ +public class FlightPlanControl extends UAVDataObject { + + public FlightPlanControl() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List CommandElemNames = new ArrayList(); + CommandElemNames.add("0"); + List CommandEnumOptions = new ArrayList(); + CommandEnumOptions.add("Start"); + CommandEnumOptions.add("Stop"); + CommandEnumOptions.add("Kill"); + fields.add( new UAVObjectField("Command", "", UAVObjectField.FieldType.ENUM, CommandElemNames, CommandEnumOptions) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.TRUE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.TRUE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.flightTelemetryUpdatePeriod = 0; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_NEVER; + 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("Command").setValue(0); + + } + + /** + * 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(int instID) { + // TODO: Need to get specific instance to clone + try { + FlightPlanControl obj = new FlightPlanControl(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public FlightPlanControl GetInstance(UAVObjectManager objMngr, int instID) + { + return (FlightPlanControl)(objMngr.getObject(FlightPlanControl.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x6B4FE6DA; + protected static final String NAME = "FlightPlanControl"; + protected static String DESCRIPTION = "Control the flight plan script"; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 0 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/FlightPlanSettings.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/FlightPlanSettings.java new file mode 100644 index 000000000..383e4aff0 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/FlightPlanSettings.java @@ -0,0 +1,140 @@ +/** + ****************************************************************************** + * + * @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. + * Settings for the flight plan module, control the execution of the script + * + * @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; + +/** +Settings for the flight plan module, control the execution of the script + +generated from flightplansettings.xml + **/ +public class FlightPlanSettings extends UAVDataObject { + + public FlightPlanSettings() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List TestElemNames = new ArrayList(); + TestElemNames.add("0"); + fields.add( new UAVObjectField("Test", "", UAVObjectField.FieldType.FLOAT32, TestElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.TRUE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_ONCHANGE; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.TRUE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_ONCHANGE; + metadata.flightTelemetryUpdatePeriod = 0; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_NEVER; + 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("Test").setValue(0); + + } + + /** + * 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(int instID) { + // TODO: Need to get specific instance to clone + try { + FlightPlanSettings obj = new FlightPlanSettings(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public FlightPlanSettings GetInstance(UAVObjectManager objMngr, int instID) + { + return (FlightPlanSettings)(objMngr.getObject(FlightPlanSettings.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x85368422; + protected static final String NAME = "FlightPlanSettings"; + protected static String DESCRIPTION = "Settings for the flight plan module, control the execution of the script"; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 1 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/FlightPlanStatus.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/FlightPlanStatus.java new file mode 100644 index 000000000..00920553c --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/FlightPlanStatus.java @@ -0,0 +1,187 @@ +/** + ****************************************************************************** + * + * @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. + * Status of the flight plan script + * + * @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; + +/** +Status of the flight plan script + +generated from flightplanstatus.xml + **/ +public class FlightPlanStatus extends UAVDataObject { + + public FlightPlanStatus() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List StatusElemNames = new ArrayList(); + StatusElemNames.add("0"); + List StatusEnumOptions = new ArrayList(); + StatusEnumOptions.add("Stopped"); + StatusEnumOptions.add("Running"); + StatusEnumOptions.add("Error"); + fields.add( new UAVObjectField("Status", "", UAVObjectField.FieldType.ENUM, StatusElemNames, StatusEnumOptions) ); + + List ErrorTypeElemNames = new ArrayList(); + ErrorTypeElemNames.add("0"); + List ErrorTypeEnumOptions = new ArrayList(); + ErrorTypeEnumOptions.add("None"); + ErrorTypeEnumOptions.add("VMInitError"); + ErrorTypeEnumOptions.add("Exception"); + ErrorTypeEnumOptions.add("IOError"); + ErrorTypeEnumOptions.add("DivByZero"); + ErrorTypeEnumOptions.add("AssertError"); + ErrorTypeEnumOptions.add("AttributeError"); + ErrorTypeEnumOptions.add("ImportError"); + ErrorTypeEnumOptions.add("IndexError"); + ErrorTypeEnumOptions.add("KeyError"); + ErrorTypeEnumOptions.add("MemoryError"); + ErrorTypeEnumOptions.add("NameError"); + ErrorTypeEnumOptions.add("SyntaxError"); + ErrorTypeEnumOptions.add("SystemError"); + ErrorTypeEnumOptions.add("TypeError"); + ErrorTypeEnumOptions.add("ValueError"); + ErrorTypeEnumOptions.add("StopIteration"); + ErrorTypeEnumOptions.add("Warning"); + ErrorTypeEnumOptions.add("UnknownError"); + fields.add( new UAVObjectField("ErrorType", "", UAVObjectField.FieldType.ENUM, ErrorTypeElemNames, ErrorTypeEnumOptions) ); + + List ErrorFileIDElemNames = new ArrayList(); + ErrorFileIDElemNames.add("0"); + fields.add( new UAVObjectField("ErrorFileID", "", UAVObjectField.FieldType.UINT32, ErrorFileIDElemNames, null) ); + + List ErrorLineNumElemNames = new ArrayList(); + ErrorLineNumElemNames.add("0"); + fields.add( new UAVObjectField("ErrorLineNum", "", UAVObjectField.FieldType.UINT32, ErrorLineNumElemNames, null) ); + + List Debug1ElemNames = new ArrayList(); + Debug1ElemNames.add("0"); + fields.add( new UAVObjectField("Debug1", "", UAVObjectField.FieldType.FLOAT32, Debug1ElemNames, null) ); + + List Debug2ElemNames = new ArrayList(); + Debug2ElemNames.add("0"); + fields.add( new UAVObjectField("Debug2", "", UAVObjectField.FieldType.FLOAT32, Debug2ElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.FALSE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.FALSE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.flightTelemetryUpdatePeriod = 2000; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_NEVER; + 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("Status").setValue(0); + getField("ErrorType").setValue(0); + getField("Debug1").setValue(0); + getField("Debug2").setValue(0); + + } + + /** + * 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(int instID) { + // TODO: Need to get specific instance to clone + try { + FlightPlanStatus obj = new FlightPlanStatus(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public FlightPlanStatus GetInstance(UAVObjectManager objMngr, int instID) + { + return (FlightPlanStatus)(objMngr.getObject(FlightPlanStatus.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x9FC14812; + protected static final String NAME = "FlightPlanStatus"; + protected static String DESCRIPTION = "Status of the flight plan script"; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 0 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/FlightTelemetryStats.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/FlightTelemetryStats.java new file mode 100644 index 000000000..b58fe6d46 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/FlightTelemetryStats.java @@ -0,0 +1,164 @@ +/** + ****************************************************************************** + * + * @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. + * Maintains the telemetry statistics from the OpenPilot flight computer. + * + * @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; + +/** +Maintains the telemetry statistics from the OpenPilot flight computer. + +generated from flighttelemetrystats.xml + **/ +public class FlightTelemetryStats extends UAVDataObject { + + public FlightTelemetryStats() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List StatusElemNames = new ArrayList(); + StatusElemNames.add("0"); + List StatusEnumOptions = new ArrayList(); + StatusEnumOptions.add("Disconnected"); + StatusEnumOptions.add("HandshakeReq"); + StatusEnumOptions.add("HandshakeAck"); + StatusEnumOptions.add("Connected"); + fields.add( new UAVObjectField("Status", "", UAVObjectField.FieldType.ENUM, StatusElemNames, StatusEnumOptions) ); + + List TxDataRateElemNames = new ArrayList(); + TxDataRateElemNames.add("0"); + fields.add( new UAVObjectField("TxDataRate", "bytes/sec", UAVObjectField.FieldType.FLOAT32, TxDataRateElemNames, null) ); + + List RxDataRateElemNames = new ArrayList(); + RxDataRateElemNames.add("0"); + fields.add( new UAVObjectField("RxDataRate", "bytes/sec", UAVObjectField.FieldType.FLOAT32, RxDataRateElemNames, null) ); + + List TxFailuresElemNames = new ArrayList(); + TxFailuresElemNames.add("0"); + fields.add( new UAVObjectField("TxFailures", "count", UAVObjectField.FieldType.UINT32, TxFailuresElemNames, null) ); + + List RxFailuresElemNames = new ArrayList(); + RxFailuresElemNames.add("0"); + fields.add( new UAVObjectField("RxFailures", "count", UAVObjectField.FieldType.UINT32, RxFailuresElemNames, null) ); + + List TxRetriesElemNames = new ArrayList(); + TxRetriesElemNames.add("0"); + fields.add( new UAVObjectField("TxRetries", "count", UAVObjectField.FieldType.UINT32, TxRetriesElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.TRUE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.TRUE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.flightTelemetryUpdatePeriod = 5000; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.loggingUpdatePeriod = 5000; + 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(int instID) { + // TODO: Need to get specific instance to clone + try { + FlightTelemetryStats obj = new FlightTelemetryStats(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public FlightTelemetryStats GetInstance(UAVObjectManager objMngr, int instID) + { + return (FlightTelemetryStats)(objMngr.getObject(FlightTelemetryStats.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x660C265E; + protected static final String NAME = "FlightTelemetryStats"; + protected static String DESCRIPTION = "Maintains the telemetry statistics from the OpenPilot flight computer."; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 0 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/GCSTelemetryStats.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/GCSTelemetryStats.java new file mode 100644 index 000000000..0f304d45d --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/GCSTelemetryStats.java @@ -0,0 +1,164 @@ +/** + ****************************************************************************** + * + * @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 telemetry statistics from the ground computer + * + * @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 telemetry statistics from the ground computer + +generated from gcstelemetrystats.xml + **/ +public class GCSTelemetryStats extends UAVDataObject { + + public GCSTelemetryStats() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List StatusElemNames = new ArrayList(); + StatusElemNames.add("0"); + List StatusEnumOptions = new ArrayList(); + StatusEnumOptions.add("Disconnected"); + StatusEnumOptions.add("HandshakeReq"); + StatusEnumOptions.add("HandshakeAck"); + StatusEnumOptions.add("Connected"); + fields.add( new UAVObjectField("Status", "", UAVObjectField.FieldType.ENUM, StatusElemNames, StatusEnumOptions) ); + + List TxDataRateElemNames = new ArrayList(); + TxDataRateElemNames.add("0"); + fields.add( new UAVObjectField("TxDataRate", "bytes/sec", UAVObjectField.FieldType.FLOAT32, TxDataRateElemNames, null) ); + + List RxDataRateElemNames = new ArrayList(); + RxDataRateElemNames.add("0"); + fields.add( new UAVObjectField("RxDataRate", "bytes/sec", UAVObjectField.FieldType.FLOAT32, RxDataRateElemNames, null) ); + + List TxFailuresElemNames = new ArrayList(); + TxFailuresElemNames.add("0"); + fields.add( new UAVObjectField("TxFailures", "count", UAVObjectField.FieldType.UINT32, TxFailuresElemNames, null) ); + + List RxFailuresElemNames = new ArrayList(); + RxFailuresElemNames.add("0"); + fields.add( new UAVObjectField("RxFailures", "count", UAVObjectField.FieldType.UINT32, RxFailuresElemNames, null) ); + + List TxRetriesElemNames = new ArrayList(); + TxRetriesElemNames.add("0"); + fields.add( new UAVObjectField("TxRetries", "count", UAVObjectField.FieldType.UINT32, TxRetriesElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.TRUE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.gcsTelemetryUpdatePeriod = 5000; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.TRUE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.flightTelemetryUpdatePeriod = 0; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_NEVER; + 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(int instID) { + // TODO: Need to get specific instance to clone + try { + GCSTelemetryStats obj = new GCSTelemetryStats(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public GCSTelemetryStats GetInstance(UAVObjectManager objMngr, int instID) + { + return (GCSTelemetryStats)(objMngr.getObject(GCSTelemetryStats.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x771E1046; + protected static final String NAME = "GCSTelemetryStats"; + protected static String DESCRIPTION = "The telemetry statistics from the ground computer"; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 0 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/GPSPosition.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/GPSPosition.java new file mode 100644 index 000000000..889091e0e --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/GPSPosition.java @@ -0,0 +1,184 @@ +/** + ****************************************************************************** + * + * @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. + * Raw GPS data from @ref GPSModule. Should only be used by @ref AHRSCommsModule. + * + * @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; + +/** +Raw GPS data from @ref GPSModule. Should only be used by @ref AHRSCommsModule. + +generated from gpsposition.xml + **/ +public class GPSPosition extends UAVDataObject { + + public GPSPosition() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List StatusElemNames = new ArrayList(); + StatusElemNames.add("0"); + List StatusEnumOptions = new ArrayList(); + StatusEnumOptions.add("NoGPS"); + StatusEnumOptions.add("NoFix"); + StatusEnumOptions.add("Fix2D"); + StatusEnumOptions.add("Fix3D"); + fields.add( new UAVObjectField("Status", "", UAVObjectField.FieldType.ENUM, StatusElemNames, StatusEnumOptions) ); + + List LatitudeElemNames = new ArrayList(); + LatitudeElemNames.add("0"); + fields.add( new UAVObjectField("Latitude", "degrees x 10^-7", UAVObjectField.FieldType.INT32, LatitudeElemNames, null) ); + + List LongitudeElemNames = new ArrayList(); + LongitudeElemNames.add("0"); + fields.add( new UAVObjectField("Longitude", "degrees x 10^-7", UAVObjectField.FieldType.INT32, LongitudeElemNames, null) ); + + List AltitudeElemNames = new ArrayList(); + AltitudeElemNames.add("0"); + fields.add( new UAVObjectField("Altitude", "meters", UAVObjectField.FieldType.FLOAT32, AltitudeElemNames, null) ); + + List GeoidSeparationElemNames = new ArrayList(); + GeoidSeparationElemNames.add("0"); + fields.add( new UAVObjectField("GeoidSeparation", "meters", UAVObjectField.FieldType.FLOAT32, GeoidSeparationElemNames, null) ); + + List HeadingElemNames = new ArrayList(); + HeadingElemNames.add("0"); + fields.add( new UAVObjectField("Heading", "degrees", UAVObjectField.FieldType.FLOAT32, HeadingElemNames, null) ); + + List GroundspeedElemNames = new ArrayList(); + GroundspeedElemNames.add("0"); + fields.add( new UAVObjectField("Groundspeed", "m/s", UAVObjectField.FieldType.FLOAT32, GroundspeedElemNames, null) ); + + List SatellitesElemNames = new ArrayList(); + SatellitesElemNames.add("0"); + fields.add( new UAVObjectField("Satellites", "", UAVObjectField.FieldType.INT8, SatellitesElemNames, null) ); + + List PDOPElemNames = new ArrayList(); + PDOPElemNames.add("0"); + fields.add( new UAVObjectField("PDOP", "", UAVObjectField.FieldType.FLOAT32, PDOPElemNames, null) ); + + List HDOPElemNames = new ArrayList(); + HDOPElemNames.add("0"); + fields.add( new UAVObjectField("HDOP", "", UAVObjectField.FieldType.FLOAT32, HDOPElemNames, null) ); + + List VDOPElemNames = new ArrayList(); + VDOPElemNames.add("0"); + fields.add( new UAVObjectField("VDOP", "", UAVObjectField.FieldType.FLOAT32, VDOPElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.FALSE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.FALSE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.flightTelemetryUpdatePeriod = 1000; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + 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(int instID) { + // TODO: Need to get specific instance to clone + try { + GPSPosition obj = new GPSPosition(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public GPSPosition GetInstance(UAVObjectManager objMngr, int instID) + { + return (GPSPosition)(objMngr.getObject(GPSPosition.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0xB5495042; + protected static final String NAME = "GPSPosition"; + protected static String DESCRIPTION = "Raw GPS data from @ref GPSModule. Should only be used by @ref AHRSCommsModule."; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 0 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/GPSSatellites.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/GPSSatellites.java new file mode 100644 index 000000000..fa1100207 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/GPSSatellites.java @@ -0,0 +1,215 @@ +/** + ****************************************************************************** + * + * @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. + * Contains information about the GPS satellites in view from @ref GPSModule. + * + * @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; + +/** +Contains information about the GPS satellites in view from @ref GPSModule. + +generated from gpssatellites.xml + **/ +public class GPSSatellites extends UAVDataObject { + + public GPSSatellites() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List SatsInViewElemNames = new ArrayList(); + SatsInViewElemNames.add("0"); + fields.add( new UAVObjectField("SatsInView", "", UAVObjectField.FieldType.INT8, SatsInViewElemNames, null) ); + + List PRNElemNames = new ArrayList(); + PRNElemNames.add("0"); + PRNElemNames.add("1"); + PRNElemNames.add("2"); + PRNElemNames.add("3"); + PRNElemNames.add("4"); + PRNElemNames.add("5"); + PRNElemNames.add("6"); + PRNElemNames.add("7"); + PRNElemNames.add("8"); + PRNElemNames.add("9"); + PRNElemNames.add("10"); + PRNElemNames.add("11"); + PRNElemNames.add("12"); + PRNElemNames.add("13"); + PRNElemNames.add("14"); + PRNElemNames.add("15"); + fields.add( new UAVObjectField("PRN", "", UAVObjectField.FieldType.INT8, PRNElemNames, null) ); + + List ElevationElemNames = new ArrayList(); + ElevationElemNames.add("0"); + ElevationElemNames.add("1"); + ElevationElemNames.add("2"); + ElevationElemNames.add("3"); + ElevationElemNames.add("4"); + ElevationElemNames.add("5"); + ElevationElemNames.add("6"); + ElevationElemNames.add("7"); + ElevationElemNames.add("8"); + ElevationElemNames.add("9"); + ElevationElemNames.add("10"); + ElevationElemNames.add("11"); + ElevationElemNames.add("12"); + ElevationElemNames.add("13"); + ElevationElemNames.add("14"); + ElevationElemNames.add("15"); + fields.add( new UAVObjectField("Elevation", "degrees", UAVObjectField.FieldType.FLOAT32, ElevationElemNames, null) ); + + List AzimuthElemNames = new ArrayList(); + AzimuthElemNames.add("0"); + AzimuthElemNames.add("1"); + AzimuthElemNames.add("2"); + AzimuthElemNames.add("3"); + AzimuthElemNames.add("4"); + AzimuthElemNames.add("5"); + AzimuthElemNames.add("6"); + AzimuthElemNames.add("7"); + AzimuthElemNames.add("8"); + AzimuthElemNames.add("9"); + AzimuthElemNames.add("10"); + AzimuthElemNames.add("11"); + AzimuthElemNames.add("12"); + AzimuthElemNames.add("13"); + AzimuthElemNames.add("14"); + AzimuthElemNames.add("15"); + fields.add( new UAVObjectField("Azimuth", "degrees", UAVObjectField.FieldType.FLOAT32, AzimuthElemNames, null) ); + + List SNRElemNames = new ArrayList(); + SNRElemNames.add("0"); + SNRElemNames.add("1"); + SNRElemNames.add("2"); + SNRElemNames.add("3"); + SNRElemNames.add("4"); + SNRElemNames.add("5"); + SNRElemNames.add("6"); + SNRElemNames.add("7"); + SNRElemNames.add("8"); + SNRElemNames.add("9"); + SNRElemNames.add("10"); + SNRElemNames.add("11"); + SNRElemNames.add("12"); + SNRElemNames.add("13"); + SNRElemNames.add("14"); + SNRElemNames.add("15"); + fields.add( new UAVObjectField("SNR", "", UAVObjectField.FieldType.INT8, SNRElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.FALSE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.FALSE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.flightTelemetryUpdatePeriod = 10000; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.loggingUpdatePeriod = 30000; + 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(int instID) { + // TODO: Need to get specific instance to clone + try { + GPSSatellites obj = new GPSSatellites(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public GPSSatellites GetInstance(UAVObjectManager objMngr, int instID) + { + return (GPSSatellites)(objMngr.getObject(GPSSatellites.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0xD62FA3AE; + protected static final String NAME = "GPSSatellites"; + protected static String DESCRIPTION = "Contains information about the GPS satellites in view from @ref GPSModule."; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 0 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/GPSTime.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/GPSTime.java new file mode 100644 index 000000000..5ff55cc2e --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/GPSTime.java @@ -0,0 +1,159 @@ +/** + ****************************************************************************** + * + * @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. + * Contains the GPS time from @ref GPSModule. Required to compute the world magnetic model correctly when setting the home location. + * + * @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; + +/** +Contains the GPS time from @ref GPSModule. Required to compute the world magnetic model correctly when setting the home location. + +generated from gpstime.xml + **/ +public class GPSTime extends UAVDataObject { + + public GPSTime() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List MonthElemNames = new ArrayList(); + MonthElemNames.add("0"); + fields.add( new UAVObjectField("Month", "", UAVObjectField.FieldType.INT8, MonthElemNames, null) ); + + List DayElemNames = new ArrayList(); + DayElemNames.add("0"); + fields.add( new UAVObjectField("Day", "", UAVObjectField.FieldType.INT8, DayElemNames, null) ); + + List YearElemNames = new ArrayList(); + YearElemNames.add("0"); + fields.add( new UAVObjectField("Year", "", UAVObjectField.FieldType.INT16, YearElemNames, null) ); + + List HourElemNames = new ArrayList(); + HourElemNames.add("0"); + fields.add( new UAVObjectField("Hour", "", UAVObjectField.FieldType.INT8, HourElemNames, null) ); + + List MinuteElemNames = new ArrayList(); + MinuteElemNames.add("0"); + fields.add( new UAVObjectField("Minute", "", UAVObjectField.FieldType.INT8, MinuteElemNames, null) ); + + List SecondElemNames = new ArrayList(); + SecondElemNames.add("0"); + fields.add( new UAVObjectField("Second", "", UAVObjectField.FieldType.INT8, SecondElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.FALSE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.FALSE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.flightTelemetryUpdatePeriod = 10000; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.loggingUpdatePeriod = 30000; + 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(int instID) { + // TODO: Need to get specific instance to clone + try { + GPSTime obj = new GPSTime(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public GPSTime GetInstance(UAVObjectManager objMngr, int instID) + { + return (GPSTime)(objMngr.getObject(GPSTime.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x56FFF0A2; + protected static final String NAME = "GPSTime"; + protected static String DESCRIPTION = "Contains the GPS time from @ref GPSModule. Required to compute the world magnetic model correctly when setting the home location."; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 0 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/GuidanceSettings.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/GuidanceSettings.java new file mode 100644 index 000000000..2cde12f64 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/GuidanceSettings.java @@ -0,0 +1,197 @@ +/** + ****************************************************************************** + * + * @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. + * Settings for the @ref GuidanceModule + * + * @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; + +/** +Settings for the @ref GuidanceModule + +generated from guidancesettings.xml + **/ +public class GuidanceSettings extends UAVDataObject { + + public GuidanceSettings() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List GuidanceModeElemNames = new ArrayList(); + GuidanceModeElemNames.add("0"); + List GuidanceModeEnumOptions = new ArrayList(); + GuidanceModeEnumOptions.add("DUAL_LOOP"); + GuidanceModeEnumOptions.add("VELOCITY_CONTROL"); + fields.add( new UAVObjectField("GuidanceMode", "", UAVObjectField.FieldType.ENUM, GuidanceModeElemNames, GuidanceModeEnumOptions) ); + + List HorizontalPElemNames = new ArrayList(); + HorizontalPElemNames.add("Kp"); + HorizontalPElemNames.add("Max"); + fields.add( new UAVObjectField("HorizontalP", "", UAVObjectField.FieldType.FLOAT32, HorizontalPElemNames, null) ); + + List HorizontalVelPIDElemNames = new ArrayList(); + HorizontalVelPIDElemNames.add("Kp"); + HorizontalVelPIDElemNames.add("Ki"); + HorizontalVelPIDElemNames.add("Kd"); + HorizontalVelPIDElemNames.add("ILimit"); + fields.add( new UAVObjectField("HorizontalVelPID", "", UAVObjectField.FieldType.FLOAT32, HorizontalVelPIDElemNames, null) ); + + List VerticalPElemNames = new ArrayList(); + VerticalPElemNames.add("Kp"); + VerticalPElemNames.add("Max"); + fields.add( new UAVObjectField("VerticalP", "", UAVObjectField.FieldType.FLOAT32, VerticalPElemNames, null) ); + + List VerticalVelPIDElemNames = new ArrayList(); + VerticalVelPIDElemNames.add("Kp"); + VerticalVelPIDElemNames.add("Ki"); + VerticalVelPIDElemNames.add("Kd"); + VerticalVelPIDElemNames.add("ILimit"); + fields.add( new UAVObjectField("VerticalVelPID", "", UAVObjectField.FieldType.FLOAT32, VerticalVelPIDElemNames, null) ); + + List ThrottleControlElemNames = new ArrayList(); + ThrottleControlElemNames.add("0"); + List ThrottleControlEnumOptions = new ArrayList(); + ThrottleControlEnumOptions.add("FALSE"); + ThrottleControlEnumOptions.add("TRUE"); + fields.add( new UAVObjectField("ThrottleControl", "", UAVObjectField.FieldType.ENUM, ThrottleControlElemNames, ThrottleControlEnumOptions) ); + + List MaxRollPitchElemNames = new ArrayList(); + MaxRollPitchElemNames.add("0"); + fields.add( new UAVObjectField("MaxRollPitch", "deg", UAVObjectField.FieldType.FLOAT32, MaxRollPitchElemNames, null) ); + + List UpdatePeriodElemNames = new ArrayList(); + UpdatePeriodElemNames.add("0"); + fields.add( new UAVObjectField("UpdatePeriod", "", UAVObjectField.FieldType.INT32, UpdatePeriodElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.TRUE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_ONCHANGE; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.TRUE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_ONCHANGE; + metadata.flightTelemetryUpdatePeriod = 0; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_NEVER; + 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("GuidanceMode").setValue(0); + getField("HorizontalP").setValue(0.2,0); + getField("HorizontalP").setValue(150,1); + getField("HorizontalVelPID").setValue(0.1,0); + getField("HorizontalVelPID").setValue(0.002,1); + getField("HorizontalVelPID").setValue(0,2); + getField("HorizontalVelPID").setValue(1000,3); + getField("VerticalP").setValue(0.1,0); + getField("VerticalP").setValue(200,1); + getField("VerticalVelPID").setValue(0.1,0); + getField("VerticalVelPID").setValue(0,1); + getField("VerticalVelPID").setValue(0,2); + getField("VerticalVelPID").setValue(0,3); + getField("ThrottleControl").setValue(0); + getField("MaxRollPitch").setValue(10); + getField("UpdatePeriod").setValue(100); + + } + + /** + * 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(int instID) { + // TODO: Need to get specific instance to clone + try { + GuidanceSettings obj = new GuidanceSettings(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public GuidanceSettings GetInstance(UAVObjectManager objMngr, int instID) + { + return (GuidanceSettings)(objMngr.getObject(GuidanceSettings.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x74740AA2; + protected static final String NAME = "GuidanceSettings"; + protected static String DESCRIPTION = "Settings for the @ref GuidanceModule"; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 1 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/HomeLocation.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/HomeLocation.java new file mode 100644 index 000000000..2adebce70 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/HomeLocation.java @@ -0,0 +1,197 @@ +/** + ****************************************************************************** + * + * @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. + * HomeLocation setting which contains the constants to tranlate from longitutde and latitude to NED reference frame. Automatically set by @ref GPSModule after acquiring a 3D lock. Used by @ref AHRSCommsModule. + * + * @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; + +/** +HomeLocation setting which contains the constants to tranlate from longitutde and latitude to NED reference frame. Automatically set by @ref GPSModule after acquiring a 3D lock. Used by @ref AHRSCommsModule. + +generated from homelocation.xml + **/ +public class HomeLocation extends UAVDataObject { + + public HomeLocation() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List SetElemNames = new ArrayList(); + SetElemNames.add("0"); + List SetEnumOptions = new ArrayList(); + SetEnumOptions.add("FALSE"); + SetEnumOptions.add("TRUE"); + fields.add( new UAVObjectField("Set", "", UAVObjectField.FieldType.ENUM, SetElemNames, SetEnumOptions) ); + + List LatitudeElemNames = new ArrayList(); + LatitudeElemNames.add("0"); + fields.add( new UAVObjectField("Latitude", "deg * 10e6", UAVObjectField.FieldType.INT32, LatitudeElemNames, null) ); + + List LongitudeElemNames = new ArrayList(); + LongitudeElemNames.add("0"); + fields.add( new UAVObjectField("Longitude", "deg * 10e6", UAVObjectField.FieldType.INT32, LongitudeElemNames, null) ); + + List AltitudeElemNames = new ArrayList(); + AltitudeElemNames.add("0"); + fields.add( new UAVObjectField("Altitude", "m over geoid", UAVObjectField.FieldType.FLOAT32, AltitudeElemNames, null) ); + + List ECEFElemNames = new ArrayList(); + ECEFElemNames.add("0"); + ECEFElemNames.add("1"); + ECEFElemNames.add("2"); + fields.add( new UAVObjectField("ECEF", "cm", UAVObjectField.FieldType.INT32, ECEFElemNames, null) ); + + List RNEElemNames = new ArrayList(); + RNEElemNames.add("0"); + RNEElemNames.add("1"); + RNEElemNames.add("2"); + RNEElemNames.add("3"); + RNEElemNames.add("4"); + RNEElemNames.add("5"); + RNEElemNames.add("6"); + RNEElemNames.add("7"); + RNEElemNames.add("8"); + fields.add( new UAVObjectField("RNE", "", UAVObjectField.FieldType.FLOAT32, RNEElemNames, null) ); + + List BeElemNames = new ArrayList(); + BeElemNames.add("0"); + BeElemNames.add("1"); + BeElemNames.add("2"); + fields.add( new UAVObjectField("Be", "", UAVObjectField.FieldType.FLOAT32, BeElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.TRUE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_ONCHANGE; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.TRUE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_ONCHANGE; + metadata.flightTelemetryUpdatePeriod = 0; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_NEVER; + 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("Set").setValue(0); + getField("Latitude").setValue(0); + getField("Longitude").setValue(0); + getField("Altitude").setValue(0); + getField("ECEF").setValue(0,0); + getField("ECEF").setValue(0,1); + getField("ECEF").setValue(0,2); + getField("RNE").setValue(0,0); + getField("RNE").setValue(0,1); + getField("RNE").setValue(0,2); + getField("RNE").setValue(0,3); + getField("RNE").setValue(0,4); + getField("RNE").setValue(0,5); + getField("RNE").setValue(0,6); + getField("RNE").setValue(0,7); + getField("RNE").setValue(0,8); + getField("Be").setValue(0,0); + getField("Be").setValue(0,1); + getField("Be").setValue(0,2); + + } + + /** + * 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(int instID) { + // TODO: Need to get specific instance to clone + try { + HomeLocation obj = new HomeLocation(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public HomeLocation GetInstance(UAVObjectManager objMngr, int instID) + { + return (HomeLocation)(objMngr.getObject(HomeLocation.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0xD6008ED2; + protected static final String NAME = "HomeLocation"; + protected static String DESCRIPTION = "HomeLocation setting which contains the constants to tranlate from longitutde and latitude to NED reference frame. Automatically set by @ref GPSModule after acquiring a 3D lock. Used by @ref AHRSCommsModule."; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 1 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/I2CStats.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/I2CStats.java new file mode 100644 index 000000000..fc68e2902 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/I2CStats.java @@ -0,0 +1,238 @@ +/** + ****************************************************************************** + * + * @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. + * Tracks statistics on the I2C bus. + * + * @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; + +/** +Tracks statistics on the I2C bus. + +generated from i2cstats.xml + **/ +public class I2CStats extends UAVDataObject { + + public I2CStats() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List event_errorsElemNames = new ArrayList(); + event_errorsElemNames.add("0"); + fields.add( new UAVObjectField("event_errors", "", UAVObjectField.FieldType.UINT8, event_errorsElemNames, null) ); + + List fsm_errorsElemNames = new ArrayList(); + fsm_errorsElemNames.add("0"); + fields.add( new UAVObjectField("fsm_errors", "", UAVObjectField.FieldType.UINT8, fsm_errorsElemNames, null) ); + + List irq_errorsElemNames = new ArrayList(); + irq_errorsElemNames.add("0"); + fields.add( new UAVObjectField("irq_errors", "", UAVObjectField.FieldType.UINT8, irq_errorsElemNames, null) ); + + List nacksElemNames = new ArrayList(); + nacksElemNames.add("0"); + fields.add( new UAVObjectField("nacks", "", UAVObjectField.FieldType.UINT8, nacksElemNames, null) ); + + List timeoutsElemNames = new ArrayList(); + timeoutsElemNames.add("0"); + fields.add( new UAVObjectField("timeouts", "", UAVObjectField.FieldType.UINT8, timeoutsElemNames, null) ); + + List last_error_typeElemNames = new ArrayList(); + last_error_typeElemNames.add("0"); + List last_error_typeEnumOptions = new ArrayList(); + last_error_typeEnumOptions.add("EVENT"); + last_error_typeEnumOptions.add("FSM"); + last_error_typeEnumOptions.add("INTERRUPT"); + fields.add( new UAVObjectField("last_error_type", "", UAVObjectField.FieldType.ENUM, last_error_typeElemNames, last_error_typeEnumOptions) ); + + List evirq_logElemNames = new ArrayList(); + evirq_logElemNames.add("0"); + evirq_logElemNames.add("1"); + evirq_logElemNames.add("2"); + evirq_logElemNames.add("3"); + evirq_logElemNames.add("4"); + fields.add( new UAVObjectField("evirq_log", "", UAVObjectField.FieldType.UINT32, evirq_logElemNames, null) ); + + List erirq_logElemNames = new ArrayList(); + erirq_logElemNames.add("0"); + erirq_logElemNames.add("1"); + erirq_logElemNames.add("2"); + erirq_logElemNames.add("3"); + erirq_logElemNames.add("4"); + fields.add( new UAVObjectField("erirq_log", "", UAVObjectField.FieldType.UINT32, erirq_logElemNames, null) ); + + List event_logElemNames = new ArrayList(); + event_logElemNames.add("0"); + event_logElemNames.add("1"); + event_logElemNames.add("2"); + event_logElemNames.add("3"); + event_logElemNames.add("4"); + List event_logEnumOptions = new ArrayList(); + event_logEnumOptions.add("I2C_EVENT_BUS_ERROR"); + event_logEnumOptions.add("I2C_EVENT_START"); + event_logEnumOptions.add("I2C_EVENT_STARTED_MORE_TXN_READ"); + event_logEnumOptions.add("I2C_EVENT_STARTED_MORE_TXN_WRITE"); + event_logEnumOptions.add("I2C_EVENT_STARTED_LAST_TXN_READ"); + event_logEnumOptions.add("I2C_EVENT_STARTED_LAST_TXN_WRITE"); + event_logEnumOptions.add("I2C_EVENT_ADDR_SENT_LEN_EQ_0"); + event_logEnumOptions.add("I2C_EVENT_ADDR_SENT_LEN_EQ_1"); + event_logEnumOptions.add("I2C_EVENT_ADDR_SENT_LEN_EQ_2"); + event_logEnumOptions.add("I2C_EVENT_ADDR_SENT_LEN_GT_2"); + event_logEnumOptions.add("I2C_EVENT_TRANSFER_DONE_LEN_EQ_0"); + event_logEnumOptions.add("I2C_EVENT_TRANSFER_DONE_LEN_EQ_1"); + event_logEnumOptions.add("I2C_EVENT_TRANSFER_DONE_LEN_EQ_2"); + event_logEnumOptions.add("I2C_EVENT_TRANSFER_DONE_LEN_GT_2"); + event_logEnumOptions.add("I2C_EVENT_NACK"); + event_logEnumOptions.add("I2C_EVENT_STOPPED"); + event_logEnumOptions.add("I2C_EVENT_AUTO"); + fields.add( new UAVObjectField("event_log", "", UAVObjectField.FieldType.ENUM, event_logElemNames, event_logEnumOptions) ); + + List state_logElemNames = new ArrayList(); + state_logElemNames.add("0"); + state_logElemNames.add("1"); + state_logElemNames.add("2"); + state_logElemNames.add("3"); + state_logElemNames.add("4"); + List state_logEnumOptions = new ArrayList(); + state_logEnumOptions.add("I2C_STATE_FSM_FAULT"); + state_logEnumOptions.add("I2C_STATE_BUS_ERROR"); + state_logEnumOptions.add("I2C_STATE_STOPPED"); + state_logEnumOptions.add("I2C_STATE_STOPPING"); + state_logEnumOptions.add("I2C_STATE_STARTING"); + state_logEnumOptions.add("I2C_STATE_R_MORE_TXN_ADDR"); + state_logEnumOptions.add("I2C_STATE_R_MORE_TXN_PRE_ONE"); + state_logEnumOptions.add("I2C_STATE_R_MORE_TXN_PRE_FIRST"); + state_logEnumOptions.add("I2C_STATE_R_MORE_TXN_PRE_MIDDLE"); + state_logEnumOptions.add("I2C_STATE_R_MORE_TXN_LAST"); + state_logEnumOptions.add("I2C_STATE_R_MORE_TXN_POST_LAST"); + state_logEnumOptions.add("R_LAST_TXN_ADDR"); + state_logEnumOptions.add("I2C_STATE_R_LAST_TXN_PRE_ONE"); + state_logEnumOptions.add("I2C_STATE_R_LAST_TXN_PRE_FIRST"); + state_logEnumOptions.add("I2C_STATE_R_LAST_TXN_PRE_MIDDLE"); + state_logEnumOptions.add("I2C_STATE_R_LAST_TXN_PRE_LAST"); + state_logEnumOptions.add("I2C_STATE_R_LAST_TXN_POST_LAST"); + state_logEnumOptions.add("I2C_STATE_W_MORE_TXN_ADDR"); + state_logEnumOptions.add("I2C_STATE_W_MORE_TXN_MIDDLE"); + state_logEnumOptions.add("I2C_STATE_W_MORE_TXN_LAST"); + state_logEnumOptions.add("I2C_STATE_W_LAST_TXN_ADDR"); + state_logEnumOptions.add("I2C_STATE_W_LAST_TXN_MIDDLE"); + state_logEnumOptions.add("I2C_STATE_W_LAST_TXN_LAST"); + state_logEnumOptions.add("I2C_STATE_NACK"); + fields.add( new UAVObjectField("state_log", "", UAVObjectField.FieldType.ENUM, state_logElemNames, state_logEnumOptions) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.FALSE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.FALSE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.flightTelemetryUpdatePeriod = 10000; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.loggingUpdatePeriod = 30000; + 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(int instID) { + // TODO: Need to get specific instance to clone + try { + I2CStats obj = new I2CStats(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public I2CStats GetInstance(UAVObjectManager objMngr, int instID) + { + return (I2CStats)(objMngr.getObject(I2CStats.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x23CE9E9C; + protected static final String NAME = "I2CStats"; + protected static String DESCRIPTION = "Tracks statistics on the I2C bus."; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 0 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/ManualControlCommand.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/ManualControlCommand.java new file mode 100644 index 000000000..636f30946 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/ManualControlCommand.java @@ -0,0 +1,199 @@ +/** + ****************************************************************************** + * + * @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 output from the @ref ManualControlModule which descodes the receiver inputs. Overriden by GCS for fly-by-wire control. + * + * @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 output from the @ref ManualControlModule which descodes the receiver inputs. Overriden by GCS for fly-by-wire control. + +generated from manualcontrolcommand.xml + **/ +public class ManualControlCommand extends UAVDataObject { + + public ManualControlCommand() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List ConnectedElemNames = new ArrayList(); + ConnectedElemNames.add("0"); + List ConnectedEnumOptions = new ArrayList(); + ConnectedEnumOptions.add("False"); + ConnectedEnumOptions.add("True"); + fields.add( new UAVObjectField("Connected", "", UAVObjectField.FieldType.ENUM, ConnectedElemNames, ConnectedEnumOptions) ); + + List ArmedElemNames = new ArrayList(); + ArmedElemNames.add("0"); + List ArmedEnumOptions = new ArrayList(); + ArmedEnumOptions.add("False"); + ArmedEnumOptions.add("True"); + fields.add( new UAVObjectField("Armed", "", UAVObjectField.FieldType.ENUM, ArmedElemNames, ArmedEnumOptions) ); + + List RollElemNames = new ArrayList(); + RollElemNames.add("0"); + fields.add( new UAVObjectField("Roll", "%", UAVObjectField.FieldType.FLOAT32, RollElemNames, null) ); + + List PitchElemNames = new ArrayList(); + PitchElemNames.add("0"); + fields.add( new UAVObjectField("Pitch", "%", UAVObjectField.FieldType.FLOAT32, PitchElemNames, null) ); + + List YawElemNames = new ArrayList(); + YawElemNames.add("0"); + fields.add( new UAVObjectField("Yaw", "%", UAVObjectField.FieldType.FLOAT32, YawElemNames, null) ); + + List ThrottleElemNames = new ArrayList(); + ThrottleElemNames.add("0"); + fields.add( new UAVObjectField("Throttle", "%", UAVObjectField.FieldType.FLOAT32, ThrottleElemNames, null) ); + + List FlightModeElemNames = new ArrayList(); + FlightModeElemNames.add("0"); + List FlightModeEnumOptions = new ArrayList(); + FlightModeEnumOptions.add("Manual"); + FlightModeEnumOptions.add("Stabilized1"); + FlightModeEnumOptions.add("Stabilized2"); + FlightModeEnumOptions.add("Stabilized3"); + FlightModeEnumOptions.add("VelocityControl"); + FlightModeEnumOptions.add("PositionHold"); + fields.add( new UAVObjectField("FlightMode", "", UAVObjectField.FieldType.ENUM, FlightModeElemNames, FlightModeEnumOptions) ); + + List Accessory1ElemNames = new ArrayList(); + Accessory1ElemNames.add("0"); + fields.add( new UAVObjectField("Accessory1", "%", UAVObjectField.FieldType.FLOAT32, Accessory1ElemNames, null) ); + + List Accessory2ElemNames = new ArrayList(); + Accessory2ElemNames.add("0"); + fields.add( new UAVObjectField("Accessory2", "%", UAVObjectField.FieldType.FLOAT32, Accessory2ElemNames, null) ); + + List Accessory3ElemNames = new ArrayList(); + Accessory3ElemNames.add("0"); + fields.add( new UAVObjectField("Accessory3", "%", UAVObjectField.FieldType.FLOAT32, Accessory3ElemNames, null) ); + + List ChannelElemNames = new ArrayList(); + ChannelElemNames.add("0"); + ChannelElemNames.add("1"); + ChannelElemNames.add("2"); + ChannelElemNames.add("3"); + ChannelElemNames.add("4"); + ChannelElemNames.add("5"); + ChannelElemNames.add("6"); + ChannelElemNames.add("7"); + fields.add( new UAVObjectField("Channel", "us", UAVObjectField.FieldType.UINT16, ChannelElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.FALSE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.FALSE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.flightTelemetryUpdatePeriod = 2000; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_NEVER; + 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(int instID) { + // TODO: Need to get specific instance to clone + try { + ManualControlCommand obj = new ManualControlCommand(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public ManualControlCommand GetInstance(UAVObjectManager objMngr, int instID) + { + return (ManualControlCommand)(objMngr.getObject(ManualControlCommand.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x926794; + protected static final String NAME = "ManualControlCommand"; + protected static String DESCRIPTION = "The output from the @ref ManualControlModule which descodes the receiver inputs. Overriden by GCS for fly-by-wire control."; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 0 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/ManualControlSettings.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/ManualControlSettings.java new file mode 100644 index 000000000..c14aef758 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/ManualControlSettings.java @@ -0,0 +1,395 @@ +/** + ****************************************************************************** + * + * @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. + * Settings to indicate how to decode receiver input by @ref ManualControlModule. + * + * @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; + +/** +Settings to indicate how to decode receiver input by @ref ManualControlModule. + +generated from manualcontrolsettings.xml + **/ +public class ManualControlSettings extends UAVDataObject { + + public ManualControlSettings() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List InputModeElemNames = new ArrayList(); + InputModeElemNames.add("0"); + List InputModeEnumOptions = new ArrayList(); + InputModeEnumOptions.add("PWM"); + InputModeEnumOptions.add("PPM"); + InputModeEnumOptions.add("Spektrum"); + fields.add( new UAVObjectField("InputMode", "", UAVObjectField.FieldType.ENUM, InputModeElemNames, InputModeEnumOptions) ); + + List RollElemNames = new ArrayList(); + RollElemNames.add("0"); + List RollEnumOptions = new ArrayList(); + RollEnumOptions.add("Channel1"); + RollEnumOptions.add("Channel2"); + RollEnumOptions.add("Channel3"); + RollEnumOptions.add("Channel4"); + RollEnumOptions.add("Channel5"); + RollEnumOptions.add("Channel6"); + RollEnumOptions.add("Channel7"); + RollEnumOptions.add("Channel8"); + RollEnumOptions.add("None"); + fields.add( new UAVObjectField("Roll", "channel", UAVObjectField.FieldType.ENUM, RollElemNames, RollEnumOptions) ); + + List PitchElemNames = new ArrayList(); + PitchElemNames.add("0"); + List PitchEnumOptions = new ArrayList(); + PitchEnumOptions.add("Channel1"); + PitchEnumOptions.add("Channel2"); + PitchEnumOptions.add("Channel3"); + PitchEnumOptions.add("Channel4"); + PitchEnumOptions.add("Channel5"); + PitchEnumOptions.add("Channel6"); + PitchEnumOptions.add("Channel7"); + PitchEnumOptions.add("Channel8"); + PitchEnumOptions.add("None"); + fields.add( new UAVObjectField("Pitch", "channel", UAVObjectField.FieldType.ENUM, PitchElemNames, PitchEnumOptions) ); + + List YawElemNames = new ArrayList(); + YawElemNames.add("0"); + List YawEnumOptions = new ArrayList(); + YawEnumOptions.add("Channel1"); + YawEnumOptions.add("Channel2"); + YawEnumOptions.add("Channel3"); + YawEnumOptions.add("Channel4"); + YawEnumOptions.add("Channel5"); + YawEnumOptions.add("Channel6"); + YawEnumOptions.add("Channel7"); + YawEnumOptions.add("Channel8"); + YawEnumOptions.add("None"); + fields.add( new UAVObjectField("Yaw", "channel", UAVObjectField.FieldType.ENUM, YawElemNames, YawEnumOptions) ); + + List ThrottleElemNames = new ArrayList(); + ThrottleElemNames.add("0"); + List ThrottleEnumOptions = new ArrayList(); + ThrottleEnumOptions.add("Channel1"); + ThrottleEnumOptions.add("Channel2"); + ThrottleEnumOptions.add("Channel3"); + ThrottleEnumOptions.add("Channel4"); + ThrottleEnumOptions.add("Channel5"); + ThrottleEnumOptions.add("Channel6"); + ThrottleEnumOptions.add("Channel7"); + ThrottleEnumOptions.add("Channel8"); + ThrottleEnumOptions.add("None"); + fields.add( new UAVObjectField("Throttle", "channel", UAVObjectField.FieldType.ENUM, ThrottleElemNames, ThrottleEnumOptions) ); + + List FlightModeElemNames = new ArrayList(); + FlightModeElemNames.add("0"); + List FlightModeEnumOptions = new ArrayList(); + FlightModeEnumOptions.add("Channel1"); + FlightModeEnumOptions.add("Channel2"); + FlightModeEnumOptions.add("Channel3"); + FlightModeEnumOptions.add("Channel4"); + FlightModeEnumOptions.add("Channel5"); + FlightModeEnumOptions.add("Channel6"); + FlightModeEnumOptions.add("Channel7"); + FlightModeEnumOptions.add("Channel8"); + FlightModeEnumOptions.add("None"); + fields.add( new UAVObjectField("FlightMode", "channel", UAVObjectField.FieldType.ENUM, FlightModeElemNames, FlightModeEnumOptions) ); + + List Accessory1ElemNames = new ArrayList(); + Accessory1ElemNames.add("0"); + List Accessory1EnumOptions = new ArrayList(); + Accessory1EnumOptions.add("Channel1"); + Accessory1EnumOptions.add("Channel2"); + Accessory1EnumOptions.add("Channel3"); + Accessory1EnumOptions.add("Channel4"); + Accessory1EnumOptions.add("Channel5"); + Accessory1EnumOptions.add("Channel6"); + Accessory1EnumOptions.add("Channel7"); + Accessory1EnumOptions.add("Channel8"); + Accessory1EnumOptions.add("None"); + fields.add( new UAVObjectField("Accessory1", "channel", UAVObjectField.FieldType.ENUM, Accessory1ElemNames, Accessory1EnumOptions) ); + + List Accessory2ElemNames = new ArrayList(); + Accessory2ElemNames.add("0"); + List Accessory2EnumOptions = new ArrayList(); + Accessory2EnumOptions.add("Channel1"); + Accessory2EnumOptions.add("Channel2"); + Accessory2EnumOptions.add("Channel3"); + Accessory2EnumOptions.add("Channel4"); + Accessory2EnumOptions.add("Channel5"); + Accessory2EnumOptions.add("Channel6"); + Accessory2EnumOptions.add("Channel7"); + Accessory2EnumOptions.add("Channel8"); + Accessory2EnumOptions.add("None"); + fields.add( new UAVObjectField("Accessory2", "channel", UAVObjectField.FieldType.ENUM, Accessory2ElemNames, Accessory2EnumOptions) ); + + List Accessory3ElemNames = new ArrayList(); + Accessory3ElemNames.add("0"); + List Accessory3EnumOptions = new ArrayList(); + Accessory3EnumOptions.add("Channel1"); + Accessory3EnumOptions.add("Channel2"); + Accessory3EnumOptions.add("Channel3"); + Accessory3EnumOptions.add("Channel4"); + Accessory3EnumOptions.add("Channel5"); + Accessory3EnumOptions.add("Channel6"); + Accessory3EnumOptions.add("Channel7"); + Accessory3EnumOptions.add("Channel8"); + Accessory3EnumOptions.add("None"); + fields.add( new UAVObjectField("Accessory3", "channel", UAVObjectField.FieldType.ENUM, Accessory3ElemNames, Accessory3EnumOptions) ); + + List ArmingElemNames = new ArrayList(); + ArmingElemNames.add("0"); + List ArmingEnumOptions = new ArrayList(); + ArmingEnumOptions.add("Always Disarmed"); + ArmingEnumOptions.add("Always Armed"); + ArmingEnumOptions.add("Roll Left"); + ArmingEnumOptions.add("Roll Right"); + ArmingEnumOptions.add("Pitch Forward"); + ArmingEnumOptions.add("Pitch Aft"); + ArmingEnumOptions.add("Yaw Left"); + ArmingEnumOptions.add("Yaw Right"); + fields.add( new UAVObjectField("Arming", "", UAVObjectField.FieldType.ENUM, ArmingElemNames, ArmingEnumOptions) ); + + List Stabilization1SettingsElemNames = new ArrayList(); + Stabilization1SettingsElemNames.add("Roll"); + Stabilization1SettingsElemNames.add("Pitch"); + Stabilization1SettingsElemNames.add("Yaw"); + List Stabilization1SettingsEnumOptions = new ArrayList(); + Stabilization1SettingsEnumOptions.add("None"); + Stabilization1SettingsEnumOptions.add("Rate"); + Stabilization1SettingsEnumOptions.add("Attitude"); + fields.add( new UAVObjectField("Stabilization1Settings", "", UAVObjectField.FieldType.ENUM, Stabilization1SettingsElemNames, Stabilization1SettingsEnumOptions) ); + + List Stabilization2SettingsElemNames = new ArrayList(); + Stabilization2SettingsElemNames.add("Roll"); + Stabilization2SettingsElemNames.add("Pitch"); + Stabilization2SettingsElemNames.add("Yaw"); + List Stabilization2SettingsEnumOptions = new ArrayList(); + Stabilization2SettingsEnumOptions.add("None"); + Stabilization2SettingsEnumOptions.add("Rate"); + Stabilization2SettingsEnumOptions.add("Attitude"); + fields.add( new UAVObjectField("Stabilization2Settings", "", UAVObjectField.FieldType.ENUM, Stabilization2SettingsElemNames, Stabilization2SettingsEnumOptions) ); + + List Stabilization3SettingsElemNames = new ArrayList(); + Stabilization3SettingsElemNames.add("Roll"); + Stabilization3SettingsElemNames.add("Pitch"); + Stabilization3SettingsElemNames.add("Yaw"); + List Stabilization3SettingsEnumOptions = new ArrayList(); + Stabilization3SettingsEnumOptions.add("None"); + Stabilization3SettingsEnumOptions.add("Rate"); + Stabilization3SettingsEnumOptions.add("Attitude"); + fields.add( new UAVObjectField("Stabilization3Settings", "", UAVObjectField.FieldType.ENUM, Stabilization3SettingsElemNames, Stabilization3SettingsEnumOptions) ); + + List FlightModePositionElemNames = new ArrayList(); + FlightModePositionElemNames.add("0"); + FlightModePositionElemNames.add("1"); + FlightModePositionElemNames.add("2"); + List FlightModePositionEnumOptions = new ArrayList(); + FlightModePositionEnumOptions.add("Manual"); + FlightModePositionEnumOptions.add("Stabilized1"); + FlightModePositionEnumOptions.add("Stabilized2"); + FlightModePositionEnumOptions.add("Stabilized3"); + FlightModePositionEnumOptions.add("VelocityControl"); + FlightModePositionEnumOptions.add("PositionHold"); + fields.add( new UAVObjectField("FlightModePosition", "", UAVObjectField.FieldType.ENUM, FlightModePositionElemNames, FlightModePositionEnumOptions) ); + + List ChannelMaxElemNames = new ArrayList(); + ChannelMaxElemNames.add("0"); + ChannelMaxElemNames.add("1"); + ChannelMaxElemNames.add("2"); + ChannelMaxElemNames.add("3"); + ChannelMaxElemNames.add("4"); + ChannelMaxElemNames.add("5"); + ChannelMaxElemNames.add("6"); + ChannelMaxElemNames.add("7"); + fields.add( new UAVObjectField("ChannelMax", "us", UAVObjectField.FieldType.INT16, ChannelMaxElemNames, null) ); + + List ChannelNeutralElemNames = new ArrayList(); + ChannelNeutralElemNames.add("0"); + ChannelNeutralElemNames.add("1"); + ChannelNeutralElemNames.add("2"); + ChannelNeutralElemNames.add("3"); + ChannelNeutralElemNames.add("4"); + ChannelNeutralElemNames.add("5"); + ChannelNeutralElemNames.add("6"); + ChannelNeutralElemNames.add("7"); + fields.add( new UAVObjectField("ChannelNeutral", "us", UAVObjectField.FieldType.INT16, ChannelNeutralElemNames, null) ); + + List ChannelMinElemNames = new ArrayList(); + ChannelMinElemNames.add("0"); + ChannelMinElemNames.add("1"); + ChannelMinElemNames.add("2"); + ChannelMinElemNames.add("3"); + ChannelMinElemNames.add("4"); + ChannelMinElemNames.add("5"); + ChannelMinElemNames.add("6"); + ChannelMinElemNames.add("7"); + fields.add( new UAVObjectField("ChannelMin", "us", UAVObjectField.FieldType.INT16, ChannelMinElemNames, null) ); + + List ArmedTimeoutElemNames = new ArrayList(); + ArmedTimeoutElemNames.add("0"); + fields.add( new UAVObjectField("ArmedTimeout", "ms", UAVObjectField.FieldType.UINT16, ArmedTimeoutElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.TRUE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_ONCHANGE; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.TRUE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_ONCHANGE; + metadata.flightTelemetryUpdatePeriod = 0; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_NEVER; + 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("InputMode").setValue(0); + getField("Roll").setValue(0); + getField("Pitch").setValue(1); + getField("Yaw").setValue(2); + getField("Throttle").setValue(3); + getField("FlightMode").setValue(4); + getField("Accessory1").setValue(8); + getField("Accessory2").setValue(8); + getField("Accessory3").setValue(8); + getField("Arming").setValue(0); + getField("Stabilization1Settings").setValue(2,0); + getField("Stabilization1Settings").setValue(2,1); + getField("Stabilization1Settings").setValue(2,2); + getField("Stabilization2Settings").setValue(2,0); + getField("Stabilization2Settings").setValue(2,1); + getField("Stabilization2Settings").setValue(2,2); + getField("Stabilization3Settings").setValue(2,0); + getField("Stabilization3Settings").setValue(2,1); + getField("Stabilization3Settings").setValue(2,2); + getField("FlightModePosition").setValue(0,0); + getField("FlightModePosition").setValue(1,1); + getField("FlightModePosition").setValue(2,2); + getField("ChannelMax").setValue(2000,0); + getField("ChannelMax").setValue(2000,1); + getField("ChannelMax").setValue(2000,2); + getField("ChannelMax").setValue(2000,3); + getField("ChannelMax").setValue(2000,4); + getField("ChannelMax").setValue(2000,5); + getField("ChannelMax").setValue(2000,6); + getField("ChannelMax").setValue(2000,7); + getField("ChannelNeutral").setValue(1500,0); + getField("ChannelNeutral").setValue(1500,1); + getField("ChannelNeutral").setValue(1500,2); + getField("ChannelNeutral").setValue(1500,3); + getField("ChannelNeutral").setValue(1500,4); + getField("ChannelNeutral").setValue(1500,5); + getField("ChannelNeutral").setValue(1500,6); + getField("ChannelNeutral").setValue(1500,7); + getField("ChannelMin").setValue(1000,0); + getField("ChannelMin").setValue(1000,1); + getField("ChannelMin").setValue(1000,2); + getField("ChannelMin").setValue(1000,3); + getField("ChannelMin").setValue(1000,4); + getField("ChannelMin").setValue(1000,5); + getField("ChannelMin").setValue(1000,6); + getField("ChannelMin").setValue(1000,7); + getField("ArmedTimeout").setValue(30000); + + } + + /** + * 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(int instID) { + // TODO: Need to get specific instance to clone + try { + ManualControlSettings obj = new ManualControlSettings(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public ManualControlSettings GetInstance(UAVObjectManager objMngr, int instID) + { + return (ManualControlSettings)(objMngr.getObject(ManualControlSettings.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x2B82102; + 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 == 1; + protected static final boolean ISSETTINGS = 1 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/MixerSettings.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/MixerSettings.java new file mode 100644 index 000000000..554e366f3 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/MixerSettings.java @@ -0,0 +1,357 @@ +/** + ****************************************************************************** + * + * @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. + * Settings for the @ref ActuatorModule that controls the channel assignments for the mixer based on AircraftType + * + * @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; + +/** +Settings for the @ref ActuatorModule that controls the channel assignments for the mixer based on AircraftType + +generated from mixersettings.xml + **/ +public class MixerSettings extends UAVDataObject { + + public MixerSettings() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List MaxAccelElemNames = new ArrayList(); + MaxAccelElemNames.add("0"); + fields.add( new UAVObjectField("MaxAccel", "units/sec", UAVObjectField.FieldType.FLOAT32, MaxAccelElemNames, null) ); + + List FeedForwardElemNames = new ArrayList(); + FeedForwardElemNames.add("0"); + fields.add( new UAVObjectField("FeedForward", "", UAVObjectField.FieldType.FLOAT32, FeedForwardElemNames, null) ); + + List AccelTimeElemNames = new ArrayList(); + AccelTimeElemNames.add("0"); + fields.add( new UAVObjectField("AccelTime", "ms", UAVObjectField.FieldType.FLOAT32, AccelTimeElemNames, null) ); + + List DecelTimeElemNames = new ArrayList(); + DecelTimeElemNames.add("0"); + fields.add( new UAVObjectField("DecelTime", "ms", UAVObjectField.FieldType.FLOAT32, DecelTimeElemNames, null) ); + + List ThrottleCurve1ElemNames = new ArrayList(); + ThrottleCurve1ElemNames.add("0"); + ThrottleCurve1ElemNames.add("25"); + ThrottleCurve1ElemNames.add("50"); + ThrottleCurve1ElemNames.add("75"); + ThrottleCurve1ElemNames.add("100"); + fields.add( new UAVObjectField("ThrottleCurve1", "percent", UAVObjectField.FieldType.FLOAT32, ThrottleCurve1ElemNames, null) ); + + List ThrottleCurve2ElemNames = new ArrayList(); + ThrottleCurve2ElemNames.add("0"); + ThrottleCurve2ElemNames.add("25"); + ThrottleCurve2ElemNames.add("50"); + ThrottleCurve2ElemNames.add("75"); + ThrottleCurve2ElemNames.add("100"); + fields.add( new UAVObjectField("ThrottleCurve2", "percent", UAVObjectField.FieldType.FLOAT32, ThrottleCurve2ElemNames, null) ); + + List Mixer1TypeElemNames = new ArrayList(); + Mixer1TypeElemNames.add("0"); + List Mixer1TypeEnumOptions = new ArrayList(); + Mixer1TypeEnumOptions.add("Disabled"); + Mixer1TypeEnumOptions.add("Motor"); + Mixer1TypeEnumOptions.add("Servo"); + fields.add( new UAVObjectField("Mixer1Type", "", UAVObjectField.FieldType.ENUM, Mixer1TypeElemNames, Mixer1TypeEnumOptions) ); + + List Mixer1VectorElemNames = new ArrayList(); + Mixer1VectorElemNames.add("ThrottleCurve1"); + Mixer1VectorElemNames.add("ThrottleCurve2"); + Mixer1VectorElemNames.add("Roll"); + Mixer1VectorElemNames.add("Pitch"); + Mixer1VectorElemNames.add("Yaw"); + fields.add( new UAVObjectField("Mixer1Vector", "", UAVObjectField.FieldType.INT8, Mixer1VectorElemNames, null) ); + + List Mixer2TypeElemNames = new ArrayList(); + Mixer2TypeElemNames.add("0"); + List Mixer2TypeEnumOptions = new ArrayList(); + Mixer2TypeEnumOptions.add("Disabled"); + Mixer2TypeEnumOptions.add("Motor"); + Mixer2TypeEnumOptions.add("Servo"); + fields.add( new UAVObjectField("Mixer2Type", "", UAVObjectField.FieldType.ENUM, Mixer2TypeElemNames, Mixer2TypeEnumOptions) ); + + List Mixer2VectorElemNames = new ArrayList(); + Mixer2VectorElemNames.add("ThrottleCurve1"); + Mixer2VectorElemNames.add("ThrottleCurve2"); + Mixer2VectorElemNames.add("Roll"); + Mixer2VectorElemNames.add("Pitch"); + Mixer2VectorElemNames.add("Yaw"); + fields.add( new UAVObjectField("Mixer2Vector", "", UAVObjectField.FieldType.INT8, Mixer2VectorElemNames, null) ); + + List Mixer3TypeElemNames = new ArrayList(); + Mixer3TypeElemNames.add("0"); + List Mixer3TypeEnumOptions = new ArrayList(); + Mixer3TypeEnumOptions.add("Disabled"); + Mixer3TypeEnumOptions.add("Motor"); + Mixer3TypeEnumOptions.add("Servo"); + fields.add( new UAVObjectField("Mixer3Type", "", UAVObjectField.FieldType.ENUM, Mixer3TypeElemNames, Mixer3TypeEnumOptions) ); + + List Mixer3VectorElemNames = new ArrayList(); + Mixer3VectorElemNames.add("ThrottleCurve1"); + Mixer3VectorElemNames.add("ThrottleCurve2"); + Mixer3VectorElemNames.add("Roll"); + Mixer3VectorElemNames.add("Pitch"); + Mixer3VectorElemNames.add("Yaw"); + fields.add( new UAVObjectField("Mixer3Vector", "", UAVObjectField.FieldType.INT8, Mixer3VectorElemNames, null) ); + + List Mixer4TypeElemNames = new ArrayList(); + Mixer4TypeElemNames.add("0"); + List Mixer4TypeEnumOptions = new ArrayList(); + Mixer4TypeEnumOptions.add("Disabled"); + Mixer4TypeEnumOptions.add("Motor"); + Mixer4TypeEnumOptions.add("Servo"); + fields.add( new UAVObjectField("Mixer4Type", "", UAVObjectField.FieldType.ENUM, Mixer4TypeElemNames, Mixer4TypeEnumOptions) ); + + List Mixer4VectorElemNames = new ArrayList(); + Mixer4VectorElemNames.add("ThrottleCurve1"); + Mixer4VectorElemNames.add("ThrottleCurve2"); + Mixer4VectorElemNames.add("Roll"); + Mixer4VectorElemNames.add("Pitch"); + Mixer4VectorElemNames.add("Yaw"); + fields.add( new UAVObjectField("Mixer4Vector", "", UAVObjectField.FieldType.INT8, Mixer4VectorElemNames, null) ); + + List Mixer5TypeElemNames = new ArrayList(); + Mixer5TypeElemNames.add("0"); + List Mixer5TypeEnumOptions = new ArrayList(); + Mixer5TypeEnumOptions.add("Disabled"); + Mixer5TypeEnumOptions.add("Motor"); + Mixer5TypeEnumOptions.add("Servo"); + fields.add( new UAVObjectField("Mixer5Type", "", UAVObjectField.FieldType.ENUM, Mixer5TypeElemNames, Mixer5TypeEnumOptions) ); + + List Mixer5VectorElemNames = new ArrayList(); + Mixer5VectorElemNames.add("ThrottleCurve1"); + Mixer5VectorElemNames.add("ThrottleCurve2"); + Mixer5VectorElemNames.add("Roll"); + Mixer5VectorElemNames.add("Pitch"); + Mixer5VectorElemNames.add("Yaw"); + fields.add( new UAVObjectField("Mixer5Vector", "", UAVObjectField.FieldType.INT8, Mixer5VectorElemNames, null) ); + + List Mixer6TypeElemNames = new ArrayList(); + Mixer6TypeElemNames.add("0"); + List Mixer6TypeEnumOptions = new ArrayList(); + Mixer6TypeEnumOptions.add("Disabled"); + Mixer6TypeEnumOptions.add("Motor"); + Mixer6TypeEnumOptions.add("Servo"); + fields.add( new UAVObjectField("Mixer6Type", "", UAVObjectField.FieldType.ENUM, Mixer6TypeElemNames, Mixer6TypeEnumOptions) ); + + List Mixer6VectorElemNames = new ArrayList(); + Mixer6VectorElemNames.add("ThrottleCurve1"); + Mixer6VectorElemNames.add("ThrottleCurve2"); + Mixer6VectorElemNames.add("Roll"); + Mixer6VectorElemNames.add("Pitch"); + Mixer6VectorElemNames.add("Yaw"); + fields.add( new UAVObjectField("Mixer6Vector", "", UAVObjectField.FieldType.INT8, Mixer6VectorElemNames, null) ); + + List Mixer7TypeElemNames = new ArrayList(); + Mixer7TypeElemNames.add("0"); + List Mixer7TypeEnumOptions = new ArrayList(); + Mixer7TypeEnumOptions.add("Disabled"); + Mixer7TypeEnumOptions.add("Motor"); + Mixer7TypeEnumOptions.add("Servo"); + fields.add( new UAVObjectField("Mixer7Type", "", UAVObjectField.FieldType.ENUM, Mixer7TypeElemNames, Mixer7TypeEnumOptions) ); + + List Mixer7VectorElemNames = new ArrayList(); + Mixer7VectorElemNames.add("ThrottleCurve1"); + Mixer7VectorElemNames.add("ThrottleCurve2"); + Mixer7VectorElemNames.add("Roll"); + Mixer7VectorElemNames.add("Pitch"); + Mixer7VectorElemNames.add("Yaw"); + fields.add( new UAVObjectField("Mixer7Vector", "", UAVObjectField.FieldType.INT8, Mixer7VectorElemNames, null) ); + + List Mixer8TypeElemNames = new ArrayList(); + Mixer8TypeElemNames.add("0"); + List Mixer8TypeEnumOptions = new ArrayList(); + Mixer8TypeEnumOptions.add("Disabled"); + Mixer8TypeEnumOptions.add("Motor"); + Mixer8TypeEnumOptions.add("Servo"); + fields.add( new UAVObjectField("Mixer8Type", "", UAVObjectField.FieldType.ENUM, Mixer8TypeElemNames, Mixer8TypeEnumOptions) ); + + List Mixer8VectorElemNames = new ArrayList(); + Mixer8VectorElemNames.add("ThrottleCurve1"); + Mixer8VectorElemNames.add("ThrottleCurve2"); + Mixer8VectorElemNames.add("Roll"); + Mixer8VectorElemNames.add("Pitch"); + Mixer8VectorElemNames.add("Yaw"); + fields.add( new UAVObjectField("Mixer8Vector", "", UAVObjectField.FieldType.INT8, Mixer8VectorElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.TRUE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_ONCHANGE; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.TRUE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_ONCHANGE; + metadata.flightTelemetryUpdatePeriod = 0; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_NEVER; + 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("MaxAccel").setValue(1000); + getField("FeedForward").setValue(0); + getField("AccelTime").setValue(0); + getField("DecelTime").setValue(0); + getField("ThrottleCurve1").setValue(0,0); + getField("ThrottleCurve1").setValue(0.25,1); + getField("ThrottleCurve1").setValue(0.5,2); + getField("ThrottleCurve1").setValue(0.75,3); + getField("ThrottleCurve1").setValue(1,4); + getField("ThrottleCurve2").setValue(0,0); + getField("ThrottleCurve2").setValue(0.25,1); + getField("ThrottleCurve2").setValue(0.5,2); + getField("ThrottleCurve2").setValue(0.75,3); + getField("ThrottleCurve2").setValue(1,4); + getField("Mixer1Type").setValue(0); + getField("Mixer1Vector").setValue(0,0); + getField("Mixer1Vector").setValue(0,1); + getField("Mixer1Vector").setValue(0,2); + getField("Mixer1Vector").setValue(0,3); + getField("Mixer1Vector").setValue(0,4); + getField("Mixer2Type").setValue(0); + getField("Mixer2Vector").setValue(0,0); + getField("Mixer2Vector").setValue(0,1); + getField("Mixer2Vector").setValue(0,2); + getField("Mixer2Vector").setValue(0,3); + getField("Mixer2Vector").setValue(0,4); + getField("Mixer3Type").setValue(0); + getField("Mixer3Vector").setValue(0,0); + getField("Mixer3Vector").setValue(0,1); + getField("Mixer3Vector").setValue(0,2); + getField("Mixer3Vector").setValue(0,3); + getField("Mixer3Vector").setValue(0,4); + getField("Mixer4Type").setValue(0); + getField("Mixer4Vector").setValue(0,0); + getField("Mixer4Vector").setValue(0,1); + getField("Mixer4Vector").setValue(0,2); + getField("Mixer4Vector").setValue(0,3); + getField("Mixer4Vector").setValue(0,4); + getField("Mixer5Type").setValue(0); + getField("Mixer5Vector").setValue(0,0); + getField("Mixer5Vector").setValue(0,1); + getField("Mixer5Vector").setValue(0,2); + getField("Mixer5Vector").setValue(0,3); + getField("Mixer5Vector").setValue(0,4); + getField("Mixer6Type").setValue(0); + getField("Mixer6Vector").setValue(0,0); + getField("Mixer6Vector").setValue(0,1); + getField("Mixer6Vector").setValue(0,2); + getField("Mixer6Vector").setValue(0,3); + getField("Mixer6Vector").setValue(0,4); + getField("Mixer7Type").setValue(0); + getField("Mixer7Vector").setValue(0,0); + getField("Mixer7Vector").setValue(0,1); + getField("Mixer7Vector").setValue(0,2); + getField("Mixer7Vector").setValue(0,3); + getField("Mixer7Vector").setValue(0,4); + getField("Mixer8Type").setValue(0); + getField("Mixer8Vector").setValue(0,0); + getField("Mixer8Vector").setValue(0,1); + getField("Mixer8Vector").setValue(0,2); + getField("Mixer8Vector").setValue(0,3); + getField("Mixer8Vector").setValue(0,4); + + } + + /** + * 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(int instID) { + // TODO: Need to get specific instance to clone + try { + MixerSettings obj = new MixerSettings(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public MixerSettings GetInstance(UAVObjectManager objMngr, int instID) + { + return (MixerSettings)(objMngr.getObject(MixerSettings.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x4FAE374E; + protected static final String NAME = "MixerSettings"; + 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 == 1; + protected static final boolean ISSETTINGS = 1 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/MixerStatus.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/MixerStatus.java new file mode 100644 index 000000000..fbd405b40 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/MixerStatus.java @@ -0,0 +1,167 @@ +/** + ****************************************************************************** + * + * @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. + * Status for the matrix mixer showing the output of each mixer after all scaling + * + * @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; + +/** +Status for the matrix mixer showing the output of each mixer after all scaling + +generated from mixerstatus.xml + **/ +public class MixerStatus extends UAVDataObject { + + public MixerStatus() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List Mixer1ElemNames = new ArrayList(); + Mixer1ElemNames.add("0"); + fields.add( new UAVObjectField("Mixer1", "", UAVObjectField.FieldType.FLOAT32, Mixer1ElemNames, null) ); + + List Mixer2ElemNames = new ArrayList(); + Mixer2ElemNames.add("0"); + fields.add( new UAVObjectField("Mixer2", "", UAVObjectField.FieldType.FLOAT32, Mixer2ElemNames, null) ); + + List Mixer3ElemNames = new ArrayList(); + Mixer3ElemNames.add("0"); + fields.add( new UAVObjectField("Mixer3", "", UAVObjectField.FieldType.FLOAT32, Mixer3ElemNames, null) ); + + List Mixer4ElemNames = new ArrayList(); + Mixer4ElemNames.add("0"); + fields.add( new UAVObjectField("Mixer4", "", UAVObjectField.FieldType.FLOAT32, Mixer4ElemNames, null) ); + + List Mixer5ElemNames = new ArrayList(); + Mixer5ElemNames.add("0"); + fields.add( new UAVObjectField("Mixer5", "", UAVObjectField.FieldType.FLOAT32, Mixer5ElemNames, null) ); + + List Mixer6ElemNames = new ArrayList(); + Mixer6ElemNames.add("0"); + fields.add( new UAVObjectField("Mixer6", "", UAVObjectField.FieldType.FLOAT32, Mixer6ElemNames, null) ); + + List Mixer7ElemNames = new ArrayList(); + Mixer7ElemNames.add("0"); + fields.add( new UAVObjectField("Mixer7", "", UAVObjectField.FieldType.FLOAT32, Mixer7ElemNames, null) ); + + List Mixer8ElemNames = new ArrayList(); + Mixer8ElemNames.add("0"); + fields.add( new UAVObjectField("Mixer8", "", UAVObjectField.FieldType.FLOAT32, Mixer8ElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.FALSE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.FALSE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.flightTelemetryUpdatePeriod = 1000; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + 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(int instID) { + // TODO: Need to get specific instance to clone + try { + MixerStatus obj = new MixerStatus(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public MixerStatus GetInstance(UAVObjectManager objMngr, int instID) + { + return (MixerStatus)(objMngr.getObject(MixerStatus.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0xF6A33F10; + protected static final String NAME = "MixerStatus"; + protected static String DESCRIPTION = "Status for the matrix mixer showing the output of each mixer after all scaling"; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 0 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/NedAccel.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/NedAccel.java new file mode 100644 index 000000000..f16ddd199 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/NedAccel.java @@ -0,0 +1,147 @@ +/** + ****************************************************************************** + * + * @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 projection of acceleration in the NED reference frame used by @ref Guidance. + * + * @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 projection of acceleration in the NED reference frame used by @ref Guidance. + +generated from nedaccel.xml + **/ +public class NedAccel extends UAVDataObject { + + public NedAccel() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List NorthElemNames = new ArrayList(); + NorthElemNames.add("0"); + fields.add( new UAVObjectField("North", "cm/s^2", UAVObjectField.FieldType.FLOAT32, NorthElemNames, null) ); + + List EastElemNames = new ArrayList(); + EastElemNames.add("0"); + fields.add( new UAVObjectField("East", "cm/s^2", UAVObjectField.FieldType.FLOAT32, EastElemNames, null) ); + + List DownElemNames = new ArrayList(); + DownElemNames.add("0"); + fields.add( new UAVObjectField("Down", "cm/s^2", UAVObjectField.FieldType.FLOAT32, DownElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.FALSE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.FALSE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.flightTelemetryUpdatePeriod = 10001; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_NEVER; + 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(int instID) { + // TODO: Need to get specific instance to clone + try { + NedAccel obj = new NedAccel(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public NedAccel GetInstance(UAVObjectManager objMngr, int instID) + { + return (NedAccel)(objMngr.getObject(NedAccel.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x8E852CE8; + protected static final String NAME = "NedAccel"; + protected static String DESCRIPTION = "The projection of acceleration in the NED reference frame used by @ref Guidance."; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 0 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/ObjectPersistence.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/ObjectPersistence.java new file mode 100644 index 000000000..2a09c2b40 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/ObjectPersistence.java @@ -0,0 +1,160 @@ +/** + ****************************************************************************** + * + * @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. + * Someone who knows please enter this + * + * @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; + +/** +Someone who knows please enter this + +generated from objectpersistence.xml + **/ +public class ObjectPersistence extends UAVDataObject { + + public ObjectPersistence() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List OperationElemNames = new ArrayList(); + OperationElemNames.add("0"); + List OperationEnumOptions = new ArrayList(); + OperationEnumOptions.add("Load"); + OperationEnumOptions.add("Save"); + OperationEnumOptions.add("Delete"); + fields.add( new UAVObjectField("Operation", "", UAVObjectField.FieldType.ENUM, OperationElemNames, OperationEnumOptions) ); + + List SelectionElemNames = new ArrayList(); + SelectionElemNames.add("0"); + List SelectionEnumOptions = new ArrayList(); + SelectionEnumOptions.add("SingleObject"); + SelectionEnumOptions.add("AllSettings"); + SelectionEnumOptions.add("AllMetaObjects"); + SelectionEnumOptions.add("AllObjects"); + fields.add( new UAVObjectField("Selection", "", UAVObjectField.FieldType.ENUM, SelectionElemNames, SelectionEnumOptions) ); + + List ObjectIDElemNames = new ArrayList(); + ObjectIDElemNames.add("0"); + fields.add( new UAVObjectField("ObjectID", "", UAVObjectField.FieldType.UINT32, ObjectIDElemNames, null) ); + + List InstanceIDElemNames = new ArrayList(); + InstanceIDElemNames.add("0"); + fields.add( new UAVObjectField("InstanceID", "", UAVObjectField.FieldType.UINT32, InstanceIDElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.TRUE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.TRUE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.flightTelemetryUpdatePeriod = 0; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_NEVER; + 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(int instID) { + // TODO: Need to get specific instance to clone + try { + ObjectPersistence obj = new ObjectPersistence(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public ObjectPersistence GetInstance(UAVObjectManager objMngr, int instID) + { + return (ObjectPersistence)(objMngr.getObject(ObjectPersistence.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x22216832; + protected static final String NAME = "ObjectPersistence"; + protected static String DESCRIPTION = "Someone who knows please enter this"; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 0 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/PositionActual.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/PositionActual.java new file mode 100644 index 000000000..444009f90 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/PositionActual.java @@ -0,0 +1,147 @@ +/** + ****************************************************************************** + * + * @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. + * Contains the current position relative to @ref HomeLocation + * + * @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; + +/** +Contains the current position relative to @ref HomeLocation + +generated from positionactual.xml + **/ +public class PositionActual extends UAVDataObject { + + public PositionActual() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List NorthElemNames = new ArrayList(); + NorthElemNames.add("0"); + fields.add( new UAVObjectField("North", "cm", UAVObjectField.FieldType.INT32, NorthElemNames, null) ); + + List EastElemNames = new ArrayList(); + EastElemNames.add("0"); + fields.add( new UAVObjectField("East", "cm", UAVObjectField.FieldType.INT32, EastElemNames, null) ); + + List DownElemNames = new ArrayList(); + DownElemNames.add("0"); + fields.add( new UAVObjectField("Down", "cm", UAVObjectField.FieldType.INT32, DownElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.FALSE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.FALSE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.flightTelemetryUpdatePeriod = 1000; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + 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(int instID) { + // TODO: Need to get specific instance to clone + try { + PositionActual obj = new PositionActual(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public PositionActual GetInstance(UAVObjectManager objMngr, int instID) + { + return (PositionActual)(objMngr.getObject(PositionActual.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0xE0739636; + protected static final String NAME = "PositionActual"; + protected static String DESCRIPTION = "Contains the current position relative to @ref HomeLocation"; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 0 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/PositionDesired.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/PositionDesired.java new file mode 100644 index 000000000..5cf51df71 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/PositionDesired.java @@ -0,0 +1,147 @@ +/** + ****************************************************************************** + * + * @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 position the craft is trying t achieve. Can come from GCS or @ref PathPlanner + * + * @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 position the craft is trying t achieve. Can come from GCS or @ref PathPlanner + +generated from positiondesired.xml + **/ +public class PositionDesired extends UAVDataObject { + + public PositionDesired() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List NorthElemNames = new ArrayList(); + NorthElemNames.add("0"); + fields.add( new UAVObjectField("North", "cm", UAVObjectField.FieldType.INT32, NorthElemNames, null) ); + + List EastElemNames = new ArrayList(); + EastElemNames.add("0"); + fields.add( new UAVObjectField("East", "cm", UAVObjectField.FieldType.INT32, EastElemNames, null) ); + + List DownElemNames = new ArrayList(); + DownElemNames.add("0"); + fields.add( new UAVObjectField("Down", "cm", UAVObjectField.FieldType.INT32, DownElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.FALSE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.FALSE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_ONCHANGE; + metadata.flightTelemetryUpdatePeriod = 0; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + 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(int instID) { + // TODO: Need to get specific instance to clone + try { + PositionDesired obj = new PositionDesired(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public PositionDesired GetInstance(UAVObjectManager objMngr, int instID) + { + return (PositionDesired)(objMngr.getObject(PositionDesired.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x2FC4E5BA; + protected static final String NAME = "PositionDesired"; + protected static String DESCRIPTION = "The position the craft is trying t achieve. Can come from GCS or @ref PathPlanner "; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 0 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/RateDesired.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/RateDesired.java new file mode 100644 index 000000000..7164c0957 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/RateDesired.java @@ -0,0 +1,147 @@ +/** + ****************************************************************************** + * + * @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. + * Status for the matrix mixer showing the output of each mixer after all scaling + * + * @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; + +/** +Status for the matrix mixer showing the output of each mixer after all scaling + +generated from ratedesired.xml + **/ +public class RateDesired extends UAVDataObject { + + public RateDesired() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List RollElemNames = new ArrayList(); + RollElemNames.add("0"); + fields.add( new UAVObjectField("Roll", "deg/s", UAVObjectField.FieldType.FLOAT32, RollElemNames, null) ); + + List PitchElemNames = new ArrayList(); + PitchElemNames.add("0"); + fields.add( new UAVObjectField("Pitch", "deg/s", UAVObjectField.FieldType.FLOAT32, PitchElemNames, null) ); + + List YawElemNames = new ArrayList(); + YawElemNames.add("0"); + fields.add( new UAVObjectField("Yaw", "deg/s", UAVObjectField.FieldType.FLOAT32, YawElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.FALSE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.FALSE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.flightTelemetryUpdatePeriod = 1000; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + 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(int instID) { + // TODO: Need to get specific instance to clone + try { + RateDesired obj = new RateDesired(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public RateDesired GetInstance(UAVObjectManager objMngr, int instID) + { + return (RateDesired)(objMngr.getObject(RateDesired.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0xBA41B51C; + protected static final String NAME = "RateDesired"; + protected static String DESCRIPTION = "Status for the matrix mixer showing the output of each mixer after all scaling"; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 0 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/SonarAltitude.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/SonarAltitude.java new file mode 100644 index 000000000..4e9f0b8b8 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/SonarAltitude.java @@ -0,0 +1,139 @@ +/** + ****************************************************************************** + * + * @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 raw data from the ultrasound sonar sensor with altitude estimate. + * + * @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 raw data from the ultrasound sonar sensor with altitude estimate. + +generated from sonaraltitude.xml + **/ +public class SonarAltitude extends UAVDataObject { + + public SonarAltitude() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List AltitudeElemNames = new ArrayList(); + AltitudeElemNames.add("0"); + fields.add( new UAVObjectField("Altitude", "m", UAVObjectField.FieldType.FLOAT32, AltitudeElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.FALSE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.FALSE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.flightTelemetryUpdatePeriod = 1000; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_NEVER; + 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(int instID) { + // TODO: Need to get specific instance to clone + try { + SonarAltitude obj = new SonarAltitude(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public SonarAltitude GetInstance(UAVObjectManager objMngr, int instID) + { + return (SonarAltitude)(objMngr.getObject(SonarAltitude.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x1FDD844C; + protected static final String NAME = "SonarAltitude"; + protected static String DESCRIPTION = "The raw data from the ultrasound sonar sensor with altitude estimate."; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 0 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/StabilizationDesired.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/StabilizationDesired.java new file mode 100644 index 000000000..8cba8a54c --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/StabilizationDesired.java @@ -0,0 +1,161 @@ +/** + ****************************************************************************** + * + * @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 desired attitude that @ref StabilizationModule will try and achieve if FlightMode is Stabilized. Comes from @ref ManaulControlModule. + * + * @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 desired attitude that @ref StabilizationModule will try and achieve if FlightMode is Stabilized. Comes from @ref ManaulControlModule. + +generated from stabilizationdesired.xml + **/ +public class StabilizationDesired extends UAVDataObject { + + public StabilizationDesired() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List RollElemNames = new ArrayList(); + RollElemNames.add("0"); + fields.add( new UAVObjectField("Roll", "degrees", UAVObjectField.FieldType.FLOAT32, RollElemNames, null) ); + + List PitchElemNames = new ArrayList(); + PitchElemNames.add("0"); + fields.add( new UAVObjectField("Pitch", "degrees", UAVObjectField.FieldType.FLOAT32, PitchElemNames, null) ); + + List YawElemNames = new ArrayList(); + YawElemNames.add("0"); + fields.add( new UAVObjectField("Yaw", "degrees", UAVObjectField.FieldType.FLOAT32, YawElemNames, null) ); + + List ThrottleElemNames = new ArrayList(); + ThrottleElemNames.add("0"); + fields.add( new UAVObjectField("Throttle", "%", UAVObjectField.FieldType.FLOAT32, ThrottleElemNames, null) ); + + List StabilizationModeElemNames = new ArrayList(); + StabilizationModeElemNames.add("Roll"); + StabilizationModeElemNames.add("Pitch"); + StabilizationModeElemNames.add("Yaw"); + List StabilizationModeEnumOptions = new ArrayList(); + StabilizationModeEnumOptions.add("None"); + StabilizationModeEnumOptions.add("Rate"); + StabilizationModeEnumOptions.add("Attitude"); + fields.add( new UAVObjectField("StabilizationMode", "", UAVObjectField.FieldType.ENUM, StabilizationModeElemNames, StabilizationModeEnumOptions) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.FALSE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.FALSE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.flightTelemetryUpdatePeriod = 1000; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_NEVER; + 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(int instID) { + // TODO: Need to get specific instance to clone + try { + StabilizationDesired obj = new StabilizationDesired(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public StabilizationDesired GetInstance(UAVObjectManager objMngr, int instID) + { + return (StabilizationDesired)(objMngr.getObject(StabilizationDesired.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x41AA9DC2; + 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 == 1; + protected static final boolean ISSETTINGS = 0 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/StabilizationSettings.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/StabilizationSettings.java new file mode 100644 index 000000000..74c480e1c --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/StabilizationSettings.java @@ -0,0 +1,222 @@ +/** + ****************************************************************************** + * + * @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. + * PID settings used by the Stabilization module to combine the @ref AttitudeActual and @ref AttitudeDesired to compute @ref ActuatorDesired + * + * @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; + +/** +PID settings used by the Stabilization module to combine the @ref AttitudeActual and @ref AttitudeDesired to compute @ref ActuatorDesired + +generated from stabilizationsettings.xml + **/ +public class StabilizationSettings extends UAVDataObject { + + public StabilizationSettings() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List RollMaxElemNames = new ArrayList(); + RollMaxElemNames.add("0"); + fields.add( new UAVObjectField("RollMax", "degrees", UAVObjectField.FieldType.UINT8, RollMaxElemNames, null) ); + + List PitchMaxElemNames = new ArrayList(); + PitchMaxElemNames.add("0"); + fields.add( new UAVObjectField("PitchMax", "degrees", UAVObjectField.FieldType.UINT8, PitchMaxElemNames, null) ); + + List YawMaxElemNames = new ArrayList(); + YawMaxElemNames.add("0"); + fields.add( new UAVObjectField("YawMax", "degrees", UAVObjectField.FieldType.UINT8, YawMaxElemNames, null) ); + + List ManualRateElemNames = new ArrayList(); + ManualRateElemNames.add("Roll"); + ManualRateElemNames.add("Pitch"); + ManualRateElemNames.add("Yaw"); + fields.add( new UAVObjectField("ManualRate", "degrees/sec", UAVObjectField.FieldType.FLOAT32, ManualRateElemNames, null) ); + + List MaximumRateElemNames = new ArrayList(); + MaximumRateElemNames.add("Roll"); + MaximumRateElemNames.add("Pitch"); + MaximumRateElemNames.add("Yaw"); + fields.add( new UAVObjectField("MaximumRate", "degrees/sec", UAVObjectField.FieldType.FLOAT32, MaximumRateElemNames, null) ); + + List RollRatePIElemNames = new ArrayList(); + RollRatePIElemNames.add("Kp"); + RollRatePIElemNames.add("Ki"); + RollRatePIElemNames.add("ILimit"); + fields.add( new UAVObjectField("RollRatePI", "", UAVObjectField.FieldType.FLOAT32, RollRatePIElemNames, null) ); + + List PitchRatePIElemNames = new ArrayList(); + PitchRatePIElemNames.add("Kp"); + PitchRatePIElemNames.add("Ki"); + PitchRatePIElemNames.add("ILimit"); + fields.add( new UAVObjectField("PitchRatePI", "", UAVObjectField.FieldType.FLOAT32, PitchRatePIElemNames, null) ); + + List YawRatePIElemNames = new ArrayList(); + YawRatePIElemNames.add("Kp"); + YawRatePIElemNames.add("Ki"); + YawRatePIElemNames.add("ILimit"); + fields.add( new UAVObjectField("YawRatePI", "", UAVObjectField.FieldType.FLOAT32, YawRatePIElemNames, null) ); + + List RollPIElemNames = new ArrayList(); + RollPIElemNames.add("Kp"); + RollPIElemNames.add("Ki"); + RollPIElemNames.add("ILimit"); + fields.add( new UAVObjectField("RollPI", "", UAVObjectField.FieldType.FLOAT32, RollPIElemNames, null) ); + + List PitchPIElemNames = new ArrayList(); + PitchPIElemNames.add("Kp"); + PitchPIElemNames.add("Ki"); + PitchPIElemNames.add("ILimit"); + fields.add( new UAVObjectField("PitchPI", "", UAVObjectField.FieldType.FLOAT32, PitchPIElemNames, null) ); + + List YawPIElemNames = new ArrayList(); + YawPIElemNames.add("Kp"); + YawPIElemNames.add("Ki"); + YawPIElemNames.add("ILimit"); + fields.add( new UAVObjectField("YawPI", "", UAVObjectField.FieldType.FLOAT32, YawPIElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.TRUE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_ONCHANGE; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.TRUE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_ONCHANGE; + metadata.flightTelemetryUpdatePeriod = 0; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_NEVER; + 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("RollMax").setValue(35); + getField("PitchMax").setValue(35); + getField("YawMax").setValue(35); + getField("ManualRate").setValue(150,0); + getField("ManualRate").setValue(150,1); + getField("ManualRate").setValue(150,2); + getField("MaximumRate").setValue(300,0); + getField("MaximumRate").setValue(300,1); + getField("MaximumRate").setValue(300,2); + getField("RollRatePI").setValue(0.0015,0); + getField("RollRatePI").setValue(0,1); + getField("RollRatePI").setValue(0.3,2); + getField("PitchRatePI").setValue(0.0015,0); + getField("PitchRatePI").setValue(0,1); + getField("PitchRatePI").setValue(0.3,2); + getField("YawRatePI").setValue(0.003,0); + getField("YawRatePI").setValue(0,1); + getField("YawRatePI").setValue(0.3,2); + getField("RollPI").setValue(2,0); + getField("RollPI").setValue(0,1); + getField("RollPI").setValue(50,2); + getField("PitchPI").setValue(2,0); + getField("PitchPI").setValue(0,1); + getField("PitchPI").setValue(50,2); + getField("YawPI").setValue(2,0); + getField("YawPI").setValue(0,1); + getField("YawPI").setValue(50,2); + + } + + /** + * 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(int instID) { + // TODO: Need to get specific instance to clone + try { + StabilizationSettings obj = new StabilizationSettings(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public StabilizationSettings GetInstance(UAVObjectManager objMngr, int instID) + { + return (StabilizationSettings)(objMngr.getObject(StabilizationSettings.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0xE2147404; + 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 == 1; + protected static final boolean ISSETTINGS = 1 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/SystemAlarms.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/SystemAlarms.java new file mode 100644 index 000000000..9136627f4 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/SystemAlarms.java @@ -0,0 +1,176 @@ +/** + ****************************************************************************** + * + * @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. + * Alarms from OpenPilot to indicate failure conditions or warnings. Set by various modules. + * + * @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; + +/** +Alarms from OpenPilot to indicate failure conditions or warnings. Set by various modules. + +generated from systemalarms.xml + **/ +public class SystemAlarms extends UAVDataObject { + + public SystemAlarms() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List AlarmElemNames = new ArrayList(); + AlarmElemNames.add("OutOfMemory"); + AlarmElemNames.add("StackOverflow"); + AlarmElemNames.add("CPUOverload"); + AlarmElemNames.add("EventSystem"); + AlarmElemNames.add("SDCard"); + AlarmElemNames.add("Telemetry"); + AlarmElemNames.add("ManualControl"); + AlarmElemNames.add("Actuator"); + AlarmElemNames.add("Attitude"); + AlarmElemNames.add("Stabilization"); + AlarmElemNames.add("Guidance"); + AlarmElemNames.add("AHRSComms"); + AlarmElemNames.add("Battery"); + AlarmElemNames.add("FlightTime"); + AlarmElemNames.add("I2C"); + AlarmElemNames.add("GPS"); + List AlarmEnumOptions = new ArrayList(); + AlarmEnumOptions.add("Uninitialised"); + AlarmEnumOptions.add("OK"); + AlarmEnumOptions.add("Warning"); + AlarmEnumOptions.add("Error"); + AlarmEnumOptions.add("Critical"); + fields.add( new UAVObjectField("Alarm", "", UAVObjectField.FieldType.ENUM, AlarmElemNames, AlarmEnumOptions) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.TRUE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_ONCHANGE; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.TRUE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.flightTelemetryUpdatePeriod = 4000; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + 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() + { + getField("Alarm").setValue(0,0); + getField("Alarm").setValue(0,1); + getField("Alarm").setValue(0,2); + getField("Alarm").setValue(0,3); + getField("Alarm").setValue(0,4); + getField("Alarm").setValue(0,5); + getField("Alarm").setValue(0,6); + getField("Alarm").setValue(0,7); + getField("Alarm").setValue(0,8); + getField("Alarm").setValue(0,9); + getField("Alarm").setValue(0,10); + getField("Alarm").setValue(0,11); + getField("Alarm").setValue(0,12); + getField("Alarm").setValue(0,13); + getField("Alarm").setValue(0,14); + getField("Alarm").setValue(0,15); + + } + + /** + * 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(int instID) { + // TODO: Need to get specific instance to clone + try { + SystemAlarms obj = new SystemAlarms(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public SystemAlarms GetInstance(UAVObjectManager objMngr, int instID) + { + return (SystemAlarms)(objMngr.getObject(SystemAlarms.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x89C3DCB2; + protected static final String NAME = "SystemAlarms"; + protected static String DESCRIPTION = "Alarms from OpenPilot to indicate failure conditions or warnings. Set by various modules."; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 0 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/SystemSettings.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/SystemSettings.java new file mode 100644 index 000000000..d01b55b24 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/SystemSettings.java @@ -0,0 +1,157 @@ +/** + ****************************************************************************** + * + * @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. + * Select airframe type. Currently used by @ref ActuatorModule to choose mixing from @ref ActuatorDesired to @ref ActuatorCommand + * + * @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; + +/** +Select airframe type. Currently used by @ref ActuatorModule to choose mixing from @ref ActuatorDesired to @ref ActuatorCommand + +generated from systemsettings.xml + **/ +public class SystemSettings extends UAVDataObject { + + public SystemSettings() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List AirframeTypeElemNames = new ArrayList(); + AirframeTypeElemNames.add("0"); + List AirframeTypeEnumOptions = new ArrayList(); + AirframeTypeEnumOptions.add("FixedWing"); + AirframeTypeEnumOptions.add("FixedWingElevon"); + AirframeTypeEnumOptions.add("FixedWingVtail"); + AirframeTypeEnumOptions.add("VTOL"); + AirframeTypeEnumOptions.add("HeliCP"); + AirframeTypeEnumOptions.add("QuadX"); + AirframeTypeEnumOptions.add("QuadP"); + AirframeTypeEnumOptions.add("Hexa"); + AirframeTypeEnumOptions.add("Octo"); + AirframeTypeEnumOptions.add("Custom"); + AirframeTypeEnumOptions.add("HexaX"); + AirframeTypeEnumOptions.add("OctoV"); + AirframeTypeEnumOptions.add("OctoCoaxP"); + AirframeTypeEnumOptions.add("OctoCoaxX"); + AirframeTypeEnumOptions.add("HexaCoax"); + AirframeTypeEnumOptions.add("Tri"); + fields.add( new UAVObjectField("AirframeType", "", UAVObjectField.FieldType.ENUM, AirframeTypeElemNames, AirframeTypeEnumOptions) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.TRUE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_ONCHANGE; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.TRUE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_ONCHANGE; + metadata.flightTelemetryUpdatePeriod = 0; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_NEVER; + 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("AirframeType").setValue(0); + + } + + /** + * 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(int instID) { + // TODO: Need to get specific instance to clone + try { + SystemSettings obj = new SystemSettings(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public SystemSettings GetInstance(UAVObjectManager objMngr, int instID) + { + return (SystemSettings)(objMngr.getObject(SystemSettings.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x3875CEE; + protected static final String NAME = "SystemSettings"; + protected static String DESCRIPTION = "Select airframe type. Currently used by @ref ActuatorModule to choose mixing from @ref ActuatorDesired to @ref ActuatorCommand"; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 1 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/SystemStats.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/SystemStats.java new file mode 100644 index 000000000..7c34360e9 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/SystemStats.java @@ -0,0 +1,151 @@ +/** + ****************************************************************************** + * + * @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. + * CPU and memory usage from OpenPilot computer. + * + * @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; + +/** +CPU and memory usage from OpenPilot computer. + +generated from systemstats.xml + **/ +public class SystemStats extends UAVDataObject { + + public SystemStats() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List FlightTimeElemNames = new ArrayList(); + FlightTimeElemNames.add("0"); + fields.add( new UAVObjectField("FlightTime", "ms", UAVObjectField.FieldType.UINT32, FlightTimeElemNames, null) ); + + List HeapRemainingElemNames = new ArrayList(); + HeapRemainingElemNames.add("0"); + fields.add( new UAVObjectField("HeapRemaining", "bytes", UAVObjectField.FieldType.UINT16, HeapRemainingElemNames, null) ); + + List CPULoadElemNames = new ArrayList(); + CPULoadElemNames.add("0"); + fields.add( new UAVObjectField("CPULoad", "%", UAVObjectField.FieldType.UINT8, CPULoadElemNames, null) ); + + List CPUTempElemNames = new ArrayList(); + CPUTempElemNames.add("0"); + fields.add( new UAVObjectField("CPUTemp", "C", UAVObjectField.FieldType.INT8, CPUTempElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.FALSE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.FALSE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.flightTelemetryUpdatePeriod = 1000; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + 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(int instID) { + // TODO: Need to get specific instance to clone + try { + SystemStats obj = new SystemStats(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public SystemStats GetInstance(UAVObjectManager objMngr, int instID) + { + return (SystemStats)(objMngr.getObject(SystemStats.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0xAA26FFFA; + protected static final String NAME = "SystemStats"; + protected static String DESCRIPTION = "CPU and memory usage from OpenPilot computer. "; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 0 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/TaskInfo.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/TaskInfo.java new file mode 100644 index 000000000..3ad065b5c --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/TaskInfo.java @@ -0,0 +1,170 @@ +/** + ****************************************************************************** + * + * @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. + * Task information + * + * @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; + +/** +Task information + +generated from taskinfo.xml + **/ +public class TaskInfo extends UAVDataObject { + + public TaskInfo() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List StackRemainingElemNames = new ArrayList(); + StackRemainingElemNames.add("System"); + StackRemainingElemNames.add("Actuator"); + StackRemainingElemNames.add("Attitude"); + StackRemainingElemNames.add("TelemetryTx"); + StackRemainingElemNames.add("TelemetryTxPri"); + StackRemainingElemNames.add("TelemetryRx"); + StackRemainingElemNames.add("GPS"); + StackRemainingElemNames.add("ManualControl"); + StackRemainingElemNames.add("Altitude"); + StackRemainingElemNames.add("AHRSComms"); + StackRemainingElemNames.add("Stabilization"); + StackRemainingElemNames.add("Guidance"); + StackRemainingElemNames.add("FlightPlan"); + fields.add( new UAVObjectField("StackRemaining", "bytes", UAVObjectField.FieldType.UINT16, StackRemainingElemNames, null) ); + + List RunningElemNames = new ArrayList(); + RunningElemNames.add("System"); + RunningElemNames.add("Actuator"); + RunningElemNames.add("Attitude"); + RunningElemNames.add("TelemetryTx"); + RunningElemNames.add("TelemetryTxPri"); + RunningElemNames.add("TelemetryRx"); + RunningElemNames.add("GPS"); + RunningElemNames.add("ManualControl"); + RunningElemNames.add("Altitude"); + RunningElemNames.add("AHRSComms"); + RunningElemNames.add("Stabilization"); + RunningElemNames.add("Guidance"); + RunningElemNames.add("FlightPlan"); + List RunningEnumOptions = new ArrayList(); + RunningEnumOptions.add("False"); + RunningEnumOptions.add("True"); + fields.add( new UAVObjectField("Running", "bool", UAVObjectField.FieldType.ENUM, RunningElemNames, RunningEnumOptions) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.TRUE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_ONCHANGE; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.TRUE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.flightTelemetryUpdatePeriod = 10000; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + 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(int instID) { + // TODO: Need to get specific instance to clone + try { + TaskInfo obj = new TaskInfo(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public TaskInfo GetInstance(UAVObjectManager objMngr, int instID) + { + return (TaskInfo)(objMngr.getObject(TaskInfo.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x50F599F0; + protected static final String NAME = "TaskInfo"; + protected static String DESCRIPTION = "Task information"; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 0 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/TelemetrySettings.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/TelemetrySettings.java new file mode 100644 index 000000000..6995a02b0 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/TelemetrySettings.java @@ -0,0 +1,148 @@ +/** + ****************************************************************************** + * + * @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. + * Select baud rate of telemetry. Warning - this must match your modem. + * + * @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; + +/** +Select baud rate of telemetry. Warning - this must match your modem. + +generated from telemetrysettings.xml + **/ +public class TelemetrySettings extends UAVDataObject { + + public TelemetrySettings() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List SpeedElemNames = new ArrayList(); + SpeedElemNames.add("0"); + List SpeedEnumOptions = new ArrayList(); + SpeedEnumOptions.add("2400"); + SpeedEnumOptions.add("4800"); + SpeedEnumOptions.add("9600"); + SpeedEnumOptions.add("19200"); + SpeedEnumOptions.add("38400"); + SpeedEnumOptions.add("57600"); + SpeedEnumOptions.add("115200"); + fields.add( new UAVObjectField("Speed", "", UAVObjectField.FieldType.ENUM, SpeedElemNames, SpeedEnumOptions) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.TRUE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_ONCHANGE; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.TRUE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_ONCHANGE; + metadata.flightTelemetryUpdatePeriod = 0; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_NEVER; + 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("Speed").setValue(5); + + } + + /** + * 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(int instID) { + // TODO: Need to get specific instance to clone + try { + TelemetrySettings obj = new TelemetrySettings(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public TelemetrySettings GetInstance(UAVObjectManager objMngr, int instID) + { + return (TelemetrySettings)(objMngr.getObject(TelemetrySettings.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0xA608C526; + protected static final String NAME = "TelemetrySettings"; + protected static String DESCRIPTION = "Select baud rate of telemetry. Warning - this must match your modem."; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 1 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/UAVObjectsInitialize.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/UAVObjectsInitialize.java new file mode 100644 index 000000000..4eca6ea82 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/UAVObjectsInitialize.java @@ -0,0 +1,87 @@ +/** + ****************************************************************************** + * + * + * @file uavobjectsinittemplate.java + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief the template for the uavobjects init part + * $(GENERATEDWARNING) + * + * @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 org.openpilot.uavtalk.uavobjects.*; +import org.openpilot.uavtalk.UAVObjectManager; + +public class UAVObjectsInitialize { + + public static void register(UAVObjectManager objMngr) { + try { + objMngr.registerObject( new ActuatorCommand() ); + objMngr.registerObject( new ActuatorDesired() ); + objMngr.registerObject( new ActuatorSettings() ); + objMngr.registerObject( new AHRSCalibration() ); + objMngr.registerObject( new AHRSSettings() ); + objMngr.registerObject( new AhrsStatus() ); + objMngr.registerObject( new AttitudeActual() ); + objMngr.registerObject( new AttitudeRaw() ); + objMngr.registerObject( new AttitudeSettings() ); + objMngr.registerObject( new BaroAltitude() ); + objMngr.registerObject( new BatterySettings() ); + objMngr.registerObject( new FirmwareIAPObj() ); + objMngr.registerObject( new FlightBatteryState() ); + objMngr.registerObject( new FlightPlanControl() ); + objMngr.registerObject( new FlightPlanSettings() ); + objMngr.registerObject( new FlightPlanStatus() ); + objMngr.registerObject( new FlightTelemetryStats() ); + objMngr.registerObject( new GCSTelemetryStats() ); + objMngr.registerObject( new GPSPosition() ); + objMngr.registerObject( new GPSSatellites() ); + objMngr.registerObject( new GPSTime() ); + objMngr.registerObject( new GuidanceSettings() ); + objMngr.registerObject( new HomeLocation() ); + objMngr.registerObject( new I2CStats() ); + objMngr.registerObject( new ManualControlCommand() ); + objMngr.registerObject( new ManualControlSettings() ); + objMngr.registerObject( new MixerSettings() ); + objMngr.registerObject( new MixerStatus() ); + objMngr.registerObject( new NedAccel() ); + objMngr.registerObject( new ObjectPersistence() ); + objMngr.registerObject( new PositionActual() ); + objMngr.registerObject( new PositionDesired() ); + objMngr.registerObject( new RateDesired() ); + objMngr.registerObject( new SonarAltitude() ); + objMngr.registerObject( new StabilizationDesired() ); + objMngr.registerObject( new StabilizationSettings() ); + objMngr.registerObject( new SystemAlarms() ); + objMngr.registerObject( new SystemSettings() ); + objMngr.registerObject( new SystemStats() ); + objMngr.registerObject( new TaskInfo() ); + objMngr.registerObject( new TelemetrySettings() ); + objMngr.registerObject( new VelocityActual() ); + objMngr.registerObject( new VelocityDesired() ); + objMngr.registerObject( new WatchdogStatus() ); + + } catch (Exception e) { + e.printStackTrace(); + } + } +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/VelocityActual.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/VelocityActual.java new file mode 100644 index 000000000..649e6c122 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/VelocityActual.java @@ -0,0 +1,147 @@ +/** + ****************************************************************************** + * + * @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. + * Updated by @ref AHRSCommsModule and used within @ref GuidanceModule for velocity control + * + * @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; + +/** +Updated by @ref AHRSCommsModule and used within @ref GuidanceModule for velocity control + +generated from velocityactual.xml + **/ +public class VelocityActual extends UAVDataObject { + + public VelocityActual() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List NorthElemNames = new ArrayList(); + NorthElemNames.add("0"); + fields.add( new UAVObjectField("North", "cm/s", UAVObjectField.FieldType.INT32, NorthElemNames, null) ); + + List EastElemNames = new ArrayList(); + EastElemNames.add("0"); + fields.add( new UAVObjectField("East", "cm/s", UAVObjectField.FieldType.INT32, EastElemNames, null) ); + + List DownElemNames = new ArrayList(); + DownElemNames.add("0"); + fields.add( new UAVObjectField("Down", "cm/s", UAVObjectField.FieldType.INT32, DownElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.FALSE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.FALSE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.flightTelemetryUpdatePeriod = 1000; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + 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(int instID) { + // TODO: Need to get specific instance to clone + try { + VelocityActual obj = new VelocityActual(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public VelocityActual GetInstance(UAVObjectManager objMngr, int instID) + { + return (VelocityActual)(objMngr.getObject(VelocityActual.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x48009C88; + protected static final String NAME = "VelocityActual"; + protected static String DESCRIPTION = "Updated by @ref AHRSCommsModule and used within @ref GuidanceModule for velocity control"; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 0 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/VelocityDesired.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/VelocityDesired.java new file mode 100644 index 000000000..27f290898 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/VelocityDesired.java @@ -0,0 +1,147 @@ +/** + ****************************************************************************** + * + * @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. + * Used within @ref GuidanceModule to communicate between the task computing the desired velocity and the PID loop to achieve it (running at different rates). + * + * @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; + +/** +Used within @ref GuidanceModule to communicate between the task computing the desired velocity and the PID loop to achieve it (running at different rates). + +generated from velocitydesired.xml + **/ +public class VelocityDesired extends UAVDataObject { + + public VelocityDesired() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List NorthElemNames = new ArrayList(); + NorthElemNames.add("0"); + fields.add( new UAVObjectField("North", "cm/s", UAVObjectField.FieldType.INT32, NorthElemNames, null) ); + + List EastElemNames = new ArrayList(); + EastElemNames.add("0"); + fields.add( new UAVObjectField("East", "cm/s", UAVObjectField.FieldType.INT32, EastElemNames, null) ); + + List DownElemNames = new ArrayList(); + DownElemNames.add("0"); + fields.add( new UAVObjectField("Down", "cm/s", UAVObjectField.FieldType.INT32, DownElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.FALSE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.FALSE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.flightTelemetryUpdatePeriod = 1000; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + 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(int instID) { + // TODO: Need to get specific instance to clone + try { + VelocityDesired obj = new VelocityDesired(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public VelocityDesired GetInstance(UAVObjectManager objMngr, int instID) + { + return (VelocityDesired)(objMngr.getObject(VelocityDesired.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x122F5E3A; + protected static final String NAME = "VelocityDesired"; + protected static String DESCRIPTION = "Used within @ref GuidanceModule to communicate between the task computing the desired velocity and the PID loop to achieve it (running at different rates)."; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 0 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/WatchdogStatus.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/WatchdogStatus.java new file mode 100644 index 000000000..3adcad96b --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/WatchdogStatus.java @@ -0,0 +1,143 @@ +/** + ****************************************************************************** + * + * @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. + * For monitoring the flags in the watchdog and especially the bootup flags + * + * @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; + +/** +For monitoring the flags in the watchdog and especially the bootup flags + +generated from watchdogstatus.xml + **/ +public class WatchdogStatus extends UAVDataObject { + + public WatchdogStatus() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List BootupFlagsElemNames = new ArrayList(); + BootupFlagsElemNames.add("0"); + fields.add( new UAVObjectField("BootupFlags", "", UAVObjectField.FieldType.UINT16, BootupFlagsElemNames, null) ); + + List ActiveFlagsElemNames = new ArrayList(); + ActiveFlagsElemNames.add("0"); + fields.add( new UAVObjectField("ActiveFlags", "", UAVObjectField.FieldType.UINT16, ActiveFlagsElemNames, null) ); + + + // Compute the number of bytes for this object + int numBytes = 0; + ListIterator 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.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.gcsTelemetryAcked = UAVObject.Acked.FALSE; + metadata.gcsTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_MANUAL; + metadata.gcsTelemetryUpdatePeriod = 0; + + metadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE; + metadata.flightTelemetryAcked = UAVObject.Acked.FALSE; + metadata.flightTelemetryUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.flightTelemetryUpdatePeriod = 5000; + + metadata.loggingUpdateMode = UAVObject.UpdateMode.UPDATEMODE_PERIODIC; + metadata.loggingUpdatePeriod = 5000; + 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(int instID) { + // TODO: Need to get specific instance to clone + try { + WatchdogStatus obj = new WatchdogStatus(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public WatchdogStatus GetInstance(UAVObjectManager objMngr, int instID) + { + return (WatchdogStatus)(objMngr.getObject(WatchdogStatus.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0xD646E910; + protected static final String NAME = "WatchdogStatus"; + protected static String DESCRIPTION = "For monitoring the flags in the watchdog and especially the bootup flags"; + protected static final boolean ISSINGLEINST = 1 == 1; + protected static final boolean ISSETTINGS = 0 == 1; + protected static int NUMBYTES = 0; + + +} \ No newline at end of file