35 typedef unsigned char uint8_t;
36 typedef unsigned int uint32_t;
37 #if defined(HOKUYOAIST_STATIC)
38 #define HOKUYOAIST_EXPORT
39 #elif defined(hokuyoaist_EXPORTS)
40 #define HOKUYOAIST_EXPORT __declspec(dllexport)
42 #define HOKUYOAIST_EXPORT __declspec(dllimport)
46 #define HOKUYOAIST_EXPORT
138 void open(std::string port_options);
219 unsigned int samples=10);
226 { time_offset_ = time_offset; }
245 { time_drift_rate_ = drift_rate; }
286 int end_step = -1,
unsigned int cluster_count = 1);
303 double end_angle,
unsigned int cluster_count = 1);
328 int start_step = -1,
int end_step = -1,
329 unsigned int cluster_count = 1);
346 double start_angle,
double end_angle,
347 unsigned int cluster_count = 1);
376 int end_step = -1,
unsigned int cluster_count = 1);
393 double start_angle,
double end_angle,
394 unsigned int cluster_count = 1);
422 int start_step = -1,
int end_step = -1,
423 unsigned int cluster_count = 1);
440 double start_angle,
double end_angle,
441 unsigned int cluster_count = 1);
464 flexiport::Port* port_;
465 std::ostream& err_output_;
467 uint8_t scip_version_;
469 bool verbose_, enable_checksum_workaround_,
472 double min_angle_, max_angle_, resolution_;
473 int first_step_, last_step_, front_step_;
474 unsigned int max_range_;
476 unsigned int time_resolution_;
479 long long time_offset_;
482 unsigned int last_timestamp_;
484 unsigned int wrap_count_;
486 float time_drift_rate_;
488 float time_skew_alpha_;
490 void clear_read_buffer();
491 int read_line(
char* buffer,
int expected_length=-1);
492 int read_line_with_check(
char* buffer,
int expected_length=-1,
493 bool has_semicolon=
false);
494 bool read_data_block(
char* buffer,
int& block_size);
495 void skip_lines(
int count);
496 int send_command(
char const* cmd,
char const* param,
int param_length,
497 char const* extra_ok);
499 void enter_timing_mode();
500 void leave_timing_mode();
502 unsigned int get_timing_mode_time(
unsigned long long* reception_time=0);
504 unsigned long long get_computer_time();
506 unsigned int wrap_timestamp(
unsigned int timestamp);
509 unsigned long long offset_timestamp(
unsigned int timestamp);
512 unsigned int step_to_time_offset(
int start_step);
514 void find_model(
char const* buffer);
515 void get_and_set_scip_version();
517 void process_vv_line(
char const* buffer,
SensorInfo& info);
518 void process_pp_line(
char const* buffer,
SensorInfo& info);
519 void process_ii_line(
char const* buffer,
SensorInfo& info);
521 uint32_t process_echo_buffer(
int const* buffer,
int num_echos);
522 void read_2_byte_range_data(
ScanData& data,
unsigned int num_steps);
523 void read_3_byte_range_data(
ScanData& data,
unsigned int num_steps);
524 void read_3_byte_range_and_intensity_data(
ScanData& data,
525 unsigned int num_steps);
527 int confirm_checksum(
char const* buffer,
int length,
Structure to store data returned from the laser scanner.
Hokuyo laser scanner class.
void set_verbose(bool verbose)
Turns on and off printing of verbose operating information to stderr.
void set_time_offset(long long time_offset)
Set the time offset (if the calculated value is bad).
void open(std::string port_options)
Open the laser scanner and begin scanning.
void set_high_sensitivity(bool on)
Switch the scanner between normal and high sensitivity modes.
void close()
Close the connection to the laser scanner.
void set_motor_speed(unsigned int speed)
Set the speed at which the scanner's sensor spins.
unsigned int get_ranges_intensities(ScanData &data, int start_step=-1, int end_step=-1, unsigned int cluster_count=1)
Get the latest scan data from the scanner with intensities.
long long calibrate_time(unsigned int skew_sleep_time=0, unsigned int samples=10)
Calibrate the time offset between the laser and computer.
void set_ip(IPAddr const &addr, IPAddr const &subnet, IPAddr const &gateway)
Change the IP address information.
void reset()
Reset the laser scanner to its default settings.
void set_multiecho_mode(MultiechoMode mode)
Set the multi-echo mode to use.
void set_skew_alpha(float alpha)
Set a skew line slope value.
void set_power(bool on)
Switch the laser scanner on or off.
void get_sensor_info(SensorInfo &info)
Get various information about the scanner.
unsigned int get_new_ranges_by_angle(ScanData &data, double start_angle, double end_angle, unsigned int cluster_count=1)
Get a new scan from the scanner.
unsigned int get_new_ranges_intensities_by_angle(ScanData &data, double start_angle, double end_angle, unsigned int cluster_count=1)
Get a new scan from the scanner with intensity data.
void set_drift_rate(float drift_rate)
Set the current clock drift rate.
unsigned int get_raw_time()
Get the raw value of the scanner's clock in milliseconds.
unsigned long long get_time()
Get the value of the scanner's clock in milliseconds.
unsigned int get_ranges(ScanData &data, int start_step=-1, int end_step=-1, unsigned int cluster_count=1)
Get the latest scan data from the scanner.
unsigned int get_new_ranges(ScanData &data, int start_step=-1, int end_step=-1, unsigned int cluster_count=1)
Get a new scan from the scanner.
float skew_alpha() const
Get the calculated skew line slope (default: 0).
unsigned int get_ranges_by_angle(ScanData &data, double start_angle, double end_angle, unsigned int cluster_count=1)
Get the latest scan data from the scanner.
void ignore_unknowns(bool ignore)
Enables/disables ignoring unknown lines in sensor info messages.
bool is_open() const
Checks if the connection to the laser scanner is open.
long long time_offset() const
Retrieve the calculated time offset (0 if not calibrated).
float drift_rate() const
Retrieve the current clock drift rate (0 if not set).
void semi_reset()
Reset everything except motor and serial speed.
double step_to_angle(unsigned int step)
A convenience function to convert a step index to an angle.
unsigned int get_ranges_intensities_by_angle(ScanData &data, double start_angle, double end_angle, unsigned int cluster_count=1)
Get the latest scan data from the scanner with intensities.
unsigned int angle_to_step(double angle)
A convenience function to convert an angle to a step (rounded towards the front).
Sensor(std::ostream &err_output)
unsigned int get_new_ranges_intensities(ScanData &data, int start_step=-1, int end_step=-1, unsigned int cluster_count=1)
Get a new scan from the scanner with intensity data.
uint8_t scip_version() const
Return the major version of the SCIP protocol in use.
#define HOKUYOAIST_EXPORT
MultiechoMode
Possible values of the multiecho mode setting.
struct hokuyoaist::IPAddr IPAddr
Structure to store an IP address.
HOKUYOAIST_EXPORT char const * multiecho_mode_to_string(MultiechoMode mode)
Structure to store an IP address.
unsigned int fourth
Fourth byte.
unsigned int third
Third byte.
unsigned int second
Second byte.
unsigned int first
First byte.