Example Code

myRIO remote controlled vehicle with video streaming

Code and Documents

Attachment

myExplorer is a remote controlled vehicle that uses the National Instruments myRIO embedded controller. myExplorer communicates with the user’s laptop or desktop via WiFi, therefore it can be used in any location with access to a wireless network, such as at home, at the office and in the lecture theatre. myExplorer receives the commands that tell it where to go, while streaming video back to the computer, so that the user knows where it is headed to even when it is on the other side of the building. myExplorer was built as part of a 1 week intern project at National Instruments UK and Ireland.

 

The following short video shows the myExplorer in action http://www.youtube.com/watch?v=ly36PHcKn0Y

 

 

myExplorer, as the name suggests, is created to allow its user to explore without leaving the chair. Admittedly, because of the limited power of the motors, in its current form myExplorer is more of a prototype or a fun little toy rather than a powerful exploration vehicle. However, the LabVIEW code would require little modification in order to scale up the project.

 

DSC00032.JPG

 

The user commands myExplorer by pressing one or more arrow keys (↑↓←→) at the same time. The VI that runs on the computer has an intelligent method of interpreting arrow key press/release events, such that all combinations of keys simultaneously pressed translate to an appropriate command that is sent to the myRIO. For example, if the ↑ and ← keys are pressed at the same time, myExplorer will turn left while still going forwards. if the ↑, ← and → keys are pressed at the same time, myExplorer will move forwards because the left and right arrow key presses cancel each other out. This event handling functionality is available for download here: https://decibel.ni.com/content/docs/DOC-34335

 

arrow keys.JPG

 

The VI that runs on the real-time processor of the myRIO interprets the movement commands and sends appropriate signals to each of the 4 motors. The motors are controlled through 2 double H bridges hidden in the base of the vehicle. Because each motor has to be able to go forwards and backwards, 2 pins are required to control each motor – therefore 8 output lines are used. Out of these 8 output lines, 4 are analog output and 4 are PWM. Despite the fact that the max output voltage of the PWM lines is 3.3 Volts, compared with 5 Volts for AO, because of how the H-Bridges work, this was not a problem – The AO and PWM are functionally equivalent in this project.

 

DSC00036.JPG

(Above) The circuit board composed of  2 x H-Bridge Motor Driver 1A – SN754410 and 1 x voltage regulator that brings down the 7.5 V of the 5 AA battery pack to 5V needed to power the 2 H-Bridge ICs

 

DSC00035.JPG

 

The body, motors and wheels of myExplorer are part of an off the shelf robotics kit available to buy online. The 4 motors are powered by 5 AA batteries (the battery rack comes with the kit), but the myRIO is powered from a separate LiPo battery, as it was found that the AA batteries cannot provide enough current for both the motors and the myRIO at the same time). A point of improvement would be to power both the motors and the myRIO from the LiPo, thus allowing the motors to draw more current and saving the weight of the 5 AA batteries while removing the need for replacing batteries. This will make the vehicle faster and reduce the maintenance work.)

 

DSC00031.JPG

Attached is the myExplorer LabVIEW project. Alongside the VIs, it contains pinout documentation files. The code is based on 2 example projects – “Simple TCP” for transmitting the movement commands and “Simple Network Streams” for transmitting the video feed.

 

Your feedback and questions are welcome.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
kdevelle
Member
Member
on

Hi,

I am currently working on the myRIO for a different project, but with similar code and I aslo used network stream to send data from the RT target to the host computer. My programm work perfectly when I am using the USB interface.  But when I am using the WIFI interface I can communicate from the computer to the myRIO with FTP for example but I can't opened network stream. I would like to know if you had the same probleme while working with the myRIO.

Thank you in advance

Petru.T
NI Employee (retired)
on

Hi kdevelle,

Sorry for the late reply, but no, I did not encounter issues with using network streams with the myRIO. Make sure that you have Network Streams functionality installed on the myRIO. (Open MAX, select your myRIO and expand the "Software" tab. You should see a Network streams item there.

david.cuban
Member
Member
on

Hi,

     I have been using your code as a guide to set up my own video stream with minimal lag-time.  However, with everyhting the same for the network stream component of the vi's and only passing the video through the stream I am getting a large lag of about 5 seconds.  I'm wondering what I might have done wrong?

Did you connect to the myRIO's wifi or had the myRIO conncet to a separate wifi? 

Are you using a laptop or desktop and what is the ram/processor of it?

What kind of camera are you using?

Lastly, are there any specific setting you have changed for your streaming to avoid a lag such as flushing out old data at the cost of a choppy video feed?

Thank you very much,

David

Alexandre2bmobi
Member
Member
on

Hello All, I have the same problem, works when using the USB connection but a 1 seccond betwen frames when using wifi.

Have you found the bug?

rockyData
Member
Member
on

How to stream video from labview to HTML ? I mean i need to stream video from a USB webcam connected to myRIO to web browser via web sockets or web service ?

Is it possible ?

Please help !

and_seb
Member
Member
on

@Petru.T 

Congratulations on your design it looks amazing! I'm also trying to build an application which is controlled by the RIO and was wondering how to best power the hardware. If you don't mind me asking what type of LiPo battery (i.e. voltage and current capacity) did you use. Also did you interface the battery and the RIO with some sort of power management system which controlled the output from the batteries in case of surges or did you simply connect it and it worked?

 

Looking forward to your answer!

Regards,

and_seb

jjlee128
Member
Member
on

Did you just plug the LIPO in with the power connector? Or did you design a voltage and current limiting circuit to prevent damage to the MyRIO? If you did the latter can you share the circuit?

Contributors