So when i run the attached visions code and it sees all three goals it slows the robot down so much it crashes. I tried putting a wait timer in the loop but that did not work. Any suggestions?
Code.docx (262 KB)
Code.docx (262 KB)
We are getting the same type of response, actually our code doesn’t even do anything with camera tracking enabled. cRIO CPU usage shows 100% on DS. Once we use a disable diagram in our teleop tracking, everything works fine. I was wondering if we should put the tracking code from teleop to periodic tasks.
Okay, first of all - you should NEVER run something as resource-intensive as vision processing inside Teleop.vi. Teleop tries to run every time the robot gets a new packet of info from the driver station, and if something is still running when a new packet is received then you get all kinds of problems. You should move your code to Periodic Tasks.vi at a minimum, or move your vision processing into your Dashboard code.
Regarding the original post - where in your code are you running your vision processing? Even if you have your vision code running in Periodic Tasks, you still may get enough lag to make the cRIO give out on you. Many teams (including us) opt to run vision code on our Driver Station PC so that we don’t use up so much processing power on the cRIO.
Thanks for the suggestion, I am wondering though, how would you go about running it on the driver station pc? Should I place our vision processing vi and teleop code in a dashboard project? Sorry, labview is not my cup of tea!
I am running my vision tracking in my dashboard project and then using a network table to send my data to my teleop vi
To the original poster, the doc you attached is running on the dashboard? And when it sees targets it causes the robot to crash?
I don’t even see the 3rd dashboard writing anything to the robot over SmartDashboard. How is it getting the data to the robot, and what is the robot doing with it. Also, what do you mean by crash?
To nickcvet89, I posted in the other thread about how to put stuff on the dashboard. You don’t need to move teleop.
The overall structure is that RobotMain calls teleop each time a new joystick command comes in – about every 20ms. If you don’t return from teleop, you miss joystick commands and the robot is not responsive. If you put the code into another function that runs in parallel, such as Periodic Tasks or Vision Processing, then teleop will work as intended.
Greg McKaskle
Thanks Greg, really helping me thru this. Although I foresee many teams not adapting vision processing, but still think its worth a try.