-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Investigate CAN bus load #231
Comments
Tiny grain of salt: technically, the Yokogawa oscilloscope we have can be used to monitor CAN messages (maybe https://www.youtube.com/watch?v=FqDPMUk1KQQ). |
Martin Rostan, Configuration Guideline for CANopen Networks, provides very useful pointers on determining CAN bus load and several hints and guidelines on this matter. Our CAN design decisions should span to issue #232. |
Idea: drop the whole zero-delay thing in CanBusControlboard's RW threads, assume users will set a tiny yet non-micro-nor-zero-delay (e.g. microseconds?), check that CPU usage does not rocket up, and embrace
|
Done at 908bc29, currently delaying 100 microseconds for both read/write threads (roboticslab-uc3m/teo-configuration-files@8c69d4c). For completeness: previous Edit: which raises up to 200% with a SYNC period of 5 milliseconds on a single arm... |
I managed to perform position control via joystick with a SYNC period of just 2 milliseconds on TEO's right arm. CSP mode was running under the hood (#222). Setup (roboticslab-uc3m/kinematics-dynamics#173 (comment)):
|
I'm unable to replicate this today. I decided to revert 908bc29 since this is a classical save-CPU-resources problem. I don't really need to run stuff at precise intervals nor any of the statistical data |
I implemented yarp-devices/libraries/YarpPlugins/CanBusControlboard/CanRxTxThreads.cpp Lines 147 to 153 in 40e212f
On power-off condition (i.e. emergency button pressed), we observed a constantly increasing CAN error count and a nearly 100% bus load via |
Regarding how to obtain/estimate CAN bus load: |
Added new
|
On this setup, (estimated) bus load is stable around 90%. |
ASWJ we pick the following defaults: 20 ms for SYNC period, 10 ms for YARPs' controlboardwrapper period (roboticslab-uc3m/teo-configuration-files@933370a). |
Split into RX bus load, TX bus load, and overall bus load: cf1aeaa. We learned a CAN bus is half-duplex, therefore it actually makes sense to sum both terms: https://stackoverflow.com/a/58505043.
|
Currently 68% CAN bus load at much lower CPU usage (albeit on a new and better PC) with a SocketCAN implementation: #251 (comment). For local inspection, the |
Issue #217 targets the saturation of CAN buses due to the Cui encoders being configured in continuous send (i.e. push) mode. It is proposed that polling (i.e. pull) mode should be used instead, although we'd like to measure bus traffic beforehand to estimate the actual RX/TX load.
If we take a look into the PCAN user manual, we learn it supports event-like incoming CAN frames (in addition to actual data):
pcanfd_set_init()
supports thePCANFD_INIT_BUS_LOAD_INFO
flag viapcanfd_init
struct:pcanfd_get_state()
populates apcanfd_state
struct in which abus_load
16-bit property is included.pcanfd_recv_msg()
(and "overloads") reads messages that may contains status information (pcanfd_msg.type
holdsPCANFD_TYPE_STATUS
) and, specifically, bus load (PCANFD_BUSLOAD
is set inpcanfd_msg.flags
).All of this concerns the Peak CAN bus device in particular. Device monitoring is proposed in #225 by means of the
ICanBusErrors
class. This solution entails dealing with YARP interfaces and propagating desired data through the CanBusControlboard layer and beyond, assuming we build a EasySetup-like GUI to rule everything status-related in a global context (having access to each node in all CAN buses).Now, other solutions exist and do not meddle with the CanBusControlboard architecture. Credits to @rsantos88 for his research on these tools (read #217 (comment) and watch https://youtu.be/GRwmkx_YIIc):
This issue aims to extract the most of information we can from CAN (hey, I'm a wordplay ninja) using available tools. Then, tweak RX/TX rates (#217 regarding Cuis) and decide on how monitoring should be carried out (#225).
The text was updated successfully, but these errors were encountered: