Go to Post I'm frustrated by the world's reluctance to bend over backwards for FIRST. - Madison [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #23   Spotlight this post!  
Unread 08-01-2009, 22:19
Jlulian Jlulian is offline
Registered User
AKA: Julian Moore
FRC #0004
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2008
Location: CA
Posts: 5
Jlulian is an unknown quantity at this point
Re: Getting Familiar with Programming in WindRiver

Quote:
Originally Posted by kyungjin View Post
I've been kinda confused on how to get some of the basic stuff done...

A lot of the functions that are in the WPILib seem inadequate because they don't have enough parameters to get a specific amount of data or control for a specific component, etc.

I'm sure the constructors have something to do with the member functions of its class but so far, I haven't been able to make any sense or relation between the two functions. The only logical idea that I have so far goes something like this...

If, for example, we have two Jaguar motors plugged into PWM 1 and 2 and we want the first motor to go half speed for two seconds and the the second motor to go full speed for three seconds...

Jaguar::Jaguar(1);
Jaguar::Set(0.5);
Wait(2000);

Jaguar::Jaguar(2);
Jaguar::Set(1.0);
Wait(3000);

I'm pretty sure the above is wrong... Can anyone correct this?
This should work:

Code:
Jaguar* jaguar1 = new Jaguar(1);
Jaguar* jaguar2 = new Jaguar(2);

jaguar1->Set(0.5); 
Wait(2000);
jaguar2->Set(1.0);
incidentally, the following does compile (and _does_ work)

Code:
SpeedController* Motor1 = new Jaguar(1);
SpeedController* Motor2 = new Victor(1); //Implicit casts
Though I wouldn't recommend using two entirely different speed controllers for your drive train
Reply With Quote
 


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
Programming - Getting Started Mark McLeod Programming 80 16-04-2008 23:37
Help Getting Started with VEX programming. Joe Johnson VEX 5 16-04-2007 09:01
pic: Mobot with familiar parts jgannon Extra Discussion 11 24-04-2006 18:55
programming motors with programming kit BorisTheBlade FIRST Tech Challenge 4 01-11-2005 19:03
Programming and Electronics — Getting Started Sidney San Martín Technical Discussion 7 12-01-2005 15:25


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

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