|
From: <gb...@us...> - 2010-08-16 02:09:33
|
Revision: 513
http://gearbox.svn.sourceforge.net/gearbox/?rev=513&view=rev
Author: gbiggs
Date: 2010-08-16 02:09:25 +0000 (Mon, 16 Aug 2010)
Log Message:
-----------
Removed public and private tags
Modified Paths:
--------------
gearbox/trunk/src/hokuyo_aist/scan_data.cpp
gearbox/trunk/src/hokuyo_aist/scan_data.h
gearbox/trunk/src/hokuyo_aist/sensor.cpp
gearbox/trunk/src/hokuyo_aist/sensor.h
gearbox/trunk/src/hokuyo_aist/sensor_info.cpp
gearbox/trunk/src/hokuyo_aist/sensor_info.h
Modified: gearbox/trunk/src/hokuyo_aist/scan_data.cpp
===================================================================
--- gearbox/trunk/src/hokuyo_aist/scan_data.cpp 2010-08-16 01:36:43 UTC (rev 512)
+++ gearbox/trunk/src/hokuyo_aist/scan_data.cpp 2010-08-16 02:09:25 UTC (rev 513)
@@ -419,7 +419,7 @@
}
-void ScanData::write_range_(unsigned int index, uint32_t value)
+void ScanData::write_range(unsigned int index, uint32_t value)
{
if(ranges_ != 0)
{
@@ -432,7 +432,7 @@
}
-void ScanData::write_intensity_(unsigned int index, uint32_t value)
+void ScanData::write_intensity(unsigned int index, uint32_t value)
{
if(intensities_ != 0)
{
Modified: gearbox/trunk/src/hokuyo_aist/scan_data.h
===================================================================
--- gearbox/trunk/src/hokuyo_aist/scan_data.h 2010-08-16 01:36:43 UTC (rev 512)
+++ gearbox/trunk/src/hokuyo_aist/scan_data.h 2010-08-16 02:09:25 UTC (rev 513)
@@ -110,7 +110,7 @@
/** @brief Get the system time stamp of the data in milliseconds.
This value is only available using SCIP version 2). */
- unsigned int system_time_stamp() const { return system_time_; }
+ unsigned long long system_time_stamp() const { return system_time_; }
/// Get the model of the laser that produced this scan.
LaserModel model() const { return model_; }
/// Check if the buffers are being provided instead of automatic.
@@ -143,14 +143,14 @@
unsigned int intensities_length_;
bool error_;
unsigned int laser_time_;
- unsigned int system_time_;
+ unsigned long long system_time_;
LaserModel model_;
bool buffers_provided_;
void allocate_data(unsigned int length,
bool include_intensities = false);
- void write_range_(unsigned int index, uint32_t value);
- void write_intensity_(unsigned int index, uint32_t value);
+ void write_range(unsigned int index, uint32_t value);
+ void write_intensity(unsigned int index, uint32_t value);
}; // class ScanData
} // namespace hokuyo_aist
Modified: gearbox/trunk/src/hokuyo_aist/sensor.cpp
===================================================================
--- gearbox/trunk/src/hokuyo_aist/sensor.cpp 2010-08-16 01:36:43 UTC (rev 512)
+++ gearbox/trunk/src/hokuyo_aist/sensor.cpp 2010-08-16 02:09:25 UTC (rev 513)
@@ -323,9 +323,9 @@
// Figure out the SCIP version currently in use and switch to a higher one
// if possible
- get_and_set_scip_version_();
+ get_and_set_scip_version();
// Get some values we need for providing default ranges
- get_defaults_();
+ get_defaults();
}
@@ -352,9 +352,9 @@
{
// Figure out the SCIP version currently in use and switch to a higher
// one if possible
- get_and_set_scip_version_();
+ get_and_set_scip_version();
// Get some values we need for providing default ranges
- get_defaults_();
+ get_defaults();
}
catch(BaseError)
{
@@ -375,8 +375,8 @@
reinterpret_cast<flexiport::SerialPort*>(port_)->SetBaudRate(bauds[ii]);
try
{
- get_and_set_scip_version_();
- get_defaults_();
+ get_and_set_scip_version();
+ get_defaults();
// If the above two functions succeed, break out of the
// loop and be happy
if(verbose_)
@@ -448,16 +448,16 @@
if(verbose_)
err_output_ << "Sensor::" << __func__ <<
"() Turning laser on.\n";
- send_command_("L", "1", 1, 0);
+ send_command("L", "1", 1, 0);
}
else
{
if(verbose_)
err_output_ << "Sensor::" << __func__ <<
"() Turning laser off.\n";
- send_command_("L", "0", 1, 0);
+ send_command("L", "0", 1, 0);
}
- skip_lines_(1);
+ skip_lines(1);
}
else if(scip_version_ == 2)
{
@@ -466,16 +466,16 @@
if(verbose_)
err_output_ << "Sensor::" << __func__ <<
"() Turning laser on.\n";
- send_command_("BM", 0, 0, "02");
+ send_command("BM", 0, 0, "02");
}
else
{
if(verbose_)
err_output_ << "Sensor::" << __func__ <<
"() Turning laser off.\n";
- send_command_("QT", 0, 0, "02");
+ send_command("QT", 0, 0, "02");
}
- skip_lines_(1);
+ skip_lines(1);
}
else
throw UnknownScipVersionError();
@@ -502,16 +502,16 @@
if(scip_version_ == 1)
{
// Send the command to change baud rate
- send_command_("S", newBaud, 13, 0);
- skip_lines_(1);
+ send_command("S", newBaud, 13, 0);
+ skip_lines(1);
// Change the port's baud rate
reinterpret_cast<flexiport::SerialPort*>(port_)->SetBaudRate(baud);
}
else if(scip_version_ == 2)
{
// Send the command to change baud rate
- send_command_("SS", newBaud, 6, "03");
- skip_lines_(1);
+ send_command("SS", newBaud, 6, "03");
+ skip_lines(1);
// Change the port's baud rate
reinterpret_cast<flexiport::SerialPort*>(port_)->SetBaudRate(baud);
}
@@ -542,9 +542,9 @@
err_output_ << "Sensor::" << __func__ <<
"() Setting IP information to $I" << params.str() << '\n';
}
- int status = send_command_(&command[0], params.str().c_str(), 48, 0);
+ int status = send_command(&command[0], params.str().c_str(), 48, 0);
// Skip the extra line feed
- skip_lines_(1);
+ skip_lines(1);
if(status != 0)
throw SetIPError();
}
@@ -561,8 +561,8 @@
err_output_ << "Sensor::" << __func__ <<
"() Resetting laser.\n";
}
- send_command_("RS", 0, 0, 0);
- skip_lines_(1);
+ send_command("RS", 0, 0, 0);
+ skip_lines(1);
}
else
throw UnknownScipVersionError();
@@ -578,8 +578,8 @@
if(verbose_)
err_output_ << "Sensor::" << __func__ <<
"() Resetting laser.\n";
- send_command_("RS", 0, 0, 0);
- skip_lines_(1);
+ send_command("RS", 0, 0, 0);
+ skip_lines(1);
}
else
throw UnknownScipVersionError();
@@ -627,8 +627,8 @@
}
number_to_string(speed, buffer, 2);
}
- send_command_("CR", buffer, 2, "03");
- skip_lines_(1);
+ send_command("CR", buffer, 2, "03");
+ skip_lines(1);
}
else
throw UnknownScipVersionError();
@@ -646,7 +646,7 @@
if(verbose_)
err_output_ << "Sensor::" << __func__ <<
"() Switching to high sensitivity.\n";
- send_command_("HS", "1", 1, "02");
+ send_command("HS", "1", 1, "02");
}
else
{
@@ -655,9 +655,9 @@
err_output_ << "Sensor::" << __func__ <<
"() Switching to normal sensitivity.\n";
}
- send_command_("HS", "0", 1, "02");
+ send_command("HS", "0", 1, "02");
}
- skip_lines_(1);
+ skip_lines(1);
}
else
throw UnknownScipVersionError();
@@ -677,36 +677,36 @@
"() Getting sensor information using SCIP version 1.\n";
}
- info->set_defaults_();
+ info->set_defaults();
char buffer[SCIP1_LINE_LENGTH];
memset(buffer, 0, sizeof(char) * SCIP1_LINE_LENGTH);
- send_command_("V", 0, 0, 0);
+ send_command("V", 0, 0, 0);
// Get the vendor info line
- read_line_(buffer);
+ read_line(buffer);
info->vendor = &buffer[5]; // Chop off the "VEND:" tag
// Get the product info line
- read_line_(buffer);
+ read_line(buffer);
info->product = &buffer[5];
// Only the URG-04LX supports SCIP1
model_ = MODEL_URG04LX;
// Get the firmware line
- read_line_(buffer);
+ read_line(buffer);
info->firmware = &buffer[5];
// Get the protocol version line
- read_line_(buffer);
+ read_line(buffer);
info->protocol = &buffer[5];
// Get the serial number
- read_line_(buffer);
+ read_line(buffer);
info->serial = &buffer[5];
// Get either the status line or the end of message
- read_line_(buffer);
+ read_line(buffer);
if(buffer[0] != '\0')
{
// Got a status line
info->sensor_diagnostic = &buffer[5];
- skip_lines_(1);
+ skip_lines(1);
}
// Check the firmware version major number. If it's >=3 there is
@@ -728,7 +728,7 @@
{
// No bracket? Crud. Fail and use the hard-coded values from
// the manual.
- info->calculate_values_();
+ info->calculate_values();
}
// Now put it through sscanf and hope...
int aperture;
@@ -740,8 +740,8 @@
{
// Didn't get enough values out, assume unknown format and fall
// back on the defaults
- info->set_defaults_();
- info->calculate_values_();
+ info->set_defaults();
+ info->calculate_values();
if(verbose_)
{
err_output_ << "Retrieved sensor info (hard-coded, not "
@@ -775,7 +775,7 @@
{
// We're stuck with hard-coded defaults from the manual (already
// set earlier).
- info->calculate_values_();
+ info->calculate_values();
if(verbose_)
{
err_output_ << "Retrieved sensor info (hard-coded):\n";
@@ -791,30 +791,30 @@
"() Getting sensor information using SCIP version 2.\n";
}
- info->set_defaults_();
+ info->set_defaults();
char buffer[SCIP2_LINE_LENGTH];
memset(buffer, 0, sizeof(char) * SCIP2_LINE_LENGTH);
// We need to send three commands to get all the info we want: VV, PP
// and II
- send_command_("VV", 0, 0, 0);
- while(read_line_with_check_(buffer, -1, true) != 0)
- process_vv_line_(buffer, info);
+ send_command("VV", 0, 0, 0);
+ while(read_line_with_check(buffer, -1, true) != 0)
+ process_vv_line(buffer, info);
// Next up, PP
- send_command_("PP", 0, 0, 0);
- while(read_line_with_check_(buffer, -1, true) != 0)
- process_pp_line_(buffer, info);
+ send_command("PP", 0, 0, 0);
+ while(read_line_with_check(buffer, -1, true) != 0)
+ process_pp_line(buffer, info);
// Command II: Revenge of the Commands.
- send_command_("II", 0, 0, 0);
- while(read_line_with_check_(buffer, -1, true) != 0)
- process_ii_line_(buffer, info);
+ send_command("II", 0, 0, 0);
+ while(read_line_with_check(buffer, -1, true) != 0)
+ process_ii_line(buffer, info);
enable_checksum_workaround_ = false;
- info->calculate_values_();
+ info->calculate_values();
if(verbose_)
{
err_output_ << "Retrieved sensor info:\n";
@@ -828,7 +828,7 @@
unsigned int Sensor::get_time()
{
- return offset_timestamp_(wrap_timestamp_(get_raw_time()));
+ return offset_timestamp(wrap_timestamp(get_raw_time()));
}
@@ -841,12 +841,12 @@
if(verbose_)
err_output_ << "Sensor::" << __func__ <<
"() Retrieving time from laser.\n";
- send_command_("TM", "0", 1, 0);
- send_command_("TM", "1", 1, 0);
+ send_command("TM", "0", 1, 0);
+ send_command("TM", "1", 1, 0);
char buffer[7];
- read_line_with_check_(buffer, 6);
- send_command_("TM", "2", 1, 0);
- skip_lines_(1);
+ read_line_with_check(buffer, 6);
+ send_command("TM", "2", 1, 0);
+ skip_lines(1);
// We need to decode the time value that's in the buffer
return decode_4_byte_value(buffer);
}
@@ -862,7 +862,7 @@
{
if(verbose_)
err_output_ << "Entering timing mode.\n";
- enter_timing_mode_();
+ enter_timing_mode();
// From A. Carballo, Y. Hara, H. Kawata, T.
// Yoshida, A. Ohya, S. Yuta, “Time synchronisation
@@ -882,9 +882,9 @@
for(unsigned int ii = 0; ii < samples; ii++)
{
unsigned long long end_time(0);
- unsigned long long start_time = get_computer_time_();
+ unsigned long long start_time = get_computer_time();
unsigned long long laser_time =
- wrap_timestamp_(get_timing_mode_time_(&end_time)) * 1e6;
+ wrap_timestamp(get_timing_mode_time(&end_time)) * 1e6;
offsets.push_back(start_time -
(laser_time - (end_time - start_time) / 2));
}
@@ -908,9 +908,9 @@
for(unsigned int ii = 0; ii < samples; ii++)
{
unsigned long long end_time(0);
- unsigned long long start_time = get_computer_time_();
+ unsigned long long start_time = get_computer_time();
unsigned long long laser_time =
- wrap_timestamp_(get_timing_mode_time_(&end_time)) * 1e6;
+ wrap_timestamp(get_timing_mode_time(&end_time)) * 1e6;
offsets.push_back(start_time -
(laser_time - (end_time - start_time) / 2));
}
@@ -934,7 +934,7 @@
// All done.
if(verbose_)
err_output_ << "Leaving timing mode.\n";
- leave_timing_mode_();
+ leave_timing_mode();
return time_offset_;
}
@@ -966,9 +966,9 @@
number_to_string(start_step, buffer, 3);
number_to_string(end_step, &buffer[3], 3);
number_to_string(cluster_count, &buffer[6], 2);
- send_command_("G", buffer, 8, 0);
+ send_command("G", buffer, 8, 0);
// In SCIP1 mode we're going to get back 2-byte data
- read_2_byte_range_data_(data, num_steps);
+ read_2_byte_range_data(data, num_steps);
}
else if(scip_version_ == 2)
{
@@ -978,20 +978,20 @@
number_to_string(end_step, &buffer[4], 4);
number_to_string(cluster_count, &buffer[8], 2);
if(model_ == MODEL_UXM30LXE && multiecho_mode_ != ME_OFF)
- send_command_("HD", buffer, 10, 0);
+ send_command("HD", buffer, 10, 0);
else
- send_command_("GD", buffer, 10, 0);
+ send_command("GD", buffer, 10, 0);
// There will be a timestamp before the data (if there is data)
// Normally we would send 6 for the expected length, but we may get no
// timestamp back if there was no data.
- if(read_line_with_check_(buffer) == 0)
+ if(read_line_with_check(buffer) == 0)
throw NoDataError();
data.laser_time_ = decode_4_byte_value(buffer) +
- step_to_time_offset_(start_step);
- data.system_time_ = offset_timestamp_(wrap_timestamp_(data.laser_time_));
+ step_to_time_offset(start_step);
+ data.system_time_ = offset_timestamp(wrap_timestamp(data.laser_time_));
// In SCIP2 mode we're going to get back 3-byte data because we're
// sending the GD command
- read_3_byte_range_data_(data, num_steps);
+ read_3_byte_range_data(data, num_steps);
}
else
throw UnknownScipVersionError();
@@ -1057,20 +1057,20 @@
number_to_string(end_step, &buffer[4], 4);
number_to_string(cluster_count, &buffer[8], 2);
if(model_ == MODEL_UXM30LXE && multiecho_mode_ != ME_OFF)
- send_command_("HE", buffer, 10, 0);
+ send_command("HE", buffer, 10, 0);
else
- send_command_("GE", buffer, 10, 0);
+ send_command("GE", buffer, 10, 0);
// There will be a timestamp before the data (if there is data)
// Normally we would send 6 for the expected length, but we may get no
// timestamp back if there was no data.
- if(read_line_with_check_(buffer) == 0)
+ if(read_line_with_check(buffer) == 0)
throw NoDataError();
data.laser_time_ = decode_4_byte_value(buffer) +
- step_to_time_offset_(start_step);
- data.system_time_ = offset_timestamp_(wrap_timestamp_(data.laser_time_));
+ step_to_time_offset(start_step);
+ data.system_time_ = offset_timestamp(wrap_timestamp(data.laser_time_));
// In SCIP2 mode we're going to get back 3-byte data because we're
// sending the GE command
- read_3_byte_range_data_(data, num_steps);
+ read_3_byte_range_data(data, num_steps);
return data.ranges_length_;
}
@@ -1140,13 +1140,13 @@
command[0] = 'M';
command[1] = 'D';
command[2] = '\0';
- send_command_(command, buffer, 13, 0);
+ send_command(command, buffer, 13, 0);
// Mx commands will perform a scan, then send the data prefixed with
// another command echo.
// Read back the command echo (minimum of 3 bytes, maximum of 16 bytes)
char response[17];
- skip_lines_(1); // End of the command echo message
- read_line_(response, 16); // Size is command(2)+params(13)+new line(1)
+ skip_lines(1); // End of the command echo message
+ read_line(response, 16); // Size is command(2)+params(13)+new line(1)
// Check the echo is correct
if(response[0] != command[0] || response[1] != command[1])
throw CommandEchoError(command, response);
@@ -1155,7 +1155,7 @@
if(memcmp(&response[2], buffer, 13) != 0)
throw ParamEchoError(command);
// The next line should be the status line
- read_line_with_check_(response, 4);
+ read_line_with_check(response, 4);
if(verbose_)
{
err_output_ << "Sensor::" << __func__ <<
@@ -1167,7 +1167,7 @@
{
// There is an extra line feed after an error status (signalling
// end of message)
- skip_lines_(1);
+ skip_lines(1);
throw ResponseError(response, command);
}
@@ -1175,14 +1175,14 @@
// There will be a timestamp before the data (if there is data)
// Normally we would send 6 for the expected length, but we may get no
// timestamp back if there was no data.
- if(read_line_with_check_(buffer) == 0)
+ if(read_line_with_check(buffer) == 0)
throw NoDataError();
data.laser_time_ = decode_4_byte_value(buffer) +
- step_to_time_offset_(start_step);
- data.system_time_ = offset_timestamp_(wrap_timestamp_(data.laser_time_));
+ step_to_time_offset(start_step);
+ data.system_time_ = offset_timestamp(wrap_timestamp(data.laser_time_));
// In SCIP2 mode we're going to get back 3-byte data because we're
// sending the MD command
- read_3_byte_range_data_(data, num_steps);
+ read_3_byte_range_data(data, num_steps);
return data.ranges_length_;
}
@@ -1256,13 +1256,13 @@
command[0] = 'M';
command[1] = 'E';
command[2] = '\0';
- send_command_(command, buffer, 13, 0);
+ send_command(command, buffer, 13, 0);
// Mx commands will perform a scan, then send the data prefixed with
// another command echo.
// Read back the command echo (minimum of 3 bytes, maximum of 16 bytes)
char response[17];
- skip_lines_(1); // End of the command echo message
- read_line_(response, 16); // Size is command(2)+params(13)+new line(1)
+ skip_lines(1); // End of the command echo message
+ read_line(response, 16); // Size is command(2)+params(13)+new line(1)
// Check the echo is correct
if(response[0] != command[0] || response[1] != command[1])
throw CommandEchoError(command, response);
@@ -1271,7 +1271,7 @@
if(memcmp(&response[2], buffer, 13) != 0)
throw ParamEchoError(command);
// The next line should be the status line
- read_line_with_check_(response, 4);
+ read_line_with_check(response, 4);
if(verbose_)
{
err_output_ << "Sensor::" << __func__ <<
@@ -1283,7 +1283,7 @@
{
// There is an extra line feed after an error status (signalling
// end of message)
- skip_lines_(1);
+ skip_lines(1);
throw ResponseError(response, command);
}
@@ -1291,14 +1291,14 @@
// There will be a timestamp before the data (if there is data)
// Normally we would send 6 for the expected length, but we may get no
// timestamp back if there was no data.
- if(read_line_with_check_(buffer) == 0)
+ if(read_line_with_check(buffer) == 0)
throw NoDataError();
data.laser_time_ = decode_4_byte_value(buffer) +
- step_to_time_offset_(start_step);
- data.system_time_ = offset_timestamp_(wrap_timestamp_(data.laser_time_));
+ step_to_time_offset(start_step);
+ data.system_time_ = offset_timestamp(wrap_timestamp(data.laser_time_));
// In SCIP2 mode we're going to get back 3-byte data because we're
// sending the ME command
- read_3_byte_range_and_intensity_data_(data, num_steps);
+ read_3_byte_range_and_intensity_data(data, num_steps);
return data.ranges_length_;
}
@@ -1368,7 +1368,7 @@
// keep flushing until the port reports there is no data left after a timeout.
// This shouldn't be called too much, as it introduces a delay as big as the
// timeout (which may be infinite).
-void Sensor::clear_read_buffer_()
+void Sensor::clear_read_buffer()
{
while(port_->BytesAvailableWait() > 0)
port_->Flush();
@@ -1383,7 +1383,7 @@
// The line feed that terminates a line will be replaced with a 0.
// The return value is the number of bytes received, not including the 0
// byte or the line feed.
-int Sensor::read_line_(char* buffer, int expected_length)
+int Sensor::read_line(char* buffer, int expected_length)
{
int linelength = 0;
@@ -1436,7 +1436,7 @@
// This function will read a line and then calculate its checksum, comparing it
// with the checksum at the end of the line. The checksum will be removed
// (along with the semi-colon, if present). buffer and expected_length args are
-// as for read_line_().
+// as for read_line().
// If has_semicolon is true, the byte before the checksum is assumed to be the
// semi-colon separator and so not a part of the checksum. If it's not a
// semi-colon, an exception is thrown.
@@ -1450,10 +1450,10 @@
// model_ is MODEL_UTM30LX. In this case, if the checksum fails normally, it
// scans the line for "<-" and recalculates the checksum on the bytes up to
// that point. This only happens in SCIP v2.
-int Sensor::read_line_with_check_(char* buffer, int expected_length,
+int Sensor::read_line_with_check(char* buffer, int expected_length,
bool has_semicolon)
{
- int linelength = read_line_(buffer, expected_length);
+ int linelength = read_line(buffer, expected_length);
if(scip_version_ == 1)
{
// No checksums in SCIP version 1
@@ -1481,7 +1481,7 @@
int checkSum = 0;
try
{
- checkSum = confirm_checksum_(buffer, bytesToConsider,
+ checkSum = confirm_checksum(buffer, bytesToConsider,
static_cast<int>(buffer[checksumIndex]));
}
catch(ProtocolError& e)
@@ -1506,7 +1506,7 @@
linelength);
}
- checkSum = confirm_checksum_(buffer, newBytesToConsider,
+ checkSum = confirm_checksum(buffer, newBytesToConsider,
static_cast<int>(buffer[checksumIndex]));
}
else
@@ -1526,7 +1526,7 @@
// Reads lines until the number specified has passed.
-void Sensor::skip_lines_(int count)
+void Sensor::skip_lines(int count)
{
if(verbose_)
err_output_ << "Sensor::" << __func__ << "() Skipping " << count <<
@@ -1545,7 +1545,7 @@
// If param_length is 0, no parameters will be sent or expected in the reply.
// extra_ok must be a 1-byte string for SCIP1 and a 2-byte string for SCIP2.
// Return value is the status code returned for the command.
-int Sensor::send_command_(char const* cmd, char const* param,
+int Sensor::send_command(char const* cmd, char const* param,
int param_length, char const* extra_ok)
{
int statusCode = -1;
@@ -1577,8 +1577,8 @@
// 16 including \n's depending on the parameters): cmd[0] params \n
// status \n
int statusIndex = 2 + param_length;
- read_line_(response, 2 + param_length);
- read_line_(&response[statusIndex], 2);
+ read_line(response, 2 + param_length);
+ read_line(&response[statusIndex], 2);
// First make sure that the echoed command matches
if(response[0] != cmd[0])
{
@@ -1616,7 +1616,7 @@
{
// There is an extra line feed after an error status
// (signalling end of message)
- skip_lines_(1);
+ skip_lines(1);
throw Scip1ResponseError(response[statusIndex], cmd[0]);
}
}
@@ -1624,7 +1624,7 @@
{
// There is an extra line feed after an error status
// (signalling end of message)
- skip_lines_(1);
+ skip_lines(1);
throw Scip1ResponseError(response[statusIndex], cmd[0]);
}
}
@@ -1651,7 +1651,7 @@
throw WriteError(21);
// Read back the command echo (minimum of 3 bytes, maximum of 16 bytes)
- read_line_(response, 3 + param_length);
+ read_line(response, 3 + param_length);
// Check the echo is correct
if(response[0] != cmd[0] || response[1] != cmd[1])
throw CommandEchoError(cmd, response);
@@ -1663,7 +1663,7 @@
}
// The next line should be the status line
- read_line_with_check_(response, 4);
+ read_line_with_check(response, 4);
if(verbose_)
{
err_output_ << "Sensor::" << __func__ <<
@@ -1681,7 +1681,7 @@
{
// There is an extra line feed after an error status
// (signalling end of message)
- skip_lines_(1);
+ skip_lines(1);
throw ResponseError(response, cmd);
}
}
@@ -1689,7 +1689,7 @@
{
// There is an extra line feed after an error status
// (signalling end of message)
- skip_lines_(1);
+ skip_lines(1);
throw ResponseError(response, cmd);
}
}
@@ -1704,25 +1704,25 @@
/// Puts the laser into the timing mode.
-void Sensor::enter_timing_mode_()
+void Sensor::enter_timing_mode()
{
- send_command_("TM", "0", 1, 0);
- skip_lines_(1);
+ send_command("TM", "0", 1, 0);
+ skip_lines(1);
}
/// Take the laser out of timing mode.
-void Sensor::leave_timing_mode_()
+void Sensor::leave_timing_mode()
{
- send_command_("TM", "2", 1, 0);
- skip_lines_(1);
+ send_command("TM", "2", 1, 0);
+ skip_lines(1);
}
/// Get the timestamp from the laser.
/// If @ref reception_time is not 0, it will be filled with the time at
/// which data reception was completed.
-unsigned int Sensor::get_timing_mode_time_(unsigned long long* reception_time)
+unsigned int Sensor::get_timing_mode_time(unsigned long long* reception_time)
{
// To get the most accurate result, we cannot do any processing while
// receiving. We want to know the time that reception finished as exactly
@@ -1734,7 +1734,7 @@
throw WriteError(19);
unsigned int line_length = port_->Read(response, 16);
if(reception_time)
- *reception_time = get_computer_time_();
+ *reception_time = get_computer_time();
// Process the response to confirm it is correct
if(line_length < 0)
throw ReadError(0);
@@ -1749,7 +1749,7 @@
if(response[4] != '0' || response[5] != '0' || response[6] != 'P')
throw ResponseError(response, "TM");
// Check the checksum on the time stamp is accurate
- confirm_checksum_(&response[8], 4, response[12]);
+ confirm_checksum(&response[8], 4, response[12]);
// Decode the time stamp
unsigned int timestamp =
decode_4_byte_value(&response[8]);
@@ -1758,7 +1758,7 @@
/// Get the computer's time as accurately as possible.
-unsigned long long Sensor::get_computer_time_()
+unsigned long long Sensor::get_computer_time()
{
#if defined(_POSIX_TIMERS)
struct timespec ts;
@@ -1773,7 +1773,7 @@
/// timestamp must be in milliseconds. The result is in milliseconds.
-unsigned int Sensor::wrap_timestamp_(unsigned int timestamp)
+unsigned int Sensor::wrap_timestamp(unsigned int timestamp)
{
if(timestamp < last_timestamp_)
{
@@ -1786,14 +1786,14 @@
/// timestamp must be in milliseconds. The result is in nanoseconds.
-unsigned long long Sensor::offset_timestamp_(unsigned int timestamp)
+unsigned long long Sensor::offset_timestamp(unsigned int timestamp)
{
return ((1 - time_drift_rate_) * timestamp * 1e6 + time_offset_) /
(1 - time_skew_alpha_);
}
-unsigned int Sensor::step_to_time_offset_(int start_step)
+unsigned int Sensor::step_to_time_offset(int start_step)
{
if(start_step < 0)
return first_step_ * time_resolution_;
@@ -1803,7 +1803,7 @@
/// Search a string for the laser's model.
-void Sensor::find_model_(char const* buffer)
+void Sensor::find_model(char const* buffer)
{
if(strstr(buffer, "URG-04LX") != 0)
model_ = MODEL_URG04LX;
@@ -1825,7 +1825,7 @@
}
-void Sensor::get_and_set_scip_version_()
+void Sensor::get_and_set_scip_version()
{
bool scip2Failed = false;
@@ -1836,7 +1836,7 @@
// Try SCIP version 2 first by sending an info command
try
{
- send_command_("VV", 0, 0, 0);
+ send_command("VV", 0, 0, 0);
}
catch(BaseError)
{
@@ -1856,18 +1856,18 @@
port_->Flush();
try
{
- send_command_("V", 0, 0, 0);
+ send_command("V", 0, 0, 0);
}
catch(BaseError)
{
throw ScipVersionError();
}
// Skip the vendor and product info
- skip_lines_(2);
+ skip_lines(2);
// Get the firmware line
char buffer[SCIP1_LINE_LENGTH];
memset(buffer, 0, sizeof(char) * SCIP1_LINE_LENGTH);
- read_line_(buffer);
+ read_line(buffer);
if(strncmp(buffer, "FIRM:", 5) != 0)
throw MissingFirmSpecError();
@@ -1887,7 +1887,7 @@
}
// Dump the rest of the V command result (one of these will be the
// empty last line)
- skip_lines_(3);
+ skip_lines(3);
// If the firmware version is less than 3, we're stuck with SCIP
// version 1.
@@ -1910,7 +1910,7 @@
// first byte as the command and the other 6 as parameters.
try
{
- send_command_("S", "CIP2.0", 6, 0);
+ send_command("S", "CIP2.0", 6, 0);
}
catch(BaseError)
{
@@ -1921,7 +1921,7 @@
return;
}
// There'll be a trailing line on the end
- skip_lines_(1);
+ skip_lines(1);
// Changed to SCIP version 2
if(verbose_)
@@ -1937,7 +1937,7 @@
scip_version_ = 2;
// Dump the rest of the result
- skip_lines_(6);
+ skip_lines(6);
if(verbose_)
err_output_ << "Sensor::" << __func__ <<
"() Using SCIP version 2.\n";
@@ -1949,7 +1949,7 @@
}
-void Sensor::get_defaults_()
+void Sensor::get_defaults()
{
if(verbose_)
err_output_ << "Sensor::" << __func__ <<
@@ -1976,7 +1976,7 @@
}
-void Sensor::process_vv_line_(char const* buffer, SensorInfo* info)
+void Sensor::process_vv_line(char const* buffer, SensorInfo* info)
{
if(strncmp(buffer, "VEND", 4) == 0)
info->vendor = &buffer[5]; // Vendor info, minus the "VEND:" tag
@@ -1984,7 +1984,7 @@
{
info->product = &buffer[5]; // Product info
// Find the product model
- find_model_(&buffer[5]);
+ find_model(&buffer[5]);
info->detected_model = model_;
}
else if(strncmp(buffer, "FIRM", 4) == 0)
@@ -1998,7 +1998,7 @@
}
-void Sensor::process_pp_line_(char const* buffer, SensorInfo* info)
+void Sensor::process_pp_line(char const* buffer, SensorInfo* info)
{
if(strncmp(buffer, "MODL", 4) == 0)
info->model = &buffer[5]; // Model
@@ -2031,7 +2031,7 @@
}
-void Sensor::process_ii_line_(char const* buffer, SensorInfo* info)
+void Sensor::process_ii_line(char const* buffer, SensorInfo* info)
{
if(strncmp(buffer, "MODL", 4) == 0)
// Do nothing here - we already know this value from PP
@@ -2094,7 +2094,7 @@
/// Combines up to three values from an echo buffer into a single value based
/// on the setting of multiecho_mode_.
-uint32_t Sensor::process_echo_buffer_(int const* buffer, int num_echos)
+uint32_t Sensor::process_echo_buffer(int const* buffer, int num_echos)
{
uint32_t sum = 0;
switch(multiecho_mode_)
@@ -2125,7 +2125,7 @@
}
-void Sensor::read_2_byte_range_data_(ScanData& data, unsigned int num_steps)
+void Sensor::read_2_byte_range_data(ScanData& data, unsigned int num_steps)
{
if(verbose_)
{
@@ -2146,7 +2146,7 @@
while(true)
{
// Read a line of data
- numBytesInLine = read_line_with_check_(buffer);
+ numBytesInLine = read_line_with_check(buffer);
// Check if we've reached the end of the data
if(numBytesInLine == 0)
break;
@@ -2158,7 +2158,7 @@
// Line feed in the middle of a data block? Why?
throw MisplacedLineFeedError();
}
- data.write_range_(current_step, decode_2_byte_value(&buffer[ii]));
+ data.write_range(current_step, decode_2_byte_value(&buffer[ii]));
}
// End of this line. Go around again.
}
@@ -2171,7 +2171,7 @@
}
-void Sensor::read_3_byte_range_data_(ScanData& data, unsigned int num_steps)
+void Sensor::read_3_byte_range_data(ScanData& data, unsigned int num_steps)
{
if(verbose_)
{
@@ -2202,15 +2202,15 @@
while(true)
{
// Read a line of data
- numBytesInLine = read_line_with_check_(buffer);
+ numBytesInLine = read_line_with_check(buffer);
// Check if we've reached the end of the data
if(numBytesInLine == 0)
{
if(echo_buffer[0] != -1)
{
// Not the first value, so deal with the previous
- data.write_range_(current_step,
- process_echo_buffer_(echo_buffer, echo_buf_ind + 1));
+ data.write_range(current_step,
+ process_echo_buffer(echo_buffer, echo_buf_ind + 1));
if(data.ranges_)
{
if(data.ranges_[current_step] > max_range_)
@@ -2247,8 +2247,8 @@
else if(echo_buffer[0] != -1)
{
// Not the first value, so deal with the previous
- data.write_range_(current_step,
- process_echo_buffer_(echo_buffer,
+ data.write_range(current_step,
+ process_echo_buffer(echo_buffer,
echo_buf_ind + 1));
if(data.ranges_)
{
@@ -2315,7 +2315,7 @@
}
-void Sensor::read_3_byte_range_and_intensity_data_(ScanData& data,
+void Sensor::read_3_byte_range_and_intensity_data(ScanData& data,
unsigned int num_steps)
{
if(verbose_)
@@ -2347,7 +2347,7 @@
while(true)
{
// Read a line of data
- numBytesInLine = read_line_with_check_(buffer);
+ numBytesInLine = read_line_with_check(buffer);
// Check if we've reached the end of the data
if(numBytesInLine == 0)
{
@@ -2357,8 +2357,8 @@
if(echo_buffer[0] != -1)
{
assert(nextIsIntensity == true);
- data.write_intensity_(current_intensity,
- process_echo_buffer_(echo_buffer, echo_buf_ind + 1));
+ data.write_intensity(current_intensity,
+ process_echo_buffer(echo_buffer, echo_buf_ind + 1));
current_intensity++;
}
break;
@@ -2387,14 +2387,14 @@
// Not the first value, so deal with the previous
if(nextIsIntensity)
{
- data.write_intensity_(current_intensity,
- process_echo_buffer_(echo_buffer,
+ data.write_intensity(current_intensity,
+ process_echo_buffer(echo_buffer,
echo_buf_ind + 1));
}
else
{
- data.write_range_(current_range,
- process_echo_buffer_(echo_buffer,
+ data.write_range(current_range,
+ process_echo_buffer(echo_buffer,
echo_buf_ind + 1));
}
echo_buf_ind = 0;
@@ -2478,7 +2478,7 @@
}
-int Sensor::confirm_checksum_(char const* buffer, int length,
+int Sensor::confirm_checksum(char const* buffer, int length,
int expected_sum)
{
int checksum = 0;
Modified: gearbox/trunk/src/hokuyo_aist/sensor.h
===================================================================
--- gearbox/trunk/src/hokuyo_aist/sensor.h 2010-08-16 01:36:43 UTC (rev 512)
+++ gearbox/trunk/src/hokuyo_aist/sensor.h 2010-08-16 02:09:25 UTC (rev 513)
@@ -509,45 +509,43 @@
/// The clock skew alpha value.
float time_skew_alpha_;
- void clear_read_buffer_();
- int read_line_(char* buffer, int expected_length = -1);
- int read_line_with_check_(char* buffer, int expected_length = -1,
+ void clear_read_buffer();
+ int read_line(char* buffer, int expected_length = -1);
+ int read_line_with_check(char* buffer, int expected_length = -1,
bool has_semicolon = false);
- void skip_lines_(int count);
- int send_command_(char const* cmd, char const* param, int param_length,
+ void skip_lines(int count);
+ int send_command(char const* cmd, char const* param, int param_length,
char const* extra_ok);
- public:
- void enter_timing_mode_();
- void leave_timing_mode_();
+ void enter_timing_mode();
+ void leave_timing_mode();
/// Get the laser time in milliseconds.
- unsigned int get_timing_mode_time_(unsigned long long* reception_time=0);
+ unsigned int get_timing_mode_time(unsigned long long* reception_time=0);
/// Get the computer time in nanoseconds.
- unsigned long long get_computer_time_();
+ unsigned long long get_computer_time();
/// Adjust a wrapped laser timestamp, in milliseconds.
- unsigned int wrap_timestamp_(unsigned int timestamp);
+ unsigned int wrap_timestamp(unsigned int timestamp);
/// Offset a laser timestamp, in milliseconds, into computer time, in
/// nanoseconds.
- unsigned long long offset_timestamp_(unsigned int timestamp);
- private:
+ unsigned long long offset_timestamp(unsigned int timestamp);
/// Convert a step value into its time offset from the start of a scan,
/// in milliseconds.
- unsigned int step_to_time_offset_(int start_step);
+ unsigned int step_to_time_offset(int start_step);
- void find_model_(char const* buffer);
- void get_and_set_scip_version_();
- void get_defaults_();
- void process_vv_line_(char const* buffer, SensorInfo* info);
- void process_pp_line_(char const* buffer, SensorInfo* info);
- void process_ii_line_(char const* buffer, SensorInfo* info);
+ void find_model(char const* buffer);
+ void get_and_set_scip_version();
+ void get_defaults();
+ void process_vv_line(char const* buffer, SensorInfo* info);
+ void process_pp_line(char const* buffer, SensorInfo* info);
+ void process_ii_line(char const* buffer, SensorInfo* info);
- uint32_t process_echo_buffer_(int const* buffer, int num_echos);
- void read_2_byte_range_data_(ScanData& data, unsigned int num_steps);
- void read_3_byte_range_data_(ScanData& data, unsigned int num_steps);
- void read_3_byte_range_and_intensity_data_(ScanData& data,
+ uint32_t process_echo_buffer(int const* buffer, int num_echos);
+ void read_2_byte_range_data(ScanData& data, unsigned int num_steps);
+ void read_3_byte_range_data(ScanData& data, unsigned int num_steps);
+ void read_3_byte_range_and_intensity_data(ScanData& data,
unsigned int num_steps);
- int confirm_checksum_(char const* buffer, int length,
+ int confirm_checksum(char const* buffer, int length,
int expected_sum);
}; // class Sensor
Modified: gearbox/trunk/src/hokuyo_aist/sensor_info.cpp
===================================================================
--- gearbox/trunk/src/hokuyo_aist/sensor_info.cpp 2010-08-16 01:36:43 UTC (rev 512)
+++ gearbox/trunk/src/hokuyo_aist/sensor_info.cpp 2010-08-16 02:09:25 UTC (rev 513)
@@ -39,7 +39,7 @@
// Set various known values based on what the manual says
-void SensorInfo::set_defaults_()
+void SensorInfo::set_defaults()
{
switch(detected_model)
{
@@ -103,7 +103,7 @@
}
-void SensorInfo::calculate_values_()
+void SensorInfo::calculate_values()
{
resolution = DTOR(360.0) / steps;
// If any of the steps are beyond INT_MAX, we have problems.
Modified: gearbox/trunk/src/hokuyo_aist/sensor_info.h
===================================================================
--- gearbox/trunk/src/hokuyo_aist/sensor_info.h 2010-08-16 01:36:43 UTC (rev 512)
+++ gearbox/trunk/src/hokuyo_aist/sensor_info.h 2010-08-16 02:09:25 UTC (rev 513)
@@ -206,8 +206,8 @@
LaserModel detected_model;
private:
- void set_defaults_();
- void calculate_values_();
+ void set_defaults();
+ void calculate_values();
}; // class SensorInfo
}; // namespace hokuyo_aist
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|