This steer-by-wire ROS node is a fork of kacanopen by KITmedical with customisations such as:
- Removed unwanted examples and EDS file
- Auto-reconnect after CAN bus diconnect or motor power drop out.
- Error code feedback
- Custom msg
- int32 steering_angle - Input/output angle to/from the steering
- uint8 steering_error - Error code from the steering
- bool steering_enagle - Enable/disable the power to the steering to allow manual takeover
KaCanOpen is an easy-to-use CANopen stack, which consists of four parts:
-
Drivers: A wide range of hardware is supported using different CAN drivers. They have been developed by the CanFestival project. Read this for details.
-
Core: This is a library which implements basic CANopen protocols like NMT, SDO and PDO. As an example, you can easily fetch a value from a device (uploading in CANopen terminology) via
core.sdo.upload(node_id, index, subindex)
. It furthermore allows you to register callbacks on certain events or any incoming messages, so one can build arbitrary CANopen nodes (master or slave) using this library. -
Master: This library is intended to be used for a master node. It detects all nodes in a network and allows to access them via standardized CiA® profiles. For example, on a motor device (profile CiA® 402) you can simply call
mymotor.set_entry("Target velocity", 500)
. A main feature of this library is transparent SDO/PDO access to dictionary entries: By default a value is fetched and set via SDO, but you can configure PDO mappings to instead keep the value up-to-date in background via (more lightweight) PDO messages. The call itself (mymotor.set_entry("Target velocity", 500)
) keeps unchanged. The dictionary structure of a device can be loaded automatically from a set of generic, CiA® profile-specific, or device-specific EDS files which is distributed along with KaCanOpen. This allows you to write a meaningful Plug and Play master node with only a few lines of code. -
ROS Bridge: This library provides a bridge to a ROS network, which makes KaCanOpen especially interesting for robotics. After setting up the CANopen network, the library can publish slave nodes so they are accessible through ROS messages. Special effort is put into the use of standardized message types which allows interaction with other software from the ROS universe. For example, motors can be operated using JointState messages.
KaCanOpen is designed to make use of modern C++11/14 features and to avoid redundant code on the user side wherever possible. This makes the interface neater than it is in other products on the market.
First make sure you've got a recent C++ compiler with C++14 support (GCC >= 4.9, Clang >= 3.6), as well as CMake >= 3.2 and Boost >= 1.46.1.
<driver>
can be one of the following: serial, socket, virtual, lincan, peak_linux.
monashcav including the ROS part must be built using Catkin. Make sure you have ROS Kinetic installed. Go to your workspace and clone the repository into src
:
cd your_catkin_workspace/src
git clone https://github.com/ycsin3/monashcav.git
cd ..
catkin_make
When building with Catkin, you can excute main programs like that:
cd your_catkin_workspace
source devel/setup.bash
rosrun monashcav mcav_steering # roscore needs to be running