Class Interface#

Nested Relationships#

Nested Types#

Class Documentation#

class Interface#

interface class for a slit device

This class defines the interface for each slit 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)#
void publish_status(bool force = false)#
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 home(std::string args, std::string &help)#

home all daisy-chained motors

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

return the home state of the motors

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

set the slit offset only

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 get(std::string &retstring)#

get the current width and offset

long get()#

get the current width and offset

long read_positions(float &width, float &offset, float &posa, float &posb)#
long read_positions(float &width, float &offset)#
long move_abs(int addr, float pos)#

send move-absolute command to specified controllers

long move_rel(std::string args)#

send move-relative command to specified controllers

long stop()#

send the stop-all-motion command to all controllers

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

writes the raw command as received to the master controller

Public Members

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

SlitDimension maxwidth#
SlitDimension minwidth#

set by config file

SlitDimension center#

position of center in actuator units

Status status#
Status last_published_status#
std::mutex publish_mutex#

serializes publish-on-change

Common::Queue async#
Physik_Instrumente::Interface<Physik_Instrumente::ServoInfo> motorinterface#
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

Public Static Functions

static void dothread_move_abs(Slit::Interface &iface, int addr, float pos)#

threaded move_abs function

struct Status#

Public Functions

inline bool operator==(const Status &other) const#
inline bool operator!=(const Status &other) const#

Public Members

SlitDimension width#
SlitDimension offset#
float posA = NAN#
float posB = NAN#
bool ishome = false#
bool isopen = false#