|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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? |
|
#2
|
||||
|
||||
|
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.
|
|
#3
|
||||||
|
||||||
|
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. |
|
#4
|
||||
|
||||
|
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. |
|
#5
|
||||
|
||||
|
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. |
|
#6
|
||||
|
||||
|
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. |
|
#7
|
|||
|
|||
|
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 |
|
#8
|
|||
|
|||
|
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?
|
|
#9
|
||||
|
||||
|
Re: Command Based Programming
Quote:
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 |
|
#10
|
||||
|
||||
|
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. |
|
#11
|
||||
|
||||
|
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 Last edited by King Nerd III : 06-02-2015 at 11:34. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|