Go to Post I suppose this would be a bad time to reveal that Q and LookingForward are the same robot person hybrid thing... - EricVanWyk [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

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 07-01-2009, 16:17
RKElectricalman's Avatar
RKElectricalman RKElectricalman is offline
Meezy the Mentor
AKA: Rameez
FRC #0384 (Sparky 384)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2004
Location: Richmond, Va
Posts: 88
RKElectricalman is just really niceRKElectricalman is just really niceRKElectricalman is just really niceRKElectricalman is just really nice
Send a message via AIM to RKElectricalman
Re: Basic functions in windriver

there's too much information to grab from that, and I honestly haven't be able to grab too much use from it...
__________________
ahhh Division Finalists!!
  #2   Spotlight this post!  
Unread 07-01-2009, 19:43
Shinigami2057 Shinigami2057 is offline
Slackware Is Your New God (Mentor)
AKA: Harry Bock
FRC #1350 (Rambots)
Team Role: Programmer
 
Join Date: Oct 2006
Rookie Year: 2006
Location: Johnston, RI
Posts: 106
Shinigami2057 is just really niceShinigami2057 is just really niceShinigami2057 is just really niceShinigami2057 is just really niceShinigami2057 is just really nice
Re: Basic functions in windriver

Why has WPI not released proper documentation yet? That PDF is from October, it still has the DRAFT watermark, and is littered with incomplete examples and napkin CAD, which is extremely frustrating when adjusting to the new API.

Looking at the internal source code has helped some, but many things are still unclear, and the manual could use a glossary for terms related to the cRIO and its new modules..

Don't get me wrong, i highly appreciate what they are doing and they've done quite a bit in a (relatively) small amount of time, but it all feels rather rough around the edges.
__________________
One of the main causes of the fall of the Roman Empire was that, lacking zero, they had no way to indicate successful termination of their C programs.
  #3   Spotlight this post!  
Unread 07-01-2009, 20:19
RKElectricalman's Avatar
RKElectricalman RKElectricalman is offline
Meezy the Mentor
AKA: Rameez
FRC #0384 (Sparky 384)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2004
Location: Richmond, Va
Posts: 88
RKElectricalman is just really niceRKElectricalman is just really niceRKElectricalman is just really niceRKElectricalman is just really nice
Send a message via AIM to RKElectricalman
Re: Basic functions in windriver

I feel the same exact thing. Every time I get to something that could possibly help me, it's still incomplete. I either need that manual complete, or some nice person to post lines of example code that is specific to what I'm asking for. ...

I spent a few hours reading through code and testing random things, and I taught myself something that someone could've showed me in two minutes.. Can anyone please help me/us out?



-Rameez
__________________
ahhh Division Finalists!!
  #4   Spotlight this post!  
Unread 08-01-2009, 01:13
wt200999's Avatar
wt200999 wt200999 is offline
Texas Instruments
AKA: Will Toth
FRC #3005 (Robochargers)
Team Role: Mentor
 
Join Date: Mar 2006
Rookie Year: 2004
Location: Dallas, Texas
Posts: 325
wt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud of
Send a message via MSN to wt200999
Re: Basic functions in windriver

Have you looked at the example template things that they have in windriver? They show a couple of decent examples.

I haven't been able to actual put code on our controller yet, but I have been playing with the code a bit (I don't know if what I wrote works yet ) so I can't help too much yet

From what I have looked at it looks like there are a couple of ways to go about the basic drive functions. You need to create your joystick objects

Code:
Joystick LeftStick(1);
Joystick RightStick(2);
then either create a RobotDrive object or create motor controller objects (or both)

Code:
Jaguar LeftMotor(1);
Jaguar RightMotor(2);

then set the speed to the joystick

Code:
LeftMotor.Set( LeftStick.GetY() );
RightMotor.Set( RightStick.GetY() );
The only problem is that I am not sure if Joystick::GetY() returns a scaled number between -1.0 and 1.0 that I think the Jaguar.Set() takes, otherwise there is the RobotDrive function which is shown in the simple robot sample example template thing

Hope that helps
__________________
Programming in LabVIEW? Try VI Snippets!

FIRST LEGO League 2004 - 2005
FRC Team 870 Student 2006 - 2009
FRC Team 3005 Mentor 2013 -
  #5   Spotlight this post!  
Unread 08-01-2009, 07:43
CyDrive's Avatar
CyDrive CyDrive is offline
Registered User
FRC #1203 (pandemonium)
Team Role: Mentor
 
Join Date: Apr 2007
Rookie Year: 2007
Location: West Babylon
Posts: 26
CyDrive is an unknown quantity at this point
Re: Basic functions in windriver

The Joysticks do return a value from -1 to 1, so you can put the values directly into the Jaguars.

If you were looking for a drive system off of one joystick you would use something like this. This could basically is a copy of the old code just usable on the new brain.

NOTE: In the code this year it seems to be easier to just declare all the variables you are going to be using as pointers. This code has also not been completely tested but it should work.

For global variables
Code:
Joystick *controller;
Jaguar *LeftMotor, *RightMotor;
In your constructor
Code:
//This creates a new joystick object to usb1 from the drive station
controller = new Joystick(1);
//Sets the left motor the pwm out 1 and right to pwm out 2
LeftMotor = new Jaguar(1);
RightMotor = new Jaguar(2);
You will need to put this function in the code. All it does is makes sure that the values given to the Jaguars are valid;
Code:
float valid_value(float value)
{
	if(value > 1)
		return 1;
	if(value < -1)
		return -1;
	return value;
}
Then finally in the teleoperated function you would use
Code:
LeftMotor->Set(valid_value(controller->GetX() - controller->GetY());
RightMotor->Set(valid_value(controller->GetX() + controller->GetY());

Now, if you want to grab button states from the joystick there are two ways to do this. In terms of this example i will use the controller variable declared above.
Code:
controller->GetRawButton(4);
controller->GetButton(Joystick::kTriggerButton)
Both lines return a simple bool state
The first example though returns the state of the button on the controller labeled 4. The second one shows how to use the GetButton function using the constants from the Joystick class.

If you would like to see all the classes in the new code with your project open in windriver look for the project explorer. Inside the project explorer hit the plus next to includes, then look at the files that appear then click the plus next to the one named C:\windriver\vcworks-6.3/target/h/WPIlib

Hopefully that cleared up alot.
Closed Thread


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
Debug Windriver issue..... programmr C/C++ 12 06-02-2011 13:47
Windriver LAC McGurky C/C++ 12 25-02-2009 18:38
compiling in windriver koreabell Programming 4 05-01-2009 15:32
windriver projects nickmagus Programming 4 01-12-2008 23:29


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

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