|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
Standalone C++ controller service. More...
#include <arpa/inet.h>#include <netinet/in.h>#include <sys/socket.h>#include <unistd.h>#include <atomic>#include <csignal>#include <cstdlib>#include <cstring>#include <fstream>#include <iostream>#include <map>#include <memory>#include <sstream>#include <string>#include <thread>#include <vector>#include "config/Config.hpp"#include "control/ControllerService.hpp"#include "control/PWMTargets.hpp"#include "control/RobustDDPController.hpp"#include "control/StateMachine.hpp"#include "net/DaqInterface.hpp"Go to the source code of this file.
Functions | |
| static std::string | resolveConfigPath (const std::string &config_path, const std::string &path) |
| Resolve path relative to config: paths like output/lut/... are relative to project root. | |
| static void | signalHandler (int) |
| static void | handleControlClient (int client_fd, fsw::control::ControllerService *svc) |
| static void | runControlServer (fsw::control::ControllerService *svc, uint16_t port) |
| int | main (int argc, char *argv[]) |
Variables | |
| static std::atomic< bool > | g_running {true} |
| constexpr size_t | kMaxControlClients = 64 |
Standalone C++ controller service.
Reads config.toml for actuator board settings, initializes the RobustDDPController, and runs the control loop sending PWM commands to actuator boards over UDP.
Usage: ./controller_service [–config /path/to/config.toml] [–elodin-host HOST] [–elodin-port PORT] [–thrust N]
Default config path: ../../config/config.toml (relative to binary)
Definition in file controller_main.cpp.
|
static |
Definition at line 75 of file controller_main.cpp.
References g_running, fsw::control::ControllerService::isFireGateEnabled(), reply(), send(), and fsw::control::ControllerService::setFireActive().
Referenced by runControlServer().
| int main | ( | int | argc, |
| char * | argv[] ) |
Definition at line 223 of file controller_main.cpp.
References fsw::control::ControllerService::PWMConfig::actuator_port, fsw::control::ControllerService::PWMConfig::bind_address, fsw::control::ControllerService::PWMConfig::duration_ms, fsw::control::ControllerService::PWMConfig::frequency_hz, fsw::control::ControllerService::PWMConfig::fuel, g_running, fsw::control::ControllerService::initialize(), fsw::control::ControllerService::is_running(), fsw::config::load(), sequencer::StateMachine::loadStatesFromConfig(), fsw::control::ControllerService::PWMConfig::ox, fsw::control::RobustDDPController::Config::P_copv_min, fsw::control::RobustDDPController::Command::P_fuel_target, fsw::control::RobustDDPController::Command::P_ox_target, fsw::control::RobustDDPController::PRESSURE_TARGET, resolveConfigPath(), fsw::net::resolveDaqBindAddress(), fsw::control::resolvePWMTargets(), runControlServer(), fsw::control::ControllerService::setCommand(), fsw::control::ControllerService::setFireGateEnabled(), fsw::control::ControllerService::setFireStateId(), fsw::control::ControllerService::setTestDuty(), signalHandler(), fsw::control::ControllerService::start(), sequencer::StateMachine::stateId(), fsw::control::ControllerService::stop(), fsw::control::RobustDDPController::THRUST_DESIRED, fsw::control::RobustDDPController::Command::thrust_desired, and fsw::control::RobustDDPController::Command::type.
|
static |
Resolve path relative to config: paths like output/lut/... are relative to project root.
Definition at line 43 of file controller_main.cpp.
References path::empty(), and path::size().
Referenced by main().
|
static |
Definition at line 127 of file controller_main.cpp.
References g_running, handleControlClient(), kMaxControlClients, port, and send().
Referenced by main().
|
static |
Definition at line 56 of file controller_main.cpp.
References g_running.
|
static |
Definition at line 54 of file controller_main.cpp.
Referenced by handleControlClient(), main(), runControlServer(), and signalHandler().
|
constexpr |
Definition at line 72 of file controller_main.cpp.
Referenced by runControlServer().