I am trying to write some flag tracking code in VCS. Right now I’m just trying to figure out how to get values for the position of an object in the sensor’s field of view from the vision sensor in real time. Here is my code. What am I doing wrong?
Here is the robot-config.h
vex::brain Brain;
vex::vision::signature RED_FLAGL (1, 8977, 10189, 9583, -1867, -1037, -1452, 3.700000047683716, 0);
vex::vision::signature BLUE_FLAGL (2, -4445, -3827, -4136, 8403, 9909, 9156, 6.400000095367432, 0);
vex::vision::signature SIG_3 (3, 0, 0, 0, 0, 0, 0, 3, 0);
vex::vision::signature SIG_4 (4, 0, 0, 0, 0, 0, 0, 3, 0);
vex::vision::signature SIG_5 (5, 0, 0, 0, 0, 0, 0, 3, 0);
vex::vision::signature SIG_6 (6, 0, 0, 0, 0, 0, 0, 3, 0);
vex::vision::signature SIG_7 (7, 0, 0, 0, 0, 0, 0, 3, 0);
vex::vision flagFinderL (vex::PORT9, 150, RED_FLAGL, BLUE_FLAGL, SIG_3, SIG_4, SIG_5, SIG_6, SIG_7);
Here is the main code:
#include “robot-config.h”
int main() {
while (true){
Brain.Screen.clearScreen(vex::color::black);
flagFinderL.takeSnapshot(RED_FLAGL);
Brain.Screen.setFont(vex::fontType::mono40);
Brain.Screen.setCursor(1,1);
Brain.Screen.print(“%d”, flagFinderL.largestObject.centerY);
Brain.Screen.render();
vex::task::sleep(10);
}
}