Welcome to pyrbs documentation!
pyrbs is a Restbus-Simulation package for Python that provides comprehensive tools for CAN bus communication, message handling, and signal processing.
Getting Started
Installation
the pyrbs package commes preinstalled on every pyCANdo device
a update of the package can be triggered via the pyCANdo Browser Dashboard or
the command line interface:
pcdusr@pycando42: ~/$ pcdup update
Quick Example
# ./rbs/main.py
from pyrbs import PyRbs, CanMessage, CanSignal, SysVar, Timer
# Initialize PyRbs
rbs = PyRbs()
# Define all the resources you need
msg_control_01: CanMessage = rbs.can_message.get("CAN1.Control_01")
sig_control_01_activate: CanSignal = rbs.can_signal.get("CAN1.Control_01.Activate")
crtl_activate: SysVar = rbs.sysvar.add("crtl_activate", 1)
timer_100ms: Timer = rbs.timer.add("timer_100ms", 0.1, active_on_start=True)
@rbs.timer.on("timer_100ms")
def on_timer_100ms(self: Timer):
msg_control_01.send()
sig_control_01_activate.raw = 1
@rbs.sysvar.on_change("crtl_activate")
def on_crtl_active_change(self):
if self.value == 0:
timer_100ms.stop()
sig_control_01_activate.raw = self.value