![]() |
Sheesh!
I have enough trouble programming in pbasic while i'm awake. But in my defense I have this to offer; I only just started. Today was my first real day programming, and I made several syntax errors. I managed to change the output of the joystick code from linear to varying with the square. Ugh. I've only got one bug left to kill. But the first bugs I had- man! I bumped the joystick and the robot went screaming full speed into a bunch of 55 gallon drums. I am so happy there is a disable switch. But yeah, it works fine going forward any speed but if you pull the joystick back into the reverse corner areas, it starts going forward. I have something going negative; tomorrow I'll figure out what and fix it.
|
Quote:
Are you trying to change the joystick from using only the y-axis to being able to use the entire plane of the joystick? This code is publicly available, but I should thank you for trying to make the code yourself, before "reinventing the wheel." |
I've found this to be of great value whilst attempting to fit programming into my schedule. I find soft classical music nice for coding, but try to stay away from the really good stuff as that will probably distract you from the finer things in life, lik enjoying your silly programming errors.
Also, PBASIC 3.0 should include the necessary math functions to evaluate our robots name (e^(pi*i)+2). |
Being a rookie programmer myself, I am perhaps super-qualified to post a couple hints...
First off, I have verified Noah's assertion that counter variables do not in fact increment themselves. Increment your counters! And secondly, remember that byte variables only count so high. Thus there is a problem with the following code: testvar VAR byte select testvar case 0 to 300 do something case 301 to 400 do something else 'This is never going to get executed! endselect testvar = testvar +1 'This part is important too! I, of course, learned both of these the hard way. =) |
words of wisdom from another rookie programmer
One important thing to mention is: PBASIC does not like negative values.........period I learned this the hard way when trying to do a case statement on the difference between two byte values and the negative code never executed :-P took me a while to figure it out, but have it running smoothly. oh and counters dont increment themselves, although didnt I hear that from somewhere already? hmmm......oh well :p
|
Quote:
Believe it or not, I have (e^(i·pi)+1=0) on my cabinet at work. Even other engineers don't behold the beauty of this equation. It brings tears to my eyes... Ok, not really, but close. |
Well, I don't get it and I'm a rookie programmer. I find that trying to code at 3 am after playing Unreal Tournament 2003 for 3 hours straight is the best method. You're too tired to play effectively, but too non-tired to sleep. Of course, when you wake up laying face first on the keyboard and read your code and dunno what it does, that's your problem :)
|
Our robot already used an ordinary 1 joystick code. I just fixed it so that the speed is not linear, but parabolic. And I fixed it the day after that post.
|
Getting bashed in the shins
On our first attempt to program auton. mode, the robot did go into full reverse and it bashed our programmer in the legs. We couldn't get it off him.
|
There is a hole in a wall in CSU where 2001's robot decided that it's arm (big iron bar on a motor) would go really fast for no apparent reason. By the way, there is no hole in CSU ;)
We shelled the motor ripping it out, had to get a new one. |
Here's my $0.02: subroutines don't call themselves. GOSUB is your friend.
Relating to this year's program, inverse tangent w/o negative numbers is fuuuuuuuun. :P |
From all the engineer-bashing (robot-wise) I've been hearing in here...I think the number 1 tip would be to PROP YOUR ROBOT UP! :D Get two 2x4's...set them on their edge...and put your robot on them. Not on a table, either. No more chances of killing your ME's :P
|
Re: sleep
Quote:
lol! i have done the same exact thing: help out with wiring or filing, etc, and then program during the last half-hour. i [and some team members] thought it was just me! lol.. |
hmmm...i have just started with PBASIC (i have experience with VBASIC and QBASIC, etc) and my team said that the robot's motors "pulsed" when they pushed the joysticks forward (two-joystick-tank-drive) here's the code i added, it checks for exceptions, and then divides the speed by 4 (i hope?!)
'============= New Code ======================== 'Added code to reduce p1_y and p2_y to 1/4 power 'Maybe only 1/2 power?? if p1_y = 0 then skip_one if p1_y = 125 then skip_one if p1_y = 126 then skip_one if p1_y = 127 then skip_one if p1_y = 128 then skip_one if p1_y = 129 then skip_one if p1_y = 255 then skip_one p1_y = (p1_y / 4) skip_one: if p2_y = 0 then skip_two if p2_y = 125 then skip_two if p2_y = 126 then skip_two if p2_y = 127 then skip_two if p2_y = 128 then skip_two if p2_y = 129 then skip_two if p2_y = 255 then skip_two p2_y = (p2_y / 4) skip_two: ' End code 'SEROUT COMMAND GOES HERE... (Can anyone help on auton mode?!?!?!) Thanks |
Init. the PWM outputs
About initilizing the PWM outputs:
Okay, i have set all the unused PWM outputs to 127 in the SEROUT line. Is this what you mean? Or should i do something like this in the VAR section: '-------Declare VAR's----------------- PWM1 = 127 PWM2 = 127 ... '------------------------------------------ |
| All times are GMT -5. The time now is 02:46. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi