examples for CAN?

Thank you Steven for reorganizing the CAN-related stuff in OCL 1.10.

Are there examples available on how to actually use the CAN classes?

Cheers, Theo

examples for CAN?

On Fri, Jan 15, 2010 at 8:53 PM, <t [dot] j [dot] a [dot] devries [..] ...> wrote:
> Thank you Steven for reorganizing the CAN-related stuff in OCL 1.10.
>
> Are there examples available on how to actually use the CAN classes?

I'm not aware of any public code unfortunately and it lacks docu
indeed -> Would be good to add stuff to the wiki (hint :).

Basically, you need to do something like

// Create a can controller
mCANController = new RTCANController( OS::HighestPriority, "rtcan0",
100 /*100 ms*/);
// Create a virtual (internal/and sw) CANbus
mCANBus = new CANBus();
// Link the bus to the controlller
mCANController->addBus( mCANBus );

// Implement some devices that implement the CanDeviceInterface or
CanListenerinterface (ie. implement the virtual function "process",
see <http://people.mech.kuleuven.be/~orocos/pub/stable/documentation/ocl/v1.10.x/api/html/structRTT_1_1CAN_1_1CANDeviceInterface.html>
// You can consider this process function as a callback in case your
CAN controller receives a message
// Let's say the device is called MyCANListener

// Add MyCANListener to the bus
mCANbus->addDevice(&MyCANListener);

// Start the CANController
mCANController->start();

// To write, you can write something on the bus directly (or
encapsulate this in a send member of a CANDevice ofcourse)
CANMessage msg;
mCANbus->write( &msg );

HTH,

Klaas

examples for CAN?

Thank you Steven for reorganizing the CAN-related stuff in OCL 1.10.

Are there examples available on how to actually use the CAN classes?

Cheers, Theo