ni.com is currently undergoing scheduled maintenance.
Some services may be unavailable at this time. Please contact us for help or try again later.
05-25-2010 12:54 PM
Hi,
For my project, I am trying to control a RC helicopter for autonomous hovering using the PC and using an onboard accelerometer for feedback measurements.
To control the helicopter, I am using the PCTx module (http://www.endurance-rc.com/howitworks.html) which connects the PC to the transmitter of the helicopter via a USB cable.
My questions are, how do I use LabVIEW to send signals to the USB port in order to control the transmitter? How do I 'extract' the seperate channels so that I can control them seperately (e.g. throttle, rudder, etc)? Would it be easier to implement this in MATLAB and Simulink instead?
Thank you all in advance for your time and efforts.
05-25-2010 02:03 PM
LabVIEW can do this if you understand how the communication protocol for your device works. I would suggest you look at the USB Instrument Control Tutorial for details about how to accomplish this.
You might also consider looking in the NI communities. These can be thought of as narrow focus forums in one sense. There are also some blogs with really useful information, like Building a Quadrotor Helicopter UAV.
Good luck with your product and thanks for the link BTW. I had not seen that company before.
Jason
05-25-2010 05:49 PM
Thanks for your reply Jason.
I forgot to mention that the PCTx module I purchased comes with its own source code and application. This contains slider bars which I can adjust to move different motors on the helicopter. The source code is written in C++. Can I just somehow merge this code into my LabVIEW VI and bypass the VISA process?
Thanks again.
05-25-2010 05:54 PM
You would need to compile the C++ code into a DLL. You would need to make sure that you use C-style parameters (no classes) since LabVIEW can only load C DLLs. Further information can be found in the LabVIEW Help as well as the NI site (search for calling external code from LabVIEW).
The link you provided indicates examples in VB.NET. Do you know if the VB.NET is simply calling unmanaged code (i.e., a DLL)?
05-26-2010 07:37 AM
Thank you all for your advice so far.
At the moment, I am trying to decide which approach (VISA or DLL) is easier for me since I am not confident with the provided C++ code.
The guide Jason gave me regarding VISAs was very helpful, but I was wondering how I would explicitly change one channel in the USB. For example, increasing the value of channel one to increase the motor speed if I sensed from the accelerometer that the helicopter was falling?
Thanks.
05-26-2010 08:59 AM
andrew_JKTA wrote:The guide Jason gave me regarding VISAs was very helpful, but I was wondering how I would explicitly change one channel in the USB. For example, increasing the value of channel one to increase the motor speed if I sensed from the accelerometer that the helicopter was falling?
That would be completely dependent on the driver provided by the company. We can't answer this since we don't have the helicopter, the driver, or the documentation.
05-26-2010 11:39 AM
If you have the DLL which implements individual commands one at a time, using a USB sniffer can get you a long way.
This is something I'd like to do as a project maybe (I like reverse-engineering protocols) but I don't have the hardware or software.
Shane.