mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/TACOS.git
synced 2025-08-06 09:37:34 +00:00
doc: Added READMEs for TACOS usage
This commit is contained in:
93
include/sta/README.md
Normal file
93
include/sta/README.md
Normal file
@@ -0,0 +1,93 @@
|
||||
# TACOS.hpp
|
||||
|
||||
The TACOS API is defined in the tacos.hpp, in normal use cases you should only need to include this file.
|
||||
|
||||
## Functions
|
||||
|
||||
```cpp
|
||||
uint16_t getState()
|
||||
```
|
||||
|
||||
Retrieves the current state of the TACOS state machine.
|
||||
|
||||
---
|
||||
```cpp
|
||||
void requestState(uint32_t from, uint32_t to, uint32_t lockout = 0, bool publish = true)
|
||||
```
|
||||
|
||||
Requests a state transition. Invalid state transitions will be dismissed. First come, first serve.
|
||||
|
||||
- **Parameters**:
|
||||
- `from`: The starting state for the transition.
|
||||
- `to`: The target state to transition to.
|
||||
- `lockout`: (Optional) A timer to block further transitions.
|
||||
- `publish`: (Optional) Whether to publish the state transition to the CAN bus.
|
||||
|
||||
```cpp
|
||||
void forceState(uint32_t from, uint32_t to, uint32_t lockout = 0, bool publish = true)
|
||||
```
|
||||
|
||||
Forces a state transition. Will be ignored if already in the given state. Triggers instantly.
|
||||
|
||||
- **Parameters**:
|
||||
- `from`: The starting state for the transition.
|
||||
- `to`: The target state to transition to.
|
||||
- `lockout`: (Optional) A timer to block further transitions.
|
||||
- `publish`: (Optional) Whether to publish the state transition to the CAN bus.
|
||||
|
||||
---
|
||||
|
||||
```cpp
|
||||
void setStateTimed(uint32_t from, uint32_t to, uint32_t millis, uint32_t lockout = 0, bool publish = false)
|
||||
```
|
||||
|
||||
Requests a state transition after a specified time.
|
||||
|
||||
- **Parameters**:
|
||||
- `from`: The starting state.
|
||||
- `to`: The target state.
|
||||
- `millis`: The wait time in milliseconds before requesting the transition.
|
||||
- `lockout`: (Optional) A timer for blocking subsequent transitions.
|
||||
|
||||
---
|
||||
|
||||
```cpp
|
||||
template<typename T, typename ... Args> std::shared_ptr<T> addThread(std::set<uint16_t> states, Args ... args)
|
||||
```
|
||||
|
||||
Registers a new thread to be run by TACOS.
|
||||
|
||||
- **Template Parameters**:
|
||||
- `T`: The class type of the thread, which should inherit from `TacosThread`.
|
||||
- **Parameters**:
|
||||
- `states`: A set of states in which the thread should be active.
|
||||
- `args`: The constructor arguments for the thread class.
|
||||
|
||||
---
|
||||
|
||||
### CAN Bus Functions (Conditional)
|
||||
|
||||
The following functions are available only if `STA_TACOS_CAN_BUS_ENABLED` is defined:
|
||||
|
||||
```cpp
|
||||
bool queueCanBusMsg(CanSysMsg & msg, uint32_t timeout)
|
||||
```
|
||||
|
||||
Queues a message to be sent over the CAN bus.
|
||||
|
||||
- **Parameters**:
|
||||
- `msg`: The message to be sent.
|
||||
- `timeout`: The maximum time to wait for sending the message.
|
||||
|
||||
---
|
||||
|
||||
```cpp
|
||||
bool publishState(uint32_t from, uint32_t to, uint32_t timeout = 0)
|
||||
```
|
||||
|
||||
Publishes a state transition message to the CAN bus.
|
||||
|
||||
- **Parameters**:
|
||||
- `from`: The starting state for the transition.
|
||||
- `to`: The target state.
|
||||
- `timeout`: (Optional) A timeout for CAN communication.
|
23
include/sta/tacos/README.md
Normal file
23
include/sta/tacos/README.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# TACOS tasks and prototypes
|
||||
|
||||
## Statemachine
|
||||
The statemachine is the core of TACOS. It is responsible for managing the state of the system and executing the threads that are registered to it. The statemachine is a singleton and can be accessed via `sta::tacos::Statemachine::instance()`.
|
||||
|
||||
For further info check the file or the doxygen documentation.
|
||||
|
||||
## Watchdog
|
||||
The watchdog checks if all threads are setting a flag after every func call. If a thread does not set the flag in the given interval the thread is restarted.
|
||||
|
||||
The watchdog is enabled and configured with the following defines:
|
||||
```cpp
|
||||
#define STA_RTOS_WATCHDOG_ENABLE
|
||||
#define STA_TACOS_WATCHDOG_FREQUENCY 10000
|
||||
```
|
||||
|
||||
## CAN Bus
|
||||
The CAN bus is used to communicate between different devices. The CAN bus task is triggered by IRQ from the transceiver or if something is inserted into it's output queue.
|
||||
|
||||
This thing is a huge steaming (but functioning) pile of shit. Further documentation is on hold until rework.
|
||||
|
||||
## Thread.hpp
|
||||
Here the TacosThread is defined. Very straight forward. Just take a look inside.
|
3
include/sta/tacos/c_api/README.md
Normal file
3
include/sta/tacos/c_api/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# TACOS C API
|
||||
|
||||
Currently the only C API is the entry point for starting up TACOS. This will be extended to provide full functionality via C calling conventions.
|
Reference in New Issue
Block a user