![]() |
Re: Encoder Code
Thanks Kevin. That works great.
I'm also using your "No Jitter" PWM code to run my drive motors on channels 13 and 15. My bot will only be using 3 or 4 PWM channels total. Should I use channels 13 through 16 if I am using interrupts for encoders? The reasons for using (or not using) PWMs 13 through 16 have never been clear. Tim |
Re: Encoder Code
Quote:
With Kevin's new stable PWM code, there's a new reason to use them: it's possible to get better resolution than the standard PWM outputs. If you want extra-precise control of servo position, you can essentially concentrate the 255 discrete steps into a smaller range of travel. This works great for controlling the CMUCam tilt/pan assembly and getting much better information on exactly which direction the green target light is from the robot. |
Re: Encoder Code
Kevin - during the season you worked a bit on new full-blown camera code with the improved resolution (which I believe you can still download off the link here in the forums, but not on your FRC page). Any chance you'll post the the streamlined version with the same improvements? We had it working at one point but we got rid of it in favor of the old version when we had to reprogram some other portions of our code.
|
Re: Encoder Code- help !!!
hi,
I try to use kevin's encoder I opend the project :'encoder.mcw' but I get en errors : 'encoder.c:130:Error [1205] unknown member 'INT3IP' in '___tag_223' 'encoder.c:130:Error [1131] type mismatch in assignment' what can I do ??? :ahh: thanks. |
Re: Encoder Code- help !!!
Quote:
Quote:
|
Re: Encoder Code
Alan, I think you forgot the most important:
Welcome to Chief Delphi! (first post of Avi):D |
Re: Encoder Code
I've been programming for over 25 years, including some fairly heavy scientific programming and hobby programming on PIC microprocessors, and I have found this entire process of mentoring in FIRST to be quite confusing.
I think that those who make obnoxious remarks have probably forgotten what it was like to be completely new at this, on a rookie team, and working with new tools. I agreed to mentor. Little did I know that I would be directed to read hundreds of pages of tedious documentation, when instead a simple example might seem to be in order. Oh, I know: search the forum for "simple example" ... sorry, no hits. |
Re: Encoder Code
Quote:
I don't think the obnoxious remarks are made on purpose. Sometimes people are kidding and the written English language is tricky when it comes to expressing emotions. ( I used to be a writer.) One basic problem is that brilliant design engineers, software engineers, electrical engineers do not always make good online teachers. A teacher is someone TRAINED to break down ideas for the expressed intent of explaining to someone who needs a very basic explanation with simple, concrete examples. (Teachers deserve a LOT more respect!) Half the stuff I read in here would be impossible to understand if I hadn't studied PIC programming and read a thick book on the chips that solved all my insomnia problems! This stuff is darned confusing and C is a fairly hostile language when it comes to humans. It's highly unintuitive and I can hardly wait for the next fad language, or a decent C translator to come along and make some sense out of it all. (Oh I CAN do it... but it takes more time and effort than it should and goes against my philosophy that computers should make things easy for people and not the other way around.) In the end, I can hardly disagree that there are a profound lack of SIMPLE examples and explanations of concepts. That's one reason mentors are important. If you understand it, then you can translate for the kids on the team in a way they can understand. Still I agree with you, it's all too cryptic and tedious. Mentoring s tough (and sometimes thankless) and I doubt we'll ever see someone get a Nobel prize out of their involvement with a FIRST team, but it's important if not rewarding. And by the way, if no one else has said it, Thanks for being a mentor. Best wishes Steve |
Re: Encoder Code
Quote:
|
Re: Encoder Code
Quote:
Everything I've seen in MPLab doesn't look documented at all. Just a bunch of empty functions with no explanation. |
Re: Encoder Code
Hey wait, I think I finally found it. It was in a logical place, sort of, but the first links for "default code" are all dead links. That's because they are from previous years. The actual active links are five pages into the thread.
This is great, only three weeks and I have the default code! Actually, I think I downloaded it before along with a million other things as I was looking for code. OK, so sometimes you just look at the 2004 documentation. I should have been able to guess that. Somtimes information from previous years is good, sometimes not. Got it. |
Re: Encoder Code
Quote:
-Kevin |
Re: Encoder Code
Quote:
I have borrowed a Vex robot, and I have ordered parts to build my own small toy robot, just to have a chance to work on the software. One of the kids is going to put the Vex robot together in the next few days. Specifically, I don't understand how the software system is supposed to work. Apparently I missed out on the thorough documentation that Mr. Anderson has alluded to, but I might have it now, I hope. The EasyC system (which we did not really look at) seems to be well documented and has explanations of how you do things. I can program in C, so I didn't look at it, as I usually find code generators to be tedious, limited, and just basically in the way. I'm sure that once I can actually download the code into a robot and experiment, it will all make sense. |
Re: Encoder Code
Ouch! That's rough! 3 weeks! You probably already know all this but just in case. Everything is overhead except for:
user_routines.h user_routines.c user_routines_fast.c user_routines_fast executes once every 26.2ms (approx) and doesn't wait for the operator interface to send data. You can run the robot from this routine and in fact this is where you'd put code for the autonomous period, or any fast calculations from on board sensors without Operator Interface input. user_routines Processes input (like joystick positions or pushbuttons or scaling the joysticks so they are not so sensitive on the low end) from the Operator Interface. most of the coding for actually operating the robot is in here, while the automatic stuff (an algorithm for keeping the robot running straight perhaps) Happens in user_routines_fast user_routines.h describes itself: Code:
* USAGE:If you're looking for Encoder routines, Kevin Watson's is a quite elegant place to start. Downloading his code in the robot gives you on screen output of 6 encoders that use A & B phase direction/count inputs that are connected to the digital in/out on 1,11 2,12, 3,13, 4,14, 5,15, 6,16 positions. You also get his interrupt driven serial port drivers. I didn't realize this at first, so I got confused until I finally figured it out. You disable unused encoders in encoder.h (I commented out the enable lines for the unused encoders). I compared the encoder user_routines.c file with the default user_routines.c program to find out what I needed to leave in to allow the encoders to run and ended up adding my own joystick programs to the encoder user_routines.c and got it to work. Really cool stuff and I have to thank Kevin for demystifying it. I'll be happy to send you MY files and you can see if they'll work on your VEX setup. Best wishes Steve |
Re: Encoder Code
Thanks Steve. No, I didn't know any of that. That is some really invaluable information to have.
A real working example is exactly what I wanted, so if you can share that would be great. I have MPLAB 8.1, compiler 3.1 set up with Kevin Watson's FRC code, which does compile. I also have EasyC set up and running the default code. I know that EasyC will work with the VEX, but I'm not really sure about MPLAB. It will be great next year when we have an extra FRC robot. I'm sure anything you send will be very instructive for me. Thanks again! |
| All times are GMT -5. The time now is 14:13. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi