Changeset 114 in pacpussensors for trunk/StdDbtPlayerComponents


Ignore:
Timestamp:
Dec 16, 2015, 2:36:49 PM (9 years ago)
Author:
DHERBOMEZ Gérald
Message:
  • add output to Alasca Player component (come from cityvip project)
  • Delete the force rebuild in build_linux.sh script
Location:
trunk/StdDbtPlayerComponents
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/StdDbtPlayerComponents/DbtPlyAlascaManager.cpp

    r111 r114  
    1616#include <iostream>
    1717#include <string>
     18#include <math.h>
    1819
    1920#include "kernel/Log.h"
     21#include "kernel/InputOutputInterface.h"
    2022#include "PacpusTools/ShMem.h"
     23
     24#define CENTIMETER_TO_METER 100
    2125
    2226namespace pacpus {
     
    5761
    5862    return ComponentBase::CONFIGURED_OK;
     63}
     64
     65void DbtPlyAlascaManager::addInputs()
     66{
     67    // empty: no inputs
     68}
     69
     70void DbtPlyAlascaManager::addOutputs()
     71{
     72    addOutput<LidarScan, DbtPlyAlascaManager>("scan");
     73    addOutput<ScanAlascaData, DbtPlyAlascaManager>("raw");
    5974}
    6075
     
    118133    }
    119134
     135    lidarScan = LidarScan(4);
     136    int layer;
     137
     138    lidarScan.nbPoint = mAlascaData.nbPoint;
     139    lidarScan.time = mAlascaData.time;
     140    lidarScan.timerange = mAlascaData.timerange;
     141    lidarScan.scannerId;
     142    lidarScan.scannerType = mAlascaData.scannertype;
     143    lidarScan.nbLayer = 4;
     144
     145    for (size_t i = 0; i < mAlascaData.nbPoint; ++i) {
     146         LidarPoint point;
     147
     148         layer = mAlascaData.point[i].layerNumber;
     149         point.echo = mAlascaData.point[i].echoNumber;
     150
     151         point.x = (float)mAlascaData.point[i].x / CENTIMETER_TO_METER;
     152         point.y = (float)mAlascaData.point[i].y / CENTIMETER_TO_METER;
     153         point.z = (float)mAlascaData.point[i].z / CENTIMETER_TO_METER;
     154         point.intensity = mAlascaData.point[i].width;
     155         point.d = (sqrt(point.x*point.x+point.y*point.y+point.z*point.z) * CENTIMETER_TO_METER);
     156
     157         lidarScan.layers[layer].nbPoint++;
     158         lidarScan.layers[layer].points.append(point);
     159    }
     160
    120161    // verify that the last value is the UTC magic word
    121162    int32_t utcMagicWord = 0;
    122163    mDataFile.read(reinterpret_cast<char *>(&(utcMagicWord)), sizeof(utcMagicWord));
    123    /* if (UTC_MAGIC_WORD != utcMagicWord) {
     164    if (UTC_MAGIC_WORD != utcMagicWord) {
    124165        LOG_WARN("corrupted data, do not use them!");
    125166        LOG_DEBUG("wrong magic word: EXPECTED=" << UTC_MAGIC_WORD << ", ACTUAL=" << utcMagicWord);
    126167    } else {
    127168        LOG_TRACE("writing scan");
    128         mShMem->write(&mAlascaData, sizeof(ScanAlascaData));
    129     }*/ // deprecated
     169        //mShMem->write(&mAlascaData, sizeof(ScanAlascaData));
     170
     171        OutputInterface<LidarScan, DbtPlyAlascaManager> * scanOutput = getTypedOutput<LidarScan, DbtPlyAlascaManager>("scan");
     172        if (scanOutput && scanOutput->hasConnection()) {
     173            scanOutput->send(lidarScan, road_time(), /*timerange=*/50000); // FIXME: magic numbers?
     174        }
     175        OutputInterface<ScanAlascaData, DbtPlyAlascaManager> * rawOutput = getTypedOutput<ScanAlascaData, DbtPlyAlascaManager>("raw");
     176        if (rawOutput && rawOutput->hasConnection()) {
     177            rawOutput->send(mAlascaData, road_time(), /*timerange=*/50000);
     178        }
     179    }
    130180
    131181    if (mVerbose) {
  • trunk/StdDbtPlayerComponents/DbtPlyAlascaManager.h

    r111 r114  
    2020#include "../Alasca/AlascaData.h"
    2121#include "StdDbtPlayerComponentsConfig.h"
     22#include <Pacpus/structures/genericLidarStructures.h>
    2223
    2324namespace pacpus {
     
    2829        : public DbtPlyFileManager
    2930{
     31    Q_OBJECT
    3032public:
    3133    DbtPlyAlascaManager(QString name);
     
    3638    void displayUI();
    3739
    38     virtual ComponentBase::COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config);
    39     virtual void startActivity();
    40     virtual void stopActivity();
     40    ComponentBase::COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config);
     41    void startActivity();
     42    void stopActivity();
     43
     44    virtual void addInputs();
     45    virtual void addOutputs();
    4146
    4247private:
    4348    //ShMem * mShMem;// deprecated
    4449    ScanAlascaData mAlascaData;
     50    LidarScan lidarScan;
    4551
    4652    std::ifstream mDataFile;
Note: See TracChangeset for help on using the changeset viewer.