ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling a RC helicopter via USB using LabVIEW

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.

0 Kudos
Message 1 of 7
(4,720 Views)

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

Wire Warrior

Behold the power of LabVIEW as my army of Roomba minions streaks across the floor!
0 Kudos
Message 2 of 7
(4,689 Views)

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.

 

 

0 Kudos
Message 3 of 7
(4,671 Views)

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)?

0 Kudos
Message 4 of 7
(4,669 Views)

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.  

0 Kudos
Message 5 of 7
(4,625 Views)

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.

0 Kudos
Message 6 of 7
(4,608 Views)

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.

0 Kudos
Message 7 of 7
(4,584 Views)