COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
rw_test_v0.cpp File Reference
#include "rw_lib.h"
#include "cssl_lib.cpp"
#include <stdio.h>
#include <unistd.h>
Include dependency graph for rw_test_v0.cpp:

Functions

void setup ()
 
int loop ()
 
int main (int argc, char *argv[])
 

Variables

int count
 
int i
 
FILE * fp
 
char cmds [15][50]
 
char buf [128]
 

Function Documentation

void setup ( )
51  {
52 
53 i = rw_connect("/dev/ttyUSB4");
54 if(i != 0) {
55  printf("Could not connect to reaction wheel.");
56  printf("\n");
57  exit(1);
58 }
59 
60 strcpy(cmds[0], "$IMU,GET,ALL*34A");
61 strcpy(cmds[1], "$IMU,GET,YAW*362");
62 
63 strcpy(cmds[2], "$IMU,STREAM,START*4EB");
64 strcpy(cmds[3], "$IMU,STREAM,STOP*4A3");
65 strcpy(cmds[4], "$IMU,GET,ALL*34A");
66 strcpy(cmds[5], "$IMU,GET,YAW*362");
67 strcpy(cmds[6], "$IMU,STREAM,START*4EB");
68 strcpy(cmds[7], "$SET,RW,SPD,-17.0*441");
69 strcpy(cmds[8], "$SET,RW,SPD,-17.0*441");
70 strcpy(cmds[9], "$SET,RW,ACC,10.0*3ED");
71 strcpy(cmds[10], "$SET,RW,ACC,10.0*3ED");
72 strcpy(cmds[11], "$SET,RW,SPD,0.0*3DC");
73 strcpy(cmds[12], "$SET,RW,SPD,-17.0*441");
74 strcpy(cmds[13], "$SET,RW,SPD,-17.0*441");
75 strcpy(cmds[14], "$SET,RW,ACC,10.0*3ED");
76 strcpy(cmds[15], "$IMU,STREAM,START*4EB");
77 strcpy(cmds[16], "$SET,RW,ACC,10.0*3ED");
78 strcpy(cmds[17], "$SET,RW,ACC,10.0*3ED");
79 strcpy(cmds[18], "$SET,RW,SPD,0.0*3DC");
80 strcpy(cmds[19], "$SET,RW,SPD,-17.0*441");
81 strcpy(cmds[20], "$SET,RW,SPD,-17.0*441");
82 strcpy(cmds[21], "$SET,RW,ACC,10.0*3ED");
83 strcpy(cmds[22], "$SET,RW,ACC,10.0*3ED");
84 strcpy(cmds[23], "$SET,RW,ACC,10.0*3ED");
85 strcpy(cmds[24], "$SET,RW,ACC,10.0*3ED");
86 strcpy(cmds[25], "$SET,RW,ACC,10,SPD,16*535");
87 strcpy(cmds[26], "$SET,RW,ACC,-10,SPD,0*52B");
88 strcpy(cmds[27], "$SET,RW,SPD,0.0*3DC");
89 strcpy(cmds[28], "$IMU,STREAM,START*4EB");
90 strcpy(cmds[29], "$SET,RW,ACC,10.0*3ED");
91 strcpy(cmds[30], "$SET,RW,ACC,10.0*3ED");
92 strcpy(cmds[31], "$SET,RW,SPD,0.0*3DC");
93 strcpy(cmds[32], "$IMU,STREAM,STOP*4A3");
94 }
char cmds[15][50]
Definition: rw_test_v0.cpp:38
int i
Definition: rw_test_v0.cpp:36
int loop ( )
96  {
97  while(count < 33) {
98  for(int i = 0; i < 128; i++) {
99  buf[i] = '\0';
100  }
101  rw_send(cmds[count], 1);
102  rw_getdata(buf, 128);
103  printf("Command: ");
104  printf(cmds[count]);
105  printf("\n");
106  printf("Output: ");
107  printf(buf);
108  count++;
109  }
110  return(0);
111 }
char cmds[15][50]
Definition: rw_test_v0.cpp:38
int count
Definition: rw_test_v0.cpp:35
char buf[128]
Definition: rw_test_v0.cpp:39
int i
Definition: rw_test_v0.cpp:36
int main ( int  argc,
char *  argv[] 
)
44  {
45  //fp = fopen("output.txt", "a+");
46  setup();
47  loop();
48  return 0;
49 }
int loop()
Definition: rw_test_v0.cpp:96
void setup()
Definition: rw_test_v0.cpp:51

Variable Documentation

int count
int i
FILE* fp
char cmds[15][50]
char buf[128]