Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Getting Familiar with Programming in WindRiver (http://www.chiefdelphi.com/forums/showthread.php?t=70839)

kyungjin 08-01-2009 15:34

Re: Getting Familiar with Programming in WindRiver
 
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?

dnrobotics11 08-01-2009 16:06

I NEED HELP
 
--------------------------------------------------------------------------------

I have set up the WindRiver programming compiler but first of all, I don't know how to set up a FIRST code template with the three phases of competition as subroutines. Also, I am extremely lost in regards to the configuration of the cRIO system with WindRiver. I set up the IP addresses but there is never a connection between the cRIO and the computer. I do not know what I'm doing. Can anyone help? Thank you

Jlulian 08-01-2009 22:19

Re: Getting Familiar with Programming in WindRiver
 
Quote:

Originally Posted by kyungjin (Post 795996)
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

kyungjin 10-01-2009 05:53

Re: Getting Familiar with Programming in WindRiver
 
Thanks for the reply! It was just what I was looking for.

Just one question though... What is the difference between the first set of code and the second set of code?

kyungjin 12-01-2009 21:58

Re: Getting Familiar with Programming in WindRiver
 
Hey Jlulian, I tried what you posted and for the most part everything seems to work fine... except when we try to put it into reverse...

Code:

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

jaguar1->Set(0.5);
Wait(2000);
jaguar2->Set(1.0);

I tried playing around with the code a bit and found that whenever I set the number to a negative value for example:
Code:

jaguar1->Set(-1.0);
... the code wouldn't run...

I haven't tried played around with it too much but I was wondering if you knew anything about this...

kyungjin 17-01-2009 13:04

Re: Getting Familiar with Programming in WindRiver
 
I've tried playing with it some more.... It seems that the jaguar command doesn't like negative numbers... Is there a reason for this?


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

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