I’ve started using PROS this year and so far it’s been (mostly) great. However, I’ve been having a recurring problem for a while now: segmentation faults. Usually it isn’t a big deal, the cortex shuts down for a second and then resumes, but my team FINALLY but optical shaft encoders on our lift and any time the fault occurs it resets the encoder, screwing up my proportional controller and auto-stacker. As I understand it, segmentation faults happen when you try to access invalid pointers. I do not have any manually defined pointers in my code, so I can’t just look around for a bad one. The fault seems to happen when I run
on my auto-stacker task, no matter where call it from. I have a suspicion that
s utilize some sort of pointer in them and my declaring
extern TaskHandle auto_stack_task;
is causing scope issues when I try to access it. Can anybody shed some light onto what may be causing this? I’d also appreciate it if somebody can come up with a better implementation of my auto-stacker task, as the current system is messy and for some reason doesn’t let my main task (opcontrol) do anything while it’s running, despite having
Have you tried a blocking delay at the end of autoStackerRun? I’m not sure of the exact details of the PROS port of FreeRTOS but usually a task should not terminate. You should also always test for NULL pointers before using them (ie. the task handle ) and assuming they are good.
Yeah it showed a message in the terminal. At the moment I’m just running the function without a task and telling my driver that he can’t move the bot around while it’s running… Not the best solution, but it’ll work for now. Thanks for the help, I’ll try passing NULL in once I get a chance with the bot.