.. _program_listing_file_include_common_ScannerSickS300.h: Program Listing for File ScannerSickS300.h ========================================== |exhale_lsh| :ref:`Return to documentation for file ` (``include/common/ScannerSickS300.h``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp /* * Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef SCANNERSICKS300_INCLUDEDEF_H #define SCANNERSICKS300_INCLUDEDEF_H //----------------------------------------------- // base classes #include #include #include #include #include #include #include #include class ScannerSickS300 { public: // set of parameters which are specific to the SickS300 struct ParamType { int range_field; //measurement range (1 to 5) --> usually 1 (default) double dScale; // scaling of the scan (multiply with to get scan in meters) double dStartAngle; // scan start angle double dStopAngle; // scan stop angle }; // storage container for received scanner data struct ScanPolarType { double dr; // distance //r; double da; // angle //a; double di; // intensity; //bool bGlare; }; enum { SCANNER_S300_READ_BUF_SIZE = 10000, READ_BUF_SIZE = 10000, WRITE_BUF_SIZE = 10000 }; // Constructor ScannerSickS300(); // Destructor ~ScannerSickS300(); bool open(const char* pcPort, int iBaudRate, int iScanId); // not implemented void resetStartup(); // not implmented void startScanner(); // not implemented void stopScanner(); //sick_lms.Uninitialize(); // whether the scanner is currently in Standby or not bool isInStandby() {return m_bInStandby;} void purgeScanBuf(); bool getScan(std::vector &vdDistanceM, std::vector &vdAngleRAD, std::vector &vdIntensityAU, unsigned int &iTimestamp, unsigned int &iTimeNow, const bool debug); void setRangeField(const int field, const ParamType ¶m) {m_Params[field] = param;} private: // Constants static const double c_dPi; // Parameters typedef std::map PARAM_MAP; PARAM_MAP m_Params; double m_dBaudMult; // Variables unsigned char m_ReadBuf[READ_BUF_SIZE+10]; unsigned char m_ReadBuf2[READ_BUF_SIZE+10]; unsigned int m_uiSumReadBytes; std::vector m_viScanRaw; int m_iPosReadBuf2; static unsigned char m_iScanId; int m_actualBufferSize; bool m_bInStandby; // Components SerialIO m_SerialIO; TelegramParser tp_; // Functions void convertScanToPolar(const PARAM_MAP::const_iterator param, std::vector viScanRaw, std::vector& vecScanPolar); }; //----------------------------------------------- #endif