Giter Club home page Giter Club logo

motor402's Introduction

motor402

An implementation of a CANopen device profile for drives and motion control according to CiA 402®.

This library heavily depends on the CANopen for Python implementation of the CANopen standard, mainly to provide NMT, SDO and PDO support. [1]

What is CANopen?

CANopen is a CAN-based communication system. It comprises higher-layer protocols and profile specifications. CANopen has been developed as a standardized embedded network with highly flexible configuration capabilities. It was designed originally for motion-oriented machine control systems, such as handling systems. Today it is used in various application fields, such as medical equipment, off-road vehicles, maritime electronics, railway applications, or building automation. [2]

CiA 301

CiA 301 specifies the CANopen application layer. This includes the data types, encoding rules and object dictionary objects as well as the CANopen communication services and protocols.

It also specifies the network management services (NMT). The NMT follows a master-slave architecture. Most devices are regarded as NMT slaves and are identified by their node ID (1-127).

Figure 1. NMT Finite State Automaton

CiA 402

The CAN in Automation 402 is a profile which defines specifications for devices able to be digitally controlled, such as stepper motors, frequency converters and servo motors.

It includes a FSA (Figure 2) that defines the device behavior for each state, determining the available commands and wether the power is enabled or not.

Figure 2. CiA402 Finite State Automaton

Although CiA402 is a well-specified set of motion control profiles, the manufacturer-specific functions and parameters (or lack thereof) heavily limit the exchangeability of compliant devices. [3]

Installation

pip install motor402

or just by cloning this repository and running

git clone https://gitlab.com/altairLab/elasticteam/can/motor402
python setup.py install

Usage example

To bring up the can0 interface we would write as follows:

sudo ip link set can0 type can bitrate 1000000
sudo ip link set up can0
import canopen
from motor402 import Motor

NODE_ID = 0x75
EDS_PATH = "./examples/TMCM-6212.eds"
TARGET_POSITION = 200

network = canopen.Network()
node = canopen.RemoteNode(NODE_ID, EDS_PATH)
network.add_node(node)
network.connect(bustype="socketcan", channel="can0", bitrate=1000000)

node.nmt.state = "PRE-OPERATIONAL"

motor = Motor(node)

node.nmt.state = "OPERATIONAL"
motor.to_switch_on_disabled()

motor.move_to_target(TARGET_POSITION)

References

[1] CANopen for Python

[2] CANopen – The standardized embedded network

[3] CiA® 402 series: CANopen device profile for drives and motion control

Authors

  • Matteo Meneghetti
  • Noè Murr

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b feature/foo)
  3. Commit your changes (git commit -am 'Add some foo')
  4. Push to the branch (git push origin feature/foo)
  5. Create a new Pull Request

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.