TurnTables
Classes and structures for controlling motorised rotary tables used during
scan acquisition. All types are in the turntables namespace.
-
namespace turntables
Namespace for TurnTables library, that provides interface for controlling turn tables.
Enums
-
enum class TableError : uint32_t
Values:
-
enumerator not_controllable
Can not be controlled.
-
enumerator plugin_does_not_exist
Plugin controller does not exist.
-
enumerator usb_port_not_available
Specified USB port is not available.
-
enumerator ximc_not_initialized
Communication with table can not be initialized (XIMCCOntroller).
-
enumerator not_controllable
-
struct BuiltInTableParams
- #include <TableParams.h>
Parameters used for connection and control of built-in supported rotary tables.
Public Functions
-
inline explicit BuiltInTableParams(const std::string &in_usb_port, const uint32_t &in_rotation_speed, const uint32_t &in_rotation_acceleration, const uint32_t &in_microsteps_per_rev)
-
inline explicit BuiltInTableParams(const std::string &in_usb_port)
Public Members
-
std::string usb_port
Identification of USB port where is rotary table plugged.
Example For Windows: “COM3” Example For Linux: “/dev/ttyUSB0”
-
uint32_t microsteps_per_rev = 480000
Number of micro steps of motor needed for 360 degree revolution (Standa rotary table) - this depend on the model of Standa rotary table.
-
inline explicit BuiltInTableParams(const std::string &in_usb_port, const uint32_t &in_rotation_speed, const uint32_t &in_rotation_acceleration, const uint32_t &in_microsteps_per_rev)
-
class ComXimController
- #include <ComXimController.h>
Interface to control the ComXim rotation table.
List of all available serial messages for a table:
CT+SPKMUTE(<is_mute>); Mute or unmute the beep. <is_mute> 0 or 1 CT+SETSPEED(<speed>); Set rotation speed. <speed> integer CT+TRUNSINGLE(<direction>, <angle>); Makes a single turn. <direction> -1 or 1 <angle> integer in degrees CT+START(<direction>, <turn_mode>, <shutter>, <angle>, <wait_time>, <wait_time>, <num_repeat>); Starts turning in CONTINUOUS or INTERMITTENT mode. <direction> -1 or 1 <turn_mode> 0 for CONTINUOUS or 1 for INTERMITTENT <shutter> 0 or 1 <angle> integer in degrees <wait_time> integer pause length in INTERMITTENT mode <num_repeat> integer number of turns in INTERMITTENT mode
Public Functions
-
explicit ComXimController(const std::string &port_str, ComXimSettings settings = {})
Connect to a device on a specified serial port.
- Parameters:
port_str – Serial port id, e.g. “/dev/ttyUSB0” on linux, or “COM1” on Windows.
settings – Controller settings.
- Throws:
std::runtime_error – When connection to serial port can not be established.
-
~ComXimController()
-
bool Rotate(float angle, double timeout = 60.0)
SendRotateCommand the table by a specified angle and wait for motion to finish.
- Parameters:
angle – Rotation angle in degrees.
timeout – Timeout [s] to wait for table to finish rotation before returning failure.
Public Static Functions
-
static bool TestSerialPort(const std::string &serial_port_id)
Check if a correct device is connected on a specified usb port.
-
explicit ComXimController(const std::string &port_str, ComXimSettings settings = {})
-
struct ComXimSettings
-
class ComXimTable : public turntables::Table
- #include <ComXimTable.h>
ComXim rotary table controller operated via USB.
Public Functions
-
explicit ComXimTable(BuiltInTableParams params)
-
virtual bool Rotate(float angle_deg) override
Commands table to rotate by a specific number of degrees.
Protected Functions
-
virtual TableStatus CheckStatus() const override
Re-check table status.
-
explicit ComXimTable(BuiltInTableParams params)
-
class PluginTable : public turntables::Table
- #include <PluginTable.h>
Plugin rotary table controller - a table controlled by a command line application.
Public Functions
-
explicit PluginTable(const PluginTableParams ¶ms)
-
virtual ~PluginTable()
-
virtual bool Rotate(float angle_deg) override
Commands table to rotate by a specific number of degrees.
Protected Functions
-
virtual TableStatus CheckStatus() const override
Refresh table status.
-
explicit PluginTable(const PluginTableParams ¶ms)
-
struct PluginTableParams
- #include <TableParams.h>
Parameters used for connection and control of plugin-controlled rotary tables.
Public Functions
-
inline explicit PluginTableParams(const std::string &pbp, const std::string &pn)
-
inline explicit PluginTableParams(const std::string &pbp, const std::string &pn)
-
struct RotationParams
- #include <RotationParams.h>
Rotary Table rotation parameters.
Public Functions
-
inline RotationParams()
Initialize with 16 rotation steps that complete a full circle.
-
inline explicit RotationParams(size_t num_rotations)
Initialize with a specified number of rotation steps that complete a full circle.
-
inline explicit RotationParams(const std::vector<float> &angles)
Initialize with specified angles [deg].
Public Members
-
std::vector<float> rotation_angles = {}
Ordered list of rotation angles [deg].
-
std::chrono::milliseconds rotation_delay = {0}
Delay after each rotation. Allows objects to stabilize before capturing the next scan.
-
std::chrono::seconds timeout = {15}
Timeout after which the connection to rotation table is evaluated as not responding.
-
inline RotationParams()
-
class Table
- #include <Table.h>
Abstract base class for turntable controllers.
Subclassed by turntables::ComXimTable, turntables::PluginTable, turntables::XIMCTable
Public Functions
-
Table()
-
~Table()
-
TableStatus GetStatus() const
Get table status.
-
virtual bool Rotate(float angle_deg) = 0
Commands table to rotate by a specific number of degrees.
Protected Functions
-
virtual TableStatus CheckStatus() const = 0
Re-check table status.
-
Table()
-
class TableConnectionBuilder
- #include <TableConnectionBuilder.h>
Tries to connect to a rotary table.
Public Types
-
using Result = std::pair<std::shared_ptr<Table>, TableStatus>
Public Static Functions
-
static Result Connect(const turntables::PluginTableParams ¶ms)
Builds a connection to a rotary table with using a plugin - a command-line controller application.
-
static Result Connect(const turntables::BuiltInTableParams ¶ms)
Builds a connection to a rotary table using specified connection params or returns nullptr.
-
using Result = std::pair<std::shared_ptr<Table>, TableStatus>
-
class TableDriver
- #include <TableDriver.h>
Class that controls arbitrary turn table models.
-
struct TableStatus
Public Functions
-
bool IsOk() const
Is table status Ok.
Public Members
-
utils::EnumFlags<TableError> errors
A list of errors.
Public Static Attributes
-
static const TableStatus OK
OK Status - no errors, connection to TurnTable successful.
-
bool IsOk() const
-
class XIMCTable : public turntables::Table
- #include <XIMCTable.h>
XIMC Rotary table controller - operated via USB connection.
Public Functions
-
explicit XIMCTable(const BuiltInTableParams ¶ms)
-
virtual ~XIMCTable()
-
virtual bool Rotate(float angle_deg) override
Commands table to rotate by a specific number of degrees.
Protected Functions
-
virtual TableStatus CheckStatus() const override
Re-check table status.
-
explicit XIMCTable(const BuiltInTableParams ¶ms)
-
enum class TableError : uint32_t