Log in

View Full Version : What base class do you use when programming?


E Dawg
12-08-2014, 13:43
What base class do you use when programming and why?

madhav
12-08-2014, 14:50
Simple robot for life

JohnFogarty
12-08-2014, 14:54
Iterative Robot based for life. Actually I'm moving to command based this year.

Oblarg
12-08-2014, 15:19
Last year we used iterative robot, because finite state machines are very easy to write and we didn't want to deal with concurrency.

We may look at multithreading this year.

madhav
12-08-2014, 15:36
We may look at multithreading this year.

We might try multithreading as well. But we want to shy away from CommandBased and try to write our own.

Jared Russell
12-08-2014, 18:01
java.lang.Object

Poseidon5817
12-08-2014, 18:11
Simple Robot, considering moving to Iterative Robot.

madhav
12-08-2014, 22:20
java.lang.Object

I second this

Kingland093
12-08-2014, 22:47
We use simple because it's well… simple.
One of our programmers briefly experimented with iterative

Bryce Paputa
12-08-2014, 22:50
I'm not going to say that they're wrong, but anyone not using command based should seriously consider it. It does make some simple things more complicated, but greatly helps readability and maintainability, and it makes chaining actions together and responding to inputs very easy.

nathanwalters
13-08-2014, 01:13
IterativeRobot. What it lacks in simplicity it makes up for in flexibility.

wmarshall11
13-08-2014, 07:52
I'm not going to say that they're wrong, but anyone not using command based should seriously consider it. It does make some simple things more complicated, but greatly helps readability and maintainability, and it makes chaining actions together and responding to inputs very easy.

Having spent serious time and energy trying to make complex actions work safely with SimpleRobot, switching to CommandBased was probably the best programming decision 11 ever made. Not having logic sprinkled through all levels of your code is the best thing ever.

notmattlythgoe
13-08-2014, 08:15
Having spent serious time and energy trying to make complex actions work safely with SimpleRobot, switching to CommandBased was probably the best programming decision 11 ever made. Not having logic sprinkled through all levels of your code is the best thing ever.

We switched to Java 2 seasons ago and went straight for the Command Based structure, and we have been all aboard ever since. As a professional Java developer and ex-CS teacher I feel it teaches excellent practices and is pretty simple to pick up as a beginner.

EricS-Team180
13-08-2014, 10:52
In 2013 and 2014, we used Brad Miller's Robot Builder to create a Command based structure in C++. I agree with the comments of Bryce Paputa, wmarshall11, and notmattlythgoe on the Command based approach.
Plus, I like Brad's "pictures-to-code". It introduces the students to the practice used extensively in my field of aero gas turbine controls - and elsewhere.
We'll use it, again, in 2015.

Prior to that we used the Iterative Robot framework, for the same reasons nathanwalters posted.

Eric

Cel Skeggs
14-08-2014, 14:30
We implement IgneousApplication. :D
More specifically, we use our team's event-based robot framework (the CCRE), which we think is nicer than the command-based framework because it gives us lots of useful tools without forcing a specific structure in the way that command-based does.
Also, event-based control seems to be a better option to program robots than cycle-based control or thread-based control, as far as I can tell. (Though we occasionally still use those in the places where they are helpful.)

madhav
15-08-2014, 01:19
We implement IgneousApplication.

Just looked at it. It looks pretty awesome, I might give it a try.

AustinSchuh
15-08-2014, 01:31
RobotBase.

ArzaanK
16-08-2014, 22:30
To start this year, we used Simple Template, but in the off season, and during the WVROX event, we used Command Based. Having a very small programming background, I thought the transition would be difficult, but it was a lot easier than I though. Moreover, there is a tool called RobotBuilder which makes programming in command based a lot easier, and very quick. It works really well, and it is easy to work with, and teach to others.

This playlist of videos really helped me get started.
https://www.youtube.com/playlist?list=PLYA9eZLlgz7t9Oleid2wtlgnvhGObeKzp

MatthewC529
19-08-2014, 05:39
Personally my background is in game development and thusly I am familiar... Very familiar with the game loop. So for me I find comfort in using IterativeBot. It is flexible in my opinion and I find it easy to implement event-based code and concurrency in some ways. Done right it is not spaghetti code at all.

IterativeBot is my choice.

kylelanman
20-08-2014, 22:53
Up until 2013 we used Iterative Robot. In 2013 we switched to Command Based. I don't envision us ever going back. It has encouraged OOP and it has been easy for the newer students to grasp. We are considering using RobotBuilder for 2015 because most of our students have very little OOP and we don't want them to be bogged down in writing classes and creating umpteen million files.

MamaSpoldi
22-08-2014, 13:40
We have been using SimpleRobot base class since 2009 when C++ and the cRIO became available. Because it gives us full control and flexibility in how we handle the robot operations. We implement an architecture similar to the CommandBase but of our own design.

We have classes representing the main robot systems which define an interface to:
[1] support the various tasks that will be requested by the operator and
[2] provide any information that will be needed by other classes, as well as
[3] a service function which is called each time through the main loop of teleop and autonomous to perform multi-step operations. [Note that none of the interface functions are allowed to perform operations which take significant processing time; they simply set a flag to start an operation or turn on a mode and return.]

Our TeleOp and Autonomous functions are basically loops which maintain the loop time (required for PID loops and other control systems) and make use of the interface defined by each class to facilitate the operation required... either based on an operator request (like pushing a button on the joystick) or based on the steps defined for the currently selected autonomous mode. Reusing the same class interface functions to perform operations in both modes allows our autonomous to come together very quickly and reliably after the testing is done for teleop.

jfitz0807
27-08-2014, 13:21
Would someone please explain the difference between a CommandBased robot and an IterativeRobot?

We went to java in 2012 and started with the RobotBuilder tool. It generated a code skeleton derived from IterativeRobot. The IterativeRobot class is contained in sunspotfrcsdk\lib\wpilibj.src\edu\wpi\first\wpilib j. I have not been able to find a CommandBased class in the wpilib.

The IterativeRobot is "command based" in the sense that on every iteration of the control loop, it executes any active commands. I'm not sure how a CommandBased robot would be any different.

As for multi-threading, we can get into a theoretical discussion on the merits of multi-threading on a single CPU platform. In general, I prefer the explicit control of keeping things single threaded and using the setInterruptible or cancel methods if I need to preempt a running command.

But this would be a discussion for a separate thread (so to speak).

notmattlythgoe
27-08-2014, 13:22
Would someone please explain the difference between a CommandBased robot and an IterativeRobot?

We went to java in 2012 and started with the RobotBuilder tool. It generated a code skeleton derived from IterativeRobot. The IterativeRobot class is contained in sunspotfrcsdk\lib\wpilibj.src\edu\wpi\first\wpilib j. I have not been able to find a CommandBased class in the wpilib.

The IterativeRobot is "command based" in the sense that on every iteration of the control loop, it executes any active commands. I'm not sure how a CommandBased robot would be any different.

As for multi-threading, we can get into a theoretical discussion on the merits of multi-threading on a single CPU platform. In general, I prefer the explicit control of keeping things single threaded and using the setInterruptible or cancel methods if I need to preempt a running command.

But this would be a discussion for a separate thread (so to speak).

The Command Based structure uses the IterativeRobot base class with extra functionality built around it. It sounds like you have been using the Command Based structure.

jfitz0807
27-08-2014, 13:32
Thank you!