Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   programming axis for motor (http://www.chiefdelphi.com/forums/showthread.php?t=75142)

mahmosh 23-02-2009 15:20

programming axis for motor
 
our team is working to improve the program so we ask u how to program the axis for jaguar ... and is there -xaxis ?! to use it left or right

Alan Anderson 23-02-2009 22:03

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.

byteit101 24-02-2009 06:43

Re: programming axis for motor
 
C++ would be
Joystick stick(1);//joystick1
stick.GetX();

mahmosh 24-02-2009 07:45

Re: programming axis for motor
 
i am using windriver
thanks i have done :D


All times are GMT -5. The time now is 01:12.

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