Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Specificity in Command Classes (http://www.chiefdelphi.com/forums/showthread.php?t=101306)

Nekel_Seyew 27-01-2012 18:13

Specificity in Command Classes
 
Hello,

A big problem I'm having with the command based robot structure is the exact use of extending the command class. If I want to say "turn turret right", I'd have to use a TurnTurretRight class which extends the command class. But what if I just want to turn the turret a little bit, say pi/6 radians. How can I specify that in my command class, and allow for other variable lengths, or must I make a different class for each amount I wish to turn my turret?

Any and all opinions on this would be helpful!

-Nekel_Seyew

RufflesRidge 27-01-2012 18:28

Re: Specificity in Command Classes
 
You should be able to make a TurnTurret command that takes a parameter of how much to rotate the turret. Then to turn the turret right, you pass positive values and to turn it left pass negative values or visa-versa.

Sunstroke 27-01-2012 20:13

Re: Specificity in Command Classes
 
Quote:

Originally Posted by RufflesRidge (Post 1114877)
You should be able to make a TurnTurret command that takes a parameter of how much to rotate the turret. Then to turn the turret right, you pass positive values and to turn it left pass negative values or visa-versa.

I agree. Just put the degree you want to turn in the constructor of your Turn command.


All times are GMT -5. The time now is 23:26.

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