//------------------------------------------------------------------------------ // setSearchVolume() -- set the scanning volume width & height and scan mode //------------------------------------------------------------------------------ bool ScanGimbal::setSearchVolume(const double width, const double height, const int reqBars) { // In all cases, set the volume size setScanWidth(width); scanHeight = height; if (reqBars != 1 && reqBars != 2 && reqBars != 3 && reqBars != 4) { if (scanHeight < (Basic::Angle::D2RCC * 1.0f)) numBars = 1; else if (scanHeight < (Basic::Angle::D2RCC * 5.0f)) numBars = 2; else if (scanHeight < (Basic::Angle::D2RCC * 10.0f)) numBars = 3; else numBars = 4; } else numBars = reqBars; if ((numBars % 2) != 0) oddNumberOfBars = true; else { oddNumberOfBars = false; reverseScan = false; } // set our barSpacing setBarSpacing(scanHeight/(numBars)); // and start the bar scan (always horizontal) setScanMode(HORIZONTAL_BAR_SCAN); return true; }
//------------------------------------------------------------------------------ // pseudoRandomScanController() -- steps through an array of vertices (fast slew) //------------------------------------------------------------------------------ void ScanGimbal::pseudoRandomScanController(const double) { static Basic::Integer iBar(1); // Depending on our scan state, we will either start or stop the bar switch(getScanState()) { // reset state, must be in electronic mode or we will not operate case 0: { if (prScanVertices != 0) { if ( isGimbalType(ELECTRONIC) ) { setServoMode(POSITION_SERVO); setFastSlewMode(true); setScanState(1); } else setScanMode(MANUAL_SCAN); } } break; case 1: { // start state - go to the desired pseudo random point (must be in electric mode) if (isPositioned() || isAtLimits()) { // make sure we have at least one vertice, then move to it if (nprv != 0 && cprv <= nprv) { // if this is the first vertice, send a start event if (cprv == 0) { // Trigger the SCAN_START event handler onStartScanEvent(&iBar); } else { setScanPos(prScanVertices[cprv].x(), prScanVertices[cprv].y()); cprv++; } } // when we reach the end else setScanState(2); } } break; case 2: { // end state - reset our vertice count and send an end event if (isPositioned() || isAtLimits()) { // Trigger the SCAN_END event handler onEndScanEvent(&iBar); // set us back to the first vertice cprv = 0; setScanState(1); } } break; } // now set our commanded position accordingly setCmdPos(getRefPosition()+getScanPos()); }
// setSlotScanMode() -- calls setScanMode() bool ScanGimbal::setSlotScanMode(Basic::String* const newMode) { // set our scan mode bool ok = true; if (newMode != 0) { if (*newMode == "manual") ok = setScanMode(MANUAL_SCAN); else if (*newMode == "horizontal") ok = setScanMode(HORIZONTAL_BAR_SCAN); else if (*newMode == "vertical") ok = setScanMode(VERTICAL_BAR_SCAN); else if (*newMode == "conical") ok = setScanMode(CONICAL_SCAN); else if (*newMode == "circular") ok = setScanMode(CIRCULAR_SCAN); else if (*newMode == "pseudorandom") ok = setScanMode(PSEUDO_RANDOM_SCAN); else if (*newMode == "spiral") ok = setScanMode(SPIRAL_SCAN); else ok = false; } return ok; }
void ScannerSettings::scanModeChanged(int m) { setScanMode(m); }