10 #ifndef CNationalInstrumentsDAQ_H
11 #define CNationalInstrumentsDAQ_H
182 std::vector<mrpt::obs::CObservationRawDAQPtr> &outObservations,
183 bool & hardwareError );
189 void writeAnalogOutputTask(
size_t task_index,
size_t nSamplesPerChannel,
const double * volt_values,
double timeout,
bool groupedByChannel);
210 bool has_ci_period, has_ci_count_edges,has_ci_pulse_width,has_ci_lin_encoder,
has_ci_ang_encoder, has_co_pulses;
221 desc_ai_t() : terminalConfig(
"DAQmx_Val_NRSE"),minVal(-10), maxVal(10),physicalChannelCount(0) { }
231 desc_ao_t() : physicalChannelCount(0),minVal(-10), maxVal(10) { }
284 std::string
counter, decodingType, ZidxPhase,units;
294 desc_ci_ang_encoder_t() : ZidxEnable(false),ZidxVal(0),pulsesPerRev(512),initialAngle(0),decimate(1),decimate_cnt(0) { }
296 std::string
counter, decodingType, ZidxPhase,units;
307 desc_co_pulses_t() : idleState(
"DAQmx_Val_Low"),initialDelay(0),freq(1000),dutyCycle(0.5) { }
325 const std::string &iniSection );
337 std::auto_ptr<mrpt::synch::CPipeReadEndPoint>
read_pipe;
#define DEFINE_GENERIC_SENSOR(class_name)
This declaration must be inserted in all CGenericSensor classes definition, within the class declarat...
A generic interface for a wide-variety of sensors designed to be used in the application RawLogGrabbe...
An interface to read from data acquisition boards compatible with National Instruments "DAQmx Base" o...
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,...
std::list< TInfoPerTask > m_running_tasks
void readFromDAQ(std::vector< mrpt::obs::CObservationRawDAQPtr > &outObservations, bool &hardwareError)
Receives data from the DAQ thread(s).
CNationalInstrumentsDAQ()
Constructor.
std::vector< mrpt::obs::CObservationRawDAQPtr > m_nextObservations
A buffer for doProcess.
void writeDigitalOutputTask(size_t task_index, bool line_value, double timeout)
Changes the boolean state of one digital output line.
void doProcess()
This method will be invoked at a minimum rate of "process_rate" (Hz)
virtual ~CNationalInstrumentsDAQ()
Destructor.
virtual void initialize()
Setup and launch the DAQ tasks, in parallel threads.
bool checkDAQIsWorking() const
Returns true if initialize() was called and at least one task is running.
void grabbing_thread(TInfoPerTask &ipt)
Method to be executed in each parallel thread.
void stop()
Stop the grabbing threads for DAQ tasks.
std::vector< TaskDescription > task_definitions
Publicly accessible vector with the list of tasks to be launched upon call to CNationalInstrumentsDAQ...
void loadConfig_sensorSpecific(const mrpt::utils::CConfigFileBase &configSource, const std::string &iniSection)
See the class documentation at the top for expected parameters.
This class acts exactly as an int (or long) variable, but with atomic increment and decrement operato...
This class allows loading and storing values and vectors of different types from a configuration text...
This base class provides a common printf-like method to send debug information to std::cout,...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
std::auto_ptr< mrpt::synch::CPipeReadEndPoint > read_pipe
std::auto_ptr< mrpt::synch::CPipeWriteEndPoint > write_pipe
mrpt::system::TThreadHandle hThread
TInfoPerTask(const TInfoPerTask &o)
Copy ctor (needed for the auto_ptr semantics)
TaskDescription task
A copy of the original task description that generated this thread.
mrpt::synch::CAtomicCounter new_obs_available
std::string physicalChannel
unsigned int physicalChannelCount
IMPORTANT This must be the total number of channels listed in "physicalChannel" (e....
unsigned int physicalChannelCount
IMPORTANT This must be the total number of channels listed in "physicalChannel" (e....
std::string physicalChannel
std::string countDirection
std::string line
The digital line (for example "Dev1/port0/line1")
std::string line
The digital line (for example "Dev1/port0/line1")
Each of the tasks to create in CNationalInstrumentsDAQ::initialize().
struct HWDRIVERS_IMPEXP mrpt::hwdrivers::CNationalInstrumentsDAQ::TaskDescription::desc_ci_count_edges_t ci_count_edges
Counter: period of a digital signal.
struct HWDRIVERS_IMPEXP mrpt::hwdrivers::CNationalInstrumentsDAQ::TaskDescription::desc_ao_t ao
Analog outputs.
struct HWDRIVERS_IMPEXP mrpt::hwdrivers::CNationalInstrumentsDAQ::TaskDescription::desc_di_t di
Digital inputs (di)
struct HWDRIVERS_IMPEXP mrpt::hwdrivers::CNationalInstrumentsDAQ::TaskDescription::desc_do_t douts
Digital outs (do)
struct HWDRIVERS_IMPEXP mrpt::hwdrivers::CNationalInstrumentsDAQ::TaskDescription::desc_ci_ang_encoder_t ci_ang_encoder
Counter: uses an angular encoder to measure angular position.
double samplesPerSecond
Sample clock config: samples per second. Continuous (infinite) sampling is assumed.
struct HWDRIVERS_IMPEXP mrpt::hwdrivers::CNationalInstrumentsDAQ::TaskDescription::desc_ci_period_t ci_period
Counter: period of a digital signal.
struct HWDRIVERS_IMPEXP mrpt::hwdrivers::CNationalInstrumentsDAQ::TaskDescription::desc_co_pulses_t co_pulses
Output counter: digital pulses output.
uint32_t samplesPerChannelToRead
(Default=1000) The number of samples to grab at once from each channel.
struct HWDRIVERS_IMPEXP mrpt::hwdrivers::CNationalInstrumentsDAQ::TaskDescription::desc_ci_pulse_width_t ci_pulse_width
Counter: measure the width of a digital pulse.
struct HWDRIVERS_IMPEXP mrpt::hwdrivers::CNationalInstrumentsDAQ::TaskDescription::desc_ai_t ai
Analog inputs.
uint32_t bufferSamplesPerChannel
(Default=0) From NI's docs: The number of samples the buffer can hold for each channel in the task....
struct HWDRIVERS_IMPEXP mrpt::hwdrivers::CNationalInstrumentsDAQ::TaskDescription::desc_ci_lin_encoder_t ci_lin_encoder
Counter: uses a linear encoder to measure linear position.
std::string sampleClkSource
Sample clock source: may be empty (default value) for some channels.
std::string taskLabel
(Default="task###")
This structure contains the information needed to interface the threads API on each platform: