Changeset 45 in flair-src for trunk


Ignore:
Timestamp:
Jul 18, 2016, 4:13:56 PM (8 years ago)
Author:
Sanahuja Guillaume
Message:

added compile info

Location:
trunk
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairCore/CMakeLists.txt

    r2 r45  
    1919
    2020FILE(GLOB FLAIRCORE_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
    21 
     21message(${CMAKE_C_COMPILER})
    2222INCLUDE_DIRECTORIES(
    2323        ${LIBXML2_INCLUDE_DIR}
     
    3636
    3737add_custom_target(
    38         svn_rev
    39         COMMAND $ENV{FLAIR_ROOT}/flair-dev/scripts/svn_revision.sh $ENV{FLAIR_ROOT}/flair-src ${CMAKE_CURRENT_SOURCE_DIR}/src/unexported/svnversion.h
     38        compile_info
     39        COMMAND $ENV{FLAIR_ROOT}/flair-dev/scripts/compile_info.sh ${CMAKE_C_COMPILER} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src/unexported/compile_info.h
    4040)
    4141
    42 add_dependencies(FlairCore_rt svn_rev)
    43 add_dependencies(FlairCore_nrt svn_rev)
     42add_dependencies(FlairCore_rt compile_info)
     43add_dependencies(FlairCore_nrt compile_info)
  • trunk/lib/FlairCore/src/FrameworkManager.cpp

    r15 r45  
    2020#include "IODevice.h"
    2121#include "config.h"
    22 #include "svnversion.h"
     22#include "compile_info.h"
    2323
    2424using std::string;
     
    2727
    2828namespace {
    29 flair::core::FrameworkManager *frameworkmanager = NULL;
     29  flair::core::FrameworkManager *frameworkmanager = NULL;
    3030}
     31
     32static void constructor() __attribute__((constructor));
     33
     34void constructor() {
     35  compile_info("FlairCore");
     36}
     37
    3138
    3239namespace flair {
     
    5562  }
    5663
    57   Printf(SVN_REV);
    5864  frameworkmanager = this;
    5965  pimpl_ = new FrameworkManager_impl(this, name);
  • trunk/lib/FlairCore/src/FrameworkManager_impl.cpp

    r20 r45  
    106106  // Avoids memory swapping for this program
    107107  mlockall(MCL_CURRENT | MCL_FUTURE);
    108   struct sigaction sa;
    109108
    110109  // catch segfault
     
    114113#ifdef __XENO__
    115114#ifdef SIGDEBUG
     115  struct sigaction sa;
    116116  sigemptyset(&sa.sa_mask);
    117117  sa.sa_sigaction = warn_upon_switch;
  • trunk/lib/FlairCore/src/GpsData.cpp

    r42 r45  
    5656
    5757GpsData::GpsData(const Object *parent, std::string name, int n)
    58     : io_data(parent, name, n), dataType(floatType) {
     58    : io_data(parent, name, n), dataType() {
    5959  if (n > 1)
    6060    Warn("n>1 not supported\n");
    6161
    62   AppendLogDescription("raw_ax", floatType);
    63   AppendLogDescription("raw_ay", floatType);
    64   AppendLogDescription("raw_az", floatType);
     62  AppendLogDescription("latitude", floatType);
     63  AppendLogDescription("longitude", floatType);
     64  AppendLogDescription("altitude", floatType);
    6565
    66   AppendLogDescription("raw_gx", floatType);
    67   AppendLogDescription("raw_gy", floatType);
    68   AppendLogDescription("raw_gz", floatType);
    6966
    70   AppendLogDescription("raw_mx", floatType);
    71   AppendLogDescription("raw_my", floatType);
    72   AppendLogDescription("raw_mz", floatType);
    7367}
    7468
  • trunk/lib/FlairCore/src/GpsData.h

    r42 r45  
    3232  class Type : public DataType {
    3333  public:
    34     Type(ScalarType const &_elementDataType)
    35         : elementDataType(_elementDataType) {}
    36     ScalarType const &GetElementDataType() const { return elementDataType; }
     34    Type(void){}
    3735    std::string GetDescription() const { return "gps data"; }
    3836    size_t GetSize() const {
     
    4139
    4240  private:
    43     ScalarType const &elementDataType;
    4441  };
    4542
  • trunk/lib/FlairFilter/CMakeLists.txt

    r7 r45  
    4444
    4545SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
     46
     47add_custom_target(
     48        compile_info
     49        COMMAND $ENV{FLAIR_ROOT}/flair-dev/scripts/compile_info.sh ${CMAKE_C_COMPILER} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src/unexported/compile_info.h
     50)
     51
     52add_dependencies(${PROJECT_NAME} compile_info)
  • trunk/lib/FlairFilter/src/UavMultiplex.cpp

    r15 r45  
    2222#include <Tab.h>
    2323#include <GridLayout.h>
     24#include "compile_info.h"
    2425
    2526using std::string;
    2627using namespace flair::core;
    2728using namespace flair::gui;
     29
     30//todo: put it on seprate file, but not possible with static lib?
     31static void constructor() __attribute__((constructor));
     32
     33void constructor() {
     34  compile_info("FlairFilter");
     35}
     36
    2837
    2938namespace flair {
  • trunk/lib/FlairMeta/CMakeLists.txt

    r7 r45  
    4444
    4545SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
     46
     47add_custom_target(
     48        compile_info
     49        COMMAND $ENV{FLAIR_ROOT}/flair-dev/scripts/compile_info.sh ${CMAKE_C_COMPILER} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src/unexported/compile_info.h
     50)
     51
     52add_dependencies(${PROJECT_NAME} compile_info)
  • trunk/lib/FlairMeta/src/UavFactory.cpp

    r41 r45  
    1818#include "UavFactory.h"
    1919#include "FrameworkManager.h"
    20 //#include "ArDrone2.h"
    2120#include "SimuX4.h"
    2221#include "SimuX8.h"
    2322#include "HdsX8.h"
    2423#include "XAir.h"
     24#include "compile_info.h"
    2525
    2626using namespace std;
     
    3030
    3131namespace { // anonymous
    32      vector<flair::meta::Uav* (*)(FrameworkManager*,string,string,UavMultiplex*)> vectoroffunctions;
     32     vector<flair::meta::Uav* (*)(FrameworkManager*,string,string,UavMultiplex*)> *vectoroffunctions=NULL;
    3333}
     34
     35
     36static void constructor() __attribute__((constructor));
     37
     38void constructor() {
     39  compile_info("FlairMeta");
     40}
     41
    3442
    3543Uav *CreateUav(FrameworkManager *parent, string uav_name, string uav_type,
     
    3745
    3846  Uav *uav;
    39   for(int i=0;i<vectoroffunctions.size();i++) {
    40     uav=vectoroffunctions.at(i)(parent, uav_name, uav_type,multiplex);
    41     if(uav!=NULL) return uav;
     47
     48  if(vectoroffunctions!=NULL) {
     49    for(int i=0;i<vectoroffunctions->size();i++) {
     50      uav=vectoroffunctions->at(i)(parent, uav_name, uav_type,multiplex);
     51      if(uav!=NULL) {
     52        free(vectoroffunctions);
     53        vectoroffunctions=NULL;
     54        return uav;
     55      }
     56    }
    4257  }
    4358
     
    7287void RegisterUavCreator(flair::meta::Uav*(*func)(FrameworkManager *parent, string uav_name, string uav_type,
    7388               UavMultiplex *multiplex)) {
    74                  vectoroffunctions.push_back(func);
     89  if(vectoroffunctions==NULL) vectoroffunctions=(vector<flair::meta::Uav* (*)(FrameworkManager*,string,string,UavMultiplex*)>*)malloc(sizeof(vector<flair::meta::Uav* (*)(FrameworkManager*,string,string,UavMultiplex*)>));
    7590
     91  vectoroffunctions->push_back(func);
    7692}
  • trunk/lib/FlairMeta/src/UavStateMachine.cpp

    r42 r45  
    181181    ComputeThrust(); // logs are added to uz, so it must be updated at last
    182182
    183     //check nan problems
    184     if(CheckIsNan(currentTorques.roll,"roll torque")
    185        || CheckIsNan(currentTorques.pitch,"pitch torque")
    186        || CheckIsNan(currentTorques.yaw,"yaw torque")
    187        || CheckIsNan(currentThrust,"thrust")) {
     183    //check nan/inf problems
     184    if(IsValuePossible(currentTorques.roll,"roll torque")
     185       || IsValuePossible(currentTorques.pitch,"pitch torque")
     186       || IsValuePossible(currentTorques.yaw,"yaw torque")
     187       || IsValuePossible(currentThrust,"thrust")) {
    188188
    189189      if(failSafeMode) {
     
    218218}
    219219
    220 bool UavStateMachine::CheckIsNan(float value,std::string desc) {
     220bool UavStateMachine::IsValuePossible(float value,std::string desc) {
    221221  if(isnan(value)) {
    222222    Warn("%s is not an number\n",desc.c_str());
     223    return true;
     224  } else if(isinf(value)) {
     225    Warn("%s is infinite\n",desc.c_str());
    223226    return true;
    224227  } else {
  • trunk/lib/FlairMeta/src/UavStateMachine.h

    r42 r45  
    261261  void Run(void);
    262262  void StopMotors(void);
    263   bool CheckIsNan(float value,std::string desc);
     263  bool IsValuePossible(float value,std::string desc);
    264264
    265265  meta::Uav *uav;
  • trunk/lib/FlairSensorActuator/CMakeLists.txt

    r3 r45  
    4343FILE(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/src/*.h")
    4444INSTALL(FILES ${files} DESTINATION $ENV{FLAIR_ROOT}/flair-dev/include/${PROJECT_NAME})
     45
     46add_custom_target(
     47        compile_info
     48        COMMAND $ENV{FLAIR_ROOT}/flair-dev/scripts/compile_info.sh ${CMAKE_C_COMPILER} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src/unexported/compile_info.h
     49)
     50
     51add_dependencies(${PROJECT_NAME} compile_info)
  • trunk/lib/FlairSensorActuator/src/Bldc.cpp

    r15 r45  
    2121#include <DoubleSpinBox.h>
    2222#include <sstream>
     23#include "compile_info.h"
     24
     25//todo: put it on seprate file, but not possible with static lib?
     26static void constructor() __attribute__((constructor));
     27
     28void constructor() {
     29  compile_info("FlairSensorActuator");
     30}
    2331
    2432using std::string;
  • trunk/lib/FlairSimulator/CMakeLists.txt

    r8 r45  
    2222        ${CMAKE_CURRENT_SOURCE_DIR}/src
    2323        ${CMAKE_CURRENT_SOURCE_DIR}/src/unexported
    24 #       $ENV{FLAIR_ROOT}/uav_dev/include
    2524        ${CMAKE_CURRENT_SOURCE_DIR}/../FlairCore/src
    2625        ${CMAKE_CURRENT_SOURCE_DIR}/../FlairSensorActuator/src
     
    3433SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
    3534
     35add_custom_target(
     36        compile_info
     37        COMMAND $ENV{FLAIR_ROOT}/flair-dev/scripts/compile_info.sh ${CMAKE_C_COMPILER} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src/unexported/compile_info.h
     38)
     39
    3640add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/no_gl)
     41add_dependencies(FlairSimulator_nogl compile_info)
    3742if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "i686" OR "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "i586" OR "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86_64")
    38 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/gl)
     43add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/gl)
     44add_dependencies(FlairSimulator_gl compile_info)
    3945endif()
  • trunk/lib/FlairSimulator/src/Gui.cpp

    r15 r45  
    3131#include <algorithm>
    3232#include <GL/gl.h>
     33#include "compile_info.h"
     34
     35//todo: put it on seprate file, but not possible with static lib?
     36static void constructor() __attribute__((constructor));
     37
     38void constructor() {
     39  compile_info("FlairSensorActuator");
     40}
    3341
    3442using namespace irr;
  • trunk/tools/Dbt2csv/CMakeLists.txt

    r40 r45  
    4040
    4141add_custom_target(
    42         svn_rev
    43         COMMAND $ENV{FLAIR_ROOT}/flair-dev/scripts/svn_revision.sh $ENV{FLAIR_ROOT}/flair-src ${CMAKE_CURRENT_SOURCE_DIR}/src/svnversion.h
     42        compile_info
     43        COMMAND $ENV{FLAIR_ROOT}/flair-dev/scripts/compile_info.sh ${CMAKE_C_COMPILER} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src/unexported/compile_info.h
    4444)
    4545
    46 add_dependencies(${PROJECT_NAME} svn_rev)
    47 
     46add_dependencies(${PROJECT_NAME} compile_info)
    4847
    4948SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
  • trunk/tools/Dbt2csv/src/main.cpp

    r16 r45  
    44
    55#include <stdio.h>
    6 #include "svnversion.h"
     6#include "unexported/compile_info.h"
    77#include "file_ui.h"
    88#include <QFileDialog>
    99
    1010int main(int argc, char *argv[]) {
    11   printf(SVN_REV);
     11  compile_info("Dbt2Csv");
    1212
    1313  QLocale::setDefault(QLocale::C);
  • trunk/tools/FlairGCS/CMakeLists.txt

    r40 r45  
    9292
    9393add_custom_target(
    94         svn_rev
    95         COMMAND $ENV{FLAIR_ROOT}/flair-dev/scripts/svn_revision.sh $ENV{FLAIR_ROOT}/flair-src ${CMAKE_CURRENT_SOURCE_DIR}/src/svnversion.h
     94        compile_info
     95        COMMAND $ENV{FLAIR_ROOT}/flair-dev/scripts/compile_info.sh ${CMAKE_C_COMPILER} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src/unexported/compile_info.h
    9696)
    9797
    98 add_dependencies(${PROJECT_NAME} svn_rev)
     98add_dependencies(${PROJECT_NAME} compile_info)
    9999
    100100
  • trunk/tools/FlairGCS/src/main.cpp

    r15 r45  
    1010
    1111#include "Manager.h"
    12 #include "svnversion.h"
     12#include "unexported/compile_info.h"
    1313
    1414using namespace TCLAP;
     
    5151  }
    5252
    53   printf(SVN_REV);
     53  compile_info("FlairGCS");
    5454
    5555  parseOptions(argc, argv);
Note: See TracChangeset for help on using the changeset viewer.