Go to Post Life is not about avoiding risk, but managing it. - dtengineering [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Spotlight this post!  
Unread 23-02-2009, 22:03
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: programming axis for motor

Are you programming using LabVIEW, or are you writing C++ in Workbench? The details differ for each.

[Caution: I am posting without benefit of LabVIEW running on my computer, so I might not get the details exactly right in what follows.]

In LabVIEW, you use a Motor Open VI to specify which PWM output and what kind of speed controller you're using. The output of that VI is a device reference that you feed to a Motor Set VI, and later to a Motor Close. The Motor Set takes a number from -1 to 1 in order to control the motor direction and speed.

Similarly, you use a Joystick Open VI to specify which USB port's joystick you want to read. Its device reference goes to a Joystick Get Axis VI, and later to a Joystick Close. The Joystick Get Axis also takes an input defining which axis you want to use (yes, the X axis is the left-right one), and provides a numeric output from -1 to 1 representing the position of the joystick.

The output of the Joystick Get Axis VI goes to the input of the Motor Set VI.

[Again, caution: I don't have practice with C++ and the WPI library this year, so my description might not get the details here right either.]

Using C++, the ideas are the same, but the implementation is completely different. You instantiate a Motor object, either by setting a Motor *pointer to a new() or by statically declaring a Motor variable, and similarly instantiate a Joystick object. Use Joystick.GetAxis() to read the joystick position, and use Motor.Set() to set the motor speed.
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
programing motor with axis frcchile Programming 1 16-02-2009 08:30
Which axis for accelerometer? bitsoglass NI LabVIEW 1 23-01-2009 17:42
Programming the axis camera...... programmr C/C++ 10 11-01-2009 12:23
Axis Camera Programming in Labview Striker_27 NI LabVIEW 10 09-01-2009 19:19
Getting feedback from Axis Camera?? *programming in C++* Straberrie Programming 3 01-01-2009 22:39


All times are GMT -5. The time now is 08:44.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi