BioXASXASScanActionController::BioXASXASScanActionController(BioXASXASScanConfiguration *configuration, QObject *parent) : AMGenericStepScanController(configuration, parent), BioXASScanController() { useFeedback_ = true; setScan(scan_); bioXASConfiguration_ = configuration; // Setup exporter option. if (bioXASConfiguration_) { AMExporterOptionXDIFormat *bioXASDefaultXAS = BioXAS::buildStandardXDIFormatExporterOption("BioXAS XAS (XDI Format)", bioXASConfiguration_->edge().split(" ").first(), bioXASConfiguration_->edge().split(" ").last(), true); if (bioXASDefaultXAS->id() > 0) AMAppControllerSupport::registerClass<BioXASXASScanConfiguration, AMExporterXDIFormat, AMExporterOptionXDIFormat>(bioXASDefaultXAS->id()); } // Add the Ge detectors spectra, if a Ge detector is being used. AMDetectorSet *geDetectors = BioXASBeamline::bioXAS()->ge32ElementDetectors(); if (geDetectors) { for (int i = 0, detectorsCount = geDetectors->count(); i < detectorsCount; i++) { BioXAS32ElementGeDetector *geDetector = qobject_cast<BioXAS32ElementGeDetector*>(geDetectors->at(i)); if (geDetector && bioXASConfiguration_->usingDetector(geDetector->name())) { // Add spectra. AMDetectorSet *elements = BioXASBeamline::bioXAS()->elementsForDetector(geDetector); if (elements) { for (int j = 0, elementsCount = elements->count(); j < elementsCount; j++) { AMDetector *element = elements->at(j); if (element && element->isConnected()) bioXASConfiguration_->addDetector(element->toInfo()); } } // Add ICRs, according to the preference set in the scan configuration. AMDetectorSet *icrDetectors = BioXASBeamline::bioXAS()->icrsForDetector(geDetector); if (icrDetectors && bioXASConfiguration_->canCollectICRs() && bioXASConfiguration_->collectICRsPreference()) { for (int j = 0, icrsCount = icrDetectors->count(); j < icrsCount; j++) { AMDetector *icrDetector = icrDetectors->at(j); if (icrDetector && icrDetector->isConnected()) bioXASConfiguration_->addDetector(icrDetector->toInfo()); } } } } } }
void CViewerContainer::showRangeScan(CNode* node) { CRangeScanNode* obsNode = dynamic_cast<CRangeScanNode*>(node); ASSERT_(obsNode); auto obj = mrpt::make_aligned_shared<mrpt::opengl::CPlanarLaserScan>(); obj->setScan(*(obsNode->observation().get())); obj->setPose(obsNode->getPose()); obj->setSurfaceColor(1.0f, 0.0f, 0.0f, 0.5f); forEachGl([obsNode, obj](CGlWidget* gl) { gl->setSelected(obsNode->getPose().asTPose()); gl->setLaserScan(obj); }); }
bool UResPassable::doFullAnalysis(ULaserData * laserData, UPose pose, UPosRot laserPose, UObstaclePool * obsts, bool outdoorContext, double obstSearchExt, UResRoadLine * roads) { double maxPassLeft; double maxPassRight; UPoseTime odoPose; double maxLineRange; // // debug //printf("doFullAnalysis scan %lu\n", laserData->getSerial()); // debug end // get a fresh set of analysis oparameters getSettingsFromVarPool(); // load sensor data into scan setScan(laserData, pose, &laserPose); // calculate variance along scan scan->setVariance(lineFitWidth, lineFitMinCnt); // divide into segments pisCnt = 0; makePassableIntervalsFit(&maxPassLeft, &maxPassRight, NULL, NULL, NULL); // pose for obstacle correlation odoPose.setPt(pose, laserData->getScanTime()); // update road lines if (roads != NULL) { maxLineRange = laserData->getMaxValidRange() * 0.8; roads->update(laserData->getSerial(), pis, pisCnt, odoPose, &laserPose, maxLineRange); } // do not look for obstacles near max range (last 20% is deemed unreliable for obstacles if ((maxPassLeft + obstSearchExt) > (laserData->getMaxValidRange() * 0.8)) maxPassLeft = laserData->getMaxValidRange() * 0.8 - obstSearchExt; if ((maxPassRight + obstSearchExt) > (laserData->getMaxValidRange() * 0.8)) maxPassRight = laserData->getMaxValidRange() * 0.8 - obstSearchExt; // find and save obstacles in scan if (obsts != NULL) scan->findNearObstacles(obsts, odoPose, maxPassLeft, maxPassRight, varMinObstDist->getValued(), outdoorContext, false, varIgnoreIfFixed->getBool(), obstSearchExt); else printf("UResPassable::doFullAnalysis Missing obstacle pool structure\n"); return true; }
bool UResPassable::doObstAnalysis(ULaserData * laserData, UPose pose, UPosRot laserPose, UObstaclePool * obsts, bool outdoorContext) { double maxPassLeft; double maxPassRight; UPoseTime odoPoseOrigin, mapPose, odoPose; int n; UVariable vpo1, vpo2; // UVariable * vpar[2] = {&vpo1, &vpo2};; UResPoseHist * mapPoseHist; // // get mapped obstacles in odometry coordinates mapPoseHist = (UResPoseHist*) getStaticResource("mapPose", false); if (mapPoseHist != NULL) { // use odo pose origin mapPose = mapPoseHist->getNewest(); odoPoseOrigin = mapPoseHist->getOdoPoseOrigin(); n = 1; vpo1.setPose(&mapPose); vpo2.setPose(&odoPoseOrigin); // fixeds->clear(); // get near obstacles in odometry coordinate system // isOK = callGlobalV("mapobst.getobst", "cc", vpar, (UDataBase**)&fixeds, &n); } // get a fresh set of analysis oparameters getSettingsFromVarPool(); // load sensor data into scan setScan(laserData, pose, &laserPose); // pose for obstacle correlation odoPose.setPt(pose, laserData->getScanTime()); /* if (isOK) obsts->setFixedObstacles(fixeds);*/ // do not look for obstacles near max range (last 20% is deemed unreliable for obstacles maxPassLeft = laserData->getMaxValidRange() * 0.9; maxPassRight = maxPassLeft; // find and save obstacles in scan scan->findNearObstacles(obsts, odoPose, maxPassLeft, maxPassRight, varMinObstDist->getValued(), outdoorContext, true, varIgnoreIfFixed->getBool(), 0.0); return true; }