leducp / kickcat Goto Github PK
View Code? Open in Web Editor NEWA C++ open source EtherCAT master stack
License: Other
A C++ open source EtherCAT master stack
License: Other
Create a tool (serving as example):
Use the tool on elmo/ingenia example.
Codebase is mainly OS agnostic but it still needs a few API to work properly (mainly socket and sleep()). C++ standard API that implement such interfaces are not really portable and as such the project cannot rely on it.
Proposal: Enable different OS port through CMake project.
Create a simple nuttx ethercat app using kickcats slave stack.
I really like how simple the current source code is, congrats!
The Bus class is starting to grow in size and could become difficult to maintain.
Should functions like waitForMessage
, getCurrentState
, readMappedPDO
, read/writeSDO
be moved to the Slave class? Slaves would be listed in the bus and initialized with a shared pointer (or whatever) to the bus.
Other possibilities would be to move some of the Frames (datagrams) and Eeprom (read/fetch/ready) logic to dedicated classes.
Currently the stack is missing the transition from op to preop, safeop etc.
Mailbox is not aware of any kind of timeout right now. This can be problematic if the message is lost (i.e. frame error) as there is no re-transmission mechanism. It leads to a potential memory leak, message collision (same counter after one loop) and user as no easy way to catch this kind of error.
ETG1004 extension unit_specification specify all the units supported in ethercat
Master mailbox is expected to answer to their description (index 0X400 -> 0X4FF)
Rework the code base to allow the use of redundancy.
Enable the client to enable/disable ECAT event (IRQ field in EtherCAT header) and attach a callback on each.
It is useful to react on topology change through DL status (hotplug or cable break) or on AL status change for instance.
ECAT Event Mask (0x0200:0x0201) -> for activation / deactivation
See ECAT Event Request (0x0210:0x0211) for details in hardware section 2.
When some slaves are disconnected we still want to read the data from the first slaves in the network.
use case: when a slave is slower to switch from safe op to op than the PDO watchdog set, it leads the slave to trigger its internal PDO watchdog.
To avoid this, as a client, we need to send multiple PDO while waiting for the switch to OP to prevent the watchdog to be triggered.
Mailbox Gateway enable external mailbox access to a master that support it. It is useful for configuration tool and maintenance tools.
Note: the Mailbox Gateway standard is required to add support for the Master Diagnostic standard (ETG.1510).
I'm currently working on a robotics project and have been entertaining the idea of replacing CODESYS which I have been using for the RT aspects of the system with an open source stack. Found this library and it's very cool, took maybe all of an hour to adapt the example and get my drive booted and PDO mapped. The problem I now face is its a Delta B3 drive and apparently wont move unless it's receiving some form of sync message.
Delta servo drives only support synchronous operation which is the controller periodically sends the SYNC object (COB-ID = 0x80).
The drive is fully powered up (locked shaft), receiving control word, target position and mode of operation, it's sending back all the right status word bits as well as actual position + velocity. But it refuses to budge. The only configuration difference between this and CODESYS I can see is that its not receiving a distributed clock.
Now the problem is that I only know a little bit about CoE, and next to nothing about EtherCAT itself. Reading what's out there it seems as though SYNC messages and distributed clocks are two different things, if that's true is there a quick and dirty way to generate that payload and get this project moving forward? I assume the only reason we don't already have DC in this library is because it's a non trivial task and unfortunately I'm probably not in the position to contribute one even though I would like to.
Any help would be much appreciated.
At the moment it seems like only the file used in kickcat unit are display in the coverage report. So a new file totally not tested is not reported as having 0% coverage.
Wanted information are:
https://download.beckhoff.com/download/Document/io/ethercat-development-products/ethercat_esc_datasheet_sec2_registers_3i0.pdf
Type (0x0000) 8b ethercat controller
Revision (0x0001) 8b
Build (0x0002:0x0003) 16b
FMMUs supported (0x0004) 8b
SyncManagers supported (0x0005) 8b
RAM Size (0x0006) 8b (pdo max size)
ESC Features supported (0x0008:0x0009)
print_esc_specification(slave)
slave
struct esc_info
Current Link unit test do not check properly the applied timeout:
GMOCK WARNING:
Uninteresting mock function call - returning directly.
Function call: setTimeout(8-byte object <22-5B 1E-00 00-00 00-00>)
NOTE: You can safely ignore the above warning unless this call should not happen. Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call. See https://github.com/google/googletest/blob/master/docs/gmock_cook_book.md#knowing-when-to-expect for details.
GMOCK WARNING:
Uninteresting mock function call - returning directly.
Function call: setTimeout(8-byte object <80-84 1E-00 00-00 00-00>)
NOTE: You can safely ignore the above warning unless this call should not happen. Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call. See https://github.com/google/googletest/blob/master/docs/gmock_cook_book.md#knowing-when-to-expect for details.
GMOCK WARNING:
Uninteresting mock function call - returning directly.
Function call: setTimeout(8-byte object <34-54 1E-00 00-00 00-00>)
NOTE: You can safely ignore the above warning unless this call should not happen. Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call. See https://github.com/google/googletest/blob/master/docs/gmock_cook_book.md#knowing-when-to-expect for details.
GMOCK WARNING:
Uninteresting mock function call - returning directly.
Function call: setTimeout(8-byte object <80-84 1E-00 00-00 00-00>)
NOTE: You can safely ignore the above warning unless this call should not happen. Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call. See https://github.com/google/googletest/blob/master/docs/gmock_cook_book.md#knowing-when-to-expect for details.
Exepcted working counter for logical read write shall be equal to read operation plus write operation times 2 (read + write x 2). However, the check is currently done on read operation only.
Here is a proposal to post analyse a network behavior with a dedicated tool.
Entry | type | value if constant | meaning |
---|---|---|---|
Magic number | u32 | TODO | To recognize file format |
Version | u16 | 1 | File format version |
Start time | u64 | N/A | Start time in ns since UNIX Epoch) |
Data section | u64 | N/A | Offset of the data section |
Entry | type | meaning |
---|---|---|
Block type | u16 | To recognize block format |
Slave address | u16 | Slave address that generates this block |
Timestamp | u64 | timestamp of the block in ns |
Data | Block type dependent | Data of the block. Cf. following sections |
Block type: 1
Entry | type | meaning |
---|---|---|
Vendor ID | u32 | cf. SSI doc |
Product code | u32 | cf. SSI doc |
Revision number | u32 | cf. SSI doc |
Serial number | u32 | cf. SSI doc |
Block type: 2
Entry | type | meaning |
---|---|---|
DL status | u16 | cf. register doc |
Block type: 3
Entry | type | meaning |
---|---|---|
AL status | u16 | cf. register doc |
AL code | u16 | cf. register doc |
Block type: 4
Entry | type | meaning |
---|---|---|
Error counters | sizeof(ErrorCounters) | cf. register doc |
In the datagram header in Frame.cc the field circulating was never reset.
The circulating field is set to 1 to indicate that the given frame has already been processed by a slave with the port0 closed. If a slave with a port0 closed try to set set it to 1 and it's already 1, the slave destroy the frame to prevent a frame to circulate indefinitely in a cut network (preventing the slaves to trigger their watchdog when communication with the master is lost).
The problem with kickcat not resetting this field to 0 was that it is not possible to communicate to a slave on its port out, leading to not being able to implement the redundancy handling.
More information about the circulating bit can be found in https://download.beckhoff.com/download/document/io/ethercat-development-products/ethercat_esc_datasheet_sec1_technology_2i2.pdf chapter 3.5, schematics explain the problem in details.
To ease the source maintenance, tools shall be separated in dedicated subfolder instead of a stack of files which are built in differents tools
https://github.com/Siviuze/KickCAT/blob/84fded65c8f95908f7be97e97ee6e087cfaaf3c2/src/Bus.cc#L1005
In the case where we want to fetch the DL status of multiple slaves, with the current code we will have to for loop through all the slaves sending datagrams one at a time vs just having one process datagram with the request dl status for all n slaves
It would be nice that in the bus class, detectSlave() return directly the number of detected slaves instead of having to call for the getter afterward.
Transform print call to print() and rely on overloading to select the right one.
At the moment the slave stack does not handle the error code.
ie:
In order to have more user friendly example it would be nice to display the available interfaces.
Thanks.
When trying to use Bus.cc from the client side to investigate cable losses a few issues arise:
We can't call detectSlaves after init to count the number of slaves still connected on the network, because detectSlaves modify the slaves vector -> we should rework this function and split it in two to allow scanning for the slaves without modifying the bus object.
The api to send / get datagram on the bus should be split in two to allow client to choose what to send / receive and at which moment.
Current SII display FMMU type with a numeric information that could be translated in human readable langage (unused, read, write, unknown)
Since redundancy merge, when enabling DEBUG, the system spam read errors on IONull while this is an expected behavior of this stub.
Tests on the handling of multiple frame inflight shall be added.
bus.readSDO(...)
with PARTIAL or COMPLETE access mode doesn't throw an error if the read failedbus.readSDO(...)
with EMULATE_COMPLETE access mode doesn't report the error code if the read failedSuggested diff: master...nesnes:KickCAT:patch-2
Add a windows socket and a windows build system through CMake
since_epoch() is a weak symbol with a default implementation. However some examples are not linked with the default implementation, which lead to a crash when since_epoch() is called (function pointer initialized with nullptr).
Extend the project to provide a slave stack implementation.
Allow the client to enable mailbox checking through FMMU.
When trying to initialize a bus on a network with more than 15 nodes, an exception is thrown saying that the network is unreadable.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.