Class Interface#

Nested Relationships#

Nested Types#

Class Documentation#

class Interface#

interface class for a flexure device

This class defines the interface for each flexure controller and contains the functions used to communicate with it.

Public Functions

inline Interface()#
inline long init_pubsub(const std::initializer_list<std::string> &topics = {})#
inline void start_subscriber_thread()#
inline void stop_subscriber_thread()#
void handletopic_snapshot(const nlohmann::json &jmessage)#

respond to a snapshot request

void handletopic_tcsd(const nlohmann::json &jmessage)#

store TCS telemetry published by tcsd

void get_status()#

refresh status from hardware

void publish_status(bool force = false)#

publish flexure state on change (or force)

void request_tcs_snapshot()#

ask tcsd to publish a snapshot of its telemetry

bool wait_for_tcs_snapshot()#

wait for that snapshot to be received

long initialize_class()#
long open()#

opens the PI socket connection

long close()#

closes the PI socket connection

long is_open(std::string arg, std::string &retstring)#

are motor controllers connected?

long set(std::string args, std::string &retstring)#

set the slit width and offset

long get(std::string args, std::string &retstring)#

get the current width and offset

long compensate(std::string args, std::string &retstring)#

perform flexure compensation

void offset_tiptilt(const std::string &chan, const std::pair<double, double> &delta, bool is_dryrun)#
long stop()#

send the stop-all-motion command to all controllers

long send_command(const std::string &name, std::string cmd)#

writes the raw command as received to the master controller, no reply

long send_command(const std::string &name, std::string cmd, std::string &retstring)#

writes command?, reads reply

long test(std::string args, std::string &retstring)#

test routines

inline void validate_tcs_telemetry()#

Public Members

Physik_Instrumente::Interface<Physik_Instrumente::PiezoInfo> motorinterface#
std::unique_ptr<Common::PubSub> publisher#

publisher object

std::string publisher_address#

publish socket endpoint

std::string publisher_topic#

my default topic for publishing

std::unique_ptr<Common::PubSub> subscriber#

subscriber object

std::string subscriber_address#

subscribe socket endpoint

std::vector<std::string> subscriber_topics#

list of topics I subscribe to

std::atomic<bool> is_subscriber_thread_running#

is my subscriber thread running?

std::atomic<bool> should_subscriber_thread_run#

should my subscriber thread run?

std::unordered_map<std::string, std::function<void(const nlohmann::json&)>> topic_handlers#

maps a handler function to each topic

bool tcs_snapshot_status#
std::mutex snapshot_mutex#
Common::Queue async#
TcsInfo tcs_info#

defined in tcs_info.h

Compensator compensator#
std::mutex pi_mutex#

mutex to protect multi-threaded access to PI controller

volatile std::atomic<int> motors_running#

number of motors that are running in threads

volatile std::atomic<long> thr_error#

error state of threads

std::mutex wait_mtx#

mutex object for waiting for threads

std::condition_variable cv#

condition variable for waiting for threads