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;
393 void setTimers(
const std::unordered_map<int, LabJack::TimerSettings>& timers);
396 const std::unordered_map<int, LabJack::TimerSettings>&
getTimers()
const;
425 void setAnalogInputs(
const std::unordered_map<int, LabJack::AnalogInputSettings>& analogInputs);
428 const std::unordered_map<int, LabJack::AnalogInputSettings>&
getAnalogInputs()
const;
508 std::unordered_map<int, LabJack::TimerSettings>
m_timers;
523 #endif // SURGSIM_DEVICES_LABJACK_LABJACKDEVICE_H
void setTimers(const std::unordered_map< int, LabJack::TimerSettings > &timers)
Set which timers are enabled.
Definition: LabJackDevice.cpp:210
Definition: LabJackDevice.h:82
Definition: DriveElementFromInputBehavior.cpp:27
Definition: LabJackDevice.h:99
AIN
Definition: LabJackDevice.h:87
Definition: LabJackDevice.h:198
Definition: LabJackDevice.h:119
int getTimerClockDivisor() const
Definition: LabJackDevice.cpp:177
CIO_LINE
Definition: LabJackDevice.h:72
Definition: LabJackDevice.h:147
int m_analogInputSettling
The settling time for all the analog inputs.
Definition: LabJackDevice.h:517
Definition: LabJackDevice.h:63
LabJack::Connection getConnection() const
Definition: LabJackDevice.cpp:109
Definition: LabJackDevice.h:142
Definition: LabJackDevice.h:173
Definition: LabJackDevice.h:64
int getTimerCounterPinOffset() const
Definition: LabJackDevice.cpp:189
void setDigitalOutputs(const std::unordered_set< int > &digitalOutputChannels)
Set which digital output lines are enabled.
Definition: LabJackDevice.cpp:148
Definition: LabJackDevice.h:160
std::unordered_set< int > m_digitalOutputChannels
The line numbers for the digital outputs.
Definition: LabJackDevice.h:491
Definition: LabJackDevice.h:42
void setAnalogInputs(const std::unordered_map< int, LabJack::AnalogInputSettings > &analogInputs)
Set which analog inputs are enabled.
Definition: LabJackDevice.cpp:251
DAC
Definition: LabJackDevice.h:107
Definition: LabJackDevice.h:208
Definition: LabJackDevice.h:90
Definition: LabJackDevice.h:56
Definition: LabJackDevice.h:167
Definition: LabJackDevice.h:149
Definition: LabJackDevice.h:152
void setTimerBase(LabJack::TimerBase base)
Set the timer base rate.
Definition: LabJackDevice.cpp:160
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:182
Definition: LabJackDevice.h:50
Definition: LabJackDevice.h:84
const std::unordered_set< int > & getDigitalOutputs() const
Definition: LabJackDevice.cpp:155
EIO_LINE
Definition: LabJackDevice.h:60
Definition: LabJackDevice.h:168
void setDigitalInputs(const std::unordered_set< int > &digitalInputChannels)
Set which digital input lines are enabled.
Definition: LabJackDevice.cpp:131
Definition: LabJackDevice.h:40
LabJack::Connection m_connection
The type of communication connection, e.g., USB.
Definition: LabJackDevice.h:479
Definition: LabJackDevice.h:169
Model
The models of LabJack devices. Numbers come from LabJackUD.h.
Definition: LabJackDevice.h:115
virtual bool initialize() override
Fully initialize the device.
Definition: LabJackDevice.cpp:48
const std::string & getAddress() const
Definition: LabJackDevice.cpp:120
Definition: LabJackDevice.h:204
Definition: LabJackDevice.h:69
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:482
void enableDigitalOutput(int channel)
Enable digital output line.
Definition: LabJackDevice.cpp:142
Definition: LabJackDevice.h:104
Definition: LabJackDevice.h:75
const std::unordered_set< int > & getDigitalInputs() const
Definition: LabJackDevice.cpp:137
Definition: LabJackDevice.h:100
Definition: LabJackDevice.h:162
int m_timerCounterPinOffset
The number of the lowest FIO pin that is a timer or counter.
Definition: LabJackDevice.h:505
Definition: LabJackDevice.h:52
Definition: LabJackDevice.h:93
virtual ~LabJackDevice()
Destructor.
Definition: LabJackDevice.cpp:40
void enableDigitalInput(int channel)
Enable digital input line.
Definition: LabJackDevice.cpp:125
Definition: LabJackDevice.h:171
const std::unordered_set< int > & getAnalogOutputs() const
Definition: LabJackDevice.cpp:276
Definition: LabJackDevice.h:97
Definition: LabJackDevice.h:67
Definition: LabJackDevice.h:109
Definition: LabJackDevice.h:164
Definition: LabJackDevice.h:120
Definition: LabJackDevice.h:95
Definition: LabJackDevice.h:43
Definition: LabJackDevice.h:141
void setAnalogInputSettling(int settling)
Set the settling time for all the analog inputs.
Definition: LabJackDevice.cpp:293
Definition: LabJackDevice.h:200
Definition: LabJackDevice.h:129
Definition: LabJackDevice.h:54
TimerMode mode
The mode.
Definition: LabJackDevice.h:189
Definition: LabJackDevice.h:96
Definition: LabJackDevice.h:206
Definition: LabJackDevice.h:65
Definition: LabJackDevice.h:91
Definition: LabJackDevice.h:66
LabJack::TimerBase getTimerBase() const
Definition: LabJackDevice.cpp:166
Definition: LabJackDevice.h:207
Definition: LabJackDevice.h:130
Range
The analog input ranges. Equivalent to gain. Ignored for Linux scaffold, which auto-ranges.
Definition: LabJackDevice.h:196
LabJack::TimerBase m_timerBase
The timer base, which is the frequency of all the output timers unless it ends in "_DIV"...
Definition: LabJackDevice.h:499
Definition: LabJackDevice.h:51
Definition: LabJackDevice.h:145
Definition: LabJackDevice.h:117
double m_threadRate
The maximum update rate for the LabJackThread.
Definition: LabJackDevice.h:511
Definition: LabJackDevice.h:101
Definition: LabJackDevice.h:126
void setAddress(std::string address)
Set the address of the LabJack, e.g., "1" or "192.168.7.23".
Definition: LabJackDevice.cpp:114
LabJackDevice(const std::string &uniqueName)
Constructor.
Definition: LabJackDevice.cpp:26
TimerMode
The timer modes.
Definition: LabJackDevice.h:158
Definition: LabJackDevice.h:138
Definition: LabJackDevice.h:140
Definition: LabJackDevice.h:161
Definition: LabJackDevice.h:144
void setModel(LabJack::Model model)
Set the model, e.g., U6.
Definition: LabJackDevice.cpp:92
FIO_LINE
Definition: LabJackDevice.h:48
TimerBase
The timer base frequencies for LabJacks.
Definition: LabJackDevice.h:136
Definition: LabJackDevice.h:53
MIO_LINE
Definition: LabJackDevice.h:80
void setMaximumUpdateRate(double rate)
Set the maximum update rate for the LabJackThread.
Definition: LabJackDevice.cpp:221
Definition: LabJackDevice.h:170
virtual bool finalize() override
Finalize (de-initialize) the device.
Definition: LabJackDevice.cpp:78
Definition: LabJackDevice.h:94
void enableTimer(int index, LabJack::TimerMode mode)
Enable timer.
Definition: LabJackDevice.cpp:194
Definition: LabJackDevice.h:103
A struct holding the data to be associated with a Timer.
Definition: LabJackDevice.h:178
Definition: LabJackDevice.h:146
void setTimerClockDivisor(int divisor)
If the Timer type ends in "_DIV", then the actual timer frequency is divided by the divisor...
Definition: LabJackDevice.cpp:171
bool operator==(const TimerSettings &other) const
Equality comparison.
Definition: LabJackDevice.h:183
void setConnection(LabJack::Connection connection)
Set the connection type of the LabJack, e.g., USB.
Definition: LabJackDevice.cpp:103
Definition: LabJackDevice.h:139
Definition: LabJackDevice.h:62
Definition: LabJackDevice.h:57
Definition: LabJackDevice.h:172
Definition: LabJackDevice.h:151
Definition: LabJackDevice.h:76
Connection
The connection (i.e., communication media) for LabJacks. Numbers come from LabJackUD.h.
Definition: LabJackDevice.h:124
std::unordered_set< int > m_digitalInputChannels
The line numbers for the digital inputs.
Definition: LabJackDevice.h:485
std::unordered_set< int > m_analogOutputChannels
The line numbers for the analog outputs.
Definition: LabJackDevice.h:494
SurgSim::DataStructures::OptionalValue< int > initialValue
The initial value.
Definition: LabJackDevice.h:192
Definition: LabJackDevice.h:166
int m_analogInputResolution
The resolution for all the analog inputs.
Definition: LabJackDevice.h:514
Definition: LabJackDevice.h:203
std::unordered_map< int, LabJack::AnalogInputSettings > m_analogInputs
The analog inputs. The key is the positive channel.
Definition: LabJackDevice.h:488
Definition: LabJackDevice.h:127
Definition: LabJackDevice.h:150
Definition: LabJackDevice.h:45
Definition: LabJackDevice.h:165
Definition: LabJackDevice.h:118
double getMaximumUpdateRate() const
Definition: LabJackDevice.cpp:228
Definition: LabJackDevice.h:89
LabJack::Model getModel() const
Definition: LabJackDevice.cpp:98
const std::unordered_map< int, LabJack::TimerSettings > & getTimers() const
Definition: LabJackDevice.cpp:216
int m_timerClockDivisor
The timer clock's divisor, see m_timerBase.
Definition: LabJackDevice.h:502
Definition: LabJackDevice.h:199
void enableAnalogInput(int positiveChannel, LabJack::Range range, int negativeChannel)
Enable differential analog input.
Definition: LabJackDevice.cpp:233
Definition: LabJackDevice.h:74
A class implementing the communication with a LabJack data acquisition (DAQ) device.
Definition: LabJackDevice.h:272
LabJack::Model m_model
The model, e.g., U6.
Definition: LabJackDevice.h:476
Definition: LabJackDevice.h:143
Definition: LabJackDevice.h:202
void setAnalogInputResolution(int resolution)
Set the resolution for all the analog inputs.
Definition: LabJackDevice.cpp:281
TIMER
Definition: LabJackDevice.h:38
Definition: LabJackDevice.h:44
Definition: LabJackDevice.h:163
Definition: LabJackDevice.h:205
Definition: LabJackDevice.h:110
Definition: LabJackDevice.h:128
void enableAnalogOutput(int channel)
Enable analog output.
Definition: LabJackDevice.cpp:264
Definition: LabJackDevice.h:68
Definition: LabJackDevice.h:98
A class that implements the behavior of LabJackDevice objects.
Definition: LabJackScaffold.h:41
Definition: LabJackDevice.h:102
int getAnalogInputSettling() const
Definition: LabJackDevice.cpp:300
Definition: LabJackDevice.h:174
Definition: LabJackDevice.h:41
int getAnalogInputResolution() const
Definition: LabJackDevice.cpp:288
Definition: LabJackDevice.h:55
bool isInitialized() const
Check whether this device is initialized.
Definition: LabJackDevice.cpp:87
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:508
Definition: LabJackDevice.h:83
Definition: LabJackDevice.h:92
Definition: LabJackDevice.h:201
void setAnalogOutputs(const std::unordered_set< int > &analogOutputChannels)
Set which analog outputs are enabled.
Definition: LabJackDevice.cpp:270
Definition: LabJackDevice.h:77
Definition: LabJackDevice.h:148
const std::unordered_map< int, LabJack::AnalogInputSettings > & getAnalogInputs() const
Definition: LabJackDevice.cpp:259
std::shared_ptr< LabJackScaffold > m_scaffold
The single scaffold object that handles communications with all instances of LabJackDevice.
Definition: LabJackDevice.h:473