Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Command Based Programming (http://www.chiefdelphi.com/forums/showthread.php?t=128329)

DavisC 29-03-2014 18:55

Command Based Programming
 
Hello,

I have been trying to switch over to Command based programming and have not had any success. I have attempted to follow the guide on the Screen Steps site with no luck.

Anyone know of a good guide/intro to follow?

SoftwareBug2.0 30-03-2014 01:02

Re: Command Based Programming
 
I know this isn't the question that you're asking but my recommendation is don't bother. It makes it harder to reason about what the code is doing.

Joe Ross 30-03-2014 14:28

Re: Command Based Programming
 
Take a look at Brad Miller's youtube playlist: https://www.youtube.com/watch?v=k7Pa...lgn vhGObeKzp While it uses Java, the concepts are the same.

I disagree with Eric. I think that the Command programming model makes it much easier for multiple programmers to work on the code in a coherent fashion. It makes the code easier to read and follow once you go beyond the simplest of programs.

Some teams may have a good framework in place, in which case the Command programming model is not helpful, but that doesn't describe most teams.

kylelanman 31-03-2014 00:29

Re: Command Based Programming
 
I too disagree with SoftwareBug2.0 and agree with Joe Ross...

The command based programming model empowered our team to create more sophisticated robots the past two years.

We were able to cleanly have multiple autonomous modes and create new ones minutes before matches.

In 2013 it allowed us a have completely autonomous 30 pt climb sequence.

In 2014 it allowed us to easily create a two ball autonomous the night before bagging.

I won't say there isn't a lot of overhead required in the command based model. It certainly requires writing a lot more code so it might not be best for beginners. In the end it encourages good OO code that is both more reusable and easier to maintain.

jmullins16 31-03-2014 00:40

Re: Command Based Programming
 
Our team has also used command based programming to get non-programmers up to speed and using object oriented concepts. Also using the Robotbuilder tool provided in the WPILiB directory has helped us create an initial set of files without getting mired in the C++ structure and semantics, and I recommend it. We can get them focused on controlling the robot actuators and sensors. But it can be a little constraining, and I do understand there are lots of teams who have passed this level of skill.

We're very willing to share our experience with C++ and RobotBuilder if needed.

bvisness 04-04-2014 19:25

Re: Command Based Programming
 
Back to the OP's question...the YouTube playlist that Joe Ross shared looks it should give you a great start.

Beyond those tutorials, I would recommend taking one of your team's old robots and trying to write new code for it using the command-based model. You'll often find that writing even simple robot code can be a difficult challenge when you're unfamiliar with a language or framework.

jalburty 05-04-2014 18:05

Re: Command Based Programming
 
Watch the videos very closely and repeatedly if you have to until you understand each concept. In fact, I would recommend slowing down the video and watching it that way. Brad goes very fast. You can do this in YouTube if you upgrade your browser to HTML5 without distorting the audio.
Here's how: https://www.youtube.com/html5

Jasonism4me 05-04-2014 22:42

Re: Command Based Programming
 
Hi! My team would like to switch to C++ next year but would like to have a programmer (me) that knows what they are doing before the year starts. I cannot find a good C++ guide or something similar to get me started and I am kind of confused with how the structure is supposed to work. Any good suggestions?

wireties 06-04-2014 01:49

Re: Command Based Programming
 
Quote:

Originally Posted by Jasonism4me (Post 1369695)
Hi! My team would like to switch to C++ next year but would like to have a programmer (me) that knows what they are doing before the year starts. I cannot find a good C++ guide or something similar to get me started and I am kind of confused with how the structure is supposed to work. Any good suggestions?

That is a little hard to believe. There are hundreds of C++ books and/or "guides" out there. Where have you looked? What sort of background do you have? FIRST has a decent how-to-get started guide. Have you looked at that?

http://wpilib.screenstepslive.com/s/3120/m/7913
http://www.usfirst.org/roboticsprogr...twareresources
http://www.cplusplus.com/doc/tutorial/
http://www.cprogramming.com/tutorial/c++-tutorial.html
http://www.informit.com/store/accele...-9780201703535
http://www.stroustrup.com/Programming/

... google is your friend.

HTH

jmullins16 07-04-2014 01:22

Re: Command Based Programming
 
I agree there are lots of good tutorials on getting started with C++. Keith has a very good list and I've been through many of them in getting our team started using C++ two years ago. Some are focused on writing a generic C++ program, Object-Oriented programming, or specifically using C++ with WPILib for an FRC robot (screenstepslive).

I recommend that if you have a robot to test with, stay close to the WPILib/screensteps tutorials which get you going very quickly. And if you want to have an initial set of template headers and source files to see how a project fits together, take a look at RobotBuilder. It will get you a working C++ project that is driving with only a few lines of your own code. It can sometimes be easier learning the language when you see lots of the structure in place for you to modify.

If you don't have a robot to learn the language right away, then I would focus on the more generic C++ tutorials that can be run with most C++ compilers. Retention is always better when you have to debug something and make it work.

By using RobotBuilder our team spends more time figuring out WPILib calls to add robot functionality than how to use C++ as a language. And that's what I want them to do.

King Nerd III 06-02-2015 11:31

Re: Command Based Programming
 
I created a new template with a huge amount of comments and examples if you want to check it out:
http://www.chiefdelphi.com/forums/sh...d.php?t=133961
This is based off of how our robot will be set up this year, and should be rather easy to follow. Just make sure you don't miss the Robot::insertobjecthere or most things as it is what causes most errors for my under programmers.
-Lord Supreme Programmer for Team 1410 Isaac


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

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