Chief Delphi

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

King Nerd III 04-02-2015 10:45

C++ Command Based Robot Template
 
1 Attachment(s)
Has anyone else noticed that the included template does not work correctly? After opening up the examples (GearBot, PacGoat) I noticed that they were different from the template!
Here are some of the discrepancies I noticed:
- There is no CommandBase.cpp/.h in the examples
- The headers in the template are different from examples
- Examples work, template doesn't
- No Robot.h in template
Realizing this made me rather mad. I had to write out some of the files by hand to make sure they worked, and by doing so our robot finally started up, drove, etc. But there was still one problem... My under-programmers are not very experienced with classes and complicated programs like this, so they had no clue how to get it to work. So I have created a blank robot with example command, subsystem, and all the small things needed (declaring motors, joysticks, methods, etc.) and for the sake of frankly being bored I would like to share the blank robot with you, especially if teams are having trouble trying to figure out why their robot won't work. Please feel free to point out any errors, update with better examples, or tell me just how wrong it is, so message me or reply with any of those things.
-Lord Supreme Programmer for Team 1410 Isaac

P.S. It works, I swear.

FleventyFive 06-02-2015 21:57

Re: C++ Command Based Robot Template
 
Never bothered with the command bassed template, that's what RobotBuilder is for. Have you ever tried using it? It's pretty great, you can get the annoying stuff done quickly so you have more time to work on perfecting commands or w/e :) Sorry for not really answering question

Alan Anderson 07-02-2015 10:26

Re: C++ Command Based Robot Template
 
Quote:

Originally Posted by King Nerd III (Post 1438162)
So I have created a blank robot with example command, subsystem, and all the small things needed (declaring motors, joysticks, methods, etc.)...

I thought that was exactly what the RobotBuilder is supposed to create for you. Are you trying to write an entire Command Based Robot from scratch?

King Nerd III 07-02-2015 14:00

Re: C++ Command Based Robot Template
 
Quote:

Originally Posted by Alan Anderson (Post 1439665)
I thought that was exactly what the RobotBuilder is supposed to create for you. Are you trying to write an entire Command Based Robot from scratch?

Is there a problem with writing it myself, instead of using a boring tool? Have you even looked at the template? It's not that much. I only write out objects, methods, and what those will do. It's relatively easy, and I don't see the point of using RobotBuilder if this is more fun, I get more experience, and frankly I enjoy this way more.

Alan Anderson 07-02-2015 14:54

Re: C++ Command Based Robot Template
 
Quote:

Originally Posted by King Nerd III (Post 1439745)
Is there a problem with writing it myself, instead of using a boring tool?

Based on the kinds of questions and complaints you've been posting recently, I think the answer is "Yes, there is a problem." If you want useful help, you need to use the tools as they are designed to be used.

If you want to go it alone, fine. But consider the effect on the rest of your team if you blaze your own path and can't get help when you need it.

King Nerd III 07-02-2015 15:08

Re: C++ Command Based Robot Template
 
Quote:

Originally Posted by Alan Anderson (Post 1439763)
Based on the kinds of questions and complaints you've been posting recently, I think the answer is "Yes, there is a problem." If you want useful help, you need to use the tools as they are designed to be used.

If you want to go it alone, fine. But consider the effect on the rest of your team if you blaze your own path and can't get help when you need it.

The problem with RobotBuilder is that no other team we know uses it. My team has never used it, and we never will. What experience do you gain by having your code generated for you? None. My team will stick with writing the code ourselves, thank you very much. RobotBuilder just looks like Labview on steroids, and will give me no experience to apply to writing code for a robot later in life.
And if you're going to say that by not using RobotBuilder I am throwing my team under a bus and making it impossible for me to get help, how come every question I have asked has been answered? And how, if not using RobotBuilder will mean our code won't work, is our robot currently error free and running smoothly?

wireties 07-02-2015 16:18

Re: C++ Command Based Robot Template
 
You should not be flippantly giving Alan a hard time. Alan is trying to help you. And though your code is now "error free and running smoothly" the OP sounds desperate (and kinda silly).

King Nerd III 07-02-2015 16:35

Re: C++ Command Based Robot Template
 
Quote:

Originally Posted by wireties (Post 1439808)
You should not be flippantly giving Alan a hard time. Alan is trying to help you. And though your code is now "error free and running smoothly" the OP sounds desperate (and kinda silly).

The original post wasn't a question, it was more stating that I have found the template to be wrong and thus have created a template that works. I don't see how that could really be considered desperate. If there are other teams out there that would like to use the template and it helps, then great, I helped someone. What I am not okay with is people saying that by not using RobotBuilder, which doesn't support Talon SRXs fully by the way so not usable for us, I am throwing my team under the bus.

Jalerre 08-02-2015 11:50

Re: C++ Command Based Robot Template
 
I believe you may be using an old template and that's what the problem is. Like you said the examples don't have CommandBase and thats because it was removed this year. And the Robot.h I believe was called RobotTemplate last year. If you are using Eclipse with this years plugins I don't know how you would be having these problems but that seems like what it is.

King Nerd III 08-02-2015 11:55

Re: C++ Command Based Robot Template
 
Quote:

Originally Posted by Jalerre (Post 1440227)
I believe you may be using an old template and that's what the problem is. Like you said the examples don't have CommandBase and thats because it was removed this year. And the Robot.h I believe was called RobotTemplate last year. If you are using Eclipse with this years plugins I don't know how you would be having these problems but that seems like what it is.

That's what I thought, maybe I somehow had the old template, but it's every installation we have! Is the template you have up to date?

Jalerre 10-02-2015 00:04

Re: C++ Command Based Robot Template
 
Quote:

Originally Posted by King Nerd III (Post 1440229)
That's what I thought, maybe I somehow had the old template, but it's every installation we have! Is the template you have up to date?

Yes, but I am not programming in C++.

JohnSmooth42 10-02-2015 22:32

Re: C++ Command Based Robot Template
 
I mean, we use robot builder and I don't see anything wrong with it, it generates all the tedious stuff which would be hard to keep track of by hand. The wiring table is indispensible and how easy it is to use means that it allows you more time to make the code more complex. Teaching freshmen with it is insanely easy(especially when you have the pretty pictures enabled) because it allows them to visualize what's going on more easily, which IMHO is the most important part of FRC programming, or programming in general for that matter.

MrRoboSteve 10-02-2015 23:17

Re: C++ Command Based Robot Template
 
FWIW, for a test I ran earlier this week, I created a new command based C++ project from the template and didn't run into any of the issues you describe.

King Nerd III 11-02-2015 12:33

Re: C++ Command Based Robot Template
 
Quote:

Originally Posted by MrRoboSteve (Post 1441619)
FWIW, for a test I ran earlier this week, I created a new command based C++ project from the template and didn't run into any of the issues you describe.

Does the template have CommandBase.ccpp/.h? That's what throws off the whole robot. You can still get it to work, just takes a lot of editing.

King Nerd III 11-02-2015 12:35

Re: C++ Command Based Robot Template
 
Quote:

Originally Posted by JohnSmooth42 (Post 1441597)
I mean, we use robot builder and I don't see anything wrong with it, it generates all the tedious stuff which would be hard to keep track of by hand. The wiring table is indispensible and how easy it is to use means that it allows you more time to make the code more complex. Teaching freshmen with it is insanely easy(especially when you have the pretty pictures enabled) because it allows them to visualize what's going on more easily, which IMHO is the most important part of FRC programming, or programming in general for that matter.

The main problem with RobotBuilder so far for us is the lack of CANTalon support. Also, we have ~7 Windows computers and 1 Mac, and currently RobotBuilder only opens on the Mac, except for the fact that it does not export.

MrRoboSteve 11-02-2015 15:19

Re: C++ Command Based Robot Template
 
Yes, the new project I created has CommandBase.cpp and CommandBase.h.

It's hard for me at this point to know what exactly your question is.

King Nerd III 11-02-2015 15:23

Re: C++ Command Based Robot Template
 
Quote:

Originally Posted by MrRoboSteve (Post 1441964)
Yes, the new project I created has CommandBase.cpp and CommandBase.h.

It's hard for me at this point to know what exactly your question is.

There is no question. Look at the original post and you'll see I did not ask for help with anything. I was simply stating a problem I ran into and then saying how I fixed it.

Ether 11-02-2015 16:54

Re: C++ Command Based Robot Template
 
Quote:

Originally Posted by King Nerd III (Post 1441967)
There is no question.

This looked a lot like a question:

Quote:

Originally Posted by King Nerd III (Post 1438162)
Has anyone else noticed that the included template does not work correctly?



Alan Anderson 11-02-2015 18:23

Re: C++ Command Based Robot Template
 
Quote:

Originally Posted by King Nerd III (Post 1441821)
The main problem with RobotBuilder so far for us is the lack of CANTalon support.

You might find the discussion in http://www.chiefdelphi.com/forums/sh....php?p=1437494 helpful.

Quote:

Also, we have ~7 Windows computers and 1 Mac, and currently RobotBuilder only opens on the Mac, except for the fact that it does not export.
RobotBuilder is a Java app and runs for others using Windows just fine. You seem to be having a lot of unique problems. I don't know why that is, but I suspect a systemic failure in translating from the ScreenSteps instructions to your system.

Sparkyshires 12-02-2015 18:47

Re: C++ Command Based Robot Template
 
Sorry to revive this thread, but is it just me, or is the CANTalon not LiveWindow Sendable? If so, what do you guys do for test mode? Because the livewindow is awesome for testing stuff but it would totally suck if it doesn't support CANTalons :/

King Nerd III 12-02-2015 19:01

Re: C++ Command Based Robot Template
 
Quote:

Originally Posted by Sparkyshires (Post 1442836)
Sorry to revive this thread, but is it just me, or is the CANTalon not LiveWindow Sendable? If so, what do you guys do for test mode? Because the livewindow is awesome for testing stuff but it would totally suck if it doesn't support CANTalons :/

I have not used test mode, so I wouldn't know how to do that, but things like RobotDrive also do not support the CANTalons so I wouldn't be surprised if LiveWindow didn't, either.
What does the code look like that you're trying to use?

Alan Anderson 12-02-2015 21:09

Re: C++ Command Based Robot Template
 
Quote:

Originally Posted by King Nerd III (Post 1442840)
...things like RobotDrive also do not support the CANTalons...

That is not the case. RobotDrive will support any speed controllers you can instantiate.

King Nerd III 12-02-2015 21:36

Re: C++ Command Based Robot Template
 
Quote:

Originally Posted by Alan Anderson (Post 1442907)
That is not the case. RobotDrive will support any speed controllers you can instantiate.

Have you verified this by creating a RobotDrive object within C++ and having it drive a robot? If so, this would be very helpful for us, as so far, in our experience, RobotDrive will not work with a CANTalon setup.

Alan Anderson 12-02-2015 22:38

Re: C++ Command Based Robot Template
 
Quote:

Originally Posted by King Nerd III (Post 1442924)
Have you verified this by creating a RobotDrive object within C++ and having it drive a robot? If so, this would be very helpful for us, as so far, in our experience, RobotDrive will not work with a CANTalon setup.

I don't use C++, so I have not verified it personally. But I count at least a half dozen teams who have posted on Chief Delphi about doing it. Here's a post containing code that explicitly says it works.

King Nerd III 12-02-2015 22:51

Re: C++ Command Based Robot Template
 
Quote:

Originally Posted by Alan Anderson (Post 1442975)
I don't use C++, so I have not verified it personally. But I count at least a half dozen teams who have posted on Chief Delphi about doing it. Here's a post containing code that explicitly says it works.

That thread has the RobotDrive initializing with PWM. Not CAN. It says so in the comments of the code. This does not show that RobotDrive works with CANTalon.

Alan Anderson 12-02-2015 23:09

Re: C++ Command Based Robot Template
 
Quote:

Originally Posted by King Nerd III (Post 1442988)
That thread has the RobotDrive initializing with PWM. Not CAN. It says so in the comments of the code. This does not show that RobotDrive works with CANTalon.

Omar took the Driving a robot using Mecanum drive example, changed it from PWM to CANTalon, and added gyro features. He just didn't fix the comments, that's all. If you look at the actual code, you won't see any PWM use.

King Nerd III 12-02-2015 23:24

Re: C++ Command Based Robot Template
 
Quote:

Originally Posted by Alan Anderson (Post 1443000)
Omar took the Driving a robot using Mecanum drive example, changed it from PWM to CANTalon, and added gyro features. He just didn't fix the comments, that's all. If you look at the actual code, you won't see any PWM use.

Even if the code compiles, it does not mean it'll absolutely work. I have tried to use RobotDrive with the CAN and it does not work for me. If other people have it working, good for them, but in my experience from using the RobotDrive with CANTalons in C++ it will not drive.

King Nerd III 12-02-2015 23:27

Re: C++ Command Based Robot Template
 
Quote:

Originally Posted by King Nerd III (Post 1443016)
Even if the code compiles, it does not mean it'll absolutely work. I have tried to use RobotDrive with the CAN and it does not work for me. If other people have it working, good for them, but in my experience from using the RobotDrive with CANTalons in C++ it will not drive.

Please, anyone, feel free to prove me wrong by writing out a simple program that uses RobotDrive and CANTalons in C++ to drive. If you do, please upload your code so I can save it for future reference, and if you can, a video showing the robot driving would be nice too!

ozrien 13-02-2015 00:57

Re: C++ Command Based Robot Template
 
Quote:

Originally Posted by Alan Anderson View Post
Omar took the Driving a robot using Mecanum drive example, changed it from PWM to CANTalon, and added gyro features. He just didn't fix the comments, that's all. If you look at the actual code, you won't see any PWM use.
Quote:

Originally Posted by King Nerd III (Post 1443016)
Even if the code compiles, it does not mean it'll absolutely work. I have tried to use RobotDrive with the CAN and it does not work for me. If other people have it working, good for them, but in my experience from using the RobotDrive with CANTalons in C++ it will not drive.

Wow, you must not think much of my examples. Well...I'm not sure what else I can do for you besides giving you functional code that I tested on my robot, which is available per Alan's suggestion. I'm not really sure what you are asking for from the community at this point. Do you really think I would not test it on an actual robot before posting it?

At any rate if you're really that unhappy with robotbuilder, then I would recommend using a clean IterativeRobot project. If you don't like RobotDrive, implement your own drive train class.

I'm not sure what problem you are seeing with RobotDrive. The only problem I've heard of and confirmed is that RobotDrive tends to trip MotorSafety occasionally, which is easy to workaround by calling RobotDrive:SetSafetyEnabled(false).

Sparkyshires brought up a good question. I'm not sure if the LiveWindow Sendable interface is implemented (I don't have the code in front of me). If it's not I'm sure you could put together an easy wrapper to hook it up, or someone from the community could recommend a way to go about it.

King Nerd III 13-02-2015 01:20

Re: C++ Command Based Robot Template
 
Quote:

Originally Posted by ozrien (Post 1443079)
Wow, you must not think much of my examples. Well...I'm not sure what else I can do for you besides giving you functional code that I tested on my robot, which is available per Alan's suggestion. I'm not really sure what you are asking for from the community at this point. Do you really think I would not test it on an actual robot before posting it?

At any rate if you're really that unhappy with robotbuilder, then I would recommend using a clean IterativeRobot project. If you don't like RobotDrive, implement your own drive train class.

I'm not sure what problem you are seeing with RobotDrive. The only problem I've heard of and confirmed is that RobotDrive tends to trip MotorSafety occasionally, which is easy to workaround by calling RobotDrive:SetSafetyEnabled(false).

Sparkyshires brought up a good question. I'm not sure if the LiveWindow Sendable interface is implemented (I don't have the code in front of me). If it's not I'm sure you could put together an easy wrapper to hook it up, or someone from the community could recommend a way to go about it.

Sorry, I did not mean to insult your examples in anyway. It's just that with RobotDrive and the CANTalons haven't been working at all for me, and its a little frustrating. We use the command based robot, as shown by the template I made, and from what I've seen the command based is an iterative robot with all the pieces broken up, which is what the team uses to also train people to use classes and such.

Alan Anderson 13-02-2015 08:24

Re: C++ Command Based Robot Template
 
Quote:

Originally Posted by King Nerd III (Post 1443016)
Even if the code compiles, it does not mean it'll absolutely work.

Apparently you didn't read the code I pointed to or the rest of the post it was included in. Omar drove a robot using that code.

Quote:

Originally Posted by King Nerd III (Post 1443019)
Please, anyone, feel free to prove me wrong by writing out a simple program that uses RobotDrive and CANTalons in C++ to drive. If you do, please upload your code so I can save it for future reference...

Already done. Working proven code has been written, uploaded, and handed to you on a silver platter.

CC_Gear 08-02-2016 00:28

Re: C++ Command Based Robot Template
 
Hey! Thanks for posting the template! We are a rookie team this year with a deficit in programmers, so this code helped make things a little clearer.

King Nerd III 19-02-2016 20:59

Re: C++ Command Based Robot Template
 
Quote:

Originally Posted by CC_Gear (Post 1536799)
Hey! Thanks for posting the template! We are a rookie team this year with a deficit in programmers, so this code helped make things a little clearer.

Sorry for the late reply, I forgot I unsubscribed from this thread. Anyways, it's no problem creating it! I know there are some typos, but overall I think that covers most of the framework. If there are any questions you have about the template, feel free to contact me, especially if any errors in the code are. I would like to be able to release an updated version soon with some new tricks I learned this year, such as SmartDashboard preferences and multiple autos.


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

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