CodeUC HRI2 v2.0 Microcontroller firmware of the board used during the HRI labs.

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

Functions | Variables
controller.c File Reference
`#include "controller.h"`
`#include "communication.h"`
`#include "drivers/adc.h"`
`#include "drivers/dac.h"`
`#include "drivers/debug_gpio.h"`
`#include "drivers/incr_encoder.h"`
`#include "drivers/hall.h"`
`#include "drivers/h_bridge.h"`
`#include "drivers/callback_timers.h"`
`#include "lib/basic_filter.h"`
`#include "lib/pid.h"`
`#include "lib/utils.h"`

## Functions
void | ctrl_RegulateCurrent ()
| Current regulation "loop" function. More...
void | ctrl_RegulatePosition ()
| Position regulation "loop" function. More...
void | ctrl_Init (void)
| Initialize the position and current controllers. More...
void | ctrl_StartCurrentLoop (void)
| Start the current regulation. More...

## Variables
uint32_t | statusReg
volatile uint32_t | ctrl_timestamp
volatile float32_t | ctrl_hallVoltage
volatile float32_t | ctrl_motorPosCod
volatile float32_t | ctrl_motorTorque_Nm_c
volatile pid_Pid | ctrl_currentPid
bool | ctrl_regulateCurrent

## Function Documentation

void ctrl_RegulateCurrent | ( | void |  | ) |

Current regulation "loop" function.

void ctrl_RegulatePosition | ( |  | ) |

Position regulation "loop" function.

Note
  As an example, a basic position regulator that uses the encoder is implemented. Feel free to remove all the content of the function to add your own code.

## Variable Documentation

volatile pid_Pid ctrl_currentPid

volatile float32_t ctrl_hallVoltage

volatile float32_t ctrl_motorPosCod

volatile float32_t ctrl_motorTorque_Nm_c

bool ctrl_regulateCurrent

volatile uint32_t ctrl_timestamp

uint32_t statusReg