6 #include <mpacklog/Logger.h>
81 void reset(
const palimpsest::Dictionary& config);
114 void simulate(
unsigned nb_substeps);
129 void cycle_actuation();
135 void log_working_dict();
Base class for actuation interfaces.
Memory map to shared memory.
Loop transmitting actions to the actuation and observations to the agent.
mpacklog::Logger logger_
Logger for the working_dict_ produced at each cycle.
AgentInterface agent_interface_
Shared memory mapping for inter-process communication.
std::future< actuation::moteus::Output > actuation_output_
Future used to wait for moteus replies.
const unsigned frequency_
Frequency of the spine loop in [Hz].
void run()
Run the spine loop until termination.
State state_cycle_beginning_
State after the last Event::kCycleBeginning.
State state_cycle_end_
State after the last Event::kCycleEnd.
void reset(const palimpsest::Dictionary &config)
Reset the spine with a new configuration.
StateMachine state_machine_
Internal state machine.
observation::ObserverPipeline observer_pipeline_
Pipeline of observers, executed in that order.
void simulate(unsigned nb_substeps)
Alternative to run where the actuation interface is cycled a fixed number of times,...
std::vector< char > ipc_buffer_
Buffer used to serialize/deserialize dictionaries in IPC.
std::vector< actuation::moteus::ServoReply > latest_replies_
Latest servo replies. They are copied and thread-safe.
void cycle()
Spin one cycle of the spine loop.
const bool & caught_interrupt_
Boolean flag that becomes true when an interruption is caught.
actuation::Interface & actuation_
Interface that communicates with actuators.
palimpsest::Dictionary working_dict_
All data from observation to action goes to this dictionary.
Spine(const Parameters ¶ms, actuation::Interface &interface, observation::ObserverPipeline &observers)
Initialize spine.
Inter-process communication protocol with the spine.
constexpr size_t kMebibytes
State
States of the state machine.
size_t shm_size
Size of the shared memory object in bytes.
std::string shm_name
Name of the shared memory object for inter-process communication.
unsigned frequency
Frequency of the spine loop in [Hz].
int cpu
CPUID for the spine thread (-1 to disable realtime).
std::string log_path
Path to output log file.