@@ -48,6 +48,17 @@ Message level constants:
4848* `hal.MSG_DBG` - Additionally include debugging information
4949* `hal.MSG_ALL` - Print all messages encountered, disregarding level
5050
51+ Realtime type constants:
52+
53+ * `hal.REALTIME_TYPE_UNINITIALIZED` - Real time module not running
54+ * `hal.REALTIME_TYPE_NONE` - No realtime available
55+ * `hal.REALTIME_TYPE_RTAI` - RTAI kernel mode
56+ * `hal.REALTIME_TYPE_PREEMPT_DYNAMIC` - Preempt dynamic: avaliable in vanilla kernel, not recommended
57+ * `hal.REALTIME_TYPE_PREEMPT_RT` - Preempt RT
58+ * `hal.REALTIME_TYPE_LXRT` - LXRT, userspace implementation for RTAI
59+ * `hal.REALTIME_TYPE_XENOMAI` - Xenomai 3
60+ * `hal.REALTIME_TYPE_XENOMAI_EVL` - Xenomai 4 aka Xenomai EVL
61+
5162System information:
5263
5364* `hal.is_kernelspace` - One (1) if RTAPI runs in the kernel, otherwise zero (0)
@@ -59,6 +70,31 @@ System information:
5970
6071=== hal methods
6172
73+ hal.is_initialized()::
74+ Returns a boolean to indicate whether hal is initialized. The hal is initialized when there is
75+ at least one component. If this is not the case, many of the following functions will
76+ fail with the error: `Cannot call before creating component`
77+
78+ .Example:
79+ [source,python]
80+ ----
81+ #The hal must be initialized to use get_realtime_type()
82+ #If it is not initialized, create a component which will initialize it
83+ #The component will be cleaned up after comp goes out of scope
84+ #Use pid as component identifier, so it is unlikely to collide
85+ #with existing components
86+ comp_name = f"halpy{os.getpid()}"
87+ if not hal.is_initialized():
88+ comp = hal.component(comp_name);
89+
90+ type = hal.get_realtime_type()
91+ ----
92+
93+ hal.get_realtime_type()::
94+ Returns the type of the running realtime system.
95+ Might return `hal.REALTIME_TYPE_UNINITIALIZED` if `rtapi_app` is not running.
96+ See xref:_hal_constants[realtime type constants].
97+
6298hal.component_exists(_name_:string)::
6399Returns a boolean to indicate whether or not the specified component exist at this time.
64100
0 commit comments