Project

General

Profile

Revision 90

Commit missed the new files. Damn svn add.

View differences:

trunk/code/projects/slam/slam_analyzer.c
1
#include "slam_analyzer.h"
2
#include "slam_defs.h"
3
#include <stdio.h>
4
#include <stdlib.h>
5

  
6

  
7

  
8
void slam_analyze(RobotData* head){
9
  //The good stuff.
10

  
11
}
12

  
13

  
14

  
15
void slam_print_data(RobotData* head){
16
  if(head==NULL) printf("No data to display.\n");
17
  RobotData* iter = head;
18
  BomNode* bomIter;
19
  char i;
20
  while(iter!= NULL){
21
    bomIter = iter->bom_head;
22
    printf("Robot %x:\n",iter->id);
23
    for(i=0;i<5;i++)
24
      printf("\tSharp IR %i : %i\n\n",i,iter->IR[i]);
25
    if(BomIter == NULL){
26
        printf("No Bom Data to Display\n\n\n");
27
    }
28
    else{
29
      while(bomIter!=NULL){
30
        printf("\tBom reading for robot %x : %i",BomIter->id, BomIter->value);
31
        bomIter = bomIter->next;
32
      }
33
    }
34
  }
35
}
trunk/code/projects/slam/slam_defs.h
1
#define SLAM_PACKET_GROUP 11
2
#define CONTROL_PACKET_TYPE 'C'
3
#define REQUEST_PACKET_TYPE 'R'
4
#define ROBOT_RESPONSE 'I'
5

  
6
#define MAX_ROBOTS 50 
7

  
8
//Request Packet organization.
9
#define IR_1_LOC 0
10
#define IR_2_LOC 1
11
#define IR_3_LOC 2
12
#define IR_4_LOC 3
13
#define IR_5_LOC 4
14
#define BOM_START_LOC 5
15

  
16
typedef struct bom_node{
17
  char value;
18
  short int id;
19
  struct bom_node* next;
20
} BomNode;
21

  
22
typedef struct robot_data{
23
  short int id; 
24
  unsigned char IR[5]; 
25
  struct robot_data* next;
26
  struct bom_node* bom_head;
27
} RobotData;
28

  
29
RobotData* head_bot;
30
RobotData* current_bot;
trunk/code/projects/slam/slam_analyzer.h
1
#include <stdio.h>
2
#include <stdlib.h>
3
#include <slam_defs.h>
4

  
5
void slam_analyze(RobotData* head);
6
void slam_print_data(RobotData* head);

Also available in: Unified diff