Product Specifications
|
Kind
|
Data output type
|
Detecting area setting type
|
|
Model No.
|
URG-04LX
|
URG-04LN
|
|
Power source
|
5VDC±5%*1
|
|
Current consumption
|
500mA or less(800mA when start-up)
|
|
Measuring area
|
60 to 4095mm(white paper with 70mm□)
|
|
240°
|
225°(any value within 270°, settable area)
|
|
Accuracy
(Repeatability)
|
60 to 1,000mm : ±10mm
1,000 to 4,095mm : 1% of measurement(70mm□ white paper)
|
|
Angular resolution
|
Step angle : approx. 0.36°(360°/1,024 steps)
|
|
Light source
|
Semiconductor laser diode(λ=785nm),
Laser safety class 1(IEC60825-1, 21 CFR 1040.10 & 1040.11)
|
|
Scanning time
|
100ms/scan
|
|
Noise
|
25dB or less
|
|
Interface
|
USB, RS-232C(19.2k, 57.6k, 115.2k, 250k, 500k, 750kbps),
NPN open-collector(synchronous output of optical scanner : 1 pce)
|
NPN open-collector(In : 3 pcs, OUT : 3 pcs), USB(for detecting area)
|
|
Communication specifications
|
Exclusive command
|
|
|
Ambient temperature/humidity
|
-10 to +50 degrees C, 85% or less(Not condensing, not icing)
|
|
Vibration resistance
|
10 to 55Hz, double amplitude 1.5mm Each 2 hour in X, Y and Z directions
|
|
Impact resistance
|
196m/s2, Each 10 time in X, Y and Z directions
|
|
Weight
|
Approx. 160g
|
|
Accessory
|
Cable for power・communication/input・output(1.5m) 1 pce,
D-sub connector with 9 pins 1 pce*2
|
*1 Sensor will not operate with USB bus power. Prepare power source separately.
*2 D-sub with 9 pins provides with URG-04LX only. USB cable and fitting metal don't provide with both URG-04LX and URG-04LN.
Note) This sensor is designed for indoor use only.
Note) This sensor is not safety device
Note) This sensor is not for use in military application.
External dimension

*URG-04LX : Power source・RS-232C・synchronous output
*URG-04LN : Power source・IN・OUT
Input/output circuit
|
Input(IN1 to IN3)
|
OUTPUT(OUT1 to OUT3)
|
 |
 |
Connection
| CN1(URG-04LX) |
CN1(URG-04LN) |
|
|
|
|
|
|
N.C.
|
|
|
|
N.C.
|
|
|
|
OUTPUT(Synchronous output)
|
|
|
|
GND(5th pin of 9-pin, D-sub connector)
|
|
|
|
RxD(3rd pin of 9-pin, D-sub connector)
|
|
|
|
TxD(2nd pin of 9-pin, D-sub connector)
|
|
|
|
0V
|
|
|
|
DC 5V
|
|
Note) It is short-circuited between GND for communication and 0V inside.
|
|
|
|
|
|
|
OUT3
|
|
|
|
OUT2
|
|
|
|
OUT1
|
|
|
|
IN3
|
|
|
|
IN2
|
|
|
|
IN1
|
|
|
|
0V
|
|
|
|
DC 5V
|
|
|
|
CN2
|
|
|
USB-miniB(5pin)
|
Downloads
This example shows how to access a HOKUYO laser scanner and retrieve scans. It makes use of the class hwdrivers::CHokuyoURG, which is in the lib_hwdrivers library. This program can be found in the MRPT source tree at /samples/HOKUYO_laser_test/.
This class works for both versions of the device, URG-04 and UTM-30LX (starting at version MRPT 0.6.0). It will automatically detects the version of the device, then adapts to query the correct amount of scan points.
Basically, the required steps are (refer to the sample code):
- Setup a serial port connection, using a hwdrivers::CSerialPort object. To create this serial port object, pass to it the correct serial port name, e.g. COM4 in Windows, or ttyUSB0 for Linux (names may change for different distributions,...). It may be also something like ttyACM0. Note that the whole path (e.g. /dev/ttyACM0) is not required, it will be generated as necessary. The same applies to Windows serial ports above COM4, you can use the full names (e.g. \.COM14) but the MRPT library will add the prefix if necessary, so you can always use the simpler names "COMXX".
- Bind the serial port to the HOKUYO laser interface, using
bindIO() .
- Setup communications and turn the laser on, with
turnOn() .
- Invoke in a timely fashion the method
doProces(), which processes incoming bytes, builds frames according to the required format, and returns scan data.
There are some options that can be loaded before calling "turnOn()":
[supplied_section_name]
COM_port_WIN = COM3
COM_port_LIN = ttyS0
pose_x=0.21 ; Laser range scaner 3D position in the robot (meters)
pose_y=0
pose_z=0.34
pose_yaw=0 ; Angles in degrees
pose_pitch=0
pose_roll=0
HOKUYO_motorSpeed_rpm=600 ; (Optional)
Check also the ready-to-use application RawLogGrabber, which allows gathering data in rawlog format from any number of devices simultaneously.
Screenshot of the example (on Windows)

2 Source Code
This example can be found in MRPT/samples/HOKUYO_laser_test/, or browse it at:
http://babel.isa.uma.es/mrpt-browse-code/mrpt-0.6.5/samples/HOKUYO_laser_test/test.cpp online
/* +---------------------------------------------------------------------------+
| The Mobile Robot Programming Toolkit (MRPT) C++ library |
| |
| http://mrpt.sourceforge.net/ |
| |
| Copyright (C) 2005-2008 University of Malaga |
| |
| This software was written by the Machine Perception and Intelligent |
| Robotics Lab, University of Malaga (Spain). |
| Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> |
| |
| This file is part of the MRPT project. |
| |
| MRPT is free software: you can redistribute it and/or modify |
| it under the terms of the GNU General Public License as published by |
| the Free Software Foundation, either version 3 of the License, or |
| (at your option) any later version. |
| |
| MRPT is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of the GNU General Public License |
| along with MRPT. If not, see <http://www.gnu.org/licenses/>. |
| |
+---------------------------------------------------------------------------+ */
#include <mrpt/core.h>
#include <mrpt/hwdrivers/CHokuyoURG.h>
#include <mrpt/hwdrivers/CSerialPort.h>
#include <mrpt/hwdrivers/CSickLaserUSB.h>
using namespace mrpt;
using namespace mrpt::hwdrivers;
using namespace mrpt::slam;
using namespace mrpt::gui;
using namespace mrpt::utils;
using namespace std;
string SERIAL_NAME; // Name of the serial port to open
// ------------------------------------------------------
// Test_HOKUYO
// ------------------------------------------------------
void Test_HOKUYO()
{
CHokuyoURG laser;
string serName;
cout << "HOKUYO laser range finder test application." << endl << endl;
if (SERIAL_NAME.empty())
{
cout << "Enter the serial port name (e.g. COM1, ttyS0, ttyUSB0): ";
getline(cin,serName);
}
else
{
cout << "Using serial port: " << SERIAL_NAME << endl;
serName = SERIAL_NAME;
}
// Set the laser serial port:
laser.m_com_port = serName;
// Load config:
CConfigFile cfgFile("./LASER_SCAN_TEST.INI");
laser.loadConfig( cfgFile,"HOKUYO#1" );
printf("[TEST] Turning laser ON...n");
if (laser.turnOn())
printf("[TEST] Initialization OK!n");
else
{
printf("[TEST] Initialization failed!n");
return;
}
#if MRPT_HAS_WXWIDGETS
CDisplayWindowPlots win("Laser scans");
#endif
cout << "Press any key to stop capturing..." << endl;
CTicTac tictac;
tictac.Tic();
while (!mrpt::system::os::kbhit())
{
bool thereIsObservation,hardError;
CObservation2DRangeScan obs;
laser.doProcessSimple( thereIsObservation, obs, hardError );
if (hardError)
printf("[TEST] Hardware error=true!!n");
if (thereIsObservation)
{
double FPS = 1.0 / tictac.Tac();
printf("Scan received: %u ranges, FOV: %.02fdeg, %.03fHz: mid rang=%fmn",
(unsigned int)obs.scan.size(),
RAD2DEG(obs.aperture),
FPS,
obs.scan[obs.scan.size()/2]);
obs.sensorPose = CPose3D(0,0,0);
mrpt::slam::CSimplePointsMap theMap;
theMap.insertionOptions.minDistBetweenLaserPoints = 0;
theMap.insertObservation( &obs );
//map.save2D_to_text_file("_out_scan.txt");
/*
COpenGLScene scene3D;
opengl::CPointCloudPtr points = opengl::CPointCloud::Create();
points->loadFromPointsMap(&map);
scene3D.insert(points);
CFileStream("_out_point_cloud.3Dscene",fomWrite) << scene3D;
*/
#if MRPT_HAS_WXWIDGETS
vector_float xs,ys,zs;
theMap.getAllPoints(xs,ys,zs);
win.plot(xs,ys,".b3");
win.axis_equal();
#endif
tictac.Tic();
}
system::sleep(5);
};
laser.turnOff();
}
int main(int argc, char **argv)
{
try
{
if (argc>1)
{
SERIAL_NAME = string(argv[1]);
}
Test_HOKUYO();
return 0;
} catch (std::exception &e)
{
std::cout << "EXCEPCION: " << e.what() << std::endl;
return -1;
}
catch (...)
{
printf("Another exception!!");
return -1;
}
}