question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support multiple motors in CiA 402 CANopen device profile

See original GitHub issue

Hello,

Currently the ds402 implementation only supports one motor. We would like to extend this to multiple motors as specified by ds402.

We working with a multi-axis board each using CiA 402. We want to be able to control all motors independently of each other.

The CiA 402 standard specifies how to implement multiple motors: Each motor has its own state machine and all the relevant parameters (e.g. Controlword, Statusword). For each subsequent motor the indices are offset by 0x0800. For example, the Controlword of the first motor is 0x6040, the Controlword of the second motor is 0x6840.

Currently the canopen library implements the ds402 state transitions like this:

BaseNode402.state = "OPERATIONAL"

In order for multiple axes to be supported, this could be changed to the following:

BaseNode402.state[0] = "OPERATIONAL"

However, (afaik) there is no good way to implement the latter without breaking the backwards compatibility to the former. As an alternative, we could have the BaseNode402.state property for supporting a single axis (the first one) and have a different property for supporting multi-axes implementations:

# Set axes 0 and 1 to operational using the new property
BaseNode402.states[0] = "OPERATIONAL
BaseNode402.states[1] = "OPERATIONAL

# Read the state axis 0 using the old backwards compatible property
print(BaseNode402.state) # Should print "OPERATIONAL"

Would you be interested in an implementation of this for this library?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Martin-Wuertembergcommented, Apr 29, 2020

The existence of more than one device per-node is configured where ??? In the manufacturer reserved area of the Object Dictionary ?? How can we know if more than one device is configured (aka available) for each node ?

The “multiple logical device” is described in CiA301, Object 0x1000 “Device Type”. In case of a multiple device, the upper 16 bits are 0xFFFF. The lower 16 bits (device profile number) is the device profile of the first logical device, in this case 402. For more details see CiA301. With this one CANopen node can contain multiple devices which can be of different types e.g. a drive (device profile 402) combined with Digital IO (device profile 401).

0reactions
af-silvacommented, Mar 11, 2020

Hi @trinamic-jm,

Ok now is clear to me, sorry for not understanding at first, i’m not aware of the full ds402 specification, I have implemented only the parts that I needed for my requirements and didn’t extended further and also since I don’t have direct access to the ds402 full specification. That being said, I think, in my opinion, that providing a full ds402 implementations through this library would be neat, so I will help as much as I can. If you already have some functional code you can contribute we can create a new branch for this functionality and test it.

So, in resume each node has it’s own NMT state machine, provided by the class LocalNode(BaseNode) and class RemoteNode(BaseNode):. On the other hand, the class class BaseNode402(RemoteNode): has the RemoteNode as base class and implements the ds402 state machine.

So, to support multiple ds402 state machines, this must be done inside this class and stored in an array, being the default behavior to access the first position. The existence of more than one device per-node is configured where ??? In the manufacturer reserved area of the Object Dictionary ?? How can we know if more than one device is configured (aka available) for each node ? The library should be manufacture agnostic, and so we need to provided the base same functionality to all device manufacturers and implement ways to resolve this.

Like I said, if you have already something done regarding this and you are willing to contribute to thsi project please share that and I can create a new branch for us to test it.

Thanks 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

CiA 402 series: CANopen device profile for drives and motion ...
This set of profile specifications standardizes the functional behavior of controllers for servo drives, frequency inverters, and stepper motors.
Read more >
Using the CiA 402 Drive Profile for Motion Control Applications
This article gives an overview of the CiA 402 CAN profile and how it ... EtherCAT supports the CiA402 device profile through CANopen...
Read more >
CiA® 402-CANopen Drives and Motion Control Profile
CiA ® 402 refers to CAN in Automation (CiA) CANopen® Drives and Motion ... The drive device is controlled primarily by the use...
Read more >
CiA 402 - CANopen Product Guide
This set of profile specifications standardizes the functional behavior of controllers for servo drives, frequency inverters, and stepper motors. It also ...
Read more >
Elmo Motion Control CANopen DSP 402 Implementation Guide
The CiA DSP 402 CANopen Device Profile for Drives and Motion Control is ... The Elmo drive supports more than one operating mode...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found