DCAITI Robot Hardware  1.0
Macros | Typedefs | Enumerations
constants.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define NUM_MOTORS   2
 all constants and custom data types More...
 
#define M1_EN_PIN   10
 
#define M1_DIR_PIN   11
 
#define M2_EN_PIN   9
 
#define M2_DIR_PIN   8
 
#define SPEED_THRESHOLD   8
 
#define ENC_1_A   6
 
#define ENC_1_B   7
 
#define ENC_2_A   5
 
#define ENC_2_B   4
 
#define COUNT_PER_ROTATION   3533
 
#define CHAIN_LENGTH_M   0.741
 
#define VEL_UPDATE_RATE_MS   20
 
#define MAX_SPEED   0.6
 
#define KP_1   10
 
#define KD_1   0.0
 
#define KI_1   0.0
 
#define KP_2   10
 
#define KD_2   0.0
 
#define KI_2   0.0
 
#define VEL2TORQUE_RATIO   1.0
 
#define P_GAIN   1.0
 
#define PRINT_RATE_MS   500
 
#define UART_BAUD_RATE   57600
 
#define MAX_PACKET_LENGTH   50
 
#define PACKAGE_LENGTH_NO_P   10
 
#define RX_328_PIN   6
 
#define TX_328_PIN   7
 
#define UART_TRANSMIT_MS   10
 
#define PACKAGE_PAUSE_MS   10
 
#define START_BYTE_POS   0
 
#define FRAME_TYPE_POS   1
 
#define PAYLOAD_LENGTH_POS   2
 
#define COMPONENT_POS   3
 
#define TIMESTAMP_POS   4
 
#define COMMAND_POS   8
 
#define PAYLOAD_POS   8
 
#define FRAME_TYPE_STARTBIT   7
 
#define FRAME_TYPE_ENDBIT   5
 
#define COMPONENT_STARTBIT   7
 
#define COMPONENT_ENDBIT   4
 
#define START_BYTE   0xAA
 
#define REQUEST_DRIVE_MOTOR   0x01
 
#define REQUEST_RESET_TIMESTAMP   0x02
 
#define FT_VALUE_BV   0
 
#define FT_REQUEST_BV   32
 
#define FT_RESPONSE_BV   64
 
#define CP_DEFAULT_BV   0
 
#define CP_LEFT_M_BV   16
 
#define CP_RIGHT_M_BV   32
 
#define CP_ALL_M_BV   48
 
#define LAST(k, n)   ((k) & ((1<<(n))-1))
 
#define MID(k, m, n)   LAST((k)>>(m),((n)-(m)))
 

Typedefs

typedef enum frametypes U_FrameType
 
typedef enum components U_Component
 
typedef enum requests U_Request
 

Enumerations

enum  frametypes { VALUE , REQUEST , RESPONSE }
 
enum  components { DEFAULT_COMPONENT , LEFT_MOTOR , RIGHT_MOTOR , ALL_MOTORS }
 
enum  requests {
  DEFAULT_REQUEST , DRIVE_MOTOR , RESET_TIMESTAMP , DRIVE_ENCODER ,
  PID_PARAMETER
}
 

Macro Definition Documentation

◆ CHAIN_LENGTH_M

#define CHAIN_LENGTH_M   0.741

◆ COMMAND_POS

#define COMMAND_POS   8

◆ COMPONENT_ENDBIT

#define COMPONENT_ENDBIT   4

◆ COMPONENT_POS

#define COMPONENT_POS   3

◆ COMPONENT_STARTBIT

#define COMPONENT_STARTBIT   7

◆ COUNT_PER_ROTATION

#define COUNT_PER_ROTATION   3533

◆ CP_ALL_M_BV

#define CP_ALL_M_BV   48

◆ CP_DEFAULT_BV

#define CP_DEFAULT_BV   0

◆ CP_LEFT_M_BV

#define CP_LEFT_M_BV   16

◆ CP_RIGHT_M_BV

#define CP_RIGHT_M_BV   32

◆ ENC_1_A

#define ENC_1_A   6

◆ ENC_1_B

#define ENC_1_B   7

◆ ENC_2_A

#define ENC_2_A   5

◆ ENC_2_B

#define ENC_2_B   4

◆ FRAME_TYPE_ENDBIT

#define FRAME_TYPE_ENDBIT   5

◆ FRAME_TYPE_POS

#define FRAME_TYPE_POS   1

◆ FRAME_TYPE_STARTBIT

#define FRAME_TYPE_STARTBIT   7

◆ FT_REQUEST_BV

#define FT_REQUEST_BV   32

◆ FT_RESPONSE_BV

#define FT_RESPONSE_BV   64

◆ FT_VALUE_BV

#define FT_VALUE_BV   0

◆ KD_1

#define KD_1   0.0

◆ KD_2

#define KD_2   0.0

◆ KI_1

#define KI_1   0.0

◆ KI_2

#define KI_2   0.0

◆ KP_1

#define KP_1   10

◆ KP_2

#define KP_2   10

◆ LAST

#define LAST (   k,
 
)    ((k) & ((1<<(n))-1))

◆ M1_DIR_PIN

#define M1_DIR_PIN   11

◆ M1_EN_PIN

#define M1_EN_PIN   10

◆ M2_DIR_PIN

#define M2_DIR_PIN   8

◆ M2_EN_PIN

#define M2_EN_PIN   9

◆ MAX_PACKET_LENGTH

#define MAX_PACKET_LENGTH   50

◆ MAX_SPEED

#define MAX_SPEED   0.6

◆ MID

#define MID (   k,
  m,
 
)    LAST((k)>>(m),((n)-(m)))

◆ NUM_MOTORS

#define NUM_MOTORS   2

all constants and custom data types

◆ P_GAIN

#define P_GAIN   1.0

◆ PACKAGE_LENGTH_NO_P

#define PACKAGE_LENGTH_NO_P   10

◆ PACKAGE_PAUSE_MS

#define PACKAGE_PAUSE_MS   10

◆ PAYLOAD_LENGTH_POS

#define PAYLOAD_LENGTH_POS   2

◆ PAYLOAD_POS

#define PAYLOAD_POS   8

◆ PRINT_RATE_MS

#define PRINT_RATE_MS   500

◆ REQUEST_DRIVE_MOTOR

#define REQUEST_DRIVE_MOTOR   0x01

◆ REQUEST_RESET_TIMESTAMP

#define REQUEST_RESET_TIMESTAMP   0x02

◆ RX_328_PIN

#define RX_328_PIN   6

◆ SPEED_THRESHOLD

#define SPEED_THRESHOLD   8

◆ START_BYTE

#define START_BYTE   0xAA

◆ START_BYTE_POS

#define START_BYTE_POS   0

◆ TIMESTAMP_POS

#define TIMESTAMP_POS   4

◆ TX_328_PIN

#define TX_328_PIN   7

◆ UART_BAUD_RATE

#define UART_BAUD_RATE   57600

◆ UART_TRANSMIT_MS

#define UART_TRANSMIT_MS   10

◆ VEL2TORQUE_RATIO

#define VEL2TORQUE_RATIO   1.0

◆ VEL_UPDATE_RATE_MS

#define VEL_UPDATE_RATE_MS   20

Typedef Documentation

◆ U_Component

typedef enum components U_Component

◆ U_FrameType

typedef enum frametypes U_FrameType

◆ U_Request

typedef enum requests U_Request

Enumeration Type Documentation

◆ components

enum components
Enumerator
DEFAULT_COMPONENT 
LEFT_MOTOR 
RIGHT_MOTOR 
ALL_MOTORS 

◆ frametypes

enum frametypes
Enumerator
VALUE 
REQUEST 
RESPONSE 

◆ requests

enum requests
Enumerator
DEFAULT_REQUEST 
DRIVE_MOTOR 
RESET_TIMESTAMP 
DRIVE_ENCODER 
PID_PARAMETER