Git Product home page Git Product logo

canopenlib's Introduction

canopenlib

This library provides simple CANopen functionalities. It uses the SocketCAN package and is therefore only for Linux. It is an extension of libcanopen. Notably, it supports PDO transfers and implements some of the CANopen communication profile for drives.

How to build

The library can be built with CMake and installed locally as follows.

mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=../install ..
make
make install

If you use this library together with EEROS it might be advantageous to use the build scripts therein.

How to use

The library can be used as follows.

Add the canopenlib

The library can be added to the target project by addding the following CMake statements to the topmost CMakeLists.txt file.

set(CMAKE_PREFIX_PATH pathTo/canopenlib/install/)

find_package(canopenlib)

include_directories(${canopenlib_INCLUDE_DIR})
link_directories(${canopenlib_DIR})

add_executable(main main.cpp)
target_link_libraries(main canopenlib)

Use the canopenlib

The library API is accessible as follows.

#include "canopenlib.h"

int main() {
  can_socket_open();
  ...
}

Bringing CAN interface up

Before you can start your application you have to bring up your interface with

/sbin/ip link set up can0 type can bitrate 125000

Choose your interface and bitrate accordingly.

Organization of the library

The basic functionality for NMT commands and SDO transfers can be found in

  • canopen.c / canopen.h (basic functionality)
  • canopen-com.c / canopen-com.h (sending and receiving packages)
  • can-if.c / can-if.h (socket handling)

Our extensions include

  • canopen-drv.c / canopen-drv.h (adds PDO support)
  • canopen-Faulhaber-drv.c / canopen-Faulhaber-drv.h (support for Faulhaber drives)

canopenlib's People

Contributors

ursgraf avatar andreaskunz avatar

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.