|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||||
|
|||||
|
We've went over the code, looked a bit at the functions and other macro stuff.
But we don't have a clue what's going on there! What's with the PWMs? Where's the parts with the engines moving? What are we supposed to write?(as in, in the intilazation, what happens there, the autonomus, what do we use; in the free part, what needs to be modeled.... WHAT ARE WE SUPPOSED TO DO!?!?! (sorry, just totally desprate trying to understand what we need to do while we're being shouted at from every direction, being asked to start writing while we have no clue what to do). |
|
#2
|
||||
|
||||
|
Re: What are we supposed to do!?!?!?!??!?!
If youre totally lost and havent programmed before, I'd suggest that you use the easyC, personally its not my favorite but it is easy to get started... you can find it in your KOP.
The 'pwm's are pulse width modulators, in effect they control the speed of motors. If you want more detailed explanation I'll be happy to give you one. From the programming interface the pwm drives are insanely easy to use, just remember that 127 is neutral, 254 is full forward, and 0 is full reverse. Everywhere in between is variable power output on the motors in forward and reverse directions. hopefully that answers a few questions, if you have more, i'll be happy to answer them. -Q |
|
#3
|
|||||
|
|||||
|
Re: What are we supposed to do!?!?!?!??!?!
Yes, I know about the PWM numbers of forward and backwards and I'm expirienced with C(even with Visual c++), but what am I supposed to do now? You say the drive system is easy, but I don't understand what am I supposed to look at that it shows that it's easy!
I've asked someone from another team in my country and from what I understood, he said that it is all written there. But I don't see it! I only see that they put the values of p1_y(which is what?!?!) to pwm01 and all kind of other stuff, but I don't see anything with number values(mabye except with the leds). Is that where I'm supposed to write the engines part?? |
|
#4
|
||||
|
||||
|
Re: What are we supposed to do!?!?!?!??!?!
Quote:
pwm01 -> this is the code representation of PWM01 on the RC the code pwm01 = p1_y would map the y-axis of port 1's joystick to PWM output 1. I recommend the RC Reference guide, found here. Reading that should answer your questions. |
|
#5
|
|||
|
|||
|
Re: What are we supposed to do!?!?!?!??!?!
Hello, I am from team 2230 too.
We have a default code in our mplab program (like everyone else). What are we supposed to change in it? It seem to be quite complete ![]() |
|
#6
|
||||
|
||||
|
Re: What are we supposed to do!?!?!?!??!?!
There is a function in user_routines.c called Default_Routine(). This is basically your playground, this function runs about 38 times a second (26.2 milliseconds) and you put all your logic in here. Your OI data (joystick values, buttons pushed) is all available in aptly named variables (p1_y, p2_x, p2_sw_trig, etc) that you can check with if statements. For example to make the trigger on the joystick connected to Port 1 drive the robot forward and your motors are on pwm01 and pwm02 you might try this:
Code:
// in Default_Routine()
...
if(p1_sw_trig) // If the trigger is pushed
{
pwm01 = 255; // Left motor full speed forward
pwm02 = 0; // Right motor full reverse since it's likely facing the opposite direction
}
else // Trigger is not pushed
{
pwm01 = 127; // Motor stopped;
pwm02 = 127; // Motor stopped;
}
Code:
... pwm01 = p1_y; Good luck! |
|
#7
|
|||||
|
|||||
|
Re: What are we supposed to do!?!?!?!??!?!
Ok, so I read about the joystick movment thing.
Do we need to build that code of if's? Do we need to make these macros to check the joystick axis status? |
|
#8
|
||||
|
||||
|
Re: What are we supposed to do!?!?!?!??!?!
Every loop the controller updates the values in the P*_* variables, including axes and buttons. All you have to do is use logic on the values and set your pwm** variables.
|
|
#9
|
|||||
|
|||||
|
Re: What are we supposed to do!?!?!?!??!?!
What do you mean by setting our own PWM** values?
|
|
#10
|
|||
|
|||
|
Re: What are we supposed to do!?!?!?!??!?!
Ok thanks alot for your help.
What do we have exactly in our code allready, and what should we use with it? |
|
#11
|
|||
|
|||
|
Re: What are we supposed to do!?!?!?!??!?!
If your using MPLAB and you find yourself blown away, dazed and confused, I would heed the EASY-C recommendation. There are several Easy-C totorials included in the software and online.
|
|
#12
|
|||||
|
|||||
|
Re: What are we supposed to do!?!?!?!??!?!
But we don't know what to do in EasyC. We're used to raw C code. These blocks are confusing(safe, but confusing).
|
|
#13
|
||||
|
||||
|
Re: What are we supposed to do!?!?!?!??!?!
If you are at all confused by anything in easyC, simply press F1 on the keyboard and go to the help file. Similarly, there is a button on every block that will bring you directly to the help page about that block. Intelitek spent literally months writing the help file. It is extremely detailed about every function included in easyC Pro.
|
|
#14
|
|||
|
|||
|
Re: What are we supposed to do!?!?!?!??!?!
These power points taught me to program the robot 4 years ago. The code has changed a little since then but the concepts are still the same.
http://www.usfirst.org/community/frc...nt.aspx?id=482 Watch all of them. |
|
#15
|
|||||
|
|||||
|
Re: What are we supposed to do!?!?!?!??!?!
We already went through the presentation of the C and it didn't give us the real help. It told us where to go but not specifically what to do(yes, write your autonoms code. But what values, varibles, functions etc. are we supposed to use in it?).
What really helped was the the RC reference guide, thx! |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| What are Potentiometers? | Theory6RobotiX | Control System | 18 | 30-12-2005 09:57 |
| PBASIC 2.5 Software supposed to be released TODAY. | Travis Hoffman | Programming | 7 | 13-01-2003 20:43 |
| What are pneumatics? | Aignam | Pneumatics | 23 | 16-10-2002 21:17 |
| Who was supposed to be in Huntington?? | Heather 45 | Off-Season Events | 4 | 16-03-2002 22:43 |