ld_alternate.c
Go to the documentation of this file.
1 #include "../csm/csm_all.h"
2 
3 int main(int argc, const char ** argv) {
4  sm_set_program_name(argv[0]);
5 
6  int every = 5;
7  int count = 0;
8  LDP ld;
9  while( (ld = ld_read_smart(stdin))) {
10  count++;
11 
12  if(!ld_valid_fields(ld)) {
13  sm_error("Invalid laser data (#%d in file)\n", count);
14  continue;
15  }
16 
17  int i;
18  for(i=0;i<ld->nrays;i++) {
19  if( (i % every) != 0 ) {
20  ld->valid[i] = 0;
21  ld->readings[i] = NAN;
22  }
23  }
24 
25  ld_write_as_json(ld, stdout);
26  ld_free(ld);
27 
28  count++;
29  }
30 
31  return 0;
32 }
int *restrict valid
Definition: laser_data.h:23
void sm_set_program_name(const char *name)
Definition: logging.c:21
#define NAN
Definition: math_utils.h:11
void ld_write_as_json(LDP ld, FILE *stream)
int ld_valid_fields(LDP ld)
Definition: laser_data.c:179
LDP ld_read_smart(FILE *)
void ld_free(LDP ld)
Definition: laser_data.c:87
double *restrict readings
Definition: laser_data.h:24
int main(int argc, const char **argv)
Definition: ld_alternate.c:3
void sm_error(const char *msg,...)
Definition: logging.c:49


csm
Author(s): Andrea Censi
autogenerated on Tue May 11 2021 02:18:23