I’m going to cover some of the code mistakes we found at worlds 2022 in this topic. Before we get going I want to provide a VEXcode project that can be used to help demonstrate the issues and also provides a C++ class that can be (at least theoretically) included with any VEXcode C++ project to help debug.
The demo project is available here.
It includes a new class inside a header file called comp_debug.h, the class is very simple to add, include comp_debug.h after vex.h in main.cpp.
#include "vex.h" #include "comp_debug.h"
and then create a global instance of it passing you competition class instance as a parameter.
// debug class competition_debug Cdebug( Competition );
The competition_debug instance will add an overlay to your code with current competition status shown as well as a few other useful items, this is what it looks like when the robot is disabled.
Any output your code has will be clipped and drawn as usual.