Go to the documentation of this file.
18 #define MRPT_HAS_SOME_NIDAQMX (MRPT_HAS_NIDAQMXBASE || MRPT_HAS_NIDAQMX)
20 #define MRPT_USE_NIDAQMXBASE (MRPT_HAS_NIDAQMXBASE && !MRPT_HAS_NIDAQMX)
21 #define MRPT_USE_NIDAQMX (MRPT_HAS_NIDAQMX)
23 #if MRPT_USE_NIDAQMXBASE
24 #include "NIDAQmxBase.h"
32 #if MRPT_USE_NIDAQMXBASE
33 #define MRPT_DAQmxGetExtendedErrorInfo DAQmxBaseGetExtendedErrorInfo
34 #define MRPT_DAQmxCreateTask DAQmxBaseCreateTask
35 #define MRPT_DAQmxCreateAIVoltageChan DAQmxBaseCreateAIVoltageChan
36 #define MRPT_DAQmxCreateAOVoltageChan DAQmxBaseCreateAOVoltageChan
37 #define MRPT_DAQmxCreateDIChan DAQmxBaseCreateDIChan
38 #define MRPT_DAQmxCreateDOChan DAQmxBaseCreateDOChan
39 #define MRPT_DAQmxCreateCIPeriodChan DAQmxBaseCreateCIPeriodChan
40 #define MRPT_DAQmxCreateCICountEdgesChan DAQmxBaseCreateCICountEdgesChan
41 #define MRPT_DAQmxCreateCIPulseWidthChan DAQmxBaseCreateCIPulseWidthChan
42 #define MRPT_DAQmxCreateCILinEncoderChan DAQmxBaseCreateCILinEncoderChan
43 #define MRPT_DAQmxCreateCIAngEncoderChan DAQmxBaseCreateCIAngEncoderChan
44 #define MRPT_DAQmxCreateCOPulseChanFreq DAQmxBaseCreateCOPulseChanFreq
45 #define MRPT_DAQmxCfgSampClkTiming DAQmxBaseCfgSampClkTiming
46 #define MRPT_DAQmxCfgInputBuffer DAQmxBaseCfgInputBuffer
47 #define MRPT_DAQmxCfgOutputBuffer DAQmxBaseCfgOutputBuffer
48 #define MRPT_DAQmxStartTask DAQmxBaseStartTask
49 #define MRPT_DAQmxStopTask DAQmxBaseStopTask
50 #define MRPT_DAQmxClearTask DAQmxBaseClearTask
51 #define MRPT_DAQmxReadAnalogF64 DAQmxBaseReadAnalogF64
52 #define MRPT_DAQmxReadCounterF64 DAQmxBaseReadCounterF64
53 #define MRPT_DAQmxReadDigitalU8 DAQmxBaseReadDigitalU8
54 #define MRPT_DAQmxWriteAnalogF64 DAQmxBaseWriteAnalogF64
55 #define MRPT_DAQmxWriteDigitalU32 DAQmxBaseWriteDigitalU32
56 #define MRPT_DAQmxWriteDigitalLines DAQmxBaseWriteDigitalLines
58 #define MRPT_DAQmxGetExtendedErrorInfo DAQmxGetExtendedErrorInfo
59 #define MRPT_DAQmxCreateTask DAQmxCreateTask
60 #define MRPT_DAQmxCreateAIVoltageChan DAQmxCreateAIVoltageChan
61 #define MRPT_DAQmxCreateAOVoltageChan DAQmxCreateAOVoltageChan
62 #define MRPT_DAQmxCreateDIChan DAQmxCreateDIChan
63 #define MRPT_DAQmxCreateDOChan DAQmxCreateDOChan
64 #define MRPT_DAQmxCreateCIPeriodChan DAQmxCreateCIPeriodChan
65 #define MRPT_DAQmxCreateCICountEdgesChan DAQmxCreateCICountEdgesChan
66 #define MRPT_DAQmxCreateCIPulseWidthChan DAQmxCreateCIPulseWidthChan
67 #define MRPT_DAQmxCreateCILinEncoderChan DAQmxCreateCILinEncoderChan
68 #define MRPT_DAQmxCreateCIAngEncoderChan DAQmxCreateCIAngEncoderChan
69 #define MRPT_DAQmxCreateCOPulseChanFreq DAQmxCreateCOPulseChanFreq
70 #define MRPT_DAQmxCfgSampClkTiming DAQmxCfgSampClkTiming
71 #define MRPT_DAQmxCfgInputBuffer DAQmxCfgInputBuffer
72 #define MRPT_DAQmxCfgOutputBuffer DAQmxCfgOutputBuffer
73 #define MRPT_DAQmxStartTask DAQmxStartTask
74 #define MRPT_DAQmxStopTask DAQmxStopTask
75 #define MRPT_DAQmxClearTask DAQmxClearTask
76 #define MRPT_DAQmxReadAnalogF64 DAQmxReadAnalogF64
77 #define MRPT_DAQmxReadCounterF64 DAQmxReadCounterF64
78 #define MRPT_DAQmxReadDigitalU8 DAQmxReadDigitalU8
79 #define MRPT_DAQmxWriteAnalogF64 DAQmxWriteAnalogF64
80 #define MRPT_DAQmxWriteDigitalU32 DAQmxWriteDigitalU32
81 #define MRPT_DAQmxWriteDigitalLines DAQmxWriteDigitalLines
86 #define MRPT_DAQmx_ErrChk(functionCall) \
87 if ((functionCall) < 0) \
90 MRPT_DAQmxGetExtendedErrorInfo(errBuff, 2048); \
91 std::string sErr = mrpt::format( \
92 "DAQ error: '%s'\nCalling: '%s'", errBuff, #functionCall); \
93 THROW_EXCEPTION(sErr); \
106 : new_obs_available(0), task()
120 #define MY_LOAD_HERE_CONFIG_VAR( \
121 variableName, variableType, targetVariable, configFileObject, \
123 targetVariable = configFileObject.read_##variableType( \
124 sectionNameStr, variableName, targetVariable, false);
126 #define MY_LOAD_HERE_CONFIG_VAR_NO_DEFAULT( \
127 variableName, variableType, targetVariable, configFileObject, \
132 targetVariable = configFileObject.read_##variableType( \
133 sectionNameStr, variableName, targetVariable, true); \
135 catch (std::exception&) \
137 THROW_EXCEPTION(format( \
138 "Value for '%s' not found in config file", \
139 std::string(variableName).c_str())); \
155 std::cerr <<
"[CNationalInstrumentsDAQ] Warning: Number of tasks is "
156 "zero. No datalogging will be done.\n";
160 for (
unsigned int i = 0; i < nTasks; i++)
167 const string sChanns =
169 vector<string> lstStrChanns;
171 if (lstStrChanns.empty())
178 sTask +
string(
".samplesPerChannelToRead"),
double,
184 sTask +
string(
".bufferSamplesPerChannel"),
double,
189 for (
auto& lstStrChann : lstStrChanns)
191 if (
strCmpI(lstStrChann,
"ai"))
195 sTask +
string(
".ai.physicalChannel"),
string,
198 sTask +
string(
".ai.physicalChannelCount"), uint64_t,
201 sTask +
string(
".ai.terminalConfig"),
string,
204 sTask +
string(
".ai.minVal"),
double, t.
ai.
minVal, cfg,
207 sTask +
string(
".ai.maxVal"),
double, t.
ai.
maxVal, cfg,
210 else if (
strCmpI(lstStrChann,
"ao"))
214 sTask +
string(
".ao.physicalChannel"),
string,
217 sTask +
string(
".ao.physicalChannelCount"), uint64_t,
220 sTask +
string(
".ao.minVal"),
double, t.
ao.
minVal, cfg,
223 sTask +
string(
".ao.maxVal"),
double, t.
ao.
maxVal, cfg,
226 else if (
strCmpI(lstStrChann,
"di"))
230 sTask +
string(
".di.line"),
string, t.
di.
line, cfg,
sect)
232 else if (
strCmpI(lstStrChann,
"do"))
238 else if (
strCmpI(lstStrChann,
"ci_period"))
242 sTask +
string(
".ci_period.counter"),
string,
245 sTask +
string(
".ci_period.minVal"),
double,
248 sTask +
string(
".ci_period.maxVal"),
double,
251 sTask +
string(
".ci_period.units"),
string,
257 sTask +
string(
".ci_period.measTime"),
double,
260 sTask +
string(
".ci_period.divisor"),
int,
263 else if (
strCmpI(lstStrChann,
"ci_count_edges"))
267 sTask +
string(
".ci_count_edges.counter"),
string,
270 sTask +
string(
".ci_count_edges.edge"),
string,
273 sTask +
string(
".ci_count_edges.initialCount"),
int,
276 sTask +
string(
".ci_count_edges.countDirection"),
string,
279 else if (
strCmpI(lstStrChann,
"ci_pulse_width"))
283 sTask +
string(
".ci_pulse_width.counter"),
string,
286 sTask +
string(
".ci_pulse_width.minVal"),
double,
289 sTask +
string(
".ci_pulse_width.maxVal"),
double,
292 sTask +
string(
".ci_pulse_width.units"),
string,
295 sTask +
string(
".ci_pulse_width.startingEdge"),
string,
298 else if (
strCmpI(lstStrChann,
"ci_lin_encoder"))
302 sTask +
string(
".ci_lin_encoder.counter"),
string,
305 sTask +
string(
".ci_lin_encoder.decodingType"),
string,
308 sTask +
string(
".ci_lin_encoder.ZidxEnable"),
bool,
311 sTask +
string(
".ci_lin_encoder.ZidxVal"),
double,
314 sTask +
string(
".ci_lin_encoder.ZidxPhase"),
string,
317 sTask +
string(
".ci_lin_encoder.units"),
string,
320 sTask +
string(
".ci_lin_encoder.distPerPulse"),
double,
323 sTask +
string(
".ci_lin_encoder.initialPos"),
double,
326 else if (
strCmpI(lstStrChann,
"ci_ang_encoder"))
330 sTask +
string(
".ci_ang_encoder.counter"),
string,
333 sTask +
string(
".ci_ang_encoder.decodingType"),
string,
336 sTask +
string(
".ci_ang_encoder.ZidxEnable"),
bool,
339 sTask +
string(
".ci_ang_encoder.ZidxVal"),
double,
342 sTask +
string(
".ci_ang_encoder.ZidxPhase"),
string,
345 sTask +
string(
".ci_ang_encoder.units"),
string,
348 sTask +
string(
".ci_ang_encoder.pulsesPerRev"),
int,
351 sTask +
string(
".ci_ang_encoder.initialAngle"),
double,
354 sTask +
string(
".ci_ang_encoder.decimate"),
int,
357 else if (
strCmpI(lstStrChann,
"co_pulses"))
361 sTask +
string(
".co_pulses.counter"),
string,
364 sTask +
string(
".co_pulses.idleState"),
string,
367 sTask +
string(
".co_pulses.initialDelay"),
double,
373 sTask +
string(
".co_pulses.dutyCycle"),
double,
379 "Unknown channel type '%s'! See the docs of "
380 "CNationalInstrumentsDAQ",
381 lstStrChann.c_str());
391 #if MRPT_HAS_SOME_NIDAQMX
399 const daqmx_str_val daqmx_vals[] = {
400 {
"DAQmx_Val_Cfg_Default", DAQmx_Val_Cfg_Default},
401 {
"DAQmx_Val_RSE", DAQmx_Val_RSE},
402 {
"DAQmx_Val_NRSE", DAQmx_Val_NRSE},
403 {
"DAQmx_Val_Diff", DAQmx_Val_Diff},
404 {
"DAQmx_Val_Seconds", DAQmx_Val_Seconds},
405 {
"DAQmx_Val_Rising", DAQmx_Val_Rising},
406 {
"DAQmx_Val_Falling", DAQmx_Val_Falling},
407 {
"DAQmx_Val_CountUp", DAQmx_Val_CountUp},
408 {
"DAQmx_Val_CountDown", DAQmx_Val_CountDown},
409 {
"DAQmx_Val_ExtControlled", DAQmx_Val_ExtControlled},
410 {
"DAQmx_Val_AHighBHigh", DAQmx_Val_AHighBHigh},
411 {
"DAQmx_Val_AHighBLow", DAQmx_Val_AHighBLow},
412 {
"DAQmx_Val_ALowBHigh", DAQmx_Val_ALowBHigh},
413 {
"DAQmx_Val_ALowBLow", DAQmx_Val_ALowBLow},
414 {
"DAQmx_Val_X1", DAQmx_Val_X1},
415 {
"DAQmx_Val_X2", DAQmx_Val_X2},
416 {
"DAQmx_Val_X4", DAQmx_Val_X4},
417 {
"DAQmx_Val_Meters", DAQmx_Val_Meters},
418 {
"DAQmx_Val_Inches", DAQmx_Val_Inches},
419 {
"DAQmx_Val_Ticks", DAQmx_Val_Ticks},
420 {
"DAQmx_Val_Degrees", DAQmx_Val_Degrees},
421 {
"DAQmx_Val_Radians", DAQmx_Val_Radians},
422 {
"DAQmx_Val_High", DAQmx_Val_High},
423 {
"DAQmx_Val_Low", DAQmx_Val_Low}};
425 int daqmx_defstr2num(
const std::string& str)
429 for (
unsigned int i = 0; i <
sizeof(daqmx_vals) /
sizeof(daqmx_vals[0]);
432 if (
strCmpI(daqmx_vals[i].str, s.c_str()))
return daqmx_vals[i].
val;
443 #if MRPT_HAS_SOME_NIDAQMX
458 TaskHandle& taskHandle =
459 *
reinterpret_cast<TaskHandle*
>(&ipt.
taskHandle);
467 "ai.physicalChannelCount is zero! Please, define it "
473 tf.
ai.
maxVal, DAQmx_Val_Volts,
nullptr));
479 "ai.physicalChannelCount is zero! Please, define it "
489 taskHandle, tf.
di.
line.c_str(),
nullptr,
490 DAQmx_Val_ChanPerLine));
495 taskHandle, tf.
douts.
line.c_str(),
nullptr,
496 DAQmx_Val_ChanPerLine));
566 DAQmx_Val_Rising, DAQmx_Val_ContSamps,
591 ipt.
read_pipe->timeout_read_start_us = 100000;
592 ipt.
read_pipe->timeout_read_between_us = 100000;
599 catch (std::exception
const& e)
601 std::cerr <<
"[CNationalInstrumentsDAQ] Error:" << std::endl
602 << e.what() << std::endl;
605 TaskHandle& taskHandle =
606 *
reinterpret_cast<TaskHandle*
>(&ipt.
taskHandle);
615 cerr <<
"[CNationalInstrumentsDAQ::initialize] Waiting for the "
616 "grabbing thread to end due to exception...\n";
618 cerr <<
"[CNationalInstrumentsDAQ::initialize] Grabbing thread "
625 std::cerr <<
"[CNationalInstrumentsDAQ] Error while creating "
626 "tasks. Closing other tasks before returning...\n";
628 std::cerr <<
"[CNationalInstrumentsDAQ] Closing tasks done.\n";
646 m_running_task.must_close =
true;
649 cout <<
"[CNationalInstrumentsDAQ::stop] Waiting for grabbing threads "
654 if (m_running_task.hThread.joinable()) m_running_task.hThread.join();
661 cout <<
"[CNationalInstrumentsDAQ::stop] All threads ended.\n";
664 #if MRPT_HAS_SOME_NIDAQMX
668 TaskHandle& taskHandle =
669 *
reinterpret_cast<TaskHandle*
>(&it->taskHandle);
673 taskHandle =
nullptr;
688 std::vector<mrpt::obs::CObservationRawDAQ::Ptr>& outObservations,
691 hardwareError =
false;
692 outObservations.clear();
696 hardwareError =
true;
708 if (m_running_task.new_obs_available != 0)
712 arch.ReadObject(&tmp_obs);
713 --(m_running_task.new_obs_available);
716 outObservations.push_back(CObservationRawDAQ::Create(tmp_obs));
744 std::vector<mrpt::serialization::CSerializable::Ptr> new_obs;
759 #if MRPT_HAS_SOME_NIDAQMX
762 TaskHandle& taskHandle =
763 *
reinterpret_cast<TaskHandle*
>(&ipt.
taskHandle);
765 cout <<
"[CNationalInstrumentsDAQ::grabbing_thread] Starting "
772 const float timeout =
777 vector<uint8_t> u8Buf;
791 bool there_are_data =
false;
800 const uint32_t totalSamplesToRead =
803 dBuf.resize(totalSamplesToRead);
804 int32 pointsReadPerChan = -1;
808 : DAQmx_Val_GroupByChannel,
809 &dBuf[0], dBuf.size(), &pointsReadPerChan,
nullptr)) <
811 err != DAQmxErrorSamplesNotYetAvailable)
815 else if (pointsReadPerChan > 0)
821 there_are_data =
true;
823 cout <<
"[CNationalInstrumentsDAQ::grabbing_thread] "
824 << pointsReadPerChan <<
" analog samples read.\n";
829 const uint32_t totalSamplesToRead =
831 u8Buf.resize(totalSamplesToRead);
833 int32 pointsReadPerChan = -1;
836 DAQmx_Val_GroupByChannel, &u8Buf[0], u8Buf.size(),
837 &pointsReadPerChan,
nullptr)) < 0 &&
838 err != DAQmxErrorSamplesNotYetAvailable)
842 else if (pointsReadPerChan > 0)
848 there_are_data =
true;
850 cout <<
"[CNationalInstrumentsDAQ::grabbing_thread] "
851 << pointsReadPerChan <<
" digital samples read.\n";
856 const int32 totalSamplesToRead =
858 dBuf.resize(totalSamplesToRead);
859 int32 pointsReadPerChan = -1;
861 taskHandle, totalSamplesToRead, timeout, &dBuf[0],
862 dBuf.size(), &pointsReadPerChan,
nullptr)) < 0 &&
863 err != DAQmxErrorSamplesNotYetAvailable)
867 else if (pointsReadPerChan > 0)
877 there_are_data =
true;
880 static int decim = 0;
882 cout <<
"[CNationalInstrumentsDAQ::grabbing_"
885 <<
" counter samples read ([0]="
887 if (++decim > 100) decim = 0;
903 std::this_thread::sleep_for(1ms);
908 catch (
const std::exception& e)
910 std::cerr <<
"[CNationalInstrumentsDAQ::grabbing_thread] Exception:\n"
911 << e.what() << std::endl;
913 #endif // MRPT_HAS_SOME_NIDAQMX
919 [[maybe_unused]]
size_t task_index,
920 [[maybe_unused]]
size_t nSamplesPerChannel,
921 [[maybe_unused]]
const double* volt_values, [[maybe_unused]]
double timeout,
922 [[maybe_unused]]
bool groupedByChannel)
924 #if MRPT_HAS_SOME_NIDAQMX
927 std::advance(it, task_index);
929 TaskHandle& taskHandle = *
reinterpret_cast<TaskHandle*
>(&ipt.
taskHandle);
931 int32 samplesWritten = 0;
934 taskHandle, nSamplesPerChannel, FALSE, timeout,
935 groupedByChannel ? DAQmx_Val_GroupByChannel
936 : DAQmx_Val_GroupByScanNumber,
937 const_cast<float64*
>(volt_values), &samplesWritten,
nullptr))
945 [[maybe_unused]]
size_t task_index, [[maybe_unused]]
bool line_value,
946 [[maybe_unused]]
double timeout)
948 #if MRPT_HAS_SOME_NIDAQMX
951 std::advance(it, task_index);
953 TaskHandle& taskHandle = *
reinterpret_cast<TaskHandle*
>(&ipt.
taskHandle);
955 uInt8 dat = line_value ? 1 : 0;
957 int32 samplesWritten = 0;
958 int32 nSamplesPerChannel = 1;
961 taskHandle, nSamplesPerChannel, FALSE, timeout,
962 DAQmx_Val_GroupByScanNumber, &dat, &samplesWritten,
nullptr))
#define MRPT_DAQmxReadAnalogF64
std::string sensorLabel
An arbitrary label that can be used to identify the sensor.
struct mrpt::hwdrivers::CNationalInstrumentsDAQ::TaskDescription::desc_di_t di
#define ASSERT_ABOVE_(__A, __B)
std::string line
The digital line (for example "Dev1/port0/line1")
uint32_t bufferSamplesPerChannel
(Default=0) From NI's docs: The number of samples the buffer can hold for each channel in the task.
Store raw data from a Data Acquisition (DAQ) device, such that input or output analog and digital cha...
struct mrpt::hwdrivers::CNationalInstrumentsDAQ::TaskDescription::desc_ci_lin_encoder_t ci_lin_encoder
#define ASSERT_EQUAL_(__A, __B)
Assert comparing two values, reporting their actual values upon failure.
std::string physicalChannel
std::vector< double > AIN_double
Readings from analog input (ADCs) channels (vector length=channel count) in Volts.
#define MRPT_DAQmxCreateCICountEdgesChan
void loadConfig_sensorSpecific(const mrpt::config::CConfigFileBase &configSource, const std::string &iniSection) override
See the class documentation at the top for expected parameters.
void readFromDAQ(std::vector< mrpt::obs::CObservationRawDAQ::Ptr > &outObservations, bool &hardwareError)
Receives data from the DAQ thread(s).
std::atomic< int > new_obs_available
MRPT_TODO("toPointCloud / calibration")
std::vector< uint8_t > DIN
Present output values for 16-bit analog output (DACs) channels (vector length=channel count) in volts...
std::string line
The digital line (for example "Dev1/port0/line1")
#define MRPT_DAQmxCreateCILinEncoderChan
struct mrpt::hwdrivers::CNationalInstrumentsDAQ::TaskDescription::desc_ci_period_t ci_period
Counter: period of a digital signal.
struct mrpt::hwdrivers::CNationalInstrumentsDAQ::TaskDescription::desc_do_t douts
mrpt::system::TTimeStamp now()
A shortcut for system::getCurrentTime.
void initialize() override
Setup and launch the DAQ tasks, in parallel threads.
Contains classes for various device interfaces.
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define MY_LOAD_HERE_CONFIG_VAR( variableName, variableType, targetVariable, configFileObject, sectionNameStr)
#define MRPT_DAQmxClearTask
#define THROW_EXCEPTION(msg)
#define ASSERT_(f)
Defines an assertion mechanism.
#define MRPT_DAQmxCreateCIAngEncoderChan
void tokenize(const std::string &inString, const std::string &inDelimiters, OUT_CONTAINER &outTokens, bool skipBlankTokens=true) noexcept
Tokenizes a string according to a set of delimiting characters.
This namespace contains representation of robot actions and observations.
#define MY_LOAD_HERE_CONFIG_VAR_NO_DEFAULT( variableName, variableType, targetVariable, configFileObject, sectionNameStr)
~CNationalInstrumentsDAQ() override
Destructor.
void grabbing_thread(TInfoPerTask &ipt)
Method to be executed in each parallel thread.
mrpt::system::TTimeStamp timestamp
The associated UTC time-stamp.
std::string read_string(const std::string §ion, const std::string &name, const std::string &defaultValue, bool failIfNotFound=false) const
#define MRPT_DAQmxCreateCIPulseWidthChan
#define MRPT_DAQmxCreateDIChan
void writeAnalogOutputTask(size_t task_index, size_t nSamplesPerChannel, const double *volt_values, double timeout, bool groupedByChannel)
Set voltage outputs to all the outputs in an AOUT task For the meaning of parameters,...
#define MRPT_DAQmxCreateCOPulseChanFreq
An interface to read from data acquisition boards compatible with National Instruments "DAQmx Base" o...
#define MRPT_DAQmxReadDigitalU8
This class allows loading and storing values and vectors of different types from a configuration text...
void appendObservations(const std::vector< mrpt::serialization::CSerializable::Ptr > &obj)
This method must be called by derived classes to enqueue a new observation in the list to be returned...
struct mrpt::hwdrivers::CNationalInstrumentsDAQ::TaskDescription::desc_ao_t ao
std::string taskLabel
(Default="task###")
TaskDescription task
A copy of the original task description that generated this thread.
double samplesPerSecond
Sample clock config: samples per second.
std::string physicalChannel
unsigned int physicalChannelCount
IMPORTANT This must be the total number of channels listed in "physicalChannel" (e....
double sample_rate
Readings from ticks counters, such as quadrature encoders.
std::string terminalConfig
std::unique_ptr< mrpt::io::CPipeWriteEndPoint > write_pipe
struct mrpt::hwdrivers::CNationalInstrumentsDAQ::TaskDescription::desc_co_pulses_t co_pulses
std::string m_sensorLabel
See CGenericSensor.
uint64_t read_uint64_t(const std::string §ion, const std::string &name, uint64_t defaultValue, bool failIfNotFound=false) const
uint32_t samplesPerChannelToRead
(Default=1000) The number of samples to grab at once from each channel.
#define MRPT_DAQmxCreateAOVoltageChan
void stop()
Stop the grabbing threads for DAQ tasks.
#define MRPT_DAQmxReadCounterF64
#define ASSERTMSG_(f, __ERROR_MSG)
Defines an assertion mechanism.
#define MRPT_DAQmxCreateCIPeriodChan
#define IMPLEMENTS_GENERIC_SENSOR(class_name, NameSpace)
This must be inserted in all CGenericSensor classes implementation files:
Versatile class for consistent logging and management of output messages.
struct mrpt::hwdrivers::CNationalInstrumentsDAQ::TaskDescription::desc_ci_pulse_width_t ci_pulse_width
void writeDigitalOutputTask(size_t task_index, bool line_value, double timeout)
Changes the boolean state of one digital output line.
CArchiveStreamBase< STREAM > archiveFrom(STREAM &s)
Helper function to create a templatized wrapper CArchive object for a: MRPT's CStream,...
std::vector< double > CNTRIN_double
Readings from ticks counters, such as quadrature encoders.
#define MRPT_DAQmx_ErrChk(functionCall)
#define MRPT_DAQmxStartTask
struct mrpt::hwdrivers::CNationalInstrumentsDAQ::TaskDescription::desc_ci_count_edges_t ci_count_edges
struct mrpt::hwdrivers::CNationalInstrumentsDAQ::TaskDescription::desc_ai_t ai
#define MRPT_DAQmxCfgSampClkTiming
#define MRPT_DAQmxWriteDigitalLines
#define MRPT_DAQmxCreateTask
Each of the tasks to create in CNationalInstrumentsDAQ::initialize().
#define MRPT_DAQmxWriteAnalogF64
std::list< TInfoPerTask > m_running_tasks
CNationalInstrumentsDAQ()
Constructor.
#define MRPT_DAQmxCfgInputBuffer
#define MRPT_DAQmxCreateAIVoltageChan
struct mrpt::hwdrivers::CNationalInstrumentsDAQ::TaskDescription::desc_ci_ang_encoder_t ci_ang_encoder
#define MRPT_DAQmxStopTask
uint16_t AIN_channel_count
Readings from analog input (ADCs) channels (vector length=channel count) in Volts.
bool checkDAQIsWorking() const
Returns true if initialize() was called and at least one task is running.
std::vector< mrpt::obs::CObservationRawDAQ::Ptr > m_nextObservations
A buffer for doProcess.
std::vector< TaskDescription > task_definitions
Publicly accessible vector with the list of tasks to be launched upon call to CNationalInstrumentsDAQ...
std::string trim(const std::string &str)
Removes leading and trailing spaces.
#define MRPT_DAQmxCreateDOChan
std::unique_ptr< mrpt::io::CPipeReadEndPoint > read_pipe
bool AIN_interleaved
Whether the channels are interleaved (A0 A1 A2 A0 A1 A2...) or not (A0 A0 A0 A1 A1 A1 A2 A2 A2....
bool strCmpI(const std::string &s1, const std::string &s2)
Return true if the two strings are equal (case insensitive)
void doProcess() override
This method will be invoked at a minimum rate of "process_rate" (Hz)
std::string std::string format(std::string_view fmt, ARGS &&... args)
std::string countDirection
std::string sampleClkSource
Sample clock source: may be empty (default value) for some channels.
unsigned int physicalChannelCount
IMPORTANT This must be the total number of channels listed in "physicalChannel" (e....
| Page generated by Doxygen 1.8.18 for MRPT 2.0.4 at Thu Sep 24 07:14:18 UTC 2020 | |