Hey there,
For a project I want to inject some white noise into my controller. From my research there isn’t really a random number generator on the ODrive and I wanted to create one similar to the our_arm_cos_f32 function that I can call throughout the rest of the code. My implementation is quite simple:
#include <board.h>
#include <cstdlib>
float noise()
{
std::srand(static_cast<unsigned int>(std::time(nullptr)));
float rand_val = -1.0 + 2.0 * static_cast<double>(std::rand() / RAND_MAX);
return (rand_val);
}
And I just placed the function next to the cos ad sin function:
extern "C" {
float our_arm_sin_f32(float x);
float our_arm_cos_f32(float x);
float noise();
}
When I build this I receive an error undefined reference ‘noise’. Am I missing something? Why doesn’t this work?