STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
ControllerService.cpp File Reference

C++ controller service with UDP PWM output. More...

#include "control/ControllerService.hpp"
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <unistd.h>
#include <chrono>
#include <cstring>
#include <fstream>
#include <iostream>
#include <sstream>
#include <thread>
#include "comms/messages/control/ControllerMessages.hpp"
#include "comms/messages/sensor/CalibratedPTMessage.hpp"
#include "comms/messages/sensor/SensorMessages.hpp"
#include "control/RobustDDPController.hpp"
#include "db.hpp"
#include "elodin/ElodinClient.hpp"
#include "net/DaqInterface.hpp"
Include dependency graph for ControllerService.cpp:

Go to the source code of this file.

Namespaces

namespace  fsw
 Motorized ball valve position: raw ADC counts -> % open.
namespace  fsw::control

Functions

template<typename T>
static bool fsw::control::send_msg (fsw::elodin::ElodinClient &client, T msg)

Variables

static constexpr uint8_t fsw::control::PACKET_TYPE_PWM = 10
static constexpr uint8_t fsw::control::COMMS_VERSION = 0
static constexpr size_t fsw::control::HEADER_SIZE = 6
static constexpr size_t fsw::control::BODY_SIZE = 1
static constexpr size_t fsw::control::CMD_SIZE = 13
static constexpr size_t fsw::control::SINGLE_CMD_PACKET_SIZE = HEADER_SIZE + BODY_SIZE + CMD_SIZE
static constexpr size_t fsw::control::DUAL_CMD_PACKET_SIZE = HEADER_SIZE + BODY_SIZE + CMD_SIZE * 2

Detailed Description

C++ controller service with UDP PWM output.

Pipeline:

  1. Reads sensor measurements (pushed via setMeasurement)
  2. Runs RobustDDPController::step() to compute actuation
  3. Sends PWM command packets over UDP to actuator board (exact combined_gui.py packet format)
  4. Optionally writes to Elodin DB for logging

Definition in file ControllerService.cpp.