diff --git a/.gitignore b/.gitignore index a951e60e5..d865cfdca 100644 --- a/.gitignore +++ b/.gitignore @@ -67,95 +67,6 @@ #ignore autogenerated files - they should really go into special dirs to be ignored more easy -flight/UAVObjects/actuatorcommand.c -flight/UAVObjects/actuatordesired.c -flight/UAVObjects/actuatorsettings.c -flight/UAVObjects/ahrscalibration.c -flight/UAVObjects/ahrssettings.c -flight/UAVObjects/ahrsstatus.c -flight/UAVObjects/attitudeactual.c -flight/UAVObjects/attitudedesired.c -flight/UAVObjects/attituderaw.c -flight/UAVObjects/baroaltitude.c -flight/UAVObjects/batterysettings.c -flight/UAVObjects/firmwareiapobj.c -flight/UAVObjects/flightbatterystate.c -flight/UAVObjects/flightplancontrol.c -flight/UAVObjects/flightplansettings.c -flight/UAVObjects/flightplanstatus.c -flight/UAVObjects/flighttelemetrystats.c -flight/UAVObjects/gcstelemetrystats.c -flight/UAVObjects/gpsposition.c -flight/UAVObjects/gpssatellites.c -flight/UAVObjects/gpstime.c -flight/UAVObjects/guidancesettings.c -flight/UAVObjects/homelocation.c -flight/UAVObjects/i2cstats.c -flight/UAVObjects/inc/actuatorcommand.h -flight/UAVObjects/inc/actuatordesired.h -flight//UAVObjects/inc/actuatorsettings.h -flight/UAVObjects/inc/ahrscalibration.h -flight/UAVObjects/inc/ahrssettings.h -flight/UAVObjects/inc/ahrsstatus.h -flight/UAVObjects/inc/attitudeactual.h -flight/UAVObjects/inc/attitudedesired.h -flight/UAVObjects/inc/attituderaw.h -flight/UAVObjects/inc/baroaltitude.h -flight/UAVObjects/inc/batterysettings.h -flight/UAVObjects/inc/firmwareiapobj.h -flight/UAVObjects/inc/flightbatterystate.h -flight/UAVObjects/inc/flightplancontrol.h -flight/UAVObjects/inc/flightplansettings.h -flight/UAVObjects/inc/flightplanstatus.h -flight/UAVObjects/inc/flighttelemetrystats.h -flight/UAVObjects/inc/gcstelemetrystats.h -flight/UAVObjects/inc/gpsposition.h -flight/UAVObjects/inc/gpssatellites.h -flight/UAVObjects/inc/gpstime.h -flight/UAVObjects/inc/guidancesettings.h -flight/UAVObjects/inc/homelocation.h -flight/UAVObjects/inc/i2cstats.h -flight/UAVObjects/inc/manualcontrolcommand.h -flight/UAVObjects/inc/manualcontrolsettings.h -flight/UAVObjects/inc/mixersettings.h -flight/UAVObjects/inc/mixerstatus.h -flight/UAVObjects/inc/objectpersistence.h -flight/UAVObjects/inc/pipxtrememodemsettings.h -flight/UAVObjects/inc/pipxtrememodemstatus.h -flight/UAVObjects/inc/positionactual.h -flight/UAVObjects/inc/positiondesired.h -flight/UAVObjects/inc/ratedesired.h -flight/UAVObjects/inc/stabilizationsettings.h -flight/UAVObjects/inc/systemalarms.h -flight/UAVObjects/inc/systemsettings.h -flight/UAVObjects/inc/systemstats.h -flight/UAVObjects/inc/taskinfo.h -flight/UAVObjects/inc/telemetrysettings.h -flight/UAVObjects/inc/velocityactual.h -flight/UAVObjects/inc/velocitydesired.h -flight/UAVObjects/inc/watchdogstatus.h -flight/UAVObjects/manualcontrolcommand.c -flight/UAVObjects/manualcontrolsettings.c -flight/UAVObjects/mixersettings.c -flight/UAVObjects/mixerstatus.c -flight/UAVObjects/objectpersistence.c -flight/UAVObjects/pipxtrememodemsettings.c -flight/UAVObjects/pipxtrememodemstatus.c -flight/UAVObjects/positionactual.c -flight/UAVObjects/positiondesired.c -flight/UAVObjects/ratedesired.c -flight/UAVObjects/stabilizationsettings.c -flight/UAVObjects/systemalarms.c -flight/UAVObjects/systemsettings.c -flight/UAVObjects/systemstats.c -flight/UAVObjects/taskinfo.c -flight/UAVObjects/telemetrysettings.c -flight/UAVObjects/velocityactual.c -flight/UAVObjects/velocitydesired.c -flight/UAVObjects/watchdogstatus.c - -flight/UAVObjects/uavobjectsinit.c - ground/src/plugins/uavobjects/actuatorcommand.cpp ground/src/plugins/uavobjects/actuatordesired.cpp ground/src/plugins/uavobjects/actuatorsettings.cpp diff --git a/Makefile b/Makefile index 3a62db795..d03cf9750 100644 --- a/Makefile +++ b/Makefile @@ -209,21 +209,21 @@ uavobjgenerator: $(MAKE) -w ; \ ) -.PHONY: build_dir -bzild_dir: +.PHONY: uavobjects-synthetics +uavobject-synthetics: mkdir -p $(BUILD_DIR)/$@ .PHONY:uavobjects -uavobjects: build_dir uavobjgenerator - $(UAVOBJGENERATOR) "$(ROOT_DIR)/" +uavobjects: uavobjects_gcs uavobjects_flight -uavobjects_gcs: build_dir uavobjgenerator +uavobjects_gcs: uavobject-synthetics uavobjgenerator $(UAVOBJGENERATOR) -gcs "$(ROOT_DIR)/" -uavobjects_flight: build_dir uavobjgenerator +uavobjects_flight: uavobject-synthetics uavobjgenerator + mkdir -p $(BUILD_DIR)/uavobject-synthetics/flight $(UAVOBJGENERATOR) -flight "$(ROOT_DIR)/" -uavobjects_test: build_dir uavobjgenerator +uavobjects_test: uavobject-synthetics uavobjgenerator $(UAVOBJGENERATOR) -v -none "$(ROOT_DIR)/" ############################## diff --git a/flight/AHRS/Makefile b/flight/AHRS/Makefile index b0cee1748..33cd59873 100644 --- a/flight/AHRS/Makefile +++ b/flight/AHRS/Makefile @@ -89,6 +89,8 @@ OPSYSINC = $(OPDIR)/System/inc BOOT = ../Bootloaders/AHRS BOOTINC = $(BOOT)/inc +OPUAVSYNTHDIR = $(OUTDIR)/../uavobject-synthetics/flight + # List C source files here. (C dependencies are automatically generated.) # use file-extension c for "c-only"-files @@ -182,7 +184,7 @@ EXTRAINCDIRS += $(PIOSBOARDS) EXTRAINCDIRS += $(STMSPDINCDIR) EXTRAINCDIRS += $(CMSISDIR) EXTRAINCDIRS += $(AHRSINC) -EXTRAINCDIRS += $(OPUAVOBJINC) +EXTRAINCDIRS += $(OPUAVSYNTHDIR) EXTRAINCDIRS += $(BOOTINC) # List any extra directories to look for library files here. diff --git a/flight/OpenPilot/Makefile b/flight/OpenPilot/Makefile index f2078cb14..75bd49aca 100644 --- a/flight/OpenPilot/Makefile +++ b/flight/OpenPilot/Makefile @@ -130,6 +130,8 @@ PYMITEINC += $(OUTDIR) FLIGHTPLANLIB = $(OPMODULEDIR)/FlightPlan/lib FLIGHTPLANS = $(OPMODULEDIR)/FlightPlan/flightplans +OPUAVSYNTHDIR = $(OUTDIR)/../uavobject-synthetics/flight + # List C source files here. (C dependencies are automatically generated.) # use file-extension c for "c-only"-files @@ -156,7 +158,6 @@ SRC += $(OPSYSTEM)/alarms.c SRC += $(OPSYSTEM)/taskmonitor.c SRC += $(OPUAVTALK)/uavtalk.c SRC += $(OPUAVOBJ)/uavobjectmanager.c -SRC += $(OPUAVOBJ)/uavobjectsinit.c SRC += $(OPUAVOBJ)/eventdispatcher.c else ## TESTCODE @@ -168,48 +169,49 @@ endif ## UAVOBJECTS ifndef TESTAPP -SRC += $(OPUAVOBJ)/objectpersistence.c -SRC += $(OPUAVOBJ)/positionactual.c -SRC += $(OPUAVOBJ)/gpsposition.c -SRC += $(OPUAVOBJ)/gpstime.c -SRC += $(OPUAVOBJ)/gpssatellites.c -SRC += $(OPUAVOBJ)/gcstelemetrystats.c -SRC += $(OPUAVOBJ)/flighttelemetrystats.c -SRC += $(OPUAVOBJ)/systemstats.c -SRC += $(OPUAVOBJ)/systemalarms.c -SRC += $(OPUAVOBJ)/systemsettings.c -SRC += $(OPUAVOBJ)/telemetrysettings.c -SRC += $(OPUAVOBJ)/actuatorcommand.c -SRC += $(OPUAVOBJ)/actuatordesired.c -SRC += $(OPUAVOBJ)/actuatorsettings.c -SRC += $(OPUAVOBJ)/manualcontrolcommand.c -SRC += $(OPUAVOBJ)/manualcontrolsettings.c -SRC += $(OPUAVOBJ)/attitudedesired.c -SRC += $(OPUAVOBJ)/stabilizationsettings.c -SRC += $(OPUAVOBJ)/ahrsstatus.c -SRC += $(OPUAVOBJ)/i2cstats.c -SRC += $(OPUAVOBJ)/baroaltitude.c -SRC += $(OPUAVOBJ)/ahrscalibration.c -SRC += $(OPUAVOBJ)/attitudeactual.c -SRC += $(OPUAVOBJ)/ahrssettings.c -SRC += $(OPUAVOBJ)/flightbatterystate.c -SRC += $(OPUAVOBJ)/attituderaw.c -SRC += $(OPUAVOBJ)/homelocation.c -SRC += $(OPUAVOBJ)/mixersettings.c -SRC += $(OPUAVOBJ)/mixerstatus.c -SRC += $(OPUAVOBJ)/positiondesired.c -SRC += $(OPUAVOBJ)/velocitydesired.c -SRC += $(OPUAVOBJ)/velocityactual.c -SRC += $(OPUAVOBJ)/guidancesettings.c -SRC += $(OPUAVOBJ)/firmwareiapobj.c -SRC += $(OPUAVOBJ)/ratedesired.c -SRC += $(OPUAVOBJ)/batterysettings.c -SRC += $(OPUAVOBJ)/flightplancontrol.c -SRC += $(OPUAVOBJ)/flightplanstatus.c -SRC += $(OPUAVOBJ)/flightplansettings.c -SRC += $(OPUAVOBJ)/taskinfo.c -SRC += $(OPUAVOBJ)/watchdogstatus.c -SRC += $(OPUAVOBJ)/nedaccel.c +SRC += $(OPUAVSYNTHDIR)/objectpersistence.c +SRC += $(OPUAVSYNTHDIR)/positionactual.c +SRC += $(OPUAVSYNTHDIR)/gpsposition.c +SRC += $(OPUAVSYNTHDIR)/gpstime.c +SRC += $(OPUAVSYNTHDIR)/gpssatellites.c +SRC += $(OPUAVSYNTHDIR)/gcstelemetrystats.c +SRC += $(OPUAVSYNTHDIR)/flighttelemetrystats.c +SRC += $(OPUAVSYNTHDIR)/systemstats.c +SRC += $(OPUAVSYNTHDIR)/systemalarms.c +SRC += $(OPUAVSYNTHDIR)/systemsettings.c +SRC += $(OPUAVSYNTHDIR)/telemetrysettings.c +SRC += $(OPUAVSYNTHDIR)/actuatorcommand.c +SRC += $(OPUAVSYNTHDIR)/actuatordesired.c +SRC += $(OPUAVSYNTHDIR)/actuatorsettings.c +SRC += $(OPUAVSYNTHDIR)/manualcontrolcommand.c +SRC += $(OPUAVSYNTHDIR)/manualcontrolsettings.c +SRC += $(OPUAVSYNTHDIR)/attitudedesired.c +SRC += $(OPUAVSYNTHDIR)/stabilizationsettings.c +SRC += $(OPUAVSYNTHDIR)/ahrsstatus.c +SRC += $(OPUAVSYNTHDIR)/i2cstats.c +SRC += $(OPUAVSYNTHDIR)/baroaltitude.c +SRC += $(OPUAVSYNTHDIR)/ahrscalibration.c +SRC += $(OPUAVSYNTHDIR)/attitudeactual.c +SRC += $(OPUAVSYNTHDIR)/ahrssettings.c +SRC += $(OPUAVSYNTHDIR)/flightbatterystate.c +SRC += $(OPUAVSYNTHDIR)/attituderaw.c +SRC += $(OPUAVSYNTHDIR)/homelocation.c +SRC += $(OPUAVSYNTHDIR)/mixersettings.c +SRC += $(OPUAVSYNTHDIR)/mixerstatus.c +SRC += $(OPUAVSYNTHDIR)/positiondesired.c +SRC += $(OPUAVSYNTHDIR)/velocitydesired.c +SRC += $(OPUAVSYNTHDIR)/velocityactual.c +SRC += $(OPUAVSYNTHDIR)/guidancesettings.c +SRC += $(OPUAVSYNTHDIR)/firmwareiapobj.c +SRC += $(OPUAVSYNTHDIR)/ratedesired.c +SRC += $(OPUAVSYNTHDIR)/batterysettings.c +SRC += $(OPUAVSYNTHDIR)/flightplancontrol.c +SRC += $(OPUAVSYNTHDIR)/flightplanstatus.c +SRC += $(OPUAVSYNTHDIR)/flightplansettings.c +SRC += $(OPUAVSYNTHDIR)/taskinfo.c +SRC += $(OPUAVSYNTHDIR)/watchdogstatus.c +SRC += $(OPUAVSYNTHDIR)/nedaccel.c +SRC += $(OPUAVSYNTHDIR)/uavobjectsinit.c endif ## PIOS Hardware (STM32F10x) @@ -346,6 +348,7 @@ EXTRAINCDIRS += $(OPUAVTALK) EXTRAINCDIRS += $(OPUAVTALKINC) EXTRAINCDIRS += $(OPUAVOBJ) EXTRAINCDIRS += $(OPUAVOBJINC) +EXTRAINCDIRS += $(OPUAVSYNTHDIR) EXTRAINCDIRS += $(PIOS) EXTRAINCDIRS += $(PIOSINC) EXTRAINCDIRS += $(FLIGHTLIBINC) diff --git a/ground/src/libs/uavobjgenerator/generators/flight/uavobjectgeneratorflight.cpp b/ground/src/libs/uavobjgenerator/generators/flight/uavobjectgeneratorflight.cpp index 3172c4875..3c37fe9c7 100644 --- a/ground/src/libs/uavobjgenerator/generators/flight/uavobjectgeneratorflight.cpp +++ b/ground/src/libs/uavobjgenerator/generators/flight/uavobjectgeneratorflight.cpp @@ -28,13 +28,14 @@ using namespace std; -bool UAVObjectGeneratorFlight::generate(UAVObjectParser* parser,QString basepath) { +bool UAVObjectGeneratorFlight::generate(UAVObjectParser* parser,QString basepath,QString outputpath) { fieldTypeStrC << "int8_t" << "int16_t" << "int32_t" <<"uint8_t" <<"uint16_t" << "uint32_t" << "float" << "uint8_t"; QString flightObjInit,objInc; flightCodePath = QDir( basepath + QString("flight/UAVObjects")); + flightOutputPath = QDir( outputpath + QString("flight")); flightCodeTemplate = readFile( flightCodePath.absoluteFilePath("uavobjecttemplate.c") ); flightIncludeTemplate = readFile( flightCodePath.absoluteFilePath("inc/uavobjecttemplate.h") ); @@ -55,7 +56,7 @@ bool UAVObjectGeneratorFlight::generate(UAVObjectParser* parser,QString basepath // Write the flight object inialization files flightInitTemplate.replace( QString("$(OBJINC)"), objInc); flightInitTemplate.replace( QString("$(OBJINIT)"), flightObjInit); - bool res = writeFileIfDiffrent( flightCodePath.absolutePath() + "/uavobjectsinit.c", + bool res = writeFileIfDiffrent( flightOutputPath.absolutePath() + "/uavobjectsinit.c", flightInitTemplate ); if (!res) { cout << "Error: Could not write flight object init files" << endl; @@ -221,13 +222,13 @@ bool UAVObjectGeneratorFlight::process_object(ObjectInfo* info) outCode.replace(QString("$(INITFIELDS)"), initfields); // Write the flight code - bool res = writeFileIfDiffrent( flightCodePath.absolutePath() + "/" + info->namelc + ".c", outCode ); + bool res = writeFileIfDiffrent( flightOutputPath.absolutePath() + "/" + info->namelc + ".c", outCode ); if (!res) { cout << "Error: Could not write flight code files" << endl; return false; } - res = writeFileIfDiffrent( flightCodePath.absolutePath() + "/inc/" + info->namelc + ".h", outInclude ); + res = writeFileIfDiffrent( flightOutputPath.absolutePath() + "/" + info->namelc + ".h", outInclude ); if (!res) { cout << "Error: Could not write flight include files" << endl; return false; diff --git a/ground/src/libs/uavobjgenerator/generators/flight/uavobjectgeneratorflight.h b/ground/src/libs/uavobjgenerator/generators/flight/uavobjectgeneratorflight.h index b78dc57bf..9988ee208 100644 --- a/ground/src/libs/uavobjgenerator/generators/flight/uavobjectgeneratorflight.h +++ b/ground/src/libs/uavobjgenerator/generators/flight/uavobjectgeneratorflight.h @@ -32,10 +32,11 @@ class UAVObjectGeneratorFlight { public: - bool generate(UAVObjectParser* gen,QString basepath); + bool generate(UAVObjectParser* gen,QString basepath,QString outputpath); QStringList fieldTypeStrC; QString flightCodeTemplate, flightIncludeTemplate, flightInitTemplate; QDir flightCodePath; + QDir flightOutputPath; private: bool process_object(ObjectInfo* info); diff --git a/ground/src/libs/uavobjgenerator/main.cpp b/ground/src/libs/uavobjgenerator/main.cpp index 91392f87d..8f2f766cc 100644 --- a/ground/src/libs/uavobjgenerator/main.cpp +++ b/ground/src/libs/uavobjgenerator/main.cpp @@ -79,6 +79,7 @@ int main(int argc, char *argv[]) cout << "- OpenPilot UAVObject Generator -" << endl; QString basepath; + QString outputpath; QStringList arguments_stringlist; // process arguments @@ -110,6 +111,8 @@ int main(int argc, char *argv[]) if (!basepath.endsWith("/")) basepath.append("/"); // append a slash if it is not there + outputpath = basepath + QString("build/uavobject-synthetics/"); + QDir xmlPath = QDir( basepath + QString("ground/src/shared/uavobjectdefinition")); UAVObjectParser* parser = new UAVObjectParser(); @@ -166,7 +169,7 @@ int main(int argc, char *argv[]) if (do_flight|do_all) { cout << "generating flight code" << endl ; UAVObjectGeneratorFlight flightgen; - flightgen.generate(parser,basepath); + flightgen.generate(parser,basepath,outputpath); } // generate gcs code if wanted