convert_xy.c
Go to the documentation of this file.
1 #include "urg_sensor.h"
2 #include "urg_utils.h"
3 #include <stdio.h>
4 #include <math.h>
5
6 int main(void)
7 {
8 urg_t urg;
9 long *length_data = NULL;
10 int length_data_size;
11 int i;
12 // 距離データを X-Y 座標系に変換して表示する length_data_size = urg_get_distance(&urg, length_data, NULL); for (i = 0; i < length_data_size; ++i) { // その距離データのラジアン角度を求め、X, Y の座標値を計算する double radian; long length; long x; long y; radian = urg_index2rad(&urg, i); length = length_data[i]; // \todo check length is valid x = (long)(length * cos(radian)); y = (long)(length * sin(radian)); printf("(%ld, %ld), ", x, y); } printf("\n"); return 0; }
13
14 length_data_size = urg_get_distance(&urg, length_data, NULL);
15 for (i = 0; i < length_data_size; ++i) {
16  // その距離データのラジアン角度を求め、X, Y の座標値を計算する double radian; long length; long x; long y; radian = urg_index2rad(&urg, i); length = length_data[i]; // \todo check length is valid x = (long)(length * cos(radian)); y = (long)(length * sin(radian)); printf("(%ld, %ld), ", x, y); } printf("\n"); return 0; }
18  long length;
19  long x;
20  long y;
21
23  length = length_data[i];
24  // \todo check length is valid
25
26  x = (long)(length * cos(radian));
27  y = (long)(length * sin(radian));
28  printf("(%ld, %ld), ", x, y);
29 }
30 printf("\n");
31 return 0;
32 }
URG sensor.
Definition: urg_sensor.h:72
double urg_index2rad(const urg_t *urg, int index)
Definition: urg_utils.c:123
URG sensor.
int main(void)
Definition: convert_xy.c:6
int urg_get_distance(urg_t *urg, long data[], long *time_stamp, unsigned long long *system_time_stamp)
Definition: urg_sensor.c:934
URG sensor utility.

urg_c
Author(s): Satofumi Kamimura , Katsumi Kimoto, Adrian Boeing
autogenerated on Thu Jun 6 2019 19:27:49