29 #ifndef INCLUDE_HOKUYOAIST_SENSOR_H__ 30 #define INCLUDE_HOKUYOAIST_SENSOR_H__ 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 131 explicit Sensor(std::ostream& err_output);
135 void open(std::string port_options);
141 bool is_open()
const;
144 void set_power(
bool on);
171 void set_motor_speed(
unsigned int speed);
175 void set_high_sensitivity(
bool on);
181 unsigned long long get_time();
184 unsigned int get_raw_time();
214 long long calibrate_time(
unsigned int skew_sleep_time=0,
unsigned int samples=10);
225 time_offset_ = time_offset;
230 return time_drift_rate_;
249 time_drift_rate_ = drift_rate;
255 return time_skew_alpha_;
271 time_skew_alpha_ = alpha;
296 unsigned int get_ranges(
300 unsigned int cluster_count = 1);
316 unsigned int get_ranges_by_angle(
320 unsigned int cluster_count = 1);
344 unsigned int get_ranges_intensities(
348 unsigned int cluster_count = 1);
364 unsigned int get_ranges_intensities_by_angle(
368 unsigned int cluster_count = 1);
396 unsigned int get_new_ranges(
400 unsigned int cluster_count = 1);
416 unsigned int get_new_ranges_by_angle(
420 unsigned int cluster_count = 1);
447 unsigned int get_new_ranges_intensities(
451 unsigned int cluster_count = 1);
467 unsigned int get_new_ranges_intensities_by_angle(
471 unsigned int cluster_count = 1);
488 double step_to_angle(
unsigned int step);
491 unsigned int angle_to_step(
double angle);
494 flexiport::Port* port_;
495 std::ostream& err_output_;
497 uint8_t scip_version_;
499 bool verbose_, enable_checksum_workaround_, ignore_unknowns_;
501 double min_angle_, max_angle_, resolution_;
502 int first_step_, last_step_, front_step_;
503 unsigned int max_range_;
505 unsigned int time_resolution_;
508 long long time_offset_;
511 unsigned int last_timestamp_;
513 unsigned int wrap_count_;
515 float time_drift_rate_;
517 float time_skew_alpha_;
519 void clear_read_buffer();
520 int read_line(
char* buffer,
int expected_length=-1);
521 int read_line_with_check(
char* buffer,
int expected_length=-1,
bool has_semicolon=
false);
522 bool read_data_block(
char* buffer,
int& block_size);
523 void skip_lines(
int count);
524 int send_command(
char const* cmd,
char const* param,
int param_length,
char const* extra_ok);
526 void enter_timing_mode();
527 void leave_timing_mode();
529 unsigned int get_timing_mode_time(
unsigned long long* reception_time=0);
531 unsigned long long get_computer_time();
533 unsigned int wrap_timestamp(
unsigned int timestamp);
536 unsigned long long offset_timestamp(
unsigned int timestamp);
539 unsigned int step_to_time_offset(
int start_step);
541 void find_model(
char const* buffer);
542 void get_and_set_scip_version();
544 void process_vv_line(
char const* buffer,
SensorInfo& info);
545 void process_pp_line(
char const* buffer,
SensorInfo& info);
546 void process_ii_line(
char const* buffer,
SensorInfo& info);
548 uint32_t process_echo_buffer(
int const* buffer,
int num_echos);
549 void read_2_byte_range_data(
ScanData& data,
unsigned int num_steps);
550 void read_3_byte_range_data(
ScanData& data,
unsigned int num_steps);
551 void read_3_byte_range_and_intensity_data(
ScanData& data,
unsigned int num_steps);
553 int confirm_checksum(
char const* buffer,
int length,
int expected_sum);
560 #endif // INCLUDE_HOKUYOAIST_SENSOR_H__ void set_multiecho_mode(MultiechoMode mode)
Set the multi-echo mode to use.
Structure to store an IP address.
uint8_t scip_version() const
Return the major version of the SCIP protocol in use.
void set_skew_alpha(float alpha)
Set a skew line slope value.
unsigned int second
Second byte.
float drift_rate() const
Retrieve the current clock drift rate (0 if not set).
struct hokuyoaist::IPAddr IPAddr
Structure to store an IP address.
Structure to store data returned from the laser scanner.
unsigned int fourth
Fourth byte.
HOKUYOAIST_EXPORT char const * multiecho_mode_to_string(MultiechoMode mode)
void set_drift_rate(float drift_rate)
Set the current clock drift rate.
void set_time_offset(long long time_offset)
Set the time offset (if the calculated value is bad).
Hokuyo laser scanner class.
long long time_offset() const
Retrieve the calculated time offset (0 if not calibrated).
#define HOKUYOAIST_EXPORT
unsigned int third
Third byte.
void ignore_unknowns(bool ignore)
Enables/disables ignoring unknown lines in sensor info messages.
void set_verbose(bool verbose)
Turns on and off printing of verbose operating information to stderr.
float skew_alpha() const
Get the calculated skew line slope (default: 0).
MultiechoMode
Possible values of the multiecho mode setting.
unsigned int first
First byte.