Minor changes
This commit is contained in:
@@ -28,10 +28,10 @@ void int_init(void){
|
|||||||
// PID controller implementatoin for the y-axis
|
// PID controller implementatoin for the y-axis
|
||||||
int16_t pixy_PID_Y(int16_t x, int16_t w)
|
int16_t pixy_PID_Y(int16_t x, int16_t w)
|
||||||
{
|
{
|
||||||
float e;
|
float e = 0;
|
||||||
static float esum;
|
static float esum = 0;
|
||||||
static float eold;
|
static float eold = 0;
|
||||||
float y;
|
float y = 0;
|
||||||
|
|
||||||
e = (float)(x - w); // calculate the controller offset
|
e = (float)(x - w); // calculate the controller offset
|
||||||
|
|
||||||
@@ -45,16 +45,16 @@ int16_t pixy_PID_Y(int16_t x, int16_t w)
|
|||||||
|
|
||||||
eold = e; // save the previous value
|
eold = e; // save the previous value
|
||||||
|
|
||||||
return (int16_t) y;
|
return (int16_t)y;
|
||||||
}
|
}
|
||||||
|
|
||||||
// PID controller implementation for the x-axis
|
// PID controller implementation for the x-axis
|
||||||
int16_t pixy_PID_X(int16_t x, int16_t w)
|
int16_t pixy_PID_X(int16_t x, int16_t w)
|
||||||
{
|
{
|
||||||
float e;
|
float e = 0;
|
||||||
static float esum;
|
static float esum = 0;
|
||||||
static float eold;
|
static float eold = 0;
|
||||||
float y;
|
float y = 0;
|
||||||
|
|
||||||
e = (float)(x - w); // calculate the controller offset
|
e = (float)(x - w); // calculate the controller offset
|
||||||
|
|
||||||
@@ -68,5 +68,5 @@ int16_t pixy_PID_X(int16_t x, int16_t w)
|
|||||||
|
|
||||||
eold = e; // save the previous value
|
eold = e; // save the previous value
|
||||||
|
|
||||||
return (int16_t) y;
|
return (int16_t)y;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,8 +91,8 @@ void tracking_our_start(void* tracking_config) {
|
|||||||
int return_value;
|
int return_value;
|
||||||
|
|
||||||
servo_x = servo_y = 500; // set a default value of 500
|
servo_x = servo_y = 500; // set a default value of 500
|
||||||
pixy_rcs_set_position(0, servo_x); //
|
pixy_rcs_set_position(0, servo_x); // set default
|
||||||
pixy_rcs_set_position(1, servo_y); //
|
pixy_rcs_set_position(1, servo_y); // set default
|
||||||
|
|
||||||
return_value = pixy_command("runprog", INT8(0), END_OUT_ARGS, &response, END_IN_ARGS);
|
return_value = pixy_command("runprog", INT8(0), END_OUT_ARGS, &response, END_IN_ARGS);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user