Micro-XRCE-DDS-Client/examples/PublishHelloWorldCAN
Pablo Garrido 8ffecce848
Rename UXR_CONFIG_CAN_TRANSPORT_MTU (#372)
Because CAN-FD MTU is fixed, it's not configurable.
UXR_CONFIG_CAN_TRANSPORT_MTU is a bit misleading. Thus, this commit
rename it to UXR_CAN_TRANSPORT_MTU.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Co-authored-by: Yasushi SHOJI <yashi@spacecubics.com>
2023-09-27 10:45:37 +02:00
..
CMakeLists.txt Add CAN client (#278) 2021-11-15 10:05:54 +01:00
HelloWorld.c Add CAN client (#278) 2021-11-15 10:05:54 +01:00
HelloWorld.h Add CAN client (#278) 2021-11-15 10:05:54 +01:00
HelloWorld.idl Add CAN client (#278) 2021-11-15 10:05:54 +01:00
README.md Add CAN client (#278) 2021-11-15 10:05:54 +01:00
main.c Rename UXR_CONFIG_CAN_TRANSPORT_MTU (#372) 2023-09-27 10:45:37 +02:00

README.md

PublishHelloWorldCAN example

This example will show how to send data to the DDS World creating a client publisher using a CAN bus. In order to compile this example, the following profiles should be enabled:

  • UCLIENT_PROFILE_CAN

To run the example, a virtual CAN FD bus can be created with the following commands:

ip link add dev vcan0 type vcan
ip link set vcan0 mtu 72
ip link set dev vcan0 up

Usage

  1. Run an agent in can mode, for example: MicroXRCEAgent canfd --dev vcan0 --id 0x00000001.

  2. Run the PublisherHelloWorldCAN example on the same CAN bus with a different can id. The example expects the CAN device name as first argument and the client can identifier as second. A different can identifier should be used on the Agent and the Client.

    It can also be parameterized with the number of topics that will be sent.

Topic

The HelloWorld topic has the following IDL representation:

struct HelloWorld
{
	unsigned long index;
	string message;
};