44 cout <<
"Specify the type of the Hokuyo connection, usb or ethernet: ";
50 cout <<
"Incorrect type" << endl;
51 cout <<
"Specify the type of the Hokuyo connection, usb or ethernet: ";
57 <<
"HOKUYO laser range finder test application." << endl
64 cout <<
"Enter the serial port name (e.g. COM1, ttyS0, ttyUSB0, " 66 getline(cin, serName);
70 cout <<
"Using serial port: " <<
SERIAL_NAME << endl;
79 cout <<
"Enter the ip direction: ";
82 cout <<
"Enter the port number: ";
89 cout << endl << endl <<
"Enable intensity [y/n]:";
90 getline(cin, intensity);
95 printf(
"[TEST] Turning laser ON...\n");
97 printf(
"[TEST] Initialization OK!\n");
100 printf(
"[TEST] Initialization failed!\n");
104 #if MRPT_HAS_WXWIDGETS 108 cout <<
"Press any key to stop capturing..." << endl;
115 bool thereIsObservation, hardError;
120 if (hardError) printf(
"[TEST] Hardware error=true!!\n");
122 if (thereIsObservation)
124 double FPS = 1.0 / tictac.
Tac();
127 "Scan received: %u ranges, FOV: %.02fdeg, %.03fHz: mid " 139 if (i % 10 == 9) std::cout << std::endl;
141 std::cout << obs.
intensity[i] <<
" ]" << std::endl;
160 #if MRPT_HAS_WXWIDGETS 161 std::vector<float> xs, ys, zs;
163 win.plot(xs, ys,
".b3");
170 std::this_thread::sleep_for(15ms);
176 int main(
int argc,
char** argv)
188 catch (std::exception& e)
190 std::cout <<
"EXCEPCION: " << e.what() << std::endl;
195 printf(
"Another exception!!");
double Tac() noexcept
Stops the stopwatch.
double RAD2DEG(const double x)
Radians to degrees.
Create a GUI window and display plots with MATLAB-like interfaces and commands.
mrpt::containers::ContainerReadOnlyProxyAccessor< mrpt::aligned_std_vector< int32_t > > intensity
The intensity values of the scan.
A high-performance stopwatch, with typical resolution of nanoseconds.
Contains classes for various device interfaces.
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans. ...
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 ...
std::string lowerCase(const std::string &str)
Returns an lower-case version of a string.
mrpt::containers::ContainerReadOnlyProxyAccessor< mrpt::aligned_std_vector< float > > scan
The range values of the scan, in meters.
void getAllPoints(VECTOR &xs, VECTOR &ys, VECTOR &zs, size_t decimation=1) const
Returns a copy of the 2D/3D points as a std::vector of float coordinates.
bool setIntensityMode(bool enabled)
If true scans will capture intensity.
This namespace contains representation of robot actions and observations.
mrpt::gui::CDisplayWindow3D::Ptr win
GLsizei const GLchar ** string
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
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).
void setIPandPort(const std::string &ip, const unsigned int &port)
Set the ip direction and port to connect using Ethernet communication.
bool turnOn()
Enables the scanning mode (which may depend on the specific laser device); this must be called before...
This software driver implements the protocol SCIP-2.0 for interfacing HOKUYO URG/UTM/UXM/UST laser sc...
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)...
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...
TInsertionOptions insertionOptions
The options used when inserting observations in the map.
Classes for creating GUI windows for 2D and 3D visualization.
bool hasIntensity() const
Return true if scan has intensity.
void Tic() noexcept
Starts the stopwatch.
bool turnOff()
Disables the scanning mode (this can be used to turn the device in low energy mode, if available)
bool insertObservation(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D *robotPose=NULL)
Insert the observation information into this map.
mrpt::poses::CPose3D sensorPose
The 6D pose of the sensor on the robot at the moment of starting the scan.
GLuint GLuint GLsizei GLenum type
float minDistBetweenLaserPoints
The minimum distance between points (in 3D): If two points are too close, one of them is not inserted...