omnilib.c File Reference
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <math.h>
#include "omnilib.h"
#include "realtime.h"
Go to the source code of this file.
| Defines | 
| #define | alpha   (0.3425 + 0.24) | 
| #define | alpha   (0.3425 + 0.24) | 
| #define | INT16   2 | 
| #define | INT8   0 | 
| #define | UINT16   3 | 
| #define | UINT8   1 | 
| Functions | 
| void | drive_status (char *drive, int index) | 
| void | jac_forward (double *in, double *out) | 
| void | jac_inverse (double *in, double *out) | 
| commstatus_t | omnidrive_commstatus () | 
| int | omnidrive_drive (double x, double y, double a) | 
| int | omnidrive_init (void) | 
| int | omnidrive_odometry (double *x, double *y, double *a) | 
| void | omnidrive_poweroff () | 
| void | omnidrive_poweron () | 
| void | omnidrive_recover () | 
| void | omnidrive_set_correction (double drift) | 
| int | omnidrive_shutdown (void) | 
| void | omnidrive_speedcontrol () | 
| void | omnidrive_status (char *drive0, char *drive1, char *drive2, char *drive3, int *estop) | 
| int | readSDO (int device, int objectNum) | 
| int | writeSDO (int device, int objectNum, int value, int type) | 
| Variables | 
| commstatus_t | commstatus | 
| int | drive_constant = 3663 | 
| uint32_t | last_odometry_position [4] = {0, 0, 0, 0} | 
| double | odometry [3] = {0, 0, 0} | 
| int | odometry_constant = 3998394 | 
| double | odometry_correction = 1.0 | 
| int | odometry_initialized = 0 | 
| int | status [4] | 
Define Documentation
      
        
          | #define alpha   (0.3425 + 0.24) | 
      
 
 
      
        
          | #define alpha   (0.3425 + 0.24) | 
      
 
 
Function Documentation
      
        
          | void drive_status | ( | char * | drive, | 
        
          |  |  | int | index |  | 
        
          |  | ) |  |  |  | 
      
 
 
      
        
          | void jac_forward | ( | double * | in, | 
        
          |  |  | double * | out |  | 
        
          |  | ) |  |  |  | 
      
 
Jacobians for a mecanum wheels based omnidirectional platform. The functions jac_forward and jac_inverse convert cartesian velocities into wheel velocities and vice versa. For our motors, the order and signs are changed. The matrix C accounts for this. 
Definition at line 106 of file omnilib.c.
 
 
      
        
          | void jac_inverse | ( | double * | in, | 
        
          |  |  | double * | out |  | 
        
          |  | ) |  |  |  | 
      
 
 
      
        
          | int omnidrive_drive | ( | double | x, | 
        
          |  |  | double | y, | 
        
          |  |  | double | a |  | 
        
          |  | ) |  |  |  | 
      
 
 
      
        
          | int omnidrive_init | ( | void |  | ) |  | 
      
 
 
      
        
          | int omnidrive_odometry | ( | double * | x, | 
        
          |  |  | double * | y, | 
        
          |  |  | double * | a |  | 
        
          |  | ) |  |  |  | 
      
 
 
      
        
          | void omnidrive_poweroff | ( |  | ) |  | 
      
 
 
      
        
          | void omnidrive_poweron | ( |  | ) |  | 
      
 
 
      
        
          | void omnidrive_recover | ( |  | ) |  | 
      
 
 
      
        
          | void omnidrive_set_correction | ( | double | drift | ) |  | 
      
 
 
      
        
          | int omnidrive_shutdown | ( | void |  | ) |  | 
      
 
 
      
        
          | void omnidrive_speedcontrol | ( |  | ) |  | 
      
 
 
      
        
          | void omnidrive_status | ( | char * | drive0, | 
        
          |  |  | char * | drive1, | 
        
          |  |  | char * | drive2, | 
        
          |  |  | char * | drive3, | 
        
          |  |  | int * | estop |  | 
        
          |  | ) |  |  |  | 
      
 
 
      
        
          | int readSDO | ( | int | device, | 
        
          |  |  | int | objectNum |  | 
        
          |  | ) |  |  |  | 
      
 
 
      
        
          | int writeSDO | ( | int | device, | 
        
          |  |  | int | objectNum, | 
        
          |  |  | int | value, | 
        
          |  |  | int | type |  | 
        
          |  | ) |  |  |  | 
      
 
 
Variable Documentation