![]() |
CAN-based delays
We are loving the new Talon SRX controllers! There are so many kewl features. But the other day our programmer-students were reporting delays processing commands from the driver station. Our application in the robot is all message-based with multiple threads responding to messages to perform subsystem-specific tasks. The students had inserted some code to query 6 different Talons for information about connected sensors inline with code that answers flurries of messages (100s per sec) and were seeing some delay. The delay was from the CANbus queries. I helped them fix it by only querying the Talons when they needed the data, not all of the time, and by handling the messages more efficiently.
Has anybody else experienced this? Any unexpected delays issuing commands to Talons (to which the Talons must answer)? If Omar is listening, how fast do the Talons respond to messages requesting data about sensor outputs etc? TIA |
Re: CAN-based delays
I haven't looked up the specific CAN algorithms, but this is a common problem on many baseband (shared) busses. A likely cause of the problem is your use of multiple threads all trying to ping CAN at the same time. If you wrote a dedicated CAN thread, then had all the subsystems that need it submit (possibly prioritized) requests to that one thread for processing, you may reduce collisions.
|
Re: CAN-based delays
Quote:
We are running 9 talon SRX controllers, and three of them are reading their sensor data in seperate threads. We have not seen any issues, though we do see strange, and quite large spikes, in the CPU usage data at a very periodic rate (~7 seconds?) that line up with small increases in CAN utilization. Not sure if that is related but I could imagine this would cause issues if the spikes hit 100% for any extended time. |
Re: CAN-based delays
Based on the threads he's started, wireties' team is using C++, not LabView. It appears they may be using SampleRobot, not IterativeRobot. That may make a difference.
|
Re: CAN-based delays
Quote:
|
Re: CAN-based delays
Quote:
|
Re: CAN-based delays
Quote:
|
Re: CAN-based delays
Quote:
If you are reading signals that are solicited (motor control profile params or Iaccum) then the CAN bus utilization will increase. So check the can utilization to see if it's high (section 15). I can't imagine why you would need to do that though. Are you getting DS messages in the log? section 16.8? What signals are you reading? What is the observed behavior in the robot that is not meeting your expectations? Is it something you can reproduce with a smaller test app? Sounds like your app is more unique/complex then a typical robot application, which without an understanding of what's going on, we're likely not going to be able to pinpoint what you are seeing in a forum. Seems like the first step should be figuring out what is actually taking more time then what you'd expect. If you want you can send your source to support@crosstheroadelectronics.com and I can take a look. |
Re: CAN-based delays
Quote:
Quote:
Quote:
Not easy to reproduce - you've ruled out the CAN queries. The students were issuing many hundreds of SmartDashboard updates per sec, maybe that was it. I moved the CAN queries and accompanying SmartDashboard updates around so they are only called as needed by the state machine in this area of the code. All is well now but I wondered where the delay came from. Thanks |
Re: CAN-based delays
Quote:
|
| All times are GMT -5. The time now is 20:14. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi