Go to the documentation of this file.
16 #ifndef SURGSIM_DEVICES_LABJACK_LABJACKDEVICE_H
17 #define SURGSIM_DEVICES_LABJACK_LABJACKDEVICE_H
21 #include <unordered_map>
22 #include <unordered_set>
31 class LabJackScaffold;
33 SURGSIM_STATIC_REGISTRATION(LabJackDevice);
406 void setTimers(
const std::unordered_map<int, LabJack::TimerSettings>& timers);
409 const std::unordered_map<int, LabJack::TimerSettings>&
getTimers()
const;
438 void setAnalogInputs(
const std::unordered_map<int, LabJack::AnalogInputSettings>& analogInputs);
441 const std::unordered_map<int, LabJack::AnalogInputSettings>&
getAnalogInputs()
const;
521 std::unordered_map<int, LabJack::TimerSettings>
m_timers;
536 #endif // SURGSIM_DEVICES_LABJACK_LABJACKDEVICE_H
void setTimerCounterPinOffset(int offset)
The timers and counters are always on consecutive pins, but the start pin can be varied within limits...
Definition: LabJackDevice.cpp:190
Definition: LabJackDevice.h:96
LabJack::Connection m_connection
The type of communication connection, e.g., USB.
Definition: LabJackDevice.h:489
bool operator==(const TimerSettings &other) const
Equality comparison.
Definition: LabJackDevice.h:185
Definition: LabJackDevice.h:86
Definition: LabJackDevice.h:66
Definition: LabJackDevice.h:65
LabJack::TimerBase getTimerBase() const
Definition: LabJackDevice.cpp:174
Definition: LabJackDevice.h:172
int getTimerCounterPinOffset() const
Definition: LabJackDevice.cpp:197
Definition: LabJackDevice.h:57
Definition: LabJackDevice.h:208
bool isInitialized() const override
Definition: LabJackDevice.cpp:85
MIO_LINE
Definition: LabJackDevice.h:82
Definition: LabJackDevice.h:46
Definition: LabJackDevice.h:112
void setAddress(std::string address)
Set the address of the LabJack, e.g., "1" or "192.168.7.23".
Definition: LabJackDevice.cpp:112
Definition: LabJackDevice.h:45
Definition: LabJackDevice.h:79
DAC
Definition: LabJackDevice.h:109
Definition: LabJackDevice.h:154
int m_timerClockDivisor
The timer clock's divisor, see m_timerBase.
Definition: LabJackDevice.h:515
Definition: LabJackDevice.h:77
Definition: LabJackDevice.h:128
int m_analogInputResolution
The resolution for all the analog inputs.
Definition: LabJackDevice.h:527
int getAnalogInputSettling() const
Definition: LabJackDevice.cpp:305
int getAnalogInputResolution() const
Definition: LabJackDevice.cpp:293
A class that implements the behavior of LabJackDevice objects.
Definition: LabJackScaffold.h:41
int m_timerCounterPinOffset
The number of the lowest FIO pin that is a timer or counter.
Definition: LabJackDevice.h:518
Definition: LabJackDevice.h:119
Definition: LabJackDevice.h:130
const std::unordered_map< int, LabJack::AnalogInputSettings > & getAnalogInputs() const
Definition: LabJackDevice.cpp:264
SURGSIM_CLASSNAME(SurgSim::Devices::LabJackDevice)
Definition: LabJackDevice.h:58
Definition: LabJackDevice.h:174
Definition: LabJackDevice.h:59
void enableAnalogOutput(int channel)
Enable analog output.
Definition: LabJackDevice.cpp:269
Definition: LabJackDevice.h:42
Definition: LabJackDevice.h:64
Definition: LabJackDevice.h:210
std::unordered_map< int, LabJack::TimerSettings > m_timers
A map from the timers' line numbers to their mode and optional initial value.
Definition: LabJackDevice.h:521
Definition: LabJackDevice.h:70
void setTimerClockDivisor(int divisor)
If the Timer type ends in "_DIV", then the actual timer frequency is divided by the divisor.
Definition: LabJackDevice.cpp:179
void setDigitalInputs(const std::unordered_set< int > &digitalInputChannels)
Set which digital input lines are enabled.
Definition: LabJackDevice.cpp:139
Definition: LabJackDevice.h:131
Definition: LabJackDevice.h:122
void setResetOnDestruct(bool reset)
Reset LabJack during destruct.
Definition: LabJackDevice.cpp:123
Definition: LabJackDevice.h:162
Definition: LabJackDevice.h:93
TIMER
Definition: LabJackDevice.h:40
const std::unordered_map< int, LabJack::TimerSettings > & getTimers() const
Definition: LabJackDevice.cpp:222
double getMaximumUpdateRate() const
Definition: LabJackDevice.cpp:234
void setConnection(LabJack::Connection connection)
Set the connection type of the LabJack, e.g., USB.
Definition: LabJackDevice.cpp:101
Definition: LabJackDevice.h:132
void setDigitalOutputs(const std::unordered_set< int > &digitalOutputChannels)
Set which digital output lines are enabled.
Definition: LabJackDevice.cpp:156
Definition: CompoundShapeToGraphics.cpp:29
Definition: LabJackDevice.h:100
Definition: LabJackDevice.h:144
const std::string & getAddress() const
Definition: LabJackDevice.cpp:118
Definition: LabJackDevice.h:175
Definition: LabJackDevice.h:145
Range
The analog input ranges. Equivalent to gain. Ignored for Linux scaffold, which auto-ranges.
Definition: LabJackDevice.h:198
Definition: LabJackDevice.h:164
double m_threadRate
The maximum update rate for the LabJackThread.
Definition: LabJackDevice.h:524
std::shared_ptr< LabJackScaffold > m_scaffold
The single scaffold object that handles communications with all instances of LabJackDevice.
Definition: LabJackDevice.h:483
void setAnalogInputSettling(int settling)
Set the settling time for all the analog inputs.
Definition: LabJackDevice.cpp:298
LabJack::Model m_model
The model, e.g., U6.
Definition: LabJackDevice.h:486
LabJack::TimerBase m_timerBase
The timer base, which is the frequency of all the output timers unless it ends in "_DIV",...
Definition: LabJackDevice.h:512
Definition: LabJackDevice.h:94
void enableDigitalOutput(int channel)
Enable digital output line.
Definition: LabJackDevice.cpp:150
Definition: LabJackDevice.h:68
Definition: LabJackDevice.h:147
CIO_LINE
Definition: LabJackDevice.h:74
Definition: LabJackDevice.h:98
Definition: LabJackDevice.h:206
Definition: LabJackDevice.h:171
Definition: LabJackDevice.h:140
Definition: LabJackDevice.h:201
AIN
Definition: LabJackDevice.h:89
Definition: LabJackDevice.h:153
void setAnalogOutputs(const std::unordered_set< int > &analogOutputChannels)
Set which analog outputs are enabled.
Definition: LabJackDevice.cpp:275
Definition: LabJackDevice.h:151
LabJackDevice(const std::string &uniqueName)
Constructor.
Definition: LabJackDevice.cpp:28
void setModel(LabJack::Model model)
Set the model, e.g., U6.
Definition: LabJackDevice.cpp:90
Definition: LabJackDevice.h:99
Definition: LabJackDevice.h:207
EIO_LINE
Definition: LabJackDevice.h:62
Definition: LabJackDevice.h:149
Connection
The connection (i.e., communication media) for LabJacks. Numbers come from LabJackUD....
Definition: LabJackDevice.h:126
Definition: LabJackDevice.h:97
Definition: LabJackDevice.h:95
void setAnalogInputResolution(int resolution)
Set the resolution for all the analog inputs.
Definition: LabJackDevice.cpp:286
std::unordered_set< int > m_analogOutputChannels
The line numbers for the analog outputs.
Definition: LabJackDevice.h:507
TimerMode
The timer modes.
Definition: LabJackDevice.h:160
Definition: LabJackDevice.h:204
Definition: LabJackDevice.h:43
const std::unordered_set< int > & getAnalogOutputs() const
Definition: LabJackDevice.cpp:281
Definition: LabJackDevice.h:84
Definition: LabJackDevice.h:44
void enableTimer(int index, LabJack::TimerMode mode)
Enable timer.
Definition: LabJackDevice.cpp:202
Definition: LabJackDevice.h:170
Definition: LabJackDevice.h:106
std::string m_address
The address, or a zero-length string to indicate the first-found device of this type on this connecti...
Definition: LabJackDevice.h:492
Definition: LabJackDevice.h:146
Definition: LabJackDevice.h:200
Definition: LabJackDevice.h:148
const std::unordered_set< int > & getDigitalInputs() const
Definition: LabJackDevice.cpp:145
Definition: LabJackDevice.h:55
void setAnalogInputs(const std::unordered_map< int, LabJack::AnalogInputSettings > &analogInputs)
Set which analog inputs are enabled.
Definition: LabJackDevice.cpp:256
std::unordered_set< int > m_digitalOutputChannels
The line numbers for the digital outputs.
Definition: LabJackDevice.h:504
Definition: LabJackDevice.h:141
FIO_LINE
Definition: LabJackDevice.h:50
Definition: LabJackDevice.h:166
Definition: LabJackDevice.h:120
Definition: LabJackDevice.h:105
TimerMode mode
The mode.
Definition: LabJackDevice.h:191
void setTimerBase(LabJack::TimerBase base)
Set the timer base rate.
Definition: LabJackDevice.cpp:168
void enableDigitalInput(int channel)
Enable digital input line.
Definition: LabJackDevice.cpp:133
Definition: LabJackDevice.h:101
Definition: LabJackDevice.h:47
Definition: LabJackDevice.h:203
void enableAnalogInput(int positiveChannel, LabJack::Range range, int negativeChannel)
Enable differential analog input.
Definition: LabJackDevice.cpp:239
Definition: LabJackDevice.h:150
Definition: LabJackDevice.h:142
Definition: LabJackDevice.h:54
Definition: LabJackDevice.h:102
Definition: LabJackDevice.h:56
Definition: LabJackDevice.h:104
Definition: LabJackDevice.h:111
TimerBase
The timer base frequencies for LabJacks.
Definition: LabJackDevice.h:138
Definition: LabJackDevice.h:143
bool initialize() override
Fully initialize the device.
Definition: LabJackDevice.cpp:51
Definition: LabJackDevice.h:205
SurgSim::DataStructures::OptionalValue< int > initialValue
The initial value.
Definition: LabJackDevice.h:194
bool m_reset
Whether or not the hardware should reset when this object destructs.
Definition: LabJackDevice.h:495
Definition: LabJackDevice.h:176
bool finalize() override
Finalize (de-initialize) the device.
Definition: LabJackDevice.cpp:77
Definition: LabJackDevice.h:152
Definition: LabJackDevice.h:168
Definition: LabJackDevice.h:121
Definition: LabJackDevice.h:91
int m_analogInputSettling
The settling time for all the analog inputs.
Definition: LabJackDevice.h:530
int getTimerClockDivisor() const
Definition: LabJackDevice.cpp:185
bool getResetOnDestruct() const
Get whether or not the hardware should reset when the LabJackDevice object destructs.
Definition: LabJackDevice.cpp:128
Definition: LabJackDevice.h:69
Definition: LabJackDevice.h:173
const std::unordered_set< int > & getDigitalOutputs() const
Definition: LabJackDevice.cpp:163
Definition: LabJackDevice.h:71
A class implementing the communication with a LabJack data acquisition (DAQ) device.
Definition: LabJackDevice.h:274
Definition: LabJackDevice.h:76
LabJack::Connection getConnection() const
Definition: LabJackDevice.cpp:107
void setTimers(const std::unordered_map< int, LabJack::TimerSettings > &timers)
Set which timers are enabled.
Definition: LabJackDevice.cpp:216
LabJack::Model getModel() const
Definition: LabJackDevice.cpp:96
Definition: LabJackDevice.h:209
Definition: LabJackDevice.h:167
Definition: LabJackDevice.h:67
Model
The models of LabJack devices. Numbers come from LabJackUD.h.
Definition: LabJackDevice.h:117
virtual ~LabJackDevice()
Destructor.
Definition: LabJackDevice.cpp:43
Definition: LabJackDevice.h:92
Definition: LabJackDevice.h:103
Definition: LabJackDevice.h:53
Definition: LabJackDevice.h:78
Definition: LabJackDevice.h:163
Definition: LabJackDevice.h:52
Definition: LabJackDevice.h:129
Definition: LabJackDevice.h:165
void setMaximumUpdateRate(double rate)
Set the maximum update rate for the LabJackThread.
Definition: LabJackDevice.cpp:227
A struct holding the data to be associated with a Timer.
Definition: LabJackDevice.h:180
std::unordered_set< int > m_digitalInputChannels
The line numbers for the digital inputs.
Definition: LabJackDevice.h:498
std::unordered_map< int, LabJack::AnalogInputSettings > m_analogInputs
The analog inputs. The key is the positive channel.
Definition: LabJackDevice.h:501
Definition: LabJackDevice.h:202
Definition: LabJackDevice.h:169
Definition: LabJackDevice.h:85