36 std::cout <<
"Enter the serial port name (e.g. COM1, ttyS0, ttyUSB0, " 38 getline(cin, serName);
42 std::cout <<
"Using serial port: " <<
SERIAL_NAME << endl;
53 printf(
"Turning laser ON...\n");
55 printf(
"Initialization OK!\n");
58 printf(
"Initialization failed!\n");
62 cout <<
"Press any key to stop capturing..." << endl;
69 bool thereIsObservation, hardError;
74 if (hardError) printf(
"[TEST] Hardware error=true!!\n");
76 if (thereIsObservation)
78 double FPS = 1.0 / tictac.
Tac();
81 "Scan received: %u ranges, FOV: %.02fdeg, %.03fHz: mid " 91 std::this_thread::sleep_for(5ms);
95 int main(
int argc,
char** argv)
104 catch (std::exception& e)
106 std::cout <<
"EXCEPCION: " << e.what() << std::endl;
111 printf(
"Another exception!!");
double Tac() noexcept
Stops the stopwatch.
void setSerialPort(const std::string &port_name)
If set to non-empty, the serial port will be attempted to be opened automatically when this class is ...
double RAD2DEG(const double x)
Radians to degrees.
A high-performance stopwatch, with typical resolution of nanoseconds.
Contains classes for various device interfaces.
virtual void doProcessSimple(bool &outThereIsObservation, mrpt::obs::CObservation2DRangeScan &outObservation, bool &hardwareError)
Specific laser scanner "software drivers" must process here new data from the I/O stream...
mrpt::containers::ContainerReadOnlyProxyAccessor< mrpt::aligned_std_vector< float > > scan
The range values of the scan, in meters.
This namespace contains representation of robot actions and observations.
void showPreview(bool enable=true)
Enables GUI visualization in real-time.
Interfaces a Robo Peak LIDAR laser scanner.
GLsizei const GLchar ** string
virtual bool turnOn()
See base class docs.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
bool kbhit() noexcept
An OS-independent version of kbhit, which returns true if a key has been pushed.
float aperture
The "aperture" or field-of-view of the range finder, in radians (typically M_PI = 180 degrees)...
Classes for creating GUI windows for 2D and 3D visualization.
void Tic() noexcept
Starts the stopwatch.
mrpt::poses::CPose3D sensorPose
The 6D pose of the sensor on the robot at the moment of starting the scan.