16 #ifndef SURGSIM_DEVICES_LABJACK_LABJACKDEVICE_H 17 #define SURGSIM_DEVICES_LABJACK_LABJACKDEVICE_H 21 #include <unordered_map> 22 #include <unordered_set> 24 #include "SurgSim/DataStructures/OptionalValue.h" 25 #include "SurgSim/Input/CommonDevice.h" 31 class LabJackScaffold;
33 SURGSIM_STATIC_REGISTRATION(LabJackDevice);
128 CONNECTION_SEARCH = -1,
130 CONNECTION_ETHERNET = 2,
131 CONNECTION_ETHERNET_MB = 3,
132 CONNECTION_ETHERNET_DATA_ONLY = 4
140 TIMERBASE_DEFAULT = -1,
162 TIMERMODE_PWM_16BIT = 0,
163 TIMERMODE_PWM_8BIT = 1,
164 TIMERMODE_RISING_EDGES_32BIT = 2,
165 TIMERMODE_FALLING_EDGES_32BIT = 3,
166 TIMERMODE_DUTY_CYCLE = 4,
167 TIMERMODE_FIRMWARE_COUNTER = 5,
168 TIMERMODE_FIRMWARE_COUNTER_DEBOUNCED = 6,
169 TIMERMODE_FREQUENCY_OUTPUT = 7,
170 TIMERMODE_QUADRATURE = 8,
171 TIMERMODE_TIMER_STOP = 9,
172 TIMERMODE_SYSTEM_TIMER_LOWER_32BITS = 10,
173 TIMERMODE_SYSTEM_TIMER_UPPR_32BITS = 11,
174 TIMERMODE_RISING_EDGES_16BIT = 12,
175 TIMERMODE_FALLING_EDGES_16BIT = 13,
176 TIMERMODE_LINE_TO_LINE = 14
199 enum Range : SURGSIM_ENUM_TYPE;
274 bool initialize()
override;
276 bool isInitialized()
const override;
298 void setAddress(std::string address);
301 const std::string& getAddress()
const;
312 void setResetOnDestruct(
bool reset);
316 bool getResetOnDestruct()
const;
321 void enableDigitalInput(
int channel);
326 void setDigitalInputs(
const std::unordered_set<int>& digitalInputChannels);
329 const std::unordered_set<int>& getDigitalInputs()
const;
334 void enableDigitalOutput(
int channel);
339 void setDigitalOutputs(
const std::unordered_set<int>& digitalOutputChannels);
342 const std::unordered_set<int>& getDigitalOutputs()
const;
357 void setTimerClockDivisor(
int divisor);
360 int getTimerClockDivisor()
const;
365 void setTimerCounterPinOffset(
int offset);
368 int getTimerCounterPinOffset()
const;
394 void setTimers(
const std::unordered_map<int, LabJack::TimerSettings>& timers);
397 const std::unordered_map<int, LabJack::TimerSettings>& getTimers()
const;
402 void setMaximumUpdateRate(
double rate);
405 double getMaximumUpdateRate()
const;
413 void enableAnalogInput(
int positiveChannel, LabJack::Range range,
int negativeChannel);
419 void enableAnalogInput(
int channel, LabJack::Range range);
426 void setAnalogInputs(
const std::unordered_map<int, LabJack::AnalogInputSettings>& analogInputs);
429 const std::unordered_map<int, LabJack::AnalogInputSettings>& getAnalogInputs()
const;
434 void enableAnalogOutput(
int channel);
440 void setAnalogOutputs(
const std::unordered_set<int>& analogOutputChannels);
443 const std::unordered_set<int>& getAnalogOutputs()
const;
450 void setAnalogInputResolution(
int resolution);
453 int getAnalogInputResolution()
const;
460 void setAnalogInputSettling(
int settling);
463 int getAnalogInputSettling()
const;
468 bool finalize()
override;
471 std::shared_ptr<LabJackScaffold> m_scaffold;
480 std::string m_address;
486 std::unordered_set<int> m_digitalInputChannels;
489 std::unordered_map<int, LabJack::AnalogInputSettings> m_analogInputs;
492 std::unordered_set<int> m_digitalOutputChannels;
495 std::unordered_set<int> m_analogOutputChannels;
503 int m_timerClockDivisor;
506 int m_timerCounterPinOffset;
509 std::unordered_map<int, LabJack::TimerSettings> m_timers;
515 int m_analogInputResolution;
518 int m_analogInputSettling;
524 SURGSIM_SERIALIZABLE_ENUM(SurgSim::Devices::LabJack::Range, (RANGE_NONE)(RANGE_20)(RANGE_10)(RANGE_5)(RANGE_4)(RANGE_2_POINT_5)(RANGE_2)(RANGE_1_POINT_25)(RANGE_1)(RANGE_0_POINT_625)(RANGE_0_POINT_1)(RANGE_0_POINT_01));
526 #endif // SURGSIM_DEVICES_LABJACK_LABJACKDEVICE_H Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
Connection
The connection (i.e., communication media) for LabJacks. Numbers come from LabJackUD.h.
Definition: LabJackDevice.h:126
TimerMode
The timer modes.
Definition: LabJackDevice.h:160
Model
The models of LabJack devices. Numbers come from LabJackUD.h.
Definition: LabJackDevice.h:117
A class implementing the communication with a LabJack data acquisition (DAQ) device.
Definition: LabJackDevice.h:262
TimerBase
The timer base frequencies for LabJacks.
Definition: LabJackDevice.h:138
A class that implements the behavior of LabJackDevice objects.
Definition: LabJackScaffold.h:41
TIMER
Definition: LabJackDevice.h:40
A struct holding the data to be associated with a Timer.
Definition: LabJackDevice.h:180
TimerMode mode
The mode.
Definition: LabJackDevice.h:191
SurgSim::DataStructures::OptionalValue< int > initialValue
The initial value.
Definition: LabJackDevice.h:194
bool operator==(const TimerSettings &other) const
Equality comparison.
Definition: LabJackDevice.h:185