![]() |
fastcat 0.13.15
C++ EtherCAT Device Command & Control Library
|
Fastcat::Manager is the main application interface to manage all fastcat devices. More...
#include "manager.h"
Public Member Functions | |
| Manager () | |
| ~Manager () | |
| void | Shutdown () |
| Shutdown the bus and joins all threads. | |
| bool | ConfigFromYaml (const YAML::Node &node, double external_time=-1) |
| Method that accepts a fastcat topology yaml and intializes bus. | |
| bool | CreateConfigFromYaml (const YAML::Node &node, double external_time=-1) |
| Parses YAML configuration and creates device objects (no hardware init) | |
| bool | InitHardware () |
| Initializes EtherCAT hardware (executes deferred jsd_init calls) | |
| bool | Process (double external_time=-1) |
| Updates synchronous PDO and background async SDO requests. | |
| void | QueueCommand (DeviceCmd &cmd) |
| Interface to command devices on the bus. | |
| std::vector< DeviceState > | GetDeviceStates () |
| Returns list of device states. | |
| std::vector< std::shared_ptr< const DeviceState > > | GetDeviceStatePointers () |
| Returns list of device state pointers. | |
| double | GetTargetLoopRate () |
Public getter to the YAML target_loop_rate_hz parameter. | |
| bool | IsFaulted () |
| Public getter retrieve fault status. | |
| bool | RecoverBus (std::string ifname) |
| Attempts to recover a faulty JSD bus by name. | |
| bool | ExecuteDeviceReset (std::string device_name) |
| Triggers a single device to reset. | |
| bool | ExecuteDeviceFault (std::string device_name) |
| Triggers a single device to fault. | |
| void | ExecuteAllDeviceResets () |
| Triggers all devices to Reset. | |
| void | ExecuteAllDeviceFaults () |
| Triggers all devices to Fault. | |
| bool | IsSdoResponseQueueEmpty () |
| checks if the SdoResponse Queue is empty | |
| bool | PopSdoResponseQueue (SdoResponse &res) |
| get the result of a background SDO operation | |
| bool | GetActuatorParams (const std::string &name, fastcat::Actuator::ActuatorParams ¶m) |
| get actuator parameters | |
| void | GetDeviceNamesByType (std::vector< std::string > &, fastcat::DeviceStateType) |
| names of actuator devices | |
| void | SetExplicitInterpolationAlgorithmCubic () |
| Set interpolation algorithm to use 3rd order cubic interpolation between knot points for all actuators. | |
| void | SetExplicitInterpolationAlgorithmLinear () |
| Set interpolation algorithm to use 1st order linear interpolation between knot points for both position and velocity for all actuators. | |
| void | SetExplicitInterpolationTimestampSourceCspMessage () |
| Set interpolation algorithm to use the timestamp in the CSP message generated by the calling module for determining time of interpolation knot-points, which accounts for latency in message passing. | |
| void | SetExplicitInterpolationTimestampSourceClock () |
| Set interpolation algorithm to use the timestamp when the CSP message was received according to fastcat's clock; this mode of interpolation does not account for latency in message passing. | |
| bool | SetExplicitInterpolationCyclesDelay (size_t delay) |
| Set number of cycles of the calling module to delay the onset of explicit interpolation, e.g. if delay is set to 3, fastcast will wait until 4 messages accumulate in the buffer before beginning motion profile. A larger buffer provides a greater margin against motion setpoints not being received fast enough as motion profile is executing, which may happen due to process jitter or message passing latency. | |
| bool | SetInterpolationCyclesStale (size_t cycles) |
| CSP interpolation will transition to a holding state if it has not received a CSP message within the provided number of fastcat process cycles. | |
Fastcat::Manager is the main application interface to manage all fastcat devices.
| fastcat::Manager::Manager | ( | ) |
| fastcat::Manager::~Manager | ( | ) |
| bool fastcat::Manager::ConfigFromYaml | ( | const YAML::Node & | node, |
| double | external_time = -1 |
||
| ) |
Method that accepts a fastcat topology yaml and intializes bus.
| bool fastcat::Manager::CreateConfigFromYaml | ( | const YAML::Node & | node, |
| double | external_time = -1 |
||
| ) |
Parses YAML configuration and creates device objects (no hardware init)

| void fastcat::Manager::ExecuteAllDeviceFaults | ( | ) |
Triggers all devices to Fault.
This function loops over all devices in the topology and calls their DeviceBase::Fault() Method. An example usage is a soft-stop GUI button that can be used to arrest motion.
| void fastcat::Manager::ExecuteAllDeviceResets | ( | ) |
Triggers all devices to Reset.
This function loops over all devices in the topology and calls their DeviceBase::Reset() Method.
| bool fastcat::Manager::ExecuteDeviceFault | ( | std::string | device_name | ) |
Triggers a single device to fault.
| device_name | the name of the device to fault, calls its Fault() method |
| bool fastcat::Manager::ExecuteDeviceReset | ( | std::string | device_name | ) |
Triggers a single device to reset.
| device_name | the name of the device to reset, calls its Reset() method |
| bool fastcat::Manager::GetActuatorParams | ( | const std::string & | name, |
| fastcat::Actuator::ActuatorParams & | param | ||
| ) |
get actuator parameters
| void fastcat::Manager::GetDeviceNamesByType | ( | std::vector< std::string > & | names, |
| fastcat::DeviceStateType | device_state_type | ||
| ) |
names of actuator devices
| std::vector< std::shared_ptr< const fastcat::DeviceState > > fastcat::Manager::GetDeviceStatePointers | ( | ) |
Returns list of device state pointers.
Provided for potential optimization. GetDeviceStates() generally performs better. This function is not intended to be called in a realtime process loop because it dynamically allocates memory to hold a vector of device state pointers.
| std::vector< fastcat::DeviceState > fastcat::Manager::GetDeviceStates | ( | ) |
Returns list of device states.
| double fastcat::Manager::GetTargetLoopRate | ( | ) |
Public getter to the YAML target_loop_rate_hz parameter.
| bool fastcat::Manager::InitHardware | ( | ) |
Initializes EtherCAT hardware (executes deferred jsd_init calls)
| bool fastcat::Manager::IsFaulted | ( | ) |
Public getter retrieve fault status.
| bool fastcat::Manager::IsSdoResponseQueueEmpty | ( | ) |
checks if the SdoResponse Queue is empty
| bool fastcat::Manager::PopSdoResponseQueue | ( | SdoResponse & | res | ) |
get the result of a background SDO operation
If the SDO Response queue contains any responses, this function pops the oldest value and returns it to the application.
| bool fastcat::Manager::Process | ( | double | external_time = -1 | ) |
Updates synchronous PDO and background async SDO requests.
Process() proceeds by
Triggers PDO Write on EtherCAT bus
Note: For best performance, the application should call the Manager::Process() function at the same frequency as the input YAML field target_loop_rate_hz. This parameter is needed by certain devices for profiling and filtering.
| external_time | Supply an external time if desired, otherwise defaults to jsd supplied system time |
| void fastcat::Manager::QueueCommand | ( | DeviceCmd & | cmd | ) |
Interface to command devices on the bus.
Commands each have a name field and that name is used to dispatch the command to the right device. If the provided name is not found on the loaded bus topology, a warning message is printed to stdout but no faults are triggered.
| bool fastcat::Manager::RecoverBus | ( | std::string | ifname | ) |
Attempts to recover a faulty JSD bus by name.
A bus fault example is spurious Working Counter (WKC) error, or perhaps an intended power cycle of a configured EtherCAT slave.
| ifname | the name of the JSD bus configured in the input topology YAML |
| void fastcat::Manager::SetExplicitInterpolationAlgorithmCubic | ( | ) |
Set interpolation algorithm to use 3rd order cubic interpolation between knot points for all actuators.
| void fastcat::Manager::SetExplicitInterpolationAlgorithmLinear | ( | ) |
Set interpolation algorithm to use 1st order linear interpolation between knot points for both position and velocity for all actuators.
| bool fastcat::Manager::SetExplicitInterpolationCyclesDelay | ( | size_t | delay | ) |
Set number of cycles of the calling module to delay the onset of explicit interpolation, e.g. if delay is set to 3, fastcast will wait until 4 messages accumulate in the buffer before beginning motion profile. A larger buffer provides a greater margin against motion setpoints not being received fast enough as motion profile is executing, which may happen due to process jitter or message passing latency.
| void fastcat::Manager::SetExplicitInterpolationTimestampSourceClock | ( | ) |
Set interpolation algorithm to use the timestamp when the CSP message was received according to fastcat's clock; this mode of interpolation does not account for latency in message passing.
| void fastcat::Manager::SetExplicitInterpolationTimestampSourceCspMessage | ( | ) |
Set interpolation algorithm to use the timestamp in the CSP message generated by the calling module for determining time of interpolation knot-points, which accounts for latency in message passing.
| bool fastcat::Manager::SetInterpolationCyclesStale | ( | size_t | cycles | ) |
CSP interpolation will transition to a holding state if it has not received a CSP message within the provided number of fastcat process cycles.
| void fastcat::Manager::Shutdown | ( | ) |
Shutdown the bus and joins all threads.
Also Writes Actuator positions to file if applicable.