yarp-devices
CanBusBroker

This device offers a custom way of interfacing with wrapped raw subdevices through yarp::dev::IRemoteVariables. Available variables depend on the implementation of the subdevice; e.g. enableIp, ipMode, ipPeriodMs and enableCsv presented in the below examples are provided by the TechnosoftIpos device and parsed in the corresponding implementation of the yarp::dev::IRemoteVariablesRaw interface.


**getRemoteVariablesList**

Lists all CAN node IDs prepended with "ID", e.g. (ID15 ID16 ...).

  • RPC sample usage: [get] [ivar] [lvar]
  • Response: (ID15 ID16 ID17 ID18 ID19 ID20)

**getRemoteVariable**

Retrieves all available key-value pairs for the selected node. Calls getRemoteVariablesListRaw to get raw keys and then iterates on getRemoteVariableRaw. The presence of additional surrounding parentheses is due to how the mapper device works and to keep being compatible with yarpmotorgui.

  • RPC sample usage: [get] [ivar] [mvar] ID15
  • Response: (((ipMode pvt) (ipPeriodMs 50) (enableIp 0) (enableCsv 1)))

If key equals all, it returns remote vars for all available CAN nodes.

  • RPC sample usage: [get] [ivar] [mvar] all
  • Response: ((ID15 (ipMode pt) (ipPeriodMs 50) (enableIp 0) (enableCsv 0)) (ID16 (ipMode pt) (ipPeriodMs 50) (enableIp 0) (enableCsv 0)) (ID17 (ipMode pt) (ipPeriodMs 50) (enableIp 0) (enableCsv 0)) (ID18 (ipMode pt) (ipPeriodMs 50) (enableIp 0) (enableCsv 0)) (ID19 (ipMode pt) (ipPeriodMs 50) (enableIp 0) (enableCsv 0)) (ID20 (ipMode pt) (ipPeriodMs 50) (enableIp 0) (enableCsv 0)))

**setRemoteVariable**

Requires a key-value two-element bottle, value is a nested list.

  • RPC sample usage: [set] [ivar] [mvar] ID15 (enableCsv 1)

Multiple keys can be bound per call, just nest them within an additional layer of bottles.

  • RPC sample usage: [set] [ivar] [mvar] ID15 ((ipMode pvt) (ipPeriodMs 20) (enableIp 1))

Same strategy works if you want to set the exact same remote variable (or variables) for all available nodes, just use all as key.

  • RPC sample usage: [set] [ivar] [mvar] all (enableCsv 1)
  • RPC sample usage: [set] [ivar] [mvar] all ((ipMode pvt) (ipPeriodMs 20) (enableIp 1))

It is also possible to target multiple nodes in a single call, and set one or more remote variables at once. Use multi as key.

  • RPC sample usage: [set] [ivar] [mvar] multi ((ID15 (enableCsv 1)) (ID16 (enableCsv 1)))
  • RPC sample usage: [set] [ivar] [mvar] multi ((ID15 (enableIp 1) (enableCsv 1)) (ID16 (enableCsv 1)))