toposens-library repository

Repository Summary

Checkout URI https://gitlab.com/toposens/public/toposens-library.git
VCS Type git
VCS Version master
Last Updated 2022-05-12
Dev Status DEVELOPED
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Packages

No packages found.

README

Toposens Sensor Library

[[TOC]]

Introduction

The purpose of this README is to document how to use the library and the provided examples.

Communication Protocol

More information about the communication protocol can be found in the communication_protocol subdirectory.

Setting up the Sensor & CAN Interface

  • Connect the D-Sub-15 cable from the sensor to the power/data D-Sub-15 cable.
  • Connect the D-Sub-9 to the peak CAN adapter and the peak CAN adapter USB to the host device.
  • Install the required kernel modules:
  sudo modprobe peak_usb
  sudo modprobe peak_pci
  sudo apt-get update
  sudo apt-get install can-utils

  • Then either every time the sensor is connected run the following command or set up an automatic way to configure the interface as described below:
sudo ip link set can0 up type can bitrate 1000000

Automatic Setup with /etc/network/interfaces

In the /etc/network/interfaces file, add the following:

allow-hotplug can0
iface can0 can static
     bitrate 1000000
     up ip link set $IFACE txqueuelen 100

Automatic Setup with systemd

If you are on Ubuntu 20.04 you can use systemd since /etc/network/interfaces is deprecated. Navigate to /etc/systemd/network/ and create a file 80-can.network with the following content:

[Match]
Name=can*

[CAN]
BitRate=1000000

Then run the following commands to enable the automatic configuration via systemd:

sudo systemctl enable systemd-networkd
sudo systemctl start systemd-networkd

Test the Interface

  • Run the command:
candump can0

  • In a new terminal, send one of the example commands from the communication protocol. If the corresponding response comes back then everything is working and connected correctly.

Compiling and Installing the Sensor Library and example applications

mkdir build
cd build
cmake ..
make
sudo make install

or simply run the install.sh

Running the Examples

After compiling the library, go to the folder build/examples. Run the example of choice.

cd build/examples
./n_frames_single_shot_example

CONTRIBUTING

No CONTRIBUTING.md found.

Repository Summary

Checkout URI https://gitlab.com/toposens/public/toposens-library.git
VCS Type git
VCS Version master
Last Updated 2022-05-12
Dev Status DEVELOPED
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Packages

No packages found.

README

Toposens Sensor Library

[[TOC]]

Introduction

The purpose of this README is to document how to use the library and the provided examples.

Communication Protocol

More information about the communication protocol can be found in the communication_protocol subdirectory.

Setting up the Sensor & CAN Interface

  • Connect the D-Sub-15 cable from the sensor to the power/data D-Sub-15 cable.
  • Connect the D-Sub-9 to the peak CAN adapter and the peak CAN adapter USB to the host device.
  • Install the required kernel modules:
  sudo modprobe peak_usb
  sudo modprobe peak_pci
  sudo apt-get update
  sudo apt-get install can-utils

  • Then either every time the sensor is connected run the following command or set up an automatic way to configure the interface as described below:
sudo ip link set can0 up type can bitrate 1000000

Automatic Setup with /etc/network/interfaces

In the /etc/network/interfaces file, add the following:

allow-hotplug can0
iface can0 can static
     bitrate 1000000
     up ip link set $IFACE txqueuelen 100

Automatic Setup with systemd

If you are on Ubuntu 20.04 you can use systemd since /etc/network/interfaces is deprecated. Navigate to /etc/systemd/network/ and create a file 80-can.network with the following content:

[Match]
Name=can*

[CAN]
BitRate=1000000

Then run the following commands to enable the automatic configuration via systemd:

sudo systemctl enable systemd-networkd
sudo systemctl start systemd-networkd

Test the Interface

  • Run the command:
candump can0

  • In a new terminal, send one of the example commands from the communication protocol. If the corresponding response comes back then everything is working and connected correctly.

Compiling and Installing the Sensor Library and example applications

mkdir build
cd build
cmake ..
make
sudo make install

or simply run the install.sh

Running the Examples

After compiling the library, go to the folder build/examples. Run the example of choice.

cd build/examples
./n_frames_single_shot_example

CONTRIBUTING

No CONTRIBUTING.md found.