Go to the documentation of this file.
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!!");
bool kbhit() noexcept
An OS-independent version of kbhit, which returns true if a key has been pushed.
bool insertObservation(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D *robotPose=NULL)
Insert the observation information into this map.
A high-performance stopwatch, with typical resolution of nanoseconds.
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
bool turnOff()
Disables the scanning mode (this can be used to turn the device in low energy mode,...
float minDistBetweenLaserPoints
The minimum distance between points (in 3D): If two points are too close, one of them is not inserted...
Contains classes for various device interfaces.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
bool hasIntensity() const
Return true if scan has intensity.
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.
GLuint GLuint GLsizei GLenum type
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
double RAD2DEG(const double x)
Radians to degrees.
This namespace contains representation of robot actions and observations.
std::string lowerCase(const std::string &str)
Returns an lower-case version of a string.
double Tac() noexcept
Stops the stopwatch.
float aperture
The "aperture" or field-of-view of the range finder, in radians (typically M_PI = 180 degrees).
mrpt::containers::ContainerReadOnlyProxyAccessor< mrpt::aligned_std_vector< int32_t > > intensity
The intensity values of the scan.
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 ...
mrpt::gui::CDisplayWindow3D::Ptr win
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
bool setIntensityMode(bool enabled)
If true scans will capture intensity.
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans.
void Tic() noexcept
Starts the stopwatch.
Classes for creating GUI windows for 2D and 3D visualization.
Create a GUI window and display plots with MATLAB-like interfaces and commands.
mrpt::containers::ContainerReadOnlyProxyAccessor< mrpt::aligned_std_vector< float > > scan
The range values of the scan, in meters.
TInsertionOptions insertionOptions
The options used when inserting observations in the map.
This software driver implements the protocol SCIP-2.0 for interfacing HOKUYO URG/UTM/UXM/UST laser sc...
GLsizei const GLchar ** string
void setIPandPort(const std::string &ip, const unsigned int &port)
Set the ip direction and port to connect using Ethernet communication.
mrpt::poses::CPose3D sensorPose
The 6D pose of the sensor on the robot at the moment of starting the scan.
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,...
bool turnOn()
Enables the scanning mode (which may depend on the specific laser device); this must be called before...
This namespace provides a OS-independent interface to many useful functions: filenames manipulation,...
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |