18 #if defined(URG_WINDOWS_OS) 40 printf(
"URG simple data viewer\n" 45 " -h, --help display this help and exit\n" 46 " -i, intensity mode\n" 47 " -m, multiecho mode\n" 63 for (i = 1; i < argc; ++i) {
64 const char *token = argv[i];
66 if (!strcmp(token,
"-h") || !strcmp(token,
"--help")) {
69 }
else if (!strcmp(token,
"-e")) {
74 }
else if (!strcmp(token,
"-m")) {
76 }
else if (!strcmp(token,
"-i")) {
92 int data_n,
bool is_multiecho,
int offset)
96 const double radian_offset = M_PI / 2.0;
97 int step = (is_multiecho) ? 3 : 1;
102 for (i = 0; i < data_n; ++i) {
103 int index = (step * i) + offset;
104 long l = (data) ? data[index] : intensity[index];
109 if ((l <= min_distance) || (l >= max_distance)) {
122 long data[],
unsigned short intensity[],
int data_n,
157 int main(
int argc,
char *argv[])
162 unsigned short *intensity = NULL;
174 printf(
"urg_open: %s\n",
urg_error(&urg));
183 data = malloc(data_size *
sizeof(data[0]));
185 intensity = malloc(data_size *
sizeof(intensity[0]));
221 printf(
"urg_get_function: %s\n",
urg_error(&urg));
static void help_exit(const char *program_name)
int urg_start_measurement(urg_t *urg, urg_measurement_type_t type, int scan_times, int skip_scan)
static const char * serial_device
double urg_index2rad(const urg_t *urg, int index)
void urg_distance_min_max(const urg_t *urg, long *min_distance, long *max_distance)
bool plotter_initialize(int data_size)
void plotter_set_color(unsigned char r, unsigned g, unsigned b)
bool plotter_is_quit(void)
const char * urg_error(const urg_t *urg)
int main(int argc, char *argv[])
void urg_close(urg_t *urg)
urg_connection_type_t
ʐM^Cv
static const char * ethernet_address
static void plot_data(urg_t *urg, long data[], unsigned short intensity[], int data_n, bool is_multiecho)
int urg_get_multiecho(urg_t *urg, long data_multi[], long *time_stamp, unsigned long long *system_time_stamp)
urg_connection_type_t connection_type
int urg_get_distance_intensity(urg_t *urg, long data[], unsigned short intensity[], long *time_stamp, unsigned long long *system_time_stamp)
void plotter_plot(float x, float y)
void plotter_terminate(void)
int urg_get_distance(urg_t *urg, long data[], long *time_stamp, unsigned long long *system_time_stamp)
static void parse_args(scan_mode_t *mode, int argc, char *argv[])
int urg_get_multiecho_intensity(urg_t *urg, long data_multi[], unsigned short intensity_multi[], long *time_stamp, unsigned long long *system_time_stamp)
urg_measurement_type_t measurement_type
static void plot_data_point(urg_t *urg, long data[], unsigned short intensity[], int data_n, bool is_multiecho, int offset)
int urg_max_data_size(const urg_t *urg)
int urg_open(urg_t *urg, urg_connection_type_t connection_type, const char *device_or_address, long baudrate_or_port)