![]() |
very basic code help
Team 1771's only programmer last year was a senior, and now he is gone. Myself and one other teammate are trying to learn how to program in time for next season.
We just got windriver installed on our team laptop and are still figuring out how to use it. No one on our team currently knows how to use it. We both have very basic C++ skills. We downloaded the basic starter code supplied by FIRST. We can currently do teleop tank drive with 2 joysticks and an autonomous that goes straight forward without stopping. Can anyone point me toward some resources for learning about windriver and about controlling basic functions of the robot, or just walk me through? |
Re: very basic code help
The FRC C/C++ Users Guide is a good starting point. It should be included in the windriver install (IIRC, c:\windriver\docs\), otherwise it should be available from http://usfirst.org/roboticsprograms/....aspx?id=14532.
Start there then when you have specific issues/question come back and I'm sure someone here will help. |
Re: very basic code help
Thanks for the help, but now we have a more specific question.
We are experimenting with autonomous and we have this code Code:
void Autonomous(void) we dont really know what GetWatchdog is, we know that the sample code has it. What we have so far makes it drive straight at half speed indefinitely as far as we can tell. We looked at RobotDrive.cpp and .h in the WPILib but we cant figure out how to end the .drive command and move on to the next line. |
Re: very basic code help
NOTE: Some of the function/class/template names have changed since I began working with this, so I may accidentally use a old name.
Quote:
When you are debugging you will often disable the watchdog. The myRobot.Drive() function sets a speed, and continues at that speed until told otherwise. If you are using the Simple robot template you just insert a delay (I believe there is a Wait() function in there somewhere), then call Drive again. If you are using the Itterative robot template you have a little more work todo. Essentially you would create a state machine using the number of itterations and/or sensor inputs to move between states (forward until hit wall, left turn 90 degree, ect.). |
Re: very basic code help
Thanks for all the help so far. One more question.
We are using the simple robot template, and as far as I can tell, everything is right, but it wont build. Code:
#include "WPILib.h""RobotDemo::RobotDemo()' is private" in reference to line 7 and a nonspecific error at the very last line. Can you tell what I need to do to fix it? |
Re: very basic code help
Quote:
To do this: Code:
class RobotDemo : public SimpleRobot |
Re: very basic code help
Oh ok, thanks. I saw that when i was reading a fragment of last years code that was left on the desktop of the laptop we use, but i didnt think we needed it because it wasn't included in the FIRST supplied code.
I cant test it now because im at home, but im pretty sure it will work. thanks. |
Re: very basic code help
Quote:
Code:
#include "WPILib.h" |
Re: very basic code help
Quote:
|
Re: very basic code help
Code:
while (IsOperatorControl()) And what is the difference between putting the RobotDrive and the Joysticks inside the class and moving the constructors as opposed to how i had it? |
Re: very basic code help
Hey, I am the other programmer working on this.
We have another problem also. During our tele-op period, it runs our autonomous code! Any idea as to why this could be? At first it worked fine, then when we ran it again, it started doing autonomous in teleop, and wouldn't accept any input from us. I changed the battery and did a power cycle, and that fixed it; once. After I ran it again in teleop, it went back to doing autonomous. Any idea? |
Re: very basic code help
you need to remove the infinite loops, the while(1) like i said above
|
Re: very basic code help
Quote:
|
Re: very basic code help
Ok, thank you.
But what about the constructors for the Joystick and RobotDrive? Why does it make a difference wether or not they are inside the class. It compiles fine either way. |
Re: very basic code help
Quote:
It also makes it easier to debug and modify since if they are contained within the class no other objects have direct access to them. In this case it shouldn't matter since you should only ever have a single instance of the robot class. However it is still best practice. |
| All times are GMT -5. The time now is 13:38. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi