Example Code

Rotate A Cartesian Coordinate By 45° To Use A Joystick To Control a Two-Motor Tank Drive

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

This example demonstrates how to uses Cartesian Coordinate Rotation to rotate a Cartesian coordinate by 45 degrees.

 

Description

This example uses Cartesian Coordinate Rotation to rotate the Cartesian coordinate output of a joystick or joystick emulator by 45 degrees. This aligns the output with a two motor tank drive robot such as the type that can be built with the Lego Mindstorms NXT kit. The example also performs a "saturation check" to ensure that the outputs do not exceed a preset value.

This example works well with the joystick emulator on the community. Simply wire the joystick position into this example VI to create a tank drive program that can be controlled from the joystick emulator.

 

Requirements

 Software

  • LabVIEW Full Development System 2012 (or compatible)
  • If running in a Real-Time context, you will need the LabVIEW Real-Time Module 2012 (or compatible)

 Hardware

  • No hardware is necessary to use this example VI

 

Steps to Implement or Execute Code

  1. Download and open the attached ZIP-file
  2. Open and run the [Main] ...VI

 

Additional Information or References

Rotate Cartesian Coordinate by 45 degree - Front Panel.png
Rotate Cartesian Coordinate by 45 degree - Block Diagram.png 

**The code for this example has been edited to meet the new Community Example Style Guidelines. The edited copy is marked with the text ‘NIVerified’. Read here for more information about the new Example Guidelines and Community Platform.**
Asa Kirby
CompactRIO Product Marketing Manager
________________
Sail Fast!

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

Comments
Jon236
Member
Member
on

can you post a 8.5 version for those of us in the FIRST community?

Captain_Kirby
NI Employee (retired)
on

8.5 version uploaded. Enjoy!

Asa Kirby
CompactRIO Product Marketing Manager
________________
Sail Fast!
Jon236
Member
Member
on

LV still says it's 8.6!

Captain_Kirby
NI Employee (retired)
on

Should be fixed now. Let me know if it works.

Asa Kirby
CompactRIO Product Marketing Manager
________________
Sail Fast!
Jon236
Member
Member
on

It does!  Thanks!