EMBER 0.1
EMBER is a fire suppression system with a thermal IR camera for hot blob detection on a pan/tilt mechanism with a solenoid for commanded water flow.
Loading...
Searching...
No Matches
task_motorControl.cpp File Reference

Motor control task for pan and tilt. More...

#include "task_motorControl.h"
#include <Arduino.h>
#include "DRV8871Driver.h"
#include <ESP32Encoder.h>
#include "PrintStream.h"
#include "shares.h"
#include <Preferences.h>

Macros

#define MAXSPEED   220
#define DEADBAND   10
#define Kp1   7
#define Kd1   4
#define Kp2   7
#define Kd2   4

Functions

void task_motorControl (void *p_params)
 task which controls the pan and tilt motors

Detailed Description

Motor control task for pan and tilt.

Author
Jackson Cordova, GPT5-mini
Date
November 2025

Function Documentation

◆ task_motorControl()

void task_motorControl ( void * p_params)

task which controls the pan and tilt motors

This task reads the reference counts for pan and tilt from shares as well as checks if a fire is present. When no fire is present, the task uses a velocity control loop to sweep the pan motor back and forth between its limits (180 degrees left and right). When a fire is detected, the task switches to position control mode to move the pan and tilt motors to the desired reference positions denoted by the reference counts from the shares. The task uses proportional-derivative (PD) control for position control, and proportional-integral-derivative (PID) control for velocity control during scanning. The task has a period of 10 ms.

Parameters
p_paramsnot used and should be set to void in the xTaskCreate call