====== Torqeedo Interface DUNE task ====== To enable communication between the IMC messages from DUNE, and the CAN bus used by the Torqeedo Interface Board, a new task has been created for use in the Otter. DUNE was also missing support for CAN, so this had to be added. ===== Task requirements ===== The task uses the [[socketcan_dune_implementation|SocketCAN DUNE implementation]], and so this task also needs to be run on a Linux kernel with SocketCAN enabled. This has been possible since kernel 2.6.25, and should be included by default on kernels from 2.8 and up. On the Raspian distribution, this works as soon as the CAN hardware has been configured, see [[sw_setup|Installing Raspian and enabling CAN bus]]. ===== How does the task work ===== The task is of the periodic type, which limits how often it runs. The frequency of the task can be set with the parameter ''%%Execution Frequency%%'', as all Periodic DUNE tasks can. The Torqeedo Interface Board typically sends 20-25 CAN messages per second, so the task has to be run with a frequency greater than this. In order to run the motors, it has to receive throttle controls at least once per second. One run of the task either reads a CAN message, or writes to the motors. To limit how often the motor is written to, a parameter called ''%%Motor write divider%%'' is set. A counter then count every time the task is run, and when ''%%Motor write divider%%'' is reached, the motors are written to, and the counter is reset. An example of this could be: You want the motor to be written to 4 times a second. Say you have set "Execution Frequency = 40", then you would have an "Motor write divider" of 40/4=10. In addition to reading information and controlling motor throttle, the task supports power control. This happens both when the parameters are read, and when the task receives an ''%%IMC::PowerChannelControl%%'' message