Getting random errors that happened after nothing changed

so this has been extremely frustrating, ever since swapping to pros ive had problems with random errors. The errors are shown in the image below, along with the output of the errors. There is no problems with my code, and these errors used to go away upon restarting vscode. now they are here indefinetely,

i have tried to run pros make clean & pros make, but pros make does not work because of some error.
i have saved every time anything happened
this happened about a week ago on a different pc and different brain, this one was working fine until it suddenly started happening today.

if anyone knows any way to fix this, any help is apreciated.

Output of Errors

Compiled src/main.cpp [ERRORS]
In file included from ./include/liblvgl/core/lv_obj.h:140,
from ./include/liblvgl/lvgl.h:35,
from ./include/liblvgl/llemu.h:46,
from ./include/pros/llemu.h:17,
from ./include/api.h:57,
from ./include/main.h:37,
from src/main.cpp:1:
./include/liblvgl/core/lv_obj_style.h: In function ‘void lv_obj_remove_style_all(_lv_obj_t*)’:
./include/liblvgl/core/lv_obj_style.h:94:48: warning: bitwise operation between different enumeration types ‘’ and ‘’ is deprecated [-Wdeprecated-enum-enum-conversion]
94 | lv_obj_remove_style(obj, NULL, LV_PART_ANY | LV_STATE_ANY);
| ^~
In file included from ./include/pros/device.hpp:22,
from ./include/api.h:69:
./include/pros/rtos.hpp: In instantiation of ‘pros::rtos::Task::Task(F&&, uint32_t, uint16_t, const char*) [with F = int; uint32_t = long unsigned int; uint16_t = short unsigned int]’:
./include/pros/rtos.hpp:266:93: required from ‘pros::rtos::Task::Task(F&&, const char*) [with F = int]’
src/main.cpp:611:55: required from here
./include/pros/rtos.hpp:230:19: error: no matching function for call to ‘std::function<void()>::function(int)’
from ./include/api.h:24:
C:/Users/mrder/AppData/Roaming/Code/User/globalStorage/sigbots.pros/install/pros-toolchain-windows/usr/arm-none-eabi/include/c++/13.3.1/type_traits: In substitution of ‘template<bool _Cond, class _Tp> using std::__enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]’:
C:/Users/mrder/AppData/Roaming/Code/User/globalStorage/sigbots.pros/install/pros-toolchain-windows/usr/arm-none-eabi/include/c++/13.3.1/bits/std_function.h:353:8: required by substitution of ‘template<class _Res, class … _ArgTypes> template<class _Cond, class _Tp> using std::function<_Res(_ArgTypes …)>::_Requires = std::__enable_if_t<_Cond::value, _Tp> [with _Cond = std::function<void()>::_Callable<int, int, std::__invoke_result<int&> >; _Tp = void; _Res = void; _ArgTypes = {}]’
C:/Users/mrder/AppData/Roaming/Code/User/globalStorage/sigbots.pros/install/pros-toolchain-windows/usr/arm-none-eabi/include/c++/13.3.1/bits/std_function.h:434:9: required from ‘pros::rtos::Task::Task(F&&, uint32_t, uint16_t, const char*) [with F = int; uint32_t = long unsigned int; uint16_t = short unsigned int]’
./include/pros/rtos.hpp:266:93: required from ‘pros::rtos::Task::Task(F&&, const char*) [with F = int]’
src/main.cpp:611:55: required from here
C:/Users/mrder/AppData/Roaming/Code/User/globalStorage/sigbots.pros/install/pros-toolchain-windows/usr/arm-none-eabi/include/c++/13.3.1/type_traits:116:11: error: no type named ‘type’ in ‘struct std::enable_if<false, void>’
| ^~~~~~~~~
C:/Users/mrder/AppData/Roaming/Code/User/globalStorage/sigbots.pros/install/pros-toolchain-windows/usr/arm-none-eabi/include/c++/13.3.1/bits/std_function.h:368:7: note: candidate: ‘std::function<_Res(_ArgTypes …)>::function() [with _Res = void; _ArgTypes = {}]’
368 | function() noexcept
| ^~~~~~~~
C:/Users/mrder/AppData/Roaming/Code/User/globalStorage/sigbots.pros/install/pros-toolchain-windows/usr/arm-none-eabi/include/c++/13.3.1/bits/std_function.h:368:7: note: candidate expects 0 arguments, 1 provided
./include/pros/rtos.hpp:231:36: error: static assertion failed
make: *** [common.mk:283: bin/main.cpp.o] Error 1
ERROR - pros.cli.build:make - Failed to make project: Exit Code 2 - pros-cli version:3.5.4
PROS-CLI Version: 3.5.4
PROS-Kernel Version: 4.1.0
± Error
---------------------------------------------------------------------+
| Failed to build |
±----------------------------------------------------------------------------+
Sentry is attempting to send 1 pending events
Waiting up to 2 seconds
Press Ctrl-Break to quit

2 Likes

okay so after diving into it a little bit, i found that it was my tasks that were the problem, but now i have no idea what to do to get them in without the errors, tasks are shown below (cropped)

void opcontrol() {
  if(redteam == 1) {
    pros::Task blueteamfilter(redfilter(), "filters red");
  } else if(blueteam == 1) {
    pros::Task redteamfilter(bluefilter(), "filters blue");
  }

	while (true) {
    pros::Task redorblue(RedOrBlue(), "RedOrBlue"); //task to see if current ring is red or blue

and these are the actual functions themselves:

RedOrBlue
int RedOrBlue(){

  if(optical.get_hue()>6 && optical.get_hue()<12){
    return Red;
  }

  if(optical.get_hue()>213 && optical.get_hue()<220){
    return Blue;
  }
  return 0;
}
bluefilter
int bluefilter() {
  while(redteam == 1) {
    if(RedOrBlue() == Blue) {
      pros::delay(300);
      Intake2.brake();
      pros::delay(1500);
      Intake2.move(90);
    }
    pros::delay(10);
  }
  return 0;
}
redfilter

int redfilter() {
while(blueteam == 1) {
if(RedOrBlue() == Red) {
pros::delay(300);
Intake2.brake();
pros::delay(1500);
Intake2.move(90);
}
}
return 0;
}

2 Likes

Anytime I have these problems, they are usually because my controller disconnected slightly. However, you seemed to figure out your problems. When you mentioned tasks, I couldn’t help but wonder if you could give me any advice or example of what a task is? I was just looking for any information on them and couldn’t find anything. Could you help me out?

redfilter() is the output of the function, not the function itself (notice the parenthesis). This means when you’re creating a task, you’re passing in the output of the function, instead of telling it which function to run in the task. You should be doing this instead:

pros::Task blueteamfilter(redfilter, "filters red"); // the parenthesis are removed

Also, you do not need to create a task just to run the RedOrBlue function, and especially don’t create it in an infinite loop. Right now that part of your code will create thousands of tasks for no reason, all of which do basically nothing then die. Calling RedOrBlue only in the two other functions will do what you want it to.

These errors are from while the program is compiling, meaning they are created by your computer when it sees your code doesn’t make sense. It has nothing to do with the controller or the brain.

Google is your friend
https://pros.cs.purdue.edu/v5/tutorials/topical/multitasking.html
Tasks are used to run multiple parts of the code at the same time, but also often rely on advanced concepts and are very error-prone if used improperly. However, when done right they can be very useful.