Repo symbol

tcan repository

usb communication can ethercat
Repo symbol

tcan repository

usb communication can ethercat
Repo symbol

tcan repository

usb communication can ethercat
Repo symbol

tcan repository

usb communication can ethercat

Repository Summary

Description A library to communicate to devices connected through CAN, EtherCat, USB or TCP/IP.
Checkout URI https://github.com/leggedrobotics/tcan.git
VCS Type git
VCS Version master
Last Updated 2023-05-04
Dev Status UNKNOWN
Released UNRELEASED
Tags usb communication can ethercat
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
tcan 0.2.0
tcan_bridge 0.0.0
tcan_bridge_msgs 0.0.0
tcan_can 0.2.0
tcan_can_j1939 0.0.0
tcan_ethercat 0.2.0
tcan_ethercat_example 0.2.0
tcan_example 0.2.0
tcan_ip 0.2.0
tcan_msgs 0.2.0
tcan_usb 0.2.0
tcan_utils 0.2.0

README

Threaded Communication and Networking library

Build Status

Overview

A library to communicate to devices connected through CAN, EtherCat, USB or TCP/IP.

License

The source code is released under the MIT license.

Authors: Philipp Leemann, Christian Gehring, Remo Diethelm

Dependencies

Common

Ethercat

Usage

See tcan_example for an easy example how to use tcan library. tcan has two modes: synchronous and asynchronous:

  • In asynchronous mode, the library creates three threads for each bus: a thread that handles incoming CAN messages, one that sends outgoing CAN messages and one that checks if devices/SDOs have timed out (sanityCheck).
  • In synchronous mode, it is up to the user to call the BusManagers readMessagesSynchronous(), writeMessagesSynchronous() and sanityCheckSynchronous() functions in his main loop.

To prevent overflow of the output buffer of the SocketCAN driver (which is used by the SocketBus class) there are two possible approaches:

  • Set the output queue length to a value which is large enough to hold the messages of one cycle:

```sudo ip link set can0 txqueuelen 100

- Setting the SocketBusOptions::sndBufLength_ to 1 (or any other small value > 0). This sets the socket buffer size to its minimal value and will make the socket blocking if this buffer is full (which is NOT the same as the buffer of the underlying netdevice)

## Setting up the interface

### Virtual can interface

Use the 
```vcan.sh
``` script provided in 
```tcan_utils/bash
```:


#!bash

rosrun tcan_utils vcan.sh {start stop restart}
e.g.



#!bash

rosrun tcan_utils vcan.sh start can0


### CAN-USB Adapter

Use the 
```canusb.sh
``` script provided in 
```tcan_utils/bash
```:


#!bash

rosrun tcan_utils canusb.sh {start stop restart} [] []
e.g.:

#!bash

rosrun tcan_utils canusb.sh start /dev/ttyUSB0 can0 -s8

rosrun tcan_utils canusb.sh stop can0

where 
```-s8
``` sets the can baud rate according to the following table:


| flag | bitrate |
|---|---|
| -s0 | 10kbit |
| -s1 | 20Kbit |
| -s2 | 50Kbit |
| -s3 | 100Kbit |
| -s4 | 125Kbit |
| -s5 | 250Kbit |
| -s6 | 500Kbit |
| -s7 | 800Kbit |
| -s8 | 1Mbit |



### Peak PCIe card

The linux kernel >= 2.6.25 supports Socketcan natively. To setup the interface, you can use



#!bash

File truncated at 100 lines see the full file

Repo symbol

tcan repository

usb communication can ethercat
Repo symbol

tcan repository

usb communication can ethercat
Repo symbol

tcan repository

usb communication can ethercat
Repo symbol

tcan repository

usb communication can ethercat