This process has a single task :

  1. Given a set of coordinates in Shmem from Plan Daemon, adjust the speed and steering to get to that coordinate/path.

The Control Daemon uses PID to calculate the accumulative error and apply the optimal factor to the actuation.

(IMPORTANT) Notice :

Plan of attack

  1. Read shmem for new desired X {-1,1}.

  2. Push to PID for new value

  3. Throttle/brake is a sigmoid activation function (test-speed!).

$f\left(x\right)\:=1-fabs(\:\left(\frac{1}{1+e^{-sx}}-.5\right)\cdot 2)$

#include <math.h>
/**
 * @brief apply sigmoid activation on @p x with curvature defined with @p sense
 * @param x input
 * @param sense the avg gradient of sigmoid function (factor of x)
 * @result A function that follow a sigmoid function
 * @note LaTeX : `f\\left(x\\right)\\:=\\:\\left(\\frac{1}{1+e^{-sx}}-.5\\right)\\cdot 2`
*/
float sigmoid_acvitvation(float x, float sense) {
	float e = 2.71828; /* Eulers Number */
	float denom = 1 + powf(e, (sense * x) * -1); /* Defined in `math.h` stdlib */
	return ((1/denom) - 0.5) * 2;
}

/* Proto func */
int steer_algo {
	float steer = read_from_shmem; // Proto 
	float throttle = 1 - fabs(sigmoid_activation(steer, 4.0f));
  write_to_shmem(steer, throttle); // Proto
}