Permalink
Browse files

Updated schema, added error limit to generator gui, and fixed bad v1.…

…0 message definitions.
  • Loading branch information...
1 parent cede443 commit b2b11bd09298f0d8886b01404909fe04909b170d @dagoodma dagoodma committed with Sep 26, 2012
View
@@ -13,6 +13,9 @@
Working on Windows 7 SP1, with Python 2.7.3 and 3.2.3
Mavgen doesn't work with Python 3.x yet
+* 2012-9-25 -- dagoodman
+ Passing error limit into mavgen to make output cleaner.
+
Copyright 2012 David Goodman (dagoodman@soe.ucsc.edu)
Released under GNU GPL version 3 or later
@@ -42,6 +45,7 @@
DEBUG = False
title = "MAVLink Generator"
+error_limit = 5
class Application(Frame):
@@ -156,7 +160,7 @@ def generateHeaders(self):
# TODO write XML schema (XDS)
# Generate headers
- opts = MavgenOptions(self.language_value.get(), self.protocol_value.get()[1:], self.out_value.get());
+ opts = MavgenOptions(self.language_value.get(), self.protocol_value.get()[1:], self.out_value.get(), error_limit);
args = [self.xml_value.get()]
if DEBUG:
print("Generating headers")
@@ -170,15 +174,19 @@ def generateHeaders(self):
exStr = formatErrorMessage(str(ex));
if DEBUG:
print('An occurred while generating headers:\n\t{0!s}'.format(ex))
- tkinter.messagebox.showerror('Error Generating Headers','An error occurred in mavgen:\n{0!s}'.format(exStr))
+ tkinter.messagebox.showerror('Error Generating Headers','{0!s}'.format(exStr))
return
"""\
Format the mavgen exceptions by removing "ERROR: ".
"""
def formatErrorMessage(message):
- reObj = re.compile(r'^ERROR:\s+',re.M);
- return re.sub(reObj, '', message)
+ reObj = re.compile(r'^(ERROR):\s+',re.M);
+ matches = re.findall(reObj, message);
+ prefix = ("An error occurred in mavgen:" if len(matches) == 1 else "Errors occured in mavgen:\n")
+ message = re.sub(reObj, '\n', message);
+
+ return prefix + message
# End of Application class
@@ -189,10 +197,11 @@ def formatErrorMessage(message):
excepts an object for its opts argument.
"""
class MavgenOptions:
- def __init__(self,language,protocol,output):
+ def __init__(self,language,protocol,output,error_limit):
self.language = language
self.wire_protocol = protocol
self.output = output
+ self.error_limit = error_limit;
# End of MavgenOptions class
# ---------------------------------
@@ -1,83 +1,143 @@
<?xml version='1.0'?>
<mavlink>
- <include>common.xml</include>
- <enums>
- <enum name="SENSESOAR_MODE">
- <description> Different flight modes </description>
- <entry name="SENSESOAR_MODE_GLIDING"> Gliding mode with motors off</entry>
- <entry name="SENSESOAR_MODE_AUTONOMOUS"> Autonomous flight</entry>
- <entry name="SENSESOAR_MODE_MANUAL"> RC controlled</entry>
- </enum>
+ <include>common.xml</include>
+ <enums>
+ <enum name="SENSESOAR_MODE">
+ <description> Different flight modes </description>
+ <entry name="SENSESOAR_MODE_GLIDING">
+ <description>Gliding mode with motors off</description>
+ </entry>
+ <entry name="SENSESOAR_MODE_AUTONOMOUS">
+ <description>Autonomous flight</description>
+ </entry>
+ <entry name="SENSESOAR_MODE_MANUAL">
+ <description>RC controlled</description>
+ </entry>
+ </enum>
</enums>
<messages>
- <message id="170" name="OBS_POSITION">
- Position estimate of the observer in global frame
- <field type="int32_t" name="lon">Longitude expressed in 1E7</field>
- <field type="int32_t" name="lat">Latitude expressed in 1E7</field>
- <field type="int32_t" name="alt">Altitude expressed in milimeters</field>
- </message>
- <message id="172" name="OBS_VELOCITY">
- velocity estimate of the observer in NED inertial frame
- <field type="float[3]" name="vel">Velocity</field>
- </message>
- <message id="174" name="OBS_ATTITUDE">
- attitude estimate of the observer
- <field type="double[4]" name="quat">Quaternion re;im</field>
- </message>
- <message id="176" name="OBS_WIND">
- Wind estimate in NED inertial frame
- <field type="float[3]" name="wind">Wind</field>
- </message>
- <message id="178" name="OBS_AIR_VELOCITY">
- Estimate of the air velocity
- <field type="float" name="magnitude">Air speed</field>
- <field type="float" name="aoa">angle of attack</field>
- <field type="float" name="slip">slip angle</field>
- </message>
- <message id="180" name="OBS_BIAS">
- IMU biases
- <field type="float[3]" name="accBias">accelerometer bias</field>
- <field type="float[3]" name="gyroBias">gyroscope bias</field>
- </message>
- <message id="182" name="OBS_QFF">
- estimate of the pressure at sea level
- <field type="float" name="qff">Wind</field>
- </message>
- <message id="183" name="OBS_AIR_TEMP">
- ambient air temperature
- <field type="float" name="airT">Air Temperatur</field>
- </message>
- <message id="184" name="FILT_ROT_VEL">
- filtered rotational velocity
- <field type="float[3]" name="rotVel">rotational velocity</field>
- </message>
- <message id="186" name="LLC_OUT">
- low level control output
- <field type="int16_t[4]" name="servoOut">Servo signal</field>
- <field type="int16_t[2]" name="MotorOut">motor signal</field>
- </message>
- <message id="188" name="PM_ELEC">
- Power managment
- <field type="float" name="PwCons">current power consumption</field>
- <field type="float" name="BatStat">battery status</field>
- <field type="float[3]" name="PwGen">Power generation from each module</field>
- </message>
- <message id="190" name="SYS_Stat">
- system status
- <field type="uint8_t" name="gps">gps status</field>
- <field type="uint8_t" name="act">actuator status</field>
- <field type="uint8_t" name="mod">module status</field>
- <field type="uint8_t" name="commRssi">module status</field>
- </message>
- <message id="192" name="CMD_AIRSPEED_CHNG">
- change commanded air speed
- <field type="uint8_t" name="target">Target ID</field>
- <field type="float" name="spCmd">commanded airspeed</field>
- </message>
- <message id="194" name="CMD_AIRSPEED_ACK">
- accept change of airspeed
- <field type="float" name="spCmd">commanded airspeed</field>
- <field type="uint8_t" name="ack">0:ack, 1:nack</field>
- </message>
- </messages>
+ <message id="170" name="OBS_POSITION">
+ <description>Position estimate of the observer in global frame</description>
+ <field type="int32_t" name="lon">
+ <description>Longitude expressed in 1E7</description>
+ </field>
+ <field type="int32_t" name="lat">
+ <description>Latitude expressed in 1E7</description>
+ </field>
+ <field type="int32_t" name="alt">
+ <description>Altitude expressed in milimeters</description>
+ </field>
+ </message>
+ <message id="172" name="OBS_VELOCITY">
+ <description>velocity estimate of the observer in NED inertial frame</description>
+ <field type="float[3]" name="vel">
+ <description>Velocity</description>
+ </field>
+ </message>
+ <message id="174" name="OBS_ATTITUDE">
+ <description>attitude estimate of the observe</description>
+ <field type="double[4]" name="quat">
+ <description>Quaternion re;im</description>
+ </field>
+ </message>
+ <message id="176" name="OBS_WIND">
+ <description>Wind estimate in NED inertial frame</description>
+ <field type="float[3]" name="wind">
+ <description>Wind</description>
+ </field>
+ </message>
+ <message id="178" name="OBS_AIR_VELOCITY">
+ <description>Estimate of the air velocity</description>
+ <field type="float" name="magnitude">
+ <description>Air speed</description>
+ </field>
+ <field type="float" name="aoa">
+ <description>angle of attack</description>
+ </field>
+ <field type="float" name="slip">
+ <description>slip angle</description>
+ </field>
+ </message>
+ <message id="180" name="OBS_BIAS">
+ <description>IMU biases</description>
+ <field type="float[3]" name="accBias">
+ <description>accelerometer bias</description>
+ </field>
+ <field type="float[3]" name="gyroBias">
+ <description>gyroscope bias</description>
+ </field>
+ </message>
+ <message id="182" name="OBS_QFF">
+ <description>estimate of the pressure at sea level</description>
+ <field type="float" name="qff">
+ <description>Wind</description>
+ </field>
+ </message>
+ <message id="183" name="OBS_AIR_TEMP">
+ <description>ambient air temperature</description>
+ <field type="float" name="airT">
+ <description>Air Temperatur</description>
+ </field>
+ </message>
+ <message id="184" name="FILT_ROT_VEL">
+ <description>filtered rotational velocity</description>
+ <field type="float[3]" name="rotVel">
+ <description>rotational velocity</description>
+ </field>
+ </message>
+ <message id="186" name="LLC_OUT">
+ <description>low level control output</description>
+ <field type="int16_t[4]" name="servoOut">
+ <description>Servo signal</description>
+ </field>
+ <field type="int16_t[2]" name="MotorOut">
+ <description>motor signal</description>
+ </field>
+ </message>
+ <message id="188" name="PM_ELEC">
+ <description>Power managment</description>
+ <field type="float" name="PwCons">
+ <description>current power consumption</description>
+ </field>
+ <field type="float" name="BatStat">
+ <description>battery status</description>
+ </field>
+ <field type="float[3]" name="PwGen">
+ <description>Power generation from each module</description>
+ </field>
+ </message>
+ <message id="190" name="SYS_Stat">
+ <description>system status</description>
+ <field type="uint8_t" name="gps">
+ <description>gps status</description>
+ </field>
+ <field type="uint8_t" name="act">
+ <description>actuator status</description>
+ </field>
+ <field type="uint8_t" name="mod">
+ <description>module status</description>
+ </field>
+ <field type="uint8_t" name="commRssi">
+ <description>module status</description>
+ </field>
+ </message>
+ <message id="192" name="CMD_AIRSPEED_CHNG">
+ <description>change commanded air speed</description>
+ <field type="uint8_t" name="target">
+ <description>Target ID</description>
+ </field>
+ <field type="float" name="spCmd">
+ <description>commanded airspeed</description>
+ </field>
+ </message>
+ <message id="194" name="CMD_AIRSPEED_ACK">
+ <description>accept change of airspeed</description>
+ <field type="float" name="spCmd">
+ <description>commanded airspeed</description>
+ </field>
+ <field type="uint8_t" name="ack">
+ <description>0:ack, 1:nack</description>
+ </field>
+ </message>
+ </messages>
</mavlink>
@@ -37,21 +37,21 @@
<messages>
<message name="CPU_LOAD" id="170">
- Sensor and DSC control loads.
+ <description>Sensor and DSC control loads.</description>
<field name="sensLoad" type="uint8_t">Sensor DSC Load</field>
<field name="ctrlLoad" type="uint8_t">Control DSC Load</field>
<field name="batVolt" type="uint16_t">Battery Voltage in millivolts</field>
</message>
<message name="AIR_DATA" id="171">
- Air data for altitude and airspeed computation.
+ <description>Air data for altitude and airspeed computation.</description>
<field name="dynamicPressure" type="float">Dynamic pressure (Pa)</field>
<field name="staticPressure" type="float">Static pressure (Pa)</field>
<field name="temperature" type="uint16_t">Board temperature</field>
</message>
<message name="SENSOR_BIAS" id="172">
- Accelerometer and gyro biases.
+ <description>Accelerometer and gyro biases.</description>
<field name="axBias" type="float">Accelerometer X bias (m/s)</field>
<field name="ayBias" type="float">Accelerometer Y bias (m/s)</field>
<field name="azBias" type="float">Accelerometer Z bias (m/s)</field>
@@ -61,7 +61,7 @@
</message>
<message name="DIAGNOSTIC" id="173">
- Configurable diagnostic messages.
+ <description>Configurable diagnostic messages.</description>
<field name="diagFl1" type="float">Diagnostic float 1</field>
<field name="diagFl2" type="float">Diagnostic float 2</field>
<field name="diagFl3" type="float">Diagnostic float 3</field>
@@ -71,7 +71,7 @@
</message>
<message name="SLUGS_NAVIGATION" id="176">
- Data used in the navigation algorithm.
+ <description>Data used in the navigation algorithm.</description>
<field name="u_m" type="float">Measured Airspeed prior to the Nav Filter</field>
<field name="phi_c" type="float">Commanded Roll</field>
<field name="theta_c" type="float">Commanded Pitch</field>
@@ -84,7 +84,7 @@
</message>
<message name="DATA_LOG" id="177">
- Configurable data log probes to be used inside Simulink
+ <description>Configurable data log probes to be used inside Simulink.</description>
<field name="fl_1" type="float">Log value 1 </field>
<field name="fl_2" type="float">Log value 2 </field>
<field name="fl_3" type="float">Log value 3 </field>
@@ -94,7 +94,7 @@
</message>
<message name="GPS_DATE_TIME" id="179">
- Pilot console PWM messges.
+ <description>Pilot console PWM messges.</description>
<field name="year" type="uint8_t">Year reported by Gps </field>
<field name="month" type="uint8_t">Month reported by Gps </field>
<field name="day" type="uint8_t">Day reported by Gps </field>
@@ -105,7 +105,7 @@
</message>
<message name="MID_LVL_CMDS" id="180">
- Mid Level commands sent from the GS to the autopilot. These are only sent when being opperated in mid-level commands mode from the ground; for periodic report of these commands generated from the autopilot see message XXXX.
+ <description>Mid Level commands sent from the GS to the autopilot. These are only sent when being opperated in mid-level commands mode from the ground; for periodic report of these commands generated from the autopilot see message XXXX.</description>
<field name="target" type="uint8_t">The system setting the commands</field>
<field name="hCommand" type="float">Commanded Airspeed</field>
<field name="uCommand" type="float">Log value 2 </field>
@@ -114,7 +114,7 @@
<message name="CTRL_SRFC_PT" id="181">
- This message configures the Selective Passthrough mode. it allows to select which control surfaces the Pilot can control from his console. It is implemented as a bitfield as follows:
+ <description>This message configures the Selective Passthrough mode. it allows to select which control surfaces the Pilot can control from his console. It is implemented as a bitfield as follows:
Position Bit Code
=================================
15-8 Reserved
@@ -126,15 +126,15 @@
2 dre_pass 4
1 dlf_pass 2
0 drf_pass 1
- Where Bit 15 is the MSb. 0 = AP has control of the surface; 1 = Pilot Console has control of the surface.
+ Where Bit 15 is the MSb. 0 = AP has control of the surface; 1 = Pilot Console has control of the surface.</description>
<field name="target" type="uint8_t">The system setting the commands</field>
<field name="bitfieldPt" type="uint16_t">Bitfield containing the PT configuration</field>
</message>
<message name="SLUGS_ACTION" id="183">
- Action messages focused on the SLUGS AP.
+ <description>Action messages focused on the SLUGS AP. </description>
<field name="target" type="uint8_t">The system reporting the action</field>
<field name="actionId" type="uint8_t">Action ID. See apDefinitions.h in the SLUGS /clib directory for the ID names</field>
<field name="actionVal" type="uint16_t">Value associated with the action</field>
Oops, something went wrong.

0 comments on commit b2b11bd

Please sign in to comment.