#include "urg_c/urg_utils.h"
#include "urg_c/urg_errno.h"
#include <math.h>
Go to the source code of this file.
|
static int | max (int a, int b) |
|
static int | min (int a, int b) |
|
int | urg_deg2index (const urg_t *urg, double degree) |
|
int | urg_deg2step (const urg_t *urg, double degree) |
|
void | urg_distance_min_max (const urg_t *urg, long *min_distance, long *max_distance) |
|
const char * | urg_error (const urg_t *urg) |
|
double | urg_index2deg (const urg_t *urg, int index) |
|
double | urg_index2rad (const urg_t *urg, int index) |
|
int | urg_max_data_size (const urg_t *urg) |
|
int | urg_rad2index (const urg_t *urg, double radian) |
|
int | urg_rad2step (const urg_t *urg, double radian) |
|
long | urg_scan_usec (const urg_t *urg) |
|
double | urg_step2deg (const urg_t *urg, int step) |
|
int | urg_step2index (const urg_t *urg, int step) |
|
double | urg_step2rad (const urg_t *urg, int step) |
|
void | urg_step_min_max (const urg_t *urg, int *min_index, int *max_index) |
|
#define _USE_MATH_DEFINES |
URG センサ用の補助関数
- Author
- Satofumi KAMIMURA
- Id
- urg_utils.c,v da778fd816c2 2011/01/05 20:02:06 Satofumi
Definition at line 11 of file urg_utils.c.
static int max |
( |
int |
a, |
|
|
int |
b |
|
) |
| |
|
static |
static int min |
( |
int |
a, |
|
|
int |
b |
|
) |
| |
|
static |
int urg_deg2index |
( |
const urg_t * |
urg, |
|
|
double |
degree |
|
) |
| |
int urg_deg2step |
( |
const urg_t * |
urg, |
|
|
double |
degree |
|
) |
| |
void urg_distance_min_max |
( |
const urg_t * |
urg, |
|
|
long * |
min_distance, |
|
|
long * |
max_distance |
|
) |
| |
Example
1 long min_distance, max_distance;
2 urg_distance_min_max(&urg, &min_distance, &max_distance);
4 for (int i = 0; i < n; ++i) {
5 long distance = data[i];
6 if ((distance < min_distance) || (distance > max_distance)) {
Definition at line 73 of file urg_utils.c.
const char* urg_error |
( |
const urg_t * |
urg | ) |
|
Example
1 if (!urg_open(&urg, "/dev/ttyACM0", 115200, URG_SERIAL)) {
2 printf("urg_open: %s\n", urg_error(&urg));
Definition at line 30 of file urg_utils.c.
double urg_index2deg |
( |
const urg_t * |
urg, |
|
|
int |
index |
|
) |
| |
double urg_index2rad |
( |
const urg_t * |
urg, |
|
|
int |
index |
|
) |
| |
Example
1 int n = urg_get_distance(&urg, data, NULL);
2 for (int i = 0; i < n; ++i) {
3 long distance = data[i];
4 double radian = urg_index2rad(i);
5 double x = distance * cos(radian);
6 double y = distance * sin(radian);
7 printf("%.1f, %.1f\n", x, y);
- See also
- urg_index2deg(), urg_rad2index(), urg_deg2index()
Definition at line 123 of file urg_utils.c.
int urg_max_data_size |
( |
const urg_t * |
urg | ) |
|
int urg_rad2index |
( |
const urg_t * |
urg, |
|
|
double |
radian |
|
) |
| |
int urg_rad2step |
( |
const urg_t * |
urg, |
|
|
double |
radian |
|
) |
| |
long urg_scan_usec |
( |
const urg_t * |
urg | ) |
|
double urg_step2deg |
( |
const urg_t * |
urg, |
|
|
int |
step |
|
) |
| |
int urg_step2index |
( |
const urg_t * |
urg, |
|
|
int |
step |
|
) |
| |
double urg_step2rad |
( |
const urg_t * |
urg, |
|
|
int |
step |
|
) |
| |
void urg_step_min_max |
( |
const urg_t * |
urg, |
|
|
int * |
min_step, |
|
|
int * |
max_step |
|
) |
| |