From 851923e8b92d25203ffa46233170140183464b2d Mon Sep 17 00:00:00 2001 From: James Cotton Date: Sat, 4 Aug 2012 01:35:49 -0500 Subject: [PATCH] Update the UAVO files --- .../openpilot/uavtalk/uavobjects/Accels.java | 150 ++++++++ .../uavtalk/uavobjects/AltHoldSmoothed.java | 146 ++++++++ .../uavobjects/AltitudeHoldDesired.java | 150 ++++++++ .../uavobjects/AltitudeHoldSettings.java | 169 +++++++++ .../uavtalk/uavobjects/AttitudeSimulated.java | 174 ++++++++++ .../uavtalk/uavobjects/BaroAirspeed.java | 153 ++++++++ .../FixedWingPathFollowerSettings.java | 239 +++++++++++++ .../FixedWingPathFollowerStatus.java | 164 +++++++++ .../uavtalk/uavobjects/GPSSettings.java | 142 ++++++++ .../uavtalk/uavobjects/GPSVelocity.java | 146 ++++++++ .../openpilot/uavtalk/uavobjects/Gyros.java | 150 ++++++++ .../uavtalk/uavobjects/GyrosBias.java | 146 ++++++++ .../openpilot/uavtalk/uavobjects/MagBias.java | 146 ++++++++ .../uavtalk/uavobjects/Magnetometer.java | 146 ++++++++ .../uavtalk/uavobjects/NEDPosition.java | 146 ++++++++ .../uavtalk/uavobjects/OveroSyncSettings.java | 143 ++++++++ .../uavtalk/uavobjects/OveroSyncStats.java | 165 +++++++++ .../uavtalk/uavobjects/PathDesired.java | 162 +++++++++ .../uavobjects/PathPlannerSettings.java | 151 ++++++++ .../uavtalk/uavobjects/PipXSettings.java | 326 ++++++++++++++++++ .../uavtalk/uavobjects/PipXStatus.java | 301 ++++++++++++++++ .../uavtalk/uavobjects/RevoCalibration.java | 249 +++++++++++++ .../uavtalk/uavobjects/RevoSettings.java | 143 ++++++++ .../uavtalk/uavobjects/TxPIDSettings.java | 225 ++++++++++++ .../uavobjects/VtolPathFollowerSettings.java | 232 +++++++++++++ .../uavtalk/uavobjects/Waypoint.java | 159 +++++++++ .../uavtalk/uavobjects/WaypointActive.java | 138 ++++++++ 27 files changed, 4761 insertions(+) create mode 100644 androidgcs/src/org/openpilot/uavtalk/uavobjects/Accels.java create mode 100644 androidgcs/src/org/openpilot/uavtalk/uavobjects/AltHoldSmoothed.java create mode 100644 androidgcs/src/org/openpilot/uavtalk/uavobjects/AltitudeHoldDesired.java create mode 100644 androidgcs/src/org/openpilot/uavtalk/uavobjects/AltitudeHoldSettings.java create mode 100644 androidgcs/src/org/openpilot/uavtalk/uavobjects/AttitudeSimulated.java create mode 100644 androidgcs/src/org/openpilot/uavtalk/uavobjects/BaroAirspeed.java create mode 100644 androidgcs/src/org/openpilot/uavtalk/uavobjects/FixedWingPathFollowerSettings.java create mode 100644 androidgcs/src/org/openpilot/uavtalk/uavobjects/FixedWingPathFollowerStatus.java create mode 100644 androidgcs/src/org/openpilot/uavtalk/uavobjects/GPSSettings.java create mode 100644 androidgcs/src/org/openpilot/uavtalk/uavobjects/GPSVelocity.java create mode 100644 androidgcs/src/org/openpilot/uavtalk/uavobjects/Gyros.java create mode 100644 androidgcs/src/org/openpilot/uavtalk/uavobjects/GyrosBias.java create mode 100644 androidgcs/src/org/openpilot/uavtalk/uavobjects/MagBias.java create mode 100644 androidgcs/src/org/openpilot/uavtalk/uavobjects/Magnetometer.java create mode 100644 androidgcs/src/org/openpilot/uavtalk/uavobjects/NEDPosition.java create mode 100644 androidgcs/src/org/openpilot/uavtalk/uavobjects/OveroSyncSettings.java create mode 100644 androidgcs/src/org/openpilot/uavtalk/uavobjects/OveroSyncStats.java create mode 100644 androidgcs/src/org/openpilot/uavtalk/uavobjects/PathDesired.java create mode 100644 androidgcs/src/org/openpilot/uavtalk/uavobjects/PathPlannerSettings.java create mode 100644 androidgcs/src/org/openpilot/uavtalk/uavobjects/PipXSettings.java create mode 100644 androidgcs/src/org/openpilot/uavtalk/uavobjects/PipXStatus.java create mode 100644 androidgcs/src/org/openpilot/uavtalk/uavobjects/RevoCalibration.java create mode 100644 androidgcs/src/org/openpilot/uavtalk/uavobjects/RevoSettings.java create mode 100644 androidgcs/src/org/openpilot/uavtalk/uavobjects/TxPIDSettings.java create mode 100644 androidgcs/src/org/openpilot/uavtalk/uavobjects/VtolPathFollowerSettings.java create mode 100644 androidgcs/src/org/openpilot/uavtalk/uavobjects/Waypoint.java create mode 100644 androidgcs/src/org/openpilot/uavtalk/uavobjects/WaypointActive.java diff --git a/androidgcs/src/org/openpilot/uavtalk/uavobjects/Accels.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/Accels.java new file mode 100644 index 000000000..32437e63e --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/Accels.java @@ -0,0 +1,150 @@ +/** + ****************************************************************************** + * + * @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 accel data. + * + * @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 accel data. + +generated from accels.xml + **/ +public class Accels extends UAVDataObject { + + public Accels() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List xElemNames = new ArrayList(); + xElemNames.add("0"); + fields.add( new UAVObjectField("x", "m/s^2", UAVObjectField.FieldType.FLOAT32, xElemNames, null) ); + + List yElemNames = new ArrayList(); + yElemNames.add("0"); + fields.add( new UAVObjectField("y", "m/s^2", UAVObjectField.FieldType.FLOAT32, yElemNames, null) ); + + List zElemNames = new ArrayList(); + zElemNames.add("0"); + fields.add( new UAVObjectField("z", "m/s^2", UAVObjectField.FieldType.FLOAT32, zElemNames, null) ); + + List temperatureElemNames = new ArrayList(); + temperatureElemNames.add("0"); + fields.add( new UAVObjectField("temperature", "deg C", UAVObjectField.FieldType.FLOAT32, temperatureElemNames, 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.flags = + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT | + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT | + 0 << UAVOBJ_TELEMETRY_ACKED_SHIFT | + 0 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_PERIODIC) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_MANUAL) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; + metadata.flightTelemetryUpdatePeriod = 1000; + metadata.gcsTelemetryUpdatePeriod = 0; + metadata.loggingUpdatePeriod = 0; + + return metadata; + } + + /** + * Initialize object fields with the default values. + * If a default value is not specified the object fields + * will be initialized to zero. + */ + public void setDefaultFieldValues() + { + + } + + /** + * Create a clone of this object, a new instance ID must be specified. + * Do not use this function directly to create new instances, the + * UAVObjectManager should be used instead. + */ + public UAVDataObject clone(int instID) { + // TODO: Need to get specific instance to clone + try { + Accels obj = new Accels(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public Accels GetInstance(UAVObjectManager objMngr, int instID) + { + return (Accels)(objMngr.getObject(Accels.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0xDD9D5FC0; + protected static final String NAME = "Accels"; + protected static String DESCRIPTION = "The accel data."; + 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/AltHoldSmoothed.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/AltHoldSmoothed.java new file mode 100644 index 000000000..46d03a544 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/AltHoldSmoothed.java @@ -0,0 +1,146 @@ +/** + ****************************************************************************** + * + * @file uavobjecttemplate.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief Template for an uavobject in java + * This is a autogenerated file!! Do not modify and expect a result. + * The output on the kalman filter on altitude. + * + * @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 on the kalman filter on altitude. + +generated from altholdsmoothed.xml + **/ +public class AltHoldSmoothed extends UAVDataObject { + + public AltHoldSmoothed() { + 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 VelocityElemNames = new ArrayList(); + VelocityElemNames.add("0"); + fields.add( new UAVObjectField("Velocity", "m/s", UAVObjectField.FieldType.FLOAT32, VelocityElemNames, null) ); + + List AccelElemNames = new ArrayList(); + AccelElemNames.add("0"); + fields.add( new UAVObjectField("Accel", "m/s^2", UAVObjectField.FieldType.FLOAT32, AccelElemNames, 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.flags = + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT | + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT | + 0 << UAVOBJ_TELEMETRY_ACKED_SHIFT | + 0 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_PERIODIC) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_MANUAL) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; + metadata.flightTelemetryUpdatePeriod = 1000; + metadata.gcsTelemetryUpdatePeriod = 0; + metadata.loggingUpdatePeriod = 0; + + return metadata; + } + + /** + * Initialize object fields with the default values. + * If a default value is not specified the object fields + * will be initialized to zero. + */ + public void setDefaultFieldValues() + { + + } + + /** + * Create a clone of this object, a new instance ID must be specified. + * Do not use this function directly to create new instances, the + * UAVObjectManager should be used instead. + */ + public UAVDataObject clone(int instID) { + // TODO: Need to get specific instance to clone + try { + AltHoldSmoothed obj = new AltHoldSmoothed(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public AltHoldSmoothed GetInstance(UAVObjectManager objMngr, int instID) + { + return (AltHoldSmoothed)(objMngr.getObject(AltHoldSmoothed.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x2BC6B9D2; + protected static final String NAME = "AltHoldSmoothed"; + protected static String DESCRIPTION = "The output on the kalman filter on altitude."; + 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/AltitudeHoldDesired.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/AltitudeHoldDesired.java new file mode 100644 index 000000000..efe860340 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/AltitudeHoldDesired.java @@ -0,0 +1,150 @@ +/** + ****************************************************************************** + * + * @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. + * Holds the desired altitude (from manual control) as well as the desired attitude to pass through + * + * @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; + +/** +Holds the desired altitude (from manual control) as well as the desired attitude to pass through + +generated from altitudeholddesired.xml + **/ +public class AltitudeHoldDesired extends UAVDataObject { + + public AltitudeHoldDesired() { + 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 RollElemNames = new ArrayList(); + RollElemNames.add("0"); + fields.add( new UAVObjectField("Roll", "deg", UAVObjectField.FieldType.FLOAT32, RollElemNames, null) ); + + List PitchElemNames = new ArrayList(); + PitchElemNames.add("0"); + fields.add( new UAVObjectField("Pitch", "deg", 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.flags = + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT | + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT | + 0 << UAVOBJ_TELEMETRY_ACKED_SHIFT | + 0 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_ONCHANGE) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_MANUAL) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; + metadata.flightTelemetryUpdatePeriod = 0; + metadata.gcsTelemetryUpdatePeriod = 0; + metadata.loggingUpdatePeriod = 1000; + + return metadata; + } + + /** + * Initialize object fields with the default values. + * If a default value is not specified the object fields + * will be initialized to zero. + */ + public void setDefaultFieldValues() + { + + } + + /** + * Create a clone of this object, a new instance ID must be specified. + * Do not use this function directly to create new instances, the + * UAVObjectManager should be used instead. + */ + public UAVDataObject clone(int instID) { + // TODO: Need to get specific instance to clone + try { + AltitudeHoldDesired obj = new AltitudeHoldDesired(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public AltitudeHoldDesired GetInstance(UAVObjectManager objMngr, int instID) + { + return (AltitudeHoldDesired)(objMngr.getObject(AltitudeHoldDesired.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x495BAD6E; + protected static final String NAME = "AltitudeHoldDesired"; + protected static String DESCRIPTION = "Holds the desired altitude (from manual control) as well as the desired attitude to pass through"; + 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/AltitudeHoldSettings.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/AltitudeHoldSettings.java new file mode 100644 index 000000000..77b6774b9 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/AltitudeHoldSettings.java @@ -0,0 +1,169 @@ +/** + ****************************************************************************** + * + * @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 AltitudeHold module + * + * @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 AltitudeHold module + +generated from altitudeholdsettings.xml + **/ +public class AltitudeHoldSettings extends UAVDataObject { + + public AltitudeHoldSettings() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List KpElemNames = new ArrayList(); + KpElemNames.add("0"); + fields.add( new UAVObjectField("Kp", "throttle/m", UAVObjectField.FieldType.FLOAT32, KpElemNames, null) ); + + List KiElemNames = new ArrayList(); + KiElemNames.add("0"); + fields.add( new UAVObjectField("Ki", "throttle/m", UAVObjectField.FieldType.FLOAT32, KiElemNames, null) ); + + List KdElemNames = new ArrayList(); + KdElemNames.add("0"); + fields.add( new UAVObjectField("Kd", "throttle/m", UAVObjectField.FieldType.FLOAT32, KdElemNames, null) ); + + List KaElemNames = new ArrayList(); + KaElemNames.add("0"); + fields.add( new UAVObjectField("Ka", "throttle/(m/s^2)", UAVObjectField.FieldType.FLOAT32, KaElemNames, null) ); + + List PressureNoiseElemNames = new ArrayList(); + PressureNoiseElemNames.add("0"); + fields.add( new UAVObjectField("PressureNoise", "m", UAVObjectField.FieldType.FLOAT32, PressureNoiseElemNames, null) ); + + List AccelNoiseElemNames = new ArrayList(); + AccelNoiseElemNames.add("0"); + fields.add( new UAVObjectField("AccelNoise", "m/s^2", UAVObjectField.FieldType.FLOAT32, AccelNoiseElemNames, null) ); + + List AccelDriftElemNames = new ArrayList(); + AccelDriftElemNames.add("0"); + fields.add( new UAVObjectField("AccelDrift", "m/s^2", UAVObjectField.FieldType.FLOAT32, AccelDriftElemNames, 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.flags = + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT | + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT | + 1 << UAVOBJ_TELEMETRY_ACKED_SHIFT | + 1 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_ONCHANGE) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_ONCHANGE) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; + metadata.flightTelemetryUpdatePeriod = 0; + metadata.gcsTelemetryUpdatePeriod = 0; + metadata.loggingUpdatePeriod = 0; + + return metadata; + } + + /** + * Initialize object fields with the default values. + * If a default value is not specified the object fields + * will be initialized to zero. + */ + public void setDefaultFieldValues() + { + getField("Kp").setValue(0.03); + getField("Ki").setValue(0); + getField("Kd").setValue(0.03); + getField("Ka").setValue(0.005); + getField("PressureNoise").setValue(0.4); + getField("AccelNoise").setValue(5); + getField("AccelDrift").setValue(0.001); + + } + + /** + * 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 { + AltitudeHoldSettings obj = new AltitudeHoldSettings(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public AltitudeHoldSettings GetInstance(UAVObjectManager objMngr, int instID) + { + return (AltitudeHoldSettings)(objMngr.getObject(AltitudeHoldSettings.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0xFEC55B42; + protected static final String NAME = "AltitudeHoldSettings"; + protected static String DESCRIPTION = "Settings for the @ref AltitudeHold module"; + 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/AttitudeSimulated.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/AttitudeSimulated.java new file mode 100644 index 000000000..3a713ab04 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/AttitudeSimulated.java @@ -0,0 +1,174 @@ +/** + ****************************************************************************** + * + * @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 simulated Attitude estimation from @ref Sensors. + * + * @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 simulated Attitude estimation from @ref Sensors. + +generated from attitudesimulated.xml + **/ +public class AttitudeSimulated extends UAVDataObject { + + public AttitudeSimulated() { + 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) ); + + List VelocityElemNames = new ArrayList(); + VelocityElemNames.add("North"); + VelocityElemNames.add("East"); + VelocityElemNames.add("Down"); + fields.add( new UAVObjectField("Velocity", "m/s", UAVObjectField.FieldType.FLOAT32, VelocityElemNames, null) ); + + List PositionElemNames = new ArrayList(); + PositionElemNames.add("North"); + PositionElemNames.add("East"); + PositionElemNames.add("Down"); + fields.add( new UAVObjectField("Position", "m", UAVObjectField.FieldType.FLOAT32, PositionElemNames, 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.flags = + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT | + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT | + 0 << UAVOBJ_TELEMETRY_ACKED_SHIFT | + 0 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_PERIODIC) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_MANUAL) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; + metadata.flightTelemetryUpdatePeriod = 100; + metadata.gcsTelemetryUpdatePeriod = 0; + metadata.loggingUpdatePeriod = 0; + + return metadata; + } + + /** + * Initialize object fields with the default values. + * If a default value is not specified the object fields + * will be initialized to zero. + */ + public void setDefaultFieldValues() + { + + } + + /** + * Create a clone of this object, a new instance ID must be specified. + * Do not use this function directly to create new instances, the + * UAVObjectManager should be used instead. + */ + public UAVDataObject clone(int instID) { + // TODO: Need to get specific instance to clone + try { + AttitudeSimulated obj = new AttitudeSimulated(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public AttitudeSimulated GetInstance(UAVObjectManager objMngr, int instID) + { + return (AttitudeSimulated)(objMngr.getObject(AttitudeSimulated.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x9266CE74; + protected static final String NAME = "AttitudeSimulated"; + protected static String DESCRIPTION = "The simulated Attitude estimation from @ref Sensors."; + 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/BaroAirspeed.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/BaroAirspeed.java new file mode 100644 index 000000000..439915741 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/BaroAirspeed.java @@ -0,0 +1,153 @@ +/** + ****************************************************************************** + * + * @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 dynamic pressure sensor with pressure, temperature and airspeed. + * + * @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 dynamic pressure sensor with pressure, temperature and airspeed. + +generated from baroairspeed.xml + **/ +public class BaroAirspeed extends UAVDataObject { + + public BaroAirspeed() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List AirspeedElemNames = new ArrayList(); + AirspeedElemNames.add("0"); + fields.add( new UAVObjectField("Airspeed", "m/s", UAVObjectField.FieldType.FLOAT32, AirspeedElemNames, null) ); + + List SensorValueElemNames = new ArrayList(); + SensorValueElemNames.add("0"); + fields.add( new UAVObjectField("SensorValue", "raw", UAVObjectField.FieldType.UINT16, SensorValueElemNames, null) ); + + List ZeroPointElemNames = new ArrayList(); + ZeroPointElemNames.add("0"); + fields.add( new UAVObjectField("ZeroPoint", "raw", UAVObjectField.FieldType.UINT16, ZeroPointElemNames, null) ); + + 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) ); + + + // 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.flags = + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT | + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT | + 0 << UAVOBJ_TELEMETRY_ACKED_SHIFT | + 0 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_PERIODIC) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_MANUAL) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; + metadata.flightTelemetryUpdatePeriod = 1000; + metadata.gcsTelemetryUpdatePeriod = 0; + metadata.loggingUpdatePeriod = 0; + + return metadata; + } + + /** + * Initialize object fields with the default values. + * If a default value is not specified the object fields + * will be initialized to zero. + */ + public void setDefaultFieldValues() + { + + } + + /** + * Create a clone of this object, a new instance ID must be specified. + * Do not use this function directly to create new instances, the + * UAVObjectManager should be used instead. + */ + public UAVDataObject clone(int instID) { + // TODO: Need to get specific instance to clone + try { + BaroAirspeed obj = new BaroAirspeed(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public BaroAirspeed GetInstance(UAVObjectManager objMngr, int instID) + { + return (BaroAirspeed)(objMngr.getObject(BaroAirspeed.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x169EA4A; + protected static final String NAME = "BaroAirspeed"; + protected static String DESCRIPTION = "The raw data from the dynamic pressure sensor with pressure, temperature and airspeed."; + 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/FixedWingPathFollowerSettings.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/FixedWingPathFollowerSettings.java new file mode 100644 index 000000000..00419bc4c --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/FixedWingPathFollowerSettings.java @@ -0,0 +1,239 @@ +/** + ****************************************************************************** + * + * @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 FixedWingPathFollowerModule + * + * @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 FixedWingPathFollowerModule + +generated from fixedwingpathfollowersettings.xml + **/ +public class FixedWingPathFollowerSettings extends UAVDataObject { + + public FixedWingPathFollowerSettings() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List AirSpeedMaxElemNames = new ArrayList(); + AirSpeedMaxElemNames.add("0"); + fields.add( new UAVObjectField("AirSpeedMax", "m/s", UAVObjectField.FieldType.FLOAT32, AirSpeedMaxElemNames, null) ); + + List AirSpeedMinElemNames = new ArrayList(); + AirSpeedMinElemNames.add("0"); + fields.add( new UAVObjectField("AirSpeedMin", "m/s", UAVObjectField.FieldType.FLOAT32, AirSpeedMinElemNames, null) ); + + List VerticalVelMaxElemNames = new ArrayList(); + VerticalVelMaxElemNames.add("0"); + fields.add( new UAVObjectField("VerticalVelMax", "m/s", UAVObjectField.FieldType.FLOAT32, VerticalVelMaxElemNames, null) ); + + List HorizontalPosPElemNames = new ArrayList(); + HorizontalPosPElemNames.add("0"); + fields.add( new UAVObjectField("HorizontalPosP", "(m/s)/m", UAVObjectField.FieldType.FLOAT32, HorizontalPosPElemNames, null) ); + + List VerticalPosPElemNames = new ArrayList(); + VerticalPosPElemNames.add("0"); + fields.add( new UAVObjectField("VerticalPosP", "(m/s)/m", UAVObjectField.FieldType.FLOAT32, VerticalPosPElemNames, null) ); + + List CoursePIElemNames = new ArrayList(); + CoursePIElemNames.add("Kp"); + CoursePIElemNames.add("Ki"); + CoursePIElemNames.add("ILimit"); + fields.add( new UAVObjectField("CoursePI", "deg/deg", UAVObjectField.FieldType.FLOAT32, CoursePIElemNames, null) ); + + List SpeedPElemNames = new ArrayList(); + SpeedPElemNames.add("Kp"); + SpeedPElemNames.add("Max"); + fields.add( new UAVObjectField("SpeedP", "(m/s^2) / ((m/s)/(m/s)", UAVObjectField.FieldType.FLOAT32, SpeedPElemNames, null) ); + + List AccelPIElemNames = new ArrayList(); + AccelPIElemNames.add("Kp"); + AccelPIElemNames.add("Ki"); + AccelPIElemNames.add("ILimit"); + fields.add( new UAVObjectField("AccelPI", "deg / (m/s^2)", UAVObjectField.FieldType.FLOAT32, AccelPIElemNames, null) ); + + List VerticalToPitchCrossFeedElemNames = new ArrayList(); + VerticalToPitchCrossFeedElemNames.add("Kp"); + VerticalToPitchCrossFeedElemNames.add("Max"); + fields.add( new UAVObjectField("VerticalToPitchCrossFeed", "deg / ((m/s)/(m/s))", UAVObjectField.FieldType.FLOAT32, VerticalToPitchCrossFeedElemNames, null) ); + + List AirspeedToVerticalCrossFeedElemNames = new ArrayList(); + AirspeedToVerticalCrossFeedElemNames.add("Kp"); + AirspeedToVerticalCrossFeedElemNames.add("Max"); + fields.add( new UAVObjectField("AirspeedToVerticalCrossFeed", "(m/s) / ((m/s)/(m/s))", UAVObjectField.FieldType.FLOAT32, AirspeedToVerticalCrossFeedElemNames, null) ); + + List PowerPIElemNames = new ArrayList(); + PowerPIElemNames.add("Kp"); + PowerPIElemNames.add("Ki"); + PowerPIElemNames.add("ILimit"); + fields.add( new UAVObjectField("PowerPI", "1/(m/s)", UAVObjectField.FieldType.FLOAT32, PowerPIElemNames, null) ); + + List RollLimitElemNames = new ArrayList(); + RollLimitElemNames.add("Min"); + RollLimitElemNames.add("Neutral"); + RollLimitElemNames.add("Max"); + fields.add( new UAVObjectField("RollLimit", "deg", UAVObjectField.FieldType.FLOAT32, RollLimitElemNames, null) ); + + List PitchLimitElemNames = new ArrayList(); + PitchLimitElemNames.add("Min"); + PitchLimitElemNames.add("Neutral"); + PitchLimitElemNames.add("Max"); + fields.add( new UAVObjectField("PitchLimit", "deg", UAVObjectField.FieldType.FLOAT32, PitchLimitElemNames, null) ); + + List ThrottleLimitElemNames = new ArrayList(); + ThrottleLimitElemNames.add("Min"); + ThrottleLimitElemNames.add("Neutral"); + ThrottleLimitElemNames.add("Max"); + fields.add( new UAVObjectField("ThrottleLimit", "", UAVObjectField.FieldType.FLOAT32, ThrottleLimitElemNames, null) ); + + List UpdatePeriodElemNames = new ArrayList(); + UpdatePeriodElemNames.add("0"); + fields.add( new UAVObjectField("UpdatePeriod", "ms", 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.flags = + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT | + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT | + 1 << UAVOBJ_TELEMETRY_ACKED_SHIFT | + 1 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_ONCHANGE) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_ONCHANGE) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; + metadata.flightTelemetryUpdatePeriod = 0; + metadata.gcsTelemetryUpdatePeriod = 0; + metadata.loggingUpdatePeriod = 0; + + return metadata; + } + + /** + * Initialize object fields with the default values. + * If a default value is not specified the object fields + * will be initialized to zero. + */ + public void setDefaultFieldValues() + { + getField("AirSpeedMax").setValue(15); + getField("AirSpeedMin").setValue(10); + getField("VerticalVelMax").setValue(10); + getField("HorizontalPosP").setValue(0.05); + getField("VerticalPosP").setValue(0.05); + getField("CoursePI").setValue(0.2,0); + getField("CoursePI").setValue(0,1); + getField("CoursePI").setValue(0,2); + getField("SpeedP").setValue(10,0); + getField("SpeedP").setValue(10,1); + getField("AccelPI").setValue(1.5,0); + getField("AccelPI").setValue(1.5,1); + getField("AccelPI").setValue(20,2); + getField("VerticalToPitchCrossFeed").setValue(50,0); + getField("VerticalToPitchCrossFeed").setValue(5,1); + getField("AirspeedToVerticalCrossFeed").setValue(100,0); + getField("AirspeedToVerticalCrossFeed").setValue(100,1); + getField("PowerPI").setValue(0.01,0); + getField("PowerPI").setValue(0.01,1); + getField("PowerPI").setValue(0.8,2); + getField("RollLimit").setValue(-35,0); + getField("RollLimit").setValue(0,1); + getField("RollLimit").setValue(35,2); + getField("PitchLimit").setValue(-10,0); + getField("PitchLimit").setValue(5,1); + getField("PitchLimit").setValue(20,2); + getField("ThrottleLimit").setValue(0.1,0); + getField("ThrottleLimit").setValue(0.5,1); + getField("ThrottleLimit").setValue(0.9,2); + 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 { + FixedWingPathFollowerSettings obj = new FixedWingPathFollowerSettings(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public FixedWingPathFollowerSettings GetInstance(UAVObjectManager objMngr, int instID) + { + return (FixedWingPathFollowerSettings)(objMngr.getObject(FixedWingPathFollowerSettings.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x8A3F1E02; + protected static final String NAME = "FixedWingPathFollowerSettings"; + protected static String DESCRIPTION = "Settings for the @ref FixedWingPathFollowerModule"; + 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/FixedWingPathFollowerStatus.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/FixedWingPathFollowerStatus.java new file mode 100644 index 000000000..a40be35cf --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/FixedWingPathFollowerStatus.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. + * Object Storing Debugging Information on PID internals + * + * @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; + +/** +Object Storing Debugging Information on PID internals + +generated from fixedwingpathfollowerstatus.xml + **/ +public class FixedWingPathFollowerStatus extends UAVDataObject { + + public FixedWingPathFollowerStatus() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List EElemNames = new ArrayList(); + EElemNames.add("Course"); + EElemNames.add("Speed"); + EElemNames.add("Accel"); + EElemNames.add("Power"); + fields.add( new UAVObjectField("E", "", UAVObjectField.FieldType.FLOAT32, EElemNames, null) ); + + List AElemNames = new ArrayList(); + AElemNames.add("Course"); + AElemNames.add("Speed"); + AElemNames.add("Accel"); + AElemNames.add("Power"); + fields.add( new UAVObjectField("A", "", UAVObjectField.FieldType.FLOAT32, AElemNames, null) ); + + List CElemNames = new ArrayList(); + CElemNames.add("Course"); + CElemNames.add("Speed"); + CElemNames.add("Accel"); + CElemNames.add("Power"); + fields.add( new UAVObjectField("C", "", UAVObjectField.FieldType.FLOAT32, CElemNames, null) ); + + List ErrorsElemNames = new ArrayList(); + ErrorsElemNames.add("Wind"); + ErrorsElemNames.add("Lowspeed"); + ErrorsElemNames.add("Highspeed"); + ErrorsElemNames.add("Lowpower"); + ErrorsElemNames.add("Highpower"); + ErrorsElemNames.add("Pitchcontrol"); + fields.add( new UAVObjectField("Errors", "", UAVObjectField.FieldType.UINT8, ErrorsElemNames, 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.flags = + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT | + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT | + 0 << UAVOBJ_TELEMETRY_ACKED_SHIFT | + 0 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_PERIODIC) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_MANUAL) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; + metadata.flightTelemetryUpdatePeriod = 500; + metadata.gcsTelemetryUpdatePeriod = 0; + metadata.loggingUpdatePeriod = 0; + + return metadata; + } + + /** + * Initialize object fields with the default values. + * If a default value is not specified the object fields + * will be initialized to zero. + */ + public void setDefaultFieldValues() + { + + } + + /** + * Create a clone of this object, a new instance ID must be specified. + * Do not use this function directly to create new instances, the + * UAVObjectManager should be used instead. + */ + public UAVDataObject clone(int instID) { + // TODO: Need to get specific instance to clone + try { + FixedWingPathFollowerStatus obj = new FixedWingPathFollowerStatus(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public FixedWingPathFollowerStatus GetInstance(UAVObjectManager objMngr, int instID) + { + return (FixedWingPathFollowerStatus)(objMngr.getObject(FixedWingPathFollowerStatus.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0xA0D6F6D4; + protected static final String NAME = "FixedWingPathFollowerStatus"; + protected static String DESCRIPTION = "Object Storing Debugging Information on PID internals"; + 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/GPSSettings.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/GPSSettings.java new file mode 100644 index 000000000..f534fc89c --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/GPSSettings.java @@ -0,0 +1,142 @@ +/** + ****************************************************************************** + * + * @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 GPS + * + * @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 GPS + +generated from gpssettings.xml + **/ +public class GPSSettings extends UAVDataObject { + + public GPSSettings() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List DataProtocolElemNames = new ArrayList(); + DataProtocolElemNames.add("0"); + List DataProtocolEnumOptions = new ArrayList(); + DataProtocolEnumOptions.add("NMEA"); + DataProtocolEnumOptions.add("UBX"); + fields.add( new UAVObjectField("DataProtocol", "", UAVObjectField.FieldType.ENUM, DataProtocolElemNames, DataProtocolEnumOptions) ); + + + // 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.flags = + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT | + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT | + 1 << UAVOBJ_TELEMETRY_ACKED_SHIFT | + 1 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_ONCHANGE) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_ONCHANGE) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; + metadata.flightTelemetryUpdatePeriod = 0; + metadata.gcsTelemetryUpdatePeriod = 0; + metadata.loggingUpdatePeriod = 0; + + return metadata; + } + + /** + * Initialize object fields with the default values. + * If a default value is not specified the object fields + * will be initialized to zero. + */ + public void setDefaultFieldValues() + { + getField("DataProtocol").setValue("NMEA"); + + } + + /** + * 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 { + GPSSettings obj = new GPSSettings(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public GPSSettings GetInstance(UAVObjectManager objMngr, int instID) + { + return (GPSSettings)(objMngr.getObject(GPSSettings.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0xAC5F6370; + protected static final String NAME = "GPSSettings"; + protected static String DESCRIPTION = "Settings for the GPS"; + 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/GPSVelocity.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/GPSVelocity.java new file mode 100644 index 000000000..2ce4a3c62 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/GPSVelocity.java @@ -0,0 +1,146 @@ +/** + ****************************************************************************** + * + * @file uavobjecttemplate.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief Template for an uavobject in java + * This is a autogenerated file!! Do not modify and expect a result. + * Raw GPS data 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; + +/** +Raw GPS data from @ref GPSModule. + +generated from gpsvelocity.xml + **/ +public class GPSVelocity extends UAVDataObject { + + public GPSVelocity() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List NorthElemNames = new ArrayList(); + NorthElemNames.add("0"); + fields.add( new UAVObjectField("North", "m/s", UAVObjectField.FieldType.FLOAT32, NorthElemNames, null) ); + + List EastElemNames = new ArrayList(); + EastElemNames.add("0"); + fields.add( new UAVObjectField("East", "m/s", UAVObjectField.FieldType.FLOAT32, EastElemNames, null) ); + + List DownElemNames = new ArrayList(); + DownElemNames.add("0"); + fields.add( new UAVObjectField("Down", "m/s", 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.flags = + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT | + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT | + 0 << UAVOBJ_TELEMETRY_ACKED_SHIFT | + 0 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_PERIODIC) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_MANUAL) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; + metadata.flightTelemetryUpdatePeriod = 1000; + metadata.gcsTelemetryUpdatePeriod = 0; + metadata.loggingUpdatePeriod = 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 { + GPSVelocity obj = new GPSVelocity(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public GPSVelocity GetInstance(UAVObjectManager objMngr, int instID) + { + return (GPSVelocity)(objMngr.getObject(GPSVelocity.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x8245DC80; + protected static final String NAME = "GPSVelocity"; + protected static String DESCRIPTION = "Raw GPS data 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/Gyros.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/Gyros.java new file mode 100644 index 000000000..5c960d2e6 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/Gyros.java @@ -0,0 +1,150 @@ +/** + ****************************************************************************** + * + * @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 gyro data. + * + * @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 gyro data. + +generated from gyros.xml + **/ +public class Gyros extends UAVDataObject { + + public Gyros() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List xElemNames = new ArrayList(); + xElemNames.add("0"); + fields.add( new UAVObjectField("x", "deg/s", UAVObjectField.FieldType.FLOAT32, xElemNames, null) ); + + List yElemNames = new ArrayList(); + yElemNames.add("0"); + fields.add( new UAVObjectField("y", "deg/s", UAVObjectField.FieldType.FLOAT32, yElemNames, null) ); + + List zElemNames = new ArrayList(); + zElemNames.add("0"); + fields.add( new UAVObjectField("z", "deg/s", UAVObjectField.FieldType.FLOAT32, zElemNames, null) ); + + List temperatureElemNames = new ArrayList(); + temperatureElemNames.add("0"); + fields.add( new UAVObjectField("temperature", "deg C", UAVObjectField.FieldType.FLOAT32, temperatureElemNames, 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.flags = + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT | + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT | + 0 << UAVOBJ_TELEMETRY_ACKED_SHIFT | + 0 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_PERIODIC) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_MANUAL) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; + metadata.flightTelemetryUpdatePeriod = 1000; + metadata.gcsTelemetryUpdatePeriod = 0; + metadata.loggingUpdatePeriod = 0; + + return metadata; + } + + /** + * Initialize object fields with the default values. + * If a default value is not specified the object fields + * will be initialized to zero. + */ + public void setDefaultFieldValues() + { + + } + + /** + * Create a clone of this object, a new instance ID must be specified. + * Do not use this function directly to create new instances, the + * UAVObjectManager should be used instead. + */ + public UAVDataObject clone(int instID) { + // TODO: Need to get specific instance to clone + try { + Gyros obj = new Gyros(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public Gyros GetInstance(UAVObjectManager objMngr, int instID) + { + return (Gyros)(objMngr.getObject(Gyros.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x4228AF6; + protected static final String NAME = "Gyros"; + protected static String DESCRIPTION = "The gyro data."; + 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/GyrosBias.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/GyrosBias.java new file mode 100644 index 000000000..00bc7da2d --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/GyrosBias.java @@ -0,0 +1,146 @@ +/** + ****************************************************************************** + * + * @file uavobjecttemplate.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief Template for an uavobject in java + * This is a autogenerated file!! Do not modify and expect a result. + * The gyro data. + * + * @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 gyro data. + +generated from gyrosbias.xml + **/ +public class GyrosBias extends UAVDataObject { + + public GyrosBias() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List xElemNames = new ArrayList(); + xElemNames.add("0"); + fields.add( new UAVObjectField("x", "deg/s", UAVObjectField.FieldType.FLOAT32, xElemNames, null) ); + + List yElemNames = new ArrayList(); + yElemNames.add("0"); + fields.add( new UAVObjectField("y", "deg/s", UAVObjectField.FieldType.FLOAT32, yElemNames, null) ); + + List zElemNames = new ArrayList(); + zElemNames.add("0"); + fields.add( new UAVObjectField("z", "deg/s", UAVObjectField.FieldType.FLOAT32, zElemNames, 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.flags = + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT | + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT | + 0 << UAVOBJ_TELEMETRY_ACKED_SHIFT | + 0 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_PERIODIC) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_MANUAL) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; + metadata.flightTelemetryUpdatePeriod = 1000; + metadata.gcsTelemetryUpdatePeriod = 0; + metadata.loggingUpdatePeriod = 0; + + return metadata; + } + + /** + * Initialize object fields with the default values. + * If a default value is not specified the object fields + * will be initialized to zero. + */ + public void setDefaultFieldValues() + { + + } + + /** + * Create a clone of this object, a new instance ID must be specified. + * Do not use this function directly to create new instances, the + * UAVObjectManager should be used instead. + */ + public UAVDataObject clone(int instID) { + // TODO: Need to get specific instance to clone + try { + GyrosBias obj = new GyrosBias(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public GyrosBias GetInstance(UAVObjectManager objMngr, int instID) + { + return (GyrosBias)(objMngr.getObject(GyrosBias.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0xE4B6F980; + protected static final String NAME = "GyrosBias"; + protected static String DESCRIPTION = "The gyro data."; + 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/MagBias.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/MagBias.java new file mode 100644 index 000000000..398f455d5 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/MagBias.java @@ -0,0 +1,146 @@ +/** + ****************************************************************************** + * + * @file uavobjecttemplate.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief Template for an uavobject in java + * This is a autogenerated file!! Do not modify and expect a result. + * The gyro data. + * + * @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 gyro data. + +generated from magbias.xml + **/ +public class MagBias extends UAVDataObject { + + public MagBias() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List xElemNames = new ArrayList(); + xElemNames.add("0"); + fields.add( new UAVObjectField("x", "mGau", UAVObjectField.FieldType.FLOAT32, xElemNames, null) ); + + List yElemNames = new ArrayList(); + yElemNames.add("0"); + fields.add( new UAVObjectField("y", "mGau", UAVObjectField.FieldType.FLOAT32, yElemNames, null) ); + + List zElemNames = new ArrayList(); + zElemNames.add("0"); + fields.add( new UAVObjectField("z", "mGau", UAVObjectField.FieldType.FLOAT32, zElemNames, 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.flags = + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT | + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT | + 0 << UAVOBJ_TELEMETRY_ACKED_SHIFT | + 0 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_PERIODIC) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_MANUAL) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; + metadata.flightTelemetryUpdatePeriod = 1000; + metadata.gcsTelemetryUpdatePeriod = 0; + metadata.loggingUpdatePeriod = 0; + + return metadata; + } + + /** + * Initialize object fields with the default values. + * If a default value is not specified the object fields + * will be initialized to zero. + */ + public void setDefaultFieldValues() + { + + } + + /** + * Create a clone of this object, a new instance ID must be specified. + * Do not use this function directly to create new instances, the + * UAVObjectManager should be used instead. + */ + public UAVDataObject clone(int instID) { + // TODO: Need to get specific instance to clone + try { + MagBias obj = new MagBias(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public MagBias GetInstance(UAVObjectManager objMngr, int instID) + { + return (MagBias)(objMngr.getObject(MagBias.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x5043E510; + protected static final String NAME = "MagBias"; + protected static String DESCRIPTION = "The gyro data."; + 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/Magnetometer.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/Magnetometer.java new file mode 100644 index 000000000..583817cca --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/Magnetometer.java @@ -0,0 +1,146 @@ +/** + ****************************************************************************** + * + * @file uavobjecttemplate.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief Template for an uavobject in java + * This is a autogenerated file!! Do not modify and expect a result. + * The mag data. + * + * @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 mag data. + +generated from magnetometer.xml + **/ +public class Magnetometer extends UAVDataObject { + + public Magnetometer() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List xElemNames = new ArrayList(); + xElemNames.add("0"); + fields.add( new UAVObjectField("x", "mGa", UAVObjectField.FieldType.FLOAT32, xElemNames, null) ); + + List yElemNames = new ArrayList(); + yElemNames.add("0"); + fields.add( new UAVObjectField("y", "mGa", UAVObjectField.FieldType.FLOAT32, yElemNames, null) ); + + List zElemNames = new ArrayList(); + zElemNames.add("0"); + fields.add( new UAVObjectField("z", "mGa", UAVObjectField.FieldType.FLOAT32, zElemNames, 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.flags = + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT | + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT | + 0 << UAVOBJ_TELEMETRY_ACKED_SHIFT | + 0 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_PERIODIC) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_MANUAL) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; + metadata.flightTelemetryUpdatePeriod = 1000; + metadata.gcsTelemetryUpdatePeriod = 0; + metadata.loggingUpdatePeriod = 0; + + return metadata; + } + + /** + * Initialize object fields with the default values. + * If a default value is not specified the object fields + * will be initialized to zero. + */ + public void setDefaultFieldValues() + { + + } + + /** + * Create a clone of this object, a new instance ID must be specified. + * Do not use this function directly to create new instances, the + * UAVObjectManager should be used instead. + */ + public UAVDataObject clone(int instID) { + // TODO: Need to get specific instance to clone + try { + Magnetometer obj = new Magnetometer(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public Magnetometer GetInstance(UAVObjectManager objMngr, int instID) + { + return (Magnetometer)(objMngr.getObject(Magnetometer.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x813B55DE; + protected static final String NAME = "Magnetometer"; + protected static String DESCRIPTION = "The mag data."; + 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/NEDPosition.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/NEDPosition.java new file mode 100644 index 000000000..0aa67862e --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/NEDPosition.java @@ -0,0 +1,146 @@ +/** + ****************************************************************************** + * + * @file uavobjecttemplate.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief Template for an uavobject in java + * This is a autogenerated file!! Do not modify and expect a result. + * 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 nedposition.xml + **/ +public class NEDPosition extends UAVDataObject { + + public NEDPosition() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List NorthElemNames = new ArrayList(); + NorthElemNames.add("0"); + fields.add( new UAVObjectField("North", "m", UAVObjectField.FieldType.FLOAT32, NorthElemNames, null) ); + + List EastElemNames = new ArrayList(); + EastElemNames.add("0"); + fields.add( new UAVObjectField("East", "m", UAVObjectField.FieldType.FLOAT32, EastElemNames, null) ); + + List DownElemNames = new ArrayList(); + DownElemNames.add("0"); + fields.add( new UAVObjectField("Down", "m", 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.flags = + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT | + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT | + 0 << UAVOBJ_TELEMETRY_ACKED_SHIFT | + 0 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_PERIODIC) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_MANUAL) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; + metadata.flightTelemetryUpdatePeriod = 1000; + metadata.gcsTelemetryUpdatePeriod = 0; + metadata.loggingUpdatePeriod = 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 { + NEDPosition obj = new NEDPosition(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public NEDPosition GetInstance(UAVObjectManager objMngr, int instID) + { + return (NEDPosition)(objMngr.getObject(NEDPosition.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x1FB15A00; + protected static final String NAME = "NEDPosition"; + 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/OveroSyncSettings.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/OveroSyncSettings.java new file mode 100644 index 000000000..c680d230c --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/OveroSyncSettings.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. + * Settings to control the behavior of the overo sync module + * + * @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 control the behavior of the overo sync module + +generated from overosyncsettings.xml + **/ +public class OveroSyncSettings extends UAVDataObject { + + public OveroSyncSettings() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List LogOnElemNames = new ArrayList(); + LogOnElemNames.add("0"); + List LogOnEnumOptions = new ArrayList(); + LogOnEnumOptions.add("Never"); + LogOnEnumOptions.add("Always"); + LogOnEnumOptions.add("Armed"); + fields.add( new UAVObjectField("LogOn", "", UAVObjectField.FieldType.ENUM, LogOnElemNames, LogOnEnumOptions) ); + + + // 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.flags = + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT | + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT | + 0 << UAVOBJ_TELEMETRY_ACKED_SHIFT | + 0 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_ONCHANGE) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_MANUAL) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; + metadata.flightTelemetryUpdatePeriod = 0; + metadata.gcsTelemetryUpdatePeriod = 0; + metadata.loggingUpdatePeriod = 1000; + + return metadata; + } + + /** + * Initialize object fields with the default values. + * If a default value is not specified the object fields + * will be initialized to zero. + */ + public void setDefaultFieldValues() + { + getField("LogOn").setValue("Armed"); + + } + + /** + * 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 { + OveroSyncSettings obj = new OveroSyncSettings(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public OveroSyncSettings GetInstance(UAVObjectManager objMngr, int instID) + { + return (OveroSyncSettings)(objMngr.getObject(OveroSyncSettings.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0xA1ABC278; + protected static final String NAME = "OveroSyncSettings"; + protected static String DESCRIPTION = "Settings to control the behavior of the overo sync module"; + 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/OveroSyncStats.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/OveroSyncStats.java new file mode 100644 index 000000000..4c31f21dd --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/OveroSyncStats.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. + * Maintains statistics on transfer rate to and from over + * + * @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 statistics on transfer rate to and from over + +generated from overosyncstats.xml + **/ +public class OveroSyncStats extends UAVDataObject { + + public OveroSyncStats() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List SendElemNames = new ArrayList(); + SendElemNames.add("0"); + fields.add( new UAVObjectField("Send", "B/s", UAVObjectField.FieldType.UINT32, SendElemNames, null) ); + + List ReceivedElemNames = new ArrayList(); + ReceivedElemNames.add("0"); + fields.add( new UAVObjectField("Received", "B/s", UAVObjectField.FieldType.UINT32, ReceivedElemNames, null) ); + + List FramesyncErrorsElemNames = new ArrayList(); + FramesyncErrorsElemNames.add("0"); + fields.add( new UAVObjectField("FramesyncErrors", "count", UAVObjectField.FieldType.UINT32, FramesyncErrorsElemNames, null) ); + + List UnderrunErrorsElemNames = new ArrayList(); + UnderrunErrorsElemNames.add("0"); + fields.add( new UAVObjectField("UnderrunErrors", "count", UAVObjectField.FieldType.UINT32, UnderrunErrorsElemNames, null) ); + + List DroppedUpdatesElemNames = new ArrayList(); + DroppedUpdatesElemNames.add("0"); + fields.add( new UAVObjectField("DroppedUpdates", "", UAVObjectField.FieldType.UINT32, DroppedUpdatesElemNames, null) ); + + List PacketsElemNames = new ArrayList(); + PacketsElemNames.add("0"); + fields.add( new UAVObjectField("Packets", "", UAVObjectField.FieldType.UINT32, PacketsElemNames, null) ); + + 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) ); + + + // 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.flags = + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT | + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT | + 0 << UAVOBJ_TELEMETRY_ACKED_SHIFT | + 0 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_PERIODIC) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_MANUAL) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; + metadata.flightTelemetryUpdatePeriod = 1000; + metadata.gcsTelemetryUpdatePeriod = 0; + metadata.loggingUpdatePeriod = 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 { + OveroSyncStats obj = new OveroSyncStats(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public OveroSyncStats GetInstance(UAVObjectManager objMngr, int instID) + { + return (OveroSyncStats)(objMngr.getObject(OveroSyncStats.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0xD2085FAC; + protected static final String NAME = "OveroSyncStats"; + protected static String DESCRIPTION = "Maintains statistics on transfer rate to and from over"; + 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/PathDesired.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/PathDesired.java new file mode 100644 index 000000000..38e710477 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/PathDesired.java @@ -0,0 +1,162 @@ +/** + ****************************************************************************** + * + * @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 endpoint or path the craft is trying to achieve. Can come from @ref ManualControl 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 endpoint or path the craft is trying to achieve. Can come from @ref ManualControl or @ref PathPlanner + +generated from pathdesired.xml + **/ +public class PathDesired extends UAVDataObject { + + public PathDesired() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List StartElemNames = new ArrayList(); + StartElemNames.add("North"); + StartElemNames.add("East"); + StartElemNames.add("Down"); + fields.add( new UAVObjectField("Start", "m", UAVObjectField.FieldType.FLOAT32, StartElemNames, null) ); + + List EndElemNames = new ArrayList(); + EndElemNames.add("North"); + EndElemNames.add("East"); + EndElemNames.add("Down"); + fields.add( new UAVObjectField("End", "m", UAVObjectField.FieldType.FLOAT32, EndElemNames, null) ); + + List StartingVelocityElemNames = new ArrayList(); + StartingVelocityElemNames.add("0"); + fields.add( new UAVObjectField("StartingVelocity", "m/s", UAVObjectField.FieldType.FLOAT32, StartingVelocityElemNames, null) ); + + List EndingVelocityElemNames = new ArrayList(); + EndingVelocityElemNames.add("0"); + fields.add( new UAVObjectField("EndingVelocity", "m/s", UAVObjectField.FieldType.FLOAT32, EndingVelocityElemNames, null) ); + + List ModeElemNames = new ArrayList(); + ModeElemNames.add("0"); + List ModeEnumOptions = new ArrayList(); + ModeEnumOptions.add("Endpoint"); + ModeEnumOptions.add("Path"); + ModeEnumOptions.add("Land"); + fields.add( new UAVObjectField("Mode", "", UAVObjectField.FieldType.ENUM, ModeElemNames, ModeEnumOptions) ); + + + // 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.flags = + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT | + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT | + 0 << UAVOBJ_TELEMETRY_ACKED_SHIFT | + 0 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_ONCHANGE) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_MANUAL) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; + metadata.flightTelemetryUpdatePeriod = 1000; + metadata.gcsTelemetryUpdatePeriod = 0; + metadata.loggingUpdatePeriod = 0; + + return metadata; + } + + /** + * Initialize object fields with the default values. + * If a default value is not specified the object fields + * will be initialized to zero. + */ + public void setDefaultFieldValues() + { + + } + + /** + * Create a clone of this object, a new instance ID must be specified. + * Do not use this function directly to create new instances, the + * UAVObjectManager should be used instead. + */ + public UAVDataObject clone(int instID) { + // TODO: Need to get specific instance to clone + try { + PathDesired obj = new PathDesired(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public PathDesired GetInstance(UAVObjectManager objMngr, int instID) + { + return (PathDesired)(objMngr.getObject(PathDesired.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x5A4DC71A; + protected static final String NAME = "PathDesired"; + protected static String DESCRIPTION = "The endpoint or path the craft is trying to achieve. Can come from @ref ManualControl 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/PathPlannerSettings.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/PathPlannerSettings.java new file mode 100644 index 000000000..fb6b66e19 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/PathPlannerSettings.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. + * Settings for the @ref PathPlanner Module + * + * @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 PathPlanner Module + +generated from pathplannersettings.xml + **/ +public class PathPlannerSettings extends UAVDataObject { + + public PathPlannerSettings() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List PathModeElemNames = new ArrayList(); + PathModeElemNames.add("0"); + List PathModeEnumOptions = new ArrayList(); + PathModeEnumOptions.add("ENDPOINT"); + PathModeEnumOptions.add("PATH"); + fields.add( new UAVObjectField("PathMode", "", UAVObjectField.FieldType.ENUM, PathModeElemNames, PathModeEnumOptions) ); + + List PreprogrammedPathElemNames = new ArrayList(); + PreprogrammedPathElemNames.add("0"); + List PreprogrammedPathEnumOptions = new ArrayList(); + PreprogrammedPathEnumOptions.add("NONE"); + PreprogrammedPathEnumOptions.add("10M_BOX"); + PreprogrammedPathEnumOptions.add("LOGO"); + fields.add( new UAVObjectField("PreprogrammedPath", "", UAVObjectField.FieldType.ENUM, PreprogrammedPathElemNames, PreprogrammedPathEnumOptions) ); + + + // 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.flags = + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT | + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT | + 1 << UAVOBJ_TELEMETRY_ACKED_SHIFT | + 1 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_ONCHANGE) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_ONCHANGE) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; + metadata.flightTelemetryUpdatePeriod = 0; + metadata.gcsTelemetryUpdatePeriod = 0; + metadata.loggingUpdatePeriod = 0; + + return metadata; + } + + /** + * Initialize object fields with the default values. + * If a default value is not specified the object fields + * will be initialized to zero. + */ + public void setDefaultFieldValues() + { + getField("PathMode").setValue("PATH"); + getField("PreprogrammedPath").setValue("NONE"); + + } + + /** + * 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 { + PathPlannerSettings obj = new PathPlannerSettings(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public PathPlannerSettings GetInstance(UAVObjectManager objMngr, int instID) + { + return (PathPlannerSettings)(objMngr.getObject(PathPlannerSettings.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x290E45DA; + protected static final String NAME = "PathPlannerSettings"; + protected static String DESCRIPTION = "Settings for the @ref PathPlanner Module"; + 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/PipXSettings.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/PipXSettings.java new file mode 100644 index 000000000..aa5387148 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/PipXSettings.java @@ -0,0 +1,326 @@ +/** + ****************************************************************************** + * + * @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. + * PipXtreme configurations options. + * + * @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; + +/** +PipXtreme configurations options. + +generated from pipxsettings.xml + **/ +public class PipXSettings extends UAVDataObject { + + public PipXSettings() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List PairIDElemNames = new ArrayList(); + PairIDElemNames.add("0"); + fields.add( new UAVObjectField("PairID", "", UAVObjectField.FieldType.UINT32, PairIDElemNames, null) ); + + List FrequencyElemNames = new ArrayList(); + FrequencyElemNames.add("0"); + fields.add( new UAVObjectField("Frequency", "", UAVObjectField.FieldType.UINT32, FrequencyElemNames, null) ); + + List SendTimeoutElemNames = new ArrayList(); + SendTimeoutElemNames.add("0"); + fields.add( new UAVObjectField("SendTimeout", "ms", UAVObjectField.FieldType.UINT16, SendTimeoutElemNames, null) ); + + List TelemetryConfigElemNames = new ArrayList(); + TelemetryConfigElemNames.add("0"); + List TelemetryConfigEnumOptions = new ArrayList(); + TelemetryConfigEnumOptions.add("Disabled"); + TelemetryConfigEnumOptions.add("Serial"); + TelemetryConfigEnumOptions.add("UAVTalk"); + TelemetryConfigEnumOptions.add("GCS"); + TelemetryConfigEnumOptions.add("Debug"); + fields.add( new UAVObjectField("TelemetryConfig", "function", UAVObjectField.FieldType.ENUM, TelemetryConfigElemNames, TelemetryConfigEnumOptions) ); + + List TelemetrySpeedElemNames = new ArrayList(); + TelemetrySpeedElemNames.add("0"); + List TelemetrySpeedEnumOptions = new ArrayList(); + TelemetrySpeedEnumOptions.add("2400"); + TelemetrySpeedEnumOptions.add("4800"); + TelemetrySpeedEnumOptions.add("9600"); + TelemetrySpeedEnumOptions.add("19200"); + TelemetrySpeedEnumOptions.add("38400"); + TelemetrySpeedEnumOptions.add("57600"); + TelemetrySpeedEnumOptions.add("115200"); + fields.add( new UAVObjectField("TelemetrySpeed", "bps", UAVObjectField.FieldType.ENUM, TelemetrySpeedElemNames, TelemetrySpeedEnumOptions) ); + + List FlexiConfigElemNames = new ArrayList(); + FlexiConfigElemNames.add("0"); + List FlexiConfigEnumOptions = new ArrayList(); + FlexiConfigEnumOptions.add("Disabled"); + FlexiConfigEnumOptions.add("Serial"); + FlexiConfigEnumOptions.add("UAVTalk"); + FlexiConfigEnumOptions.add("GCS"); + FlexiConfigEnumOptions.add("PPM_In"); + FlexiConfigEnumOptions.add("PPM_Out"); + FlexiConfigEnumOptions.add("RSSI"); + FlexiConfigEnumOptions.add("Debug"); + fields.add( new UAVObjectField("FlexiConfig", "function", UAVObjectField.FieldType.ENUM, FlexiConfigElemNames, FlexiConfigEnumOptions) ); + + List FlexiSpeedElemNames = new ArrayList(); + FlexiSpeedElemNames.add("0"); + List FlexiSpeedEnumOptions = new ArrayList(); + FlexiSpeedEnumOptions.add("2400"); + FlexiSpeedEnumOptions.add("4800"); + FlexiSpeedEnumOptions.add("9600"); + FlexiSpeedEnumOptions.add("19200"); + FlexiSpeedEnumOptions.add("38400"); + FlexiSpeedEnumOptions.add("57600"); + FlexiSpeedEnumOptions.add("115200"); + fields.add( new UAVObjectField("FlexiSpeed", "bps", UAVObjectField.FieldType.ENUM, FlexiSpeedElemNames, FlexiSpeedEnumOptions) ); + + List VCPConfigElemNames = new ArrayList(); + VCPConfigElemNames.add("0"); + List VCPConfigEnumOptions = new ArrayList(); + VCPConfigEnumOptions.add("Disabled"); + VCPConfigEnumOptions.add("Serial"); + VCPConfigEnumOptions.add("Debug"); + fields.add( new UAVObjectField("VCPConfig", "function", UAVObjectField.FieldType.ENUM, VCPConfigElemNames, VCPConfigEnumOptions) ); + + List VCPSpeedElemNames = new ArrayList(); + VCPSpeedElemNames.add("0"); + List VCPSpeedEnumOptions = new ArrayList(); + VCPSpeedEnumOptions.add("2400"); + VCPSpeedEnumOptions.add("4800"); + VCPSpeedEnumOptions.add("9600"); + VCPSpeedEnumOptions.add("19200"); + VCPSpeedEnumOptions.add("38400"); + VCPSpeedEnumOptions.add("57600"); + VCPSpeedEnumOptions.add("115200"); + fields.add( new UAVObjectField("VCPSpeed", "bps", UAVObjectField.FieldType.ENUM, VCPSpeedElemNames, VCPSpeedEnumOptions) ); + + List RFSpeedElemNames = new ArrayList(); + RFSpeedElemNames.add("0"); + List RFSpeedEnumOptions = new ArrayList(); + RFSpeedEnumOptions.add("2400"); + RFSpeedEnumOptions.add("4800"); + RFSpeedEnumOptions.add("9600"); + RFSpeedEnumOptions.add("19200"); + RFSpeedEnumOptions.add("38400"); + RFSpeedEnumOptions.add("57600"); + RFSpeedEnumOptions.add("115200"); + fields.add( new UAVObjectField("RFSpeed", "bps", UAVObjectField.FieldType.ENUM, RFSpeedElemNames, RFSpeedEnumOptions) ); + + List MaxRFPowerElemNames = new ArrayList(); + MaxRFPowerElemNames.add("0"); + List MaxRFPowerEnumOptions = new ArrayList(); + MaxRFPowerEnumOptions.add("1.25"); + MaxRFPowerEnumOptions.add("1.6"); + MaxRFPowerEnumOptions.add("3.16"); + MaxRFPowerEnumOptions.add("6.3"); + MaxRFPowerEnumOptions.add("12.6"); + MaxRFPowerEnumOptions.add("25"); + MaxRFPowerEnumOptions.add("50"); + MaxRFPowerEnumOptions.add("100"); + fields.add( new UAVObjectField("MaxRFPower", "mW", UAVObjectField.FieldType.ENUM, MaxRFPowerElemNames, MaxRFPowerEnumOptions) ); + + List MinPacketSizeElemNames = new ArrayList(); + MinPacketSizeElemNames.add("0"); + fields.add( new UAVObjectField("MinPacketSize", "bytes", UAVObjectField.FieldType.UINT8, MinPacketSizeElemNames, null) ); + + List FrequencyCalibrationElemNames = new ArrayList(); + FrequencyCalibrationElemNames.add("0"); + fields.add( new UAVObjectField("FrequencyCalibration", "", UAVObjectField.FieldType.UINT8, FrequencyCalibrationElemNames, null) ); + + List AESKeyElemNames = new ArrayList(); + AESKeyElemNames.add("0"); + AESKeyElemNames.add("1"); + AESKeyElemNames.add("2"); + AESKeyElemNames.add("3"); + AESKeyElemNames.add("4"); + AESKeyElemNames.add("5"); + AESKeyElemNames.add("6"); + AESKeyElemNames.add("7"); + AESKeyElemNames.add("8"); + AESKeyElemNames.add("9"); + AESKeyElemNames.add("10"); + AESKeyElemNames.add("11"); + AESKeyElemNames.add("12"); + AESKeyElemNames.add("13"); + AESKeyElemNames.add("14"); + AESKeyElemNames.add("15"); + AESKeyElemNames.add("16"); + AESKeyElemNames.add("17"); + AESKeyElemNames.add("18"); + AESKeyElemNames.add("19"); + AESKeyElemNames.add("20"); + AESKeyElemNames.add("21"); + AESKeyElemNames.add("22"); + AESKeyElemNames.add("23"); + AESKeyElemNames.add("24"); + AESKeyElemNames.add("25"); + AESKeyElemNames.add("26"); + AESKeyElemNames.add("27"); + AESKeyElemNames.add("28"); + AESKeyElemNames.add("29"); + AESKeyElemNames.add("30"); + AESKeyElemNames.add("31"); + fields.add( new UAVObjectField("AESKey", "", UAVObjectField.FieldType.UINT8, AESKeyElemNames, 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.flags = + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT | + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT | + 1 << UAVOBJ_TELEMETRY_ACKED_SHIFT | + 1 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_ONCHANGE) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_ONCHANGE) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; + metadata.flightTelemetryUpdatePeriod = 0; + metadata.gcsTelemetryUpdatePeriod = 0; + metadata.loggingUpdatePeriod = 0; + + return metadata; + } + + /** + * Initialize object fields with the default values. + * If a default value is not specified the object fields + * will be initialized to zero. + */ + public void setDefaultFieldValues() + { + getField("PairID").setValue(0); + getField("Frequency").setValue(434000000); + getField("SendTimeout").setValue(50); + getField("TelemetryConfig").setValue("UAVTalk"); + getField("TelemetrySpeed").setValue("57600"); + getField("FlexiConfig").setValue("Disabled"); + getField("FlexiSpeed").setValue("57600"); + getField("VCPConfig").setValue("Disabled"); + getField("VCPSpeed").setValue("57600"); + getField("RFSpeed").setValue("115200"); + getField("MaxRFPower").setValue("100"); + getField("MinPacketSize").setValue(50); + getField("FrequencyCalibration").setValue(127); + getField("AESKey").setValue(0,0); + getField("AESKey").setValue(0,1); + getField("AESKey").setValue(0,2); + getField("AESKey").setValue(0,3); + getField("AESKey").setValue(0,4); + getField("AESKey").setValue(0,5); + getField("AESKey").setValue(0,6); + getField("AESKey").setValue(0,7); + getField("AESKey").setValue(0,8); + getField("AESKey").setValue(0,9); + getField("AESKey").setValue(0,10); + getField("AESKey").setValue(0,11); + getField("AESKey").setValue(0,12); + getField("AESKey").setValue(0,13); + getField("AESKey").setValue(0,14); + getField("AESKey").setValue(0,15); + getField("AESKey").setValue(0,16); + getField("AESKey").setValue(0,17); + getField("AESKey").setValue(0,18); + getField("AESKey").setValue(0,19); + getField("AESKey").setValue(0,20); + getField("AESKey").setValue(0,21); + getField("AESKey").setValue(0,22); + getField("AESKey").setValue(0,23); + getField("AESKey").setValue(0,24); + getField("AESKey").setValue(0,25); + getField("AESKey").setValue(0,26); + getField("AESKey").setValue(0,27); + getField("AESKey").setValue(0,28); + getField("AESKey").setValue(0,29); + getField("AESKey").setValue(0,30); + getField("AESKey").setValue(0,31); + + } + + /** + * 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 { + PipXSettings obj = new PipXSettings(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public PipXSettings GetInstance(UAVObjectManager objMngr, int instID) + { + return (PipXSettings)(objMngr.getObject(PipXSettings.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0xBA192BCA; + protected static final String NAME = "PipXSettings"; + protected static String DESCRIPTION = "PipXtreme configurations options."; + 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/PipXStatus.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/PipXStatus.java new file mode 100644 index 000000000..fb6a91e33 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/PipXStatus.java @@ -0,0 +1,301 @@ +/** + ****************************************************************************** + * + * @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. + * PipXtreme device status. + * + * @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; + +/** +PipXtreme device status. + +generated from pipxstatus.xml + **/ +public class PipXStatus extends UAVDataObject { + + public PipXStatus() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List MinFrequencyElemNames = new ArrayList(); + MinFrequencyElemNames.add("0"); + fields.add( new UAVObjectField("MinFrequency", "Hz", UAVObjectField.FieldType.UINT32, MinFrequencyElemNames, null) ); + + List MaxFrequencyElemNames = new ArrayList(); + MaxFrequencyElemNames.add("0"); + fields.add( new UAVObjectField("MaxFrequency", "Hz", UAVObjectField.FieldType.UINT32, MaxFrequencyElemNames, null) ); + + List FrequencyStepSizeElemNames = new ArrayList(); + FrequencyStepSizeElemNames.add("0"); + fields.add( new UAVObjectField("FrequencyStepSize", "", UAVObjectField.FieldType.FLOAT32, FrequencyStepSizeElemNames, null) ); + + List DeviceIDElemNames = new ArrayList(); + DeviceIDElemNames.add("0"); + fields.add( new UAVObjectField("DeviceID", "", UAVObjectField.FieldType.UINT32, DeviceIDElemNames, null) ); + + List AFCElemNames = new ArrayList(); + AFCElemNames.add("0"); + fields.add( new UAVObjectField("AFC", "", UAVObjectField.FieldType.INT32, AFCElemNames, null) ); + + List PairIDsElemNames = new ArrayList(); + PairIDsElemNames.add("0"); + PairIDsElemNames.add("1"); + PairIDsElemNames.add("2"); + PairIDsElemNames.add("3"); + fields.add( new UAVObjectField("PairIDs", "", UAVObjectField.FieldType.UINT32, PairIDsElemNames, null) ); + + List BoardRevisionElemNames = new ArrayList(); + BoardRevisionElemNames.add("0"); + fields.add( new UAVObjectField("BoardRevision", "", UAVObjectField.FieldType.UINT16, BoardRevisionElemNames, null) ); + + List RetriesElemNames = new ArrayList(); + RetriesElemNames.add("0"); + fields.add( new UAVObjectField("Retries", "", UAVObjectField.FieldType.UINT16, RetriesElemNames, null) ); + + List ErrorsElemNames = new ArrayList(); + ErrorsElemNames.add("0"); + fields.add( new UAVObjectField("Errors", "", UAVObjectField.FieldType.UINT16, ErrorsElemNames, null) ); + + List UAVTalkErrorsElemNames = new ArrayList(); + UAVTalkErrorsElemNames.add("0"); + fields.add( new UAVObjectField("UAVTalkErrors", "", UAVObjectField.FieldType.UINT16, UAVTalkErrorsElemNames, null) ); + + List DroppedElemNames = new ArrayList(); + DroppedElemNames.add("0"); + fields.add( new UAVObjectField("Dropped", "", UAVObjectField.FieldType.UINT16, DroppedElemNames, null) ); + + List ResetsElemNames = new ArrayList(); + ResetsElemNames.add("0"); + fields.add( new UAVObjectField("Resets", "", UAVObjectField.FieldType.UINT16, ResetsElemNames, null) ); + + List TXRateElemNames = new ArrayList(); + TXRateElemNames.add("0"); + fields.add( new UAVObjectField("TXRate", "Bps", UAVObjectField.FieldType.UINT16, TXRateElemNames, null) ); + + List RXRateElemNames = new ArrayList(); + RXRateElemNames.add("0"); + fields.add( new UAVObjectField("RXRate", "Bps", UAVObjectField.FieldType.UINT16, RXRateElemNames, 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"); + fields.add( new UAVObjectField("Description", "", UAVObjectField.FieldType.UINT8, DescriptionElemNames, null) ); + + List CPUSerialElemNames = new ArrayList(); + CPUSerialElemNames.add("0"); + CPUSerialElemNames.add("1"); + CPUSerialElemNames.add("2"); + CPUSerialElemNames.add("3"); + CPUSerialElemNames.add("4"); + CPUSerialElemNames.add("5"); + CPUSerialElemNames.add("6"); + CPUSerialElemNames.add("7"); + CPUSerialElemNames.add("8"); + CPUSerialElemNames.add("9"); + CPUSerialElemNames.add("10"); + CPUSerialElemNames.add("11"); + fields.add( new UAVObjectField("CPUSerial", "", UAVObjectField.FieldType.UINT8, CPUSerialElemNames, null) ); + + List BoardTypeElemNames = new ArrayList(); + BoardTypeElemNames.add("0"); + fields.add( new UAVObjectField("BoardType", "", UAVObjectField.FieldType.UINT8, BoardTypeElemNames, null) ); + + List FrequencyBandElemNames = new ArrayList(); + FrequencyBandElemNames.add("0"); + fields.add( new UAVObjectField("FrequencyBand", "", UAVObjectField.FieldType.UINT8, FrequencyBandElemNames, null) ); + + List RSSIElemNames = new ArrayList(); + RSSIElemNames.add("0"); + fields.add( new UAVObjectField("RSSI", "dBm", UAVObjectField.FieldType.INT8, RSSIElemNames, null) ); + + List LinkStateElemNames = new ArrayList(); + LinkStateElemNames.add("0"); + List LinkStateEnumOptions = new ArrayList(); + LinkStateEnumOptions.add("Disconnected"); + LinkStateEnumOptions.add("Connecting"); + LinkStateEnumOptions.add("Connected"); + fields.add( new UAVObjectField("LinkState", "function", UAVObjectField.FieldType.ENUM, LinkStateElemNames, LinkStateEnumOptions) ); + + List PairSignalStrengthsElemNames = new ArrayList(); + PairSignalStrengthsElemNames.add("0"); + PairSignalStrengthsElemNames.add("1"); + PairSignalStrengthsElemNames.add("2"); + PairSignalStrengthsElemNames.add("3"); + fields.add( new UAVObjectField("PairSignalStrengths", "dBm", UAVObjectField.FieldType.INT8, PairSignalStrengthsElemNames, 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.flags = + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT | + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READONLY) << UAVOBJ_GCS_ACCESS_SHIFT | + 0 << UAVOBJ_TELEMETRY_ACKED_SHIFT | + 0 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_MANUAL) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_MANUAL) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; + metadata.flightTelemetryUpdatePeriod = 0; + metadata.gcsTelemetryUpdatePeriod = 0; + metadata.loggingUpdatePeriod = 1000; + + return metadata; + } + + /** + * Initialize object fields with the default values. + * If a default value is not specified the object fields + * will be initialized to zero. + */ + public void setDefaultFieldValues() + { + getField("MinFrequency").setValue(0); + getField("MaxFrequency").setValue(0); + getField("FrequencyStepSize").setValue(0); + getField("DeviceID").setValue(0); + getField("AFC").setValue(0); + getField("PairIDs").setValue(0,0); + getField("PairIDs").setValue(0,1); + getField("PairIDs").setValue(0,2); + getField("PairIDs").setValue(0,3); + getField("Retries").setValue(0); + getField("Errors").setValue(0); + getField("UAVTalkErrors").setValue(0); + getField("Dropped").setValue(0); + getField("Resets").setValue(0); + getField("TXRate").setValue(0); + getField("RXRate").setValue(0); + getField("FrequencyBand").setValue(0); + getField("RSSI").setValue(0); + getField("LinkState").setValue("Disconnected"); + getField("PairSignalStrengths").setValue(-127,0); + getField("PairSignalStrengths").setValue(-127,1); + getField("PairSignalStrengths").setValue(-127,2); + getField("PairSignalStrengths").setValue(-127,3); + + } + + /** + * 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 { + PipXStatus obj = new PipXStatus(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public PipXStatus GetInstance(UAVObjectManager objMngr, int instID) + { + return (PipXStatus)(objMngr.getObject(PipXStatus.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x3FC68A86; + protected static final String NAME = "PipXStatus"; + protected static String DESCRIPTION = "PipXtreme device status."; + 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/RevoCalibration.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/RevoCalibration.java new file mode 100644 index 000000000..940f78875 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/RevoCalibration.java @@ -0,0 +1,249 @@ +/** + ****************************************************************************** + * + * @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 INS 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 INS to control the algorithm and what is updated + +generated from revocalibration.xml + **/ +public class RevoCalibration extends UAVDataObject { + + public RevoCalibration() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + 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", 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", "gain", 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", 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", "deg/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", "gain", 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", "(deg/s)^2", UAVObjectField.FieldType.FLOAT32, gyro_varElemNames, null) ); + + List gyro_tempcoeffElemNames = new ArrayList(); + gyro_tempcoeffElemNames.add("X"); + gyro_tempcoeffElemNames.add("Y"); + gyro_tempcoeffElemNames.add("Z"); + fields.add( new UAVObjectField("gyro_tempcoeff", "(deg/s)/deg", UAVObjectField.FieldType.FLOAT32, gyro_tempcoeffElemNames, 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", "gain", 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 gps_varElemNames = new ArrayList(); + gps_varElemNames.add("Pos"); + gps_varElemNames.add("Vel"); + fields.add( new UAVObjectField("gps_var", "m^2", UAVObjectField.FieldType.FLOAT32, gps_varElemNames, null) ); + + List baro_varElemNames = new ArrayList(); + baro_varElemNames.add("0"); + fields.add( new UAVObjectField("baro_var", "m^2", UAVObjectField.FieldType.FLOAT32, baro_varElemNames, null) ); + + List MagBiasNullingRateElemNames = new ArrayList(); + MagBiasNullingRateElemNames.add("0"); + fields.add( new UAVObjectField("MagBiasNullingRate", "", UAVObjectField.FieldType.FLOAT32, MagBiasNullingRateElemNames, null) ); + + List BiasCorrectedRawElemNames = new ArrayList(); + BiasCorrectedRawElemNames.add("0"); + List BiasCorrectedRawEnumOptions = new ArrayList(); + BiasCorrectedRawEnumOptions.add("FALSE"); + BiasCorrectedRawEnumOptions.add("TRUE"); + fields.add( new UAVObjectField("BiasCorrectedRaw", "", UAVObjectField.FieldType.ENUM, BiasCorrectedRawElemNames, BiasCorrectedRawEnumOptions) ); + + + // 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.flags = + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT | + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT | + 1 << UAVOBJ_TELEMETRY_ACKED_SHIFT | + 1 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_ONCHANGE) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_ONCHANGE) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; + metadata.flightTelemetryUpdatePeriod = 0; + metadata.gcsTelemetryUpdatePeriod = 0; + metadata.loggingUpdatePeriod = 0; + + return metadata; + } + + /** + * Initialize object fields with the default values. + * If a default value is not specified the object fields + * will be initialized to zero. + */ + public void setDefaultFieldValues() + { + getField("accel_bias").setValue(0,0); + getField("accel_bias").setValue(0,1); + getField("accel_bias").setValue(0,2); + getField("accel_scale").setValue(1,0); + getField("accel_scale").setValue(1,1); + getField("accel_scale").setValue(1,2); + getField("accel_var").setValue(0.01,0); + getField("accel_var").setValue(0.01,1); + getField("accel_var").setValue(0.01,2); + getField("gyro_bias").setValue(0,0); + getField("gyro_bias").setValue(0,1); + getField("gyro_bias").setValue(0,2); + getField("gyro_scale").setValue(1,0); + getField("gyro_scale").setValue(1,1); + getField("gyro_scale").setValue(1,2); + getField("gyro_var").setValue(0.01,0); + getField("gyro_var").setValue(0.01,1); + getField("gyro_var").setValue(0.01,2); + getField("gyro_tempcoeff").setValue(1,0); + getField("gyro_tempcoeff").setValue(1,1); + getField("gyro_tempcoeff").setValue(1,2); + getField("mag_bias").setValue(0,0); + getField("mag_bias").setValue(0,1); + getField("mag_bias").setValue(0,2); + getField("mag_scale").setValue(1,0); + getField("mag_scale").setValue(1,1); + getField("mag_scale").setValue(1,2); + getField("mag_var").setValue(0.01,0); + getField("mag_var").setValue(0.01,1); + getField("mag_var").setValue(10,2); + getField("gps_var").setValue(1,0); + getField("gps_var").setValue(1,1); + getField("baro_var").setValue(1); + getField("MagBiasNullingRate").setValue(0); + getField("BiasCorrectedRaw").setValue("TRUE"); + + } + + /** + * 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 { + RevoCalibration obj = new RevoCalibration(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public RevoCalibration GetInstance(UAVObjectManager objMngr, int instID) + { + return (RevoCalibration)(objMngr.getObject(RevoCalibration.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0xA2A63C7C; + protected static final String NAME = "RevoCalibration"; + protected static String DESCRIPTION = "Settings for the INS 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/RevoSettings.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/RevoSettings.java new file mode 100644 index 000000000..5e36565b2 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/RevoSettings.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. + * Settings for the revo 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 revo to control the algorithm and what is updated + +generated from revosettings.xml + **/ +public class RevoSettings extends UAVDataObject { + + public RevoSettings() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List FusionAlgorithmElemNames = new ArrayList(); + FusionAlgorithmElemNames.add("0"); + List FusionAlgorithmEnumOptions = new ArrayList(); + FusionAlgorithmEnumOptions.add("Complimentary"); + FusionAlgorithmEnumOptions.add("INSIndoor"); + FusionAlgorithmEnumOptions.add("INSOutdoor"); + fields.add( new UAVObjectField("FusionAlgorithm", "", UAVObjectField.FieldType.ENUM, FusionAlgorithmElemNames, FusionAlgorithmEnumOptions) ); + + + // 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.flags = + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT | + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT | + 1 << UAVOBJ_TELEMETRY_ACKED_SHIFT | + 1 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_ONCHANGE) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_ONCHANGE) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; + metadata.flightTelemetryUpdatePeriod = 0; + metadata.gcsTelemetryUpdatePeriod = 0; + metadata.loggingUpdatePeriod = 0; + + return metadata; + } + + /** + * Initialize object fields with the default values. + * If a default value is not specified the object fields + * will be initialized to zero. + */ + public void setDefaultFieldValues() + { + getField("FusionAlgorithm").setValue("Complimentary"); + + } + + /** + * 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 { + RevoSettings obj = new RevoSettings(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public RevoSettings GetInstance(UAVObjectManager objMngr, int instID) + { + return (RevoSettings)(objMngr.getObject(RevoSettings.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0xE2DA70EA; + protected static final String NAME = "RevoSettings"; + protected static String DESCRIPTION = "Settings for the revo 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/TxPIDSettings.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/TxPIDSettings.java new file mode 100644 index 000000000..789f31b3f --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/TxPIDSettings.java @@ -0,0 +1,225 @@ +/** + ****************************************************************************** + * + * @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 used by @ref TxPID optional module to tune PID settings using R/C transmitter + * + * @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 used by @ref TxPID optional module to tune PID settings using R/C transmitter + +generated from txpidsettings.xml + **/ +public class TxPIDSettings extends UAVDataObject { + + public TxPIDSettings() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List ThrottleRangeElemNames = new ArrayList(); + ThrottleRangeElemNames.add("Min"); + ThrottleRangeElemNames.add("Max"); + fields.add( new UAVObjectField("ThrottleRange", "%", UAVObjectField.FieldType.FLOAT32, ThrottleRangeElemNames, null) ); + + List MinPIDElemNames = new ArrayList(); + MinPIDElemNames.add("Instance1"); + MinPIDElemNames.add("Instance2"); + MinPIDElemNames.add("Instance3"); + fields.add( new UAVObjectField("MinPID", "", UAVObjectField.FieldType.FLOAT32, MinPIDElemNames, null) ); + + List MaxPIDElemNames = new ArrayList(); + MaxPIDElemNames.add("Instance1"); + MaxPIDElemNames.add("Instance2"); + MaxPIDElemNames.add("Instance3"); + fields.add( new UAVObjectField("MaxPID", "", UAVObjectField.FieldType.FLOAT32, MaxPIDElemNames, null) ); + + List UpdateModeElemNames = new ArrayList(); + UpdateModeElemNames.add("0"); + List UpdateModeEnumOptions = new ArrayList(); + UpdateModeEnumOptions.add("Never"); + UpdateModeEnumOptions.add("When Armed"); + UpdateModeEnumOptions.add("Always"); + fields.add( new UAVObjectField("UpdateMode", "option", UAVObjectField.FieldType.ENUM, UpdateModeElemNames, UpdateModeEnumOptions) ); + + List InputsElemNames = new ArrayList(); + InputsElemNames.add("Instance1"); + InputsElemNames.add("Instance2"); + InputsElemNames.add("Instance3"); + List InputsEnumOptions = new ArrayList(); + InputsEnumOptions.add("Throttle"); + InputsEnumOptions.add("Accessory0"); + InputsEnumOptions.add("Accessory1"); + InputsEnumOptions.add("Accessory2"); + InputsEnumOptions.add("Accessory3"); + InputsEnumOptions.add("Accessory4"); + InputsEnumOptions.add("Accessory5"); + fields.add( new UAVObjectField("Inputs", "channel", UAVObjectField.FieldType.ENUM, InputsElemNames, InputsEnumOptions) ); + + List PIDsElemNames = new ArrayList(); + PIDsElemNames.add("Instance1"); + PIDsElemNames.add("Instance2"); + PIDsElemNames.add("Instance3"); + List PIDsEnumOptions = new ArrayList(); + PIDsEnumOptions.add("Disabled"); + PIDsEnumOptions.add("Roll Rate.Kp"); + PIDsEnumOptions.add("Pitch Rate.Kp"); + PIDsEnumOptions.add("Roll+Pitch Rate.Kp"); + PIDsEnumOptions.add("Yaw Rate.Kp"); + PIDsEnumOptions.add("Roll Rate.Ki"); + PIDsEnumOptions.add("Pitch Rate.Ki"); + PIDsEnumOptions.add("Roll+Pitch Rate.Ki"); + PIDsEnumOptions.add("Yaw Rate.Ki"); + PIDsEnumOptions.add("Roll Rate.Kd"); + PIDsEnumOptions.add("Pitch Rate.Kd"); + PIDsEnumOptions.add("Roll+Pitch Rate.Kd"); + PIDsEnumOptions.add("Yaw Rate.Kd"); + PIDsEnumOptions.add("Roll Rate.ILimit"); + PIDsEnumOptions.add("Pitch Rate.ILimit"); + PIDsEnumOptions.add("Roll+Pitch Rate.ILimit"); + PIDsEnumOptions.add("Yaw Rate.ILimit"); + PIDsEnumOptions.add("Roll Attitude.Kp"); + PIDsEnumOptions.add("Pitch Attitude.Kp"); + PIDsEnumOptions.add("Roll+Pitch Attitude.Kp"); + PIDsEnumOptions.add("Yaw Attitude.Kp"); + PIDsEnumOptions.add("Roll Attitude.Ki"); + PIDsEnumOptions.add("Pitch Attitude.Ki"); + PIDsEnumOptions.add("Roll+Pitch Attitude.Ki"); + PIDsEnumOptions.add("Yaw Attitude.Ki"); + PIDsEnumOptions.add("Roll Attitude.ILimit"); + PIDsEnumOptions.add("Pitch Attitude.ILimit"); + PIDsEnumOptions.add("Roll+Pitch Attitude.ILimit"); + PIDsEnumOptions.add("Yaw Attitude.ILimit"); + PIDsEnumOptions.add("GyroTau"); + fields.add( new UAVObjectField("PIDs", "option", UAVObjectField.FieldType.ENUM, PIDsElemNames, PIDsEnumOptions) ); + + + // 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.flags = + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT | + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT | + 1 << UAVOBJ_TELEMETRY_ACKED_SHIFT | + 1 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_ONCHANGE) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_ONCHANGE) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; + metadata.flightTelemetryUpdatePeriod = 0; + metadata.gcsTelemetryUpdatePeriod = 0; + metadata.loggingUpdatePeriod = 0; + + return metadata; + } + + /** + * Initialize object fields with the default values. + * If a default value is not specified the object fields + * will be initialized to zero. + */ + public void setDefaultFieldValues() + { + getField("ThrottleRange").setValue(0.2,0); + getField("ThrottleRange").setValue(0.8,1); + getField("MinPID").setValue(0,0); + getField("MinPID").setValue(0,1); + getField("MinPID").setValue(0,2); + getField("MaxPID").setValue(0,0); + getField("MaxPID").setValue(0,1); + getField("MaxPID").setValue(0,2); + getField("UpdateMode").setValue("When Armed"); + getField("Inputs").setValue("Throttle",0); + getField("Inputs").setValue("Accessory0",1); + getField("Inputs").setValue("Accessory1",2); + getField("PIDs").setValue("Disabled",0); + getField("PIDs").setValue("Disabled",1); + getField("PIDs").setValue("Disabled",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 { + TxPIDSettings obj = new TxPIDSettings(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public TxPIDSettings GetInstance(UAVObjectManager objMngr, int instID) + { + return (TxPIDSettings)(objMngr.getObject(TxPIDSettings.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x42B2D2AE; + protected static final String NAME = "TxPIDSettings"; + protected static String DESCRIPTION = "Settings used by @ref TxPID optional module to tune PID settings using R/C transmitter"; + 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/VtolPathFollowerSettings.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/VtolPathFollowerSettings.java new file mode 100644 index 000000000..b3c01dc8a --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/VtolPathFollowerSettings.java @@ -0,0 +1,232 @@ +/** + ****************************************************************************** + * + * @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 VtolPathFollower module + * + * @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 VtolPathFollower module + +generated from vtolpathfollowersettings.xml + **/ +public class VtolPathFollowerSettings extends UAVDataObject { + + public VtolPathFollowerSettings() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List HorizontalPosPIElemNames = new ArrayList(); + HorizontalPosPIElemNames.add("Kp"); + HorizontalPosPIElemNames.add("Ki"); + HorizontalPosPIElemNames.add("ILimit"); + fields.add( new UAVObjectField("HorizontalPosPI", "(m/s)/m", UAVObjectField.FieldType.FLOAT32, HorizontalPosPIElemNames, null) ); + + List HorizontalVelPIDElemNames = new ArrayList(); + HorizontalVelPIDElemNames.add("Kp"); + HorizontalVelPIDElemNames.add("Ki"); + HorizontalVelPIDElemNames.add("Kd"); + HorizontalVelPIDElemNames.add("ILimit"); + fields.add( new UAVObjectField("HorizontalVelPID", "deg/(m/s)", UAVObjectField.FieldType.FLOAT32, HorizontalVelPIDElemNames, null) ); + + List VerticalPosPIElemNames = new ArrayList(); + VerticalPosPIElemNames.add("Kp"); + VerticalPosPIElemNames.add("Ki"); + VerticalPosPIElemNames.add("ILimit"); + fields.add( new UAVObjectField("VerticalPosPI", "", UAVObjectField.FieldType.FLOAT32, VerticalPosPIElemNames, 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 VelocityFeedforwardElemNames = new ArrayList(); + VelocityFeedforwardElemNames.add("0"); + fields.add( new UAVObjectField("VelocityFeedforward", "deg/(m/s)", UAVObjectField.FieldType.FLOAT32, VelocityFeedforwardElemNames, null) ); + + 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", "ms", UAVObjectField.FieldType.INT32, UpdatePeriodElemNames, null) ); + + List HorizontalVelMaxElemNames = new ArrayList(); + HorizontalVelMaxElemNames.add("0"); + fields.add( new UAVObjectField("HorizontalVelMax", "m/s", UAVObjectField.FieldType.UINT16, HorizontalVelMaxElemNames, null) ); + + List VerticalVelMaxElemNames = new ArrayList(); + VerticalVelMaxElemNames.add("0"); + fields.add( new UAVObjectField("VerticalVelMax", "m/s", UAVObjectField.FieldType.UINT16, VerticalVelMaxElemNames, null) ); + + 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 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 VelocitySourceElemNames = new ArrayList(); + VelocitySourceElemNames.add("0"); + List VelocitySourceEnumOptions = new ArrayList(); + VelocitySourceEnumOptions.add("EKF"); + VelocitySourceEnumOptions.add("NEDVEL"); + VelocitySourceEnumOptions.add("GPSPOS"); + fields.add( new UAVObjectField("VelocitySource", "", UAVObjectField.FieldType.ENUM, VelocitySourceElemNames, VelocitySourceEnumOptions) ); + + List PositionSourceElemNames = new ArrayList(); + PositionSourceElemNames.add("0"); + List PositionSourceEnumOptions = new ArrayList(); + PositionSourceEnumOptions.add("EKF"); + PositionSourceEnumOptions.add("GPSPOS"); + fields.add( new UAVObjectField("PositionSource", "", UAVObjectField.FieldType.ENUM, PositionSourceElemNames, PositionSourceEnumOptions) ); + + + // 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.flags = + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT | + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT | + 1 << UAVOBJ_TELEMETRY_ACKED_SHIFT | + 1 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_ONCHANGE) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_ONCHANGE) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; + metadata.flightTelemetryUpdatePeriod = 0; + metadata.gcsTelemetryUpdatePeriod = 0; + metadata.loggingUpdatePeriod = 0; + + return metadata; + } + + /** + * Initialize object fields with the default values. + * If a default value is not specified the object fields + * will be initialized to zero. + */ + public void setDefaultFieldValues() + { + getField("HorizontalPosPI").setValue(1,0); + getField("HorizontalPosPI").setValue(0,1); + getField("HorizontalPosPI").setValue(0,2); + getField("HorizontalVelPID").setValue(5,0); + getField("HorizontalVelPID").setValue(0,1); + getField("HorizontalVelPID").setValue(1,2); + getField("HorizontalVelPID").setValue(0,3); + getField("VerticalPosPI").setValue(0.1,0); + getField("VerticalPosPI").setValue(0.001,1); + getField("VerticalPosPI").setValue(200,2); + getField("VerticalVelPID").setValue(0.1,0); + getField("VerticalVelPID").setValue(0,1); + getField("VerticalVelPID").setValue(0,2); + getField("VerticalVelPID").setValue(0,3); + getField("VelocityFeedforward").setValue(0); + getField("MaxRollPitch").setValue(20); + getField("UpdatePeriod").setValue(100); + getField("HorizontalVelMax").setValue(10); + getField("VerticalVelMax").setValue(1); + getField("GuidanceMode").setValue("DUAL_LOOP"); + getField("ThrottleControl").setValue("FALSE"); + getField("VelocitySource").setValue("EKF"); + getField("PositionSource").setValue("EKF"); + + } + + /** + * 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 { + VtolPathFollowerSettings obj = new VtolPathFollowerSettings(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public VtolPathFollowerSettings GetInstance(UAVObjectManager objMngr, int instID) + { + return (VtolPathFollowerSettings)(objMngr.getObject(VtolPathFollowerSettings.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x973991F6; + protected static final String NAME = "VtolPathFollowerSettings"; + protected static String DESCRIPTION = "Settings for the @ref VtolPathFollower module"; + 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/Waypoint.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/Waypoint.java new file mode 100644 index 000000000..4db7179ad --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/Waypoint.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. + * A waypoint the aircraft can try and hit. Used by the @ref PathPlanner module + * + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +package org.openpilot.uavtalk.uavobjects; + +import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.List; +import java.util.ListIterator; + +import org.openpilot.uavtalk.UAVObjectManager; +import org.openpilot.uavtalk.UAVObject; +import org.openpilot.uavtalk.UAVDataObject; +import org.openpilot.uavtalk.UAVObjectField; + +/** +A waypoint the aircraft can try and hit. Used by the @ref PathPlanner module + +generated from waypoint.xml + **/ +public class Waypoint extends UAVDataObject { + + public Waypoint() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List PositionElemNames = new ArrayList(); + PositionElemNames.add("North"); + PositionElemNames.add("East"); + PositionElemNames.add("Down"); + fields.add( new UAVObjectField("Position", "m", UAVObjectField.FieldType.FLOAT32, PositionElemNames, null) ); + + List VelocityElemNames = new ArrayList(); + VelocityElemNames.add("North"); + VelocityElemNames.add("East"); + VelocityElemNames.add("Down"); + fields.add( new UAVObjectField("Velocity", "m/s", UAVObjectField.FieldType.FLOAT32, VelocityElemNames, null) ); + + List YawDesiredElemNames = new ArrayList(); + YawDesiredElemNames.add("0"); + fields.add( new UAVObjectField("YawDesired", "deg", UAVObjectField.FieldType.FLOAT32, YawDesiredElemNames, null) ); + + List ActionElemNames = new ArrayList(); + ActionElemNames.add("0"); + List ActionEnumOptions = new ArrayList(); + ActionEnumOptions.add("PathToNext"); + ActionEnumOptions.add("EndpointToNext"); + ActionEnumOptions.add("Land"); + ActionEnumOptions.add("Stop"); + fields.add( new UAVObjectField("Action", "", UAVObjectField.FieldType.ENUM, ActionElemNames, ActionEnumOptions) ); + + + // 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.flags = + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT | + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT | + 0 << UAVOBJ_TELEMETRY_ACKED_SHIFT | + 0 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_PERIODIC) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_MANUAL) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; + metadata.flightTelemetryUpdatePeriod = 4000; + metadata.gcsTelemetryUpdatePeriod = 0; + metadata.loggingUpdatePeriod = 1000; + + return metadata; + } + + /** + * Initialize object fields with the default values. + * If a default value is not specified the object fields + * will be initialized to zero. + */ + public void setDefaultFieldValues() + { + + } + + /** + * Create a clone of this object, a new instance ID must be specified. + * Do not use this function directly to create new instances, the + * UAVObjectManager should be used instead. + */ + public UAVDataObject clone(int instID) { + // TODO: Need to get specific instance to clone + try { + Waypoint obj = new Waypoint(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public Waypoint GetInstance(UAVObjectManager objMngr, int instID) + { + return (Waypoint)(objMngr.getObject(Waypoint.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x338C5F90; + protected static final String NAME = "Waypoint"; + protected static String DESCRIPTION = "A waypoint the aircraft can try and hit. Used by the @ref PathPlanner module"; + protected static final boolean ISSINGLEINST = 0 == 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/WaypointActive.java b/androidgcs/src/org/openpilot/uavtalk/uavobjects/WaypointActive.java new file mode 100644 index 000000000..06f3ab6c4 --- /dev/null +++ b/androidgcs/src/org/openpilot/uavtalk/uavobjects/WaypointActive.java @@ -0,0 +1,138 @@ +/** + ****************************************************************************** + * + * @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. + * Indicates the currently active waypoint + * + * @see The GNU Public License (GPL) Version 3 + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +package org.openpilot.uavtalk.uavobjects; + +import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.List; +import java.util.ListIterator; + +import org.openpilot.uavtalk.UAVObjectManager; +import org.openpilot.uavtalk.UAVObject; +import org.openpilot.uavtalk.UAVDataObject; +import org.openpilot.uavtalk.UAVObjectField; + +/** +Indicates the currently active waypoint + +generated from waypointactive.xml + **/ +public class WaypointActive extends UAVDataObject { + + public WaypointActive() { + super(OBJID, ISSINGLEINST, ISSETTINGS, NAME); + + List fields = new ArrayList(); + + + List IndexElemNames = new ArrayList(); + IndexElemNames.add("0"); + fields.add( new UAVObjectField("Index", "", UAVObjectField.FieldType.UINT8, IndexElemNames, 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.flags = + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT | + UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT | + 0 << UAVOBJ_TELEMETRY_ACKED_SHIFT | + 0 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_ONCHANGE) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | + UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_MANUAL) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; + metadata.flightTelemetryUpdatePeriod = 0; + metadata.gcsTelemetryUpdatePeriod = 0; + metadata.loggingUpdatePeriod = 1000; + + return metadata; + } + + /** + * Initialize object fields with the default values. + * If a default value is not specified the object fields + * will be initialized to zero. + */ + public void setDefaultFieldValues() + { + + } + + /** + * Create a clone of this object, a new instance ID must be specified. + * Do not use this function directly to create new instances, the + * UAVObjectManager should be used instead. + */ + public UAVDataObject clone(int instID) { + // TODO: Need to get specific instance to clone + try { + WaypointActive obj = new WaypointActive(); + obj.initialize(instID, this.getMetaObject()); + return obj; + } catch (Exception e) { + return null; + } + } + + /** + * Static function to retrieve an instance of the object. + */ + public WaypointActive GetInstance(UAVObjectManager objMngr, int instID) + { + return (WaypointActive)(objMngr.getObject(WaypointActive.OBJID, instID)); + } + + // Constants + protected static final int OBJID = 0x1EA5B192; + protected static final String NAME = "WaypointActive"; + protected static String DESCRIPTION = "Indicates the currently active waypoint"; + 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