04-29-2009 12:12 PM
Hi.
I am working on a school project where we are creating a robot and are using LabView to regulate the motor control.
The robot is a two track "tank" and we thus are regulating the two motors that propel it.
The brain of the robot is however written in C++ and we have chosen to compile the LabView part to DLLs.
The problem is that if we call the generated function from C++, we have to initialize the DAQs every time, and stop the vehicle between interactions.
We have two ideas for a solution but have problems with both.
1. Have the motor regulation running in a LabView while loop and have a multithreaded C++ application where we interact with the already running motor control with the changes in speed/direction we want. (Preferred way)
2. Have the program single threaded but somehow retain the initialized DAQs between calls to the LabView DLL.
Note that we do not have much experience with LabView but are fairly seasoned C++ programmers.
If anyone has any Ideas and sample code it would be greatly appreciated.
With regards
Gylfi Gudmundsson.
Student at Reykjavik University.
04-30-2009 12:19 PM
Gylfi,
Thank you for posting on the NI Forums. I seem to get the main idea of what you are trying to do but I might suggest looking into writing the DAQ control in C++ as well. This would greatly cut down on the difficulty of integration for your project. There is very good documentation that is installed with the DAQmx driver and can be found under Start Menu >> Programs >> National Instruments >> NI-DAQ >> Text-Based Code Support >> NI-DAQmx C Reference Help. I think it would be much easier to be able to run the DAQ code in the main part of your program without having to call a LabVIEW DLL. Let me know if you have any questions. Thanks.