Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Passing Parameters with Command-Based Robot Structure (http://www.chiefdelphi.com/forums/showthread.php?t=123387)

Kyle Chan 18-12-2013 22:13

Passing Parameters with Command-Based Robot Structure
 
1 Attachment(s)
This year our team just switched over from LabVIEW to Windriver and we've decided to go with a Command-Based structure. After looking through various guides, we were able to get the Teleop part of the program going but the Autonomous portion is giving us problems. How do we pass through parameters to specify how far we want the robot to drive (for example)? If anyone could help us out with this, it would be greatly appreciated.

Joe Ross 18-12-2013 22:44

Re: Passing Parameters with Command-Based Robot Structure
 
Where do you want to pass parameters from?

You can make command constructors that take parameters and use those. Have you see WPI's GearsBot videos? They lead you through a complete command based program (albeit in java). https://www.youtube.com/playlist?lis...F26A88C6D16C8F

wireties 19-12-2013 02:12

Re: Passing Parameters with Command-Based Robot Structure
 
Our autonomous code reads the desired motions from a text file and executes them. We make up our own command language each year, build a parser and call functions/methods to execute a series of motions or actions. That way we do not have to change the code for each match or before playoffs, we just FTP a new command file to the robot.

HTH

Kyle Chan 19-12-2013 03:22

Re: Passing Parameters with Command-Based Robot Structure
 
Thanks for the quick responses! We'll look into constructors and also reading commands in from a text file.

Kyle Chan 30-12-2013 18:43

Re: Passing Parameters with Command-Based Robot Structure
 
1 Attachment(s)
Update: We got the autonomous up and running. Had to use a "this" pointer and make it equal to a variable of with a different name from the parameter. In our code we used power, leftdistance, and rightdistance parameters/local variables. Format: "this->localvariable = parameter"

BradAMiller 05-01-2014 11:44

You can also choose which command, and therefore which autonomous program runs during autonomous using some radio buttons or combo box on the driver station.

http://wpilib.screenstepslive.com/s/...smartdashboard.

Hope this helps.

Brad


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

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