Hi, is there something special about vision signatures 4-7? Seems that only signatures 1-3 work as expected. I modified the c++ vision sample to have the same color green in sig 3 and sig 4 and only the one in 3 seems to trigger correctly.
How I got the signature was to place a green triball infront of the camera and use the configure utility in Vexcode, then copy the trained signature to the clipboard and added to the code. Here’s the output from the configure utility, and code following that.
vision::signature SIG_1 (1, -5113, -4239, -4676, -4311, -3567, -3938, 8.000, 0);
vision::signature SIG_2 (2, 0, 0, 0, 0, 0, 0, 2.500, 0);
vision::signature SIG_3 (3, 0, 0, 0, 0, 0, 0, 2.500, 0);
vision::signature SIG_4 (4, 0, 0, 0, 0, 0, 0, 2.500, 0);
vision::signature SIG_5 (5, 0, 0, 0, 0, 0, 0, 2.500, 0);
vision::signature SIG_6 (6, 0, 0, 0, 0, 0, 0, 2.500, 0);
vision::signature SIG_7 (7, 0, 0, 0, 0, 0, 0, 2.500, 0);
vex::vision vision1 ( vex::PORT1, 50, SIG_1, SIG_2, SIG_3, SIG_4, SIG_5, SIG_6, SIG_7 );
#pragma region VEXcode Generated Robot Configuration
// Make sure all required headers are included.
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
#include <string.h>
#include "vex.h"
using namespace vex;
// Brain should be defined by default
brain Brain;
// START V5 MACROS
#define waitUntil(condition) \
do { \
wait(5, msec); \
} while (!(condition))
#define repeat(iterations) \
for (int iterator = 0; iterator < iterations; iterator++)
// END V5 MACROS
// Robot configuration code.
// Helper to make playing sounds from the V5 in VEXcode easier and
// keeps the code cleaner by making it clear what is happening.
void playVexcodeSound(const char *soundName) {
printf("VEXPlaySound:%s\n", soundName);
wait(5, msec);
}
#pragma endregion VEXcode Generated Robot Configuration
// ----------------------------------------------------------------------------
//
// Project: Detecting Objects (Vision)
// Description: This project will detect 3 different colored objects
// and display when each object is found on the V5
// Brain's screen.
// Configuration: Vision5 on Port 5
//
// ----------------------------------------------------------------------------
// Include the V5 Library
#include "vex.h"
// Allows for easier use of the VEX Library
using namespace vex;
vision::signature Vision8__BLUEBOX = vision::signature (1, -1489, -1091, -1290,13889, 14359, 14124,3, 0);
vision::signature Vision8__REDBOX = vision::signature (2, 12863, 15019, 13941,-345, 275, -35,3, 0);
vision::signature Vision8__GREENBOX = vision::signature (3, -5113, -4239, -4676, -4311, -3567, -3938, 8.000, 0);
vision::signature Vision8__GREENBOX4 = vision::signature (4, -5113, -4239, -4676, -4311, -3567, -3938, 8.000, 0);
vision Vision8 = vision (PORT8, 50, Vision8__BLUEBOX, Vision8__REDBOX, Vision8__GREENBOX, Vision8__GREENBOX4);
event checkGreen = event();
event checkGreen4 = event();
// Will check to see if there is a green object in view of the vision
// sensor and display the result on line 5 on the V5 Brain's screen
void hasGreenCallback() {
Brain.Screen.clearLine(1);
Brain.Screen.setCursor(1, 1);
Vision8.takeSnapshot(Vision8__GREENBOX);
if (Vision8.objectCount > 0) {
Brain.Screen.print("Green SIG3 Object Found");
} else {
Brain.Screen.print("No Green SIG3 Object");
}
}
void hasGreen4Callback() {
Brain.Screen.clearLine(3);
Brain.Screen.setCursor(3, 1);
Vision8.takeSnapshot(Vision8__GREENBOX4);
if (Vision8.objectCount > 0) {
Brain.Screen.print("Green SIG4 Object Found");
} else {
Brain.Screen.print("No Green SIG4 Object");
}
}
int main() {
// register event handlers
checkGreen(hasGreenCallback);
checkGreen(hasGreen4Callback);
// small delay to ensure that the event handlers are ready to be used
wait(15, msec);
// set the print font for all future prints to the V5 screen
Brain.Screen.setFont(mono40);
// constantly runs to check for new sensor data
while (true) {
checkGreen.broadcastAndWait();
checkGreen4.broadcastAndWait();
wait(0.1, seconds);
}
}