Go to Post Here is one really important thing I learnt this season: If you do it for yourself, you ain't gonna make it. If you do it for you're team, You'll make it. - Bharat Nain [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 06-10-2002, 20:53
Melissa H. Melissa H. is offline
MIA
AKA: Melissa
no team
Team Role: Alumni
 
Join Date: Oct 2002
Rookie Year: 2002
Location: Bloomfield Hills, MI
Posts: 239
Melissa H. is on a distinguished road
Arrow PBasic Question

I'm new to programming PBasic...though I know a little of C and C++(very minimal though ) I was wondering, how can I start learning PBasic and/or find out more on this programming language?

Anything would be helpful!
__________________
FIRST Robotics Alumni =D
  #2   Spotlight this post!  
Unread 06-10-2002, 21:27
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
My advice would be to grab the default code from InnovationFIRST's website (http://www.innovationfirst.com) and go through it line-by-line until you understand it.

After that, I'd try playing around with my emulator (http://FIRSTprograms.tripod.com/Programs.htm) and see what comes out. If you ever run into problems, post them here and you'll get an answer in a few hours at the most.

Also, if you feel like a challenge, here is the code we used last year: http://FIRSTprograms.tripod.com/cog2002.txt
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php

Last edited by rbayer : 06-10-2002 at 21:30.
  #3   Spotlight this post!  
Unread 06-10-2002, 21:34
Ian W. Ian W. is offline
College? What?
no team (Gompei and the Herd)
Team Role: College Student
 
Join Date: Jan 2002
Rookie Year: 2002
Location: Worcester, MA | Smithtown, NY
Posts: 1,464
Ian W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to all
Send a message via AIM to Ian W.
Quote:
Originally posted by rbayer
My advice would be to grab the default code from InnovationFIRST's website (http://www.innovationfirst.com) and go through it line-by-line until you understand it.
what he said. that's what i did, and considering i had about 2 hours to learn it, i did pretty good.
__________________
AIM --> Woloi
Email --> ian@woloschin.com
  #4   Spotlight this post!  
Unread 07-10-2002, 07:12
Melissa H. Melissa H. is offline
MIA
AKA: Melissa
no team
Team Role: Alumni
 
Join Date: Oct 2002
Rookie Year: 2002
Location: Bloomfield Hills, MI
Posts: 239
Melissa H. is on a distinguished road
Thanks for the help!!! The http://www.innovationfirst.com was probably the most helpful (with the default program and all.... )
__________________
FIRST Robotics Alumni =D
  #5   Spotlight this post!  
Unread 07-10-2002, 15:30
Matt Reiland's Avatar
Matt Reiland Matt Reiland is offline
'The' drive behind the drive
None #0226 (TEC CReW Hammerheads)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1999
Location: Troy Michigan
Posts: 712
Matt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond repute
Thumbs up Even more fun!!

Here is some Swerve code broken into processor slots if you get bored.

Hopefully your team can get the edu robot to try out or get your hands on a IFI controller. For right now the emulator is great also.

Thanks for the hard work rbayer!

PBasic is not that hard but living in the hardware limitations is more difficult.
Attached Files
File Type: zip pegasus.zip (20.5 KB, 131 views)
  #6   Spotlight this post!  
Unread 31-10-2002, 14:19
f22flyboy's Avatar
f22flyboy f22flyboy is offline
Distributor of Mayhem
#0540 (Rhythmic Disturbance)
 
Join Date: Oct 2002
Location: Richmond, VA
Posts: 199
f22flyboy will become famous soon enoughf22flyboy will become famous soon enough
Quote:
Originally posted by rbayer


Also, if you feel like a challenge, here is the code we used last year: http://FIRSTprograms.tripod.com/cog2002.txt
I get most of it, but I am confused by this line:


if ((gear_shifting=1) and (gear_count=10)) then shift


do you have to press the top button of your joystick 10 times to shift?

I'm still learning this code so if this is a stupid question feel free to flame me.
__________________
Godwin Robotics Association- Rhythmic Disturbance

Team 540 Forums

FIRST Look... FIRST Shot... FIRST Kill.
  #7   Spotlight this post!  
Unread 31-10-2002, 14:45
Matt Reiland's Avatar
Matt Reiland Matt Reiland is offline
'The' drive behind the drive
None #0226 (TEC CReW Hammerheads)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1999
Location: Troy Michigan
Posts: 712
Matt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond repute
Quote:
Originally posted by f22flyboy


I get most of it, but I am confused by this line:


if ((gear_shifting=1) and (gear_count=10)) then shift


do you have to press the top button of your joystick 10 times to shift?

My best guess for the code is you have to press the top button to shift gears which will stop both drive motors while the shift takes place, they increment a counter for a delay (gear_count) when it increments to 10 the shift takes place (relay lowGear toggles) when gear_count hits 40 it looks like the section gets skipped over

BUt I am not sure where gear_shifting ever gets reset back to zero after the first initialization.?
  #8   Spotlight this post!  
Unread 31-10-2002, 14:55
f22flyboy's Avatar
f22flyboy f22flyboy is offline
Distributor of Mayhem
#0540 (Rhythmic Disturbance)
 
Join Date: Oct 2002
Location: Richmond, VA
Posts: 199
f22flyboy will become famous soon enoughf22flyboy will become famous soon enough
How long

Do you have any idea how long it would be? Does is there a preset time for counter-type variables, or does it depend on the rest of your program?
__________________
Godwin Robotics Association- Rhythmic Disturbance

Team 540 Forums

FIRST Look... FIRST Shot... FIRST Kill.
  #9   Spotlight this post!  
Unread 31-10-2002, 15:00
f22flyboy's Avatar
f22flyboy f22flyboy is offline
Distributor of Mayhem
#0540 (Rhythmic Disturbance)
 
Join Date: Oct 2002
Location: Richmond, VA
Posts: 199
f22flyboy will become famous soon enoughf22flyboy will become famous soon enough
startShift:
leftDrive=127
rightDrive=127
gear_shifting=1
gear_count=0




also what is this here for?

p1_sw_top_prev=p1_sw_top

I see that it sets p1_sw_top_prev=0 but why not just say that?
__________________
Godwin Robotics Association- Rhythmic Disturbance

Team 540 Forums

FIRST Look... FIRST Shot... FIRST Kill.
  #10   Spotlight this post!  
Unread 31-10-2002, 15:17
SlamminSammy's Avatar
SlamminSammy SlamminSammy is offline
Registered User
no team
Team Role: College Student
 
Join Date: Jun 2002
Location: Glasgow, Scoland
Posts: 140
SlamminSammy is on a distinguished road
Send a message via AIM to SlamminSammy
Quote:
Originally posted by f22flyboy

p1_sw_top_prev=p1_sw_top

I see that it sets p1_sw_top_prev=0 but why not just say that?
The gear_count is a delay to prevent damage to the gearbox and I think the p1_sw_top_prev=p1_sw_top resets the input and as for not setting it equal to zero, the button may not have started in the zero (off) position.

Anyway, Rob will be back in an hour and explain everything.
__________________
The opinions stated above are not necessarily those expressed by the FIRST Robotics Program, its participating teams, or any other individual or organization.
  #11   Spotlight this post!  
Unread 31-10-2002, 15:20
Matt Reiland's Avatar
Matt Reiland Matt Reiland is offline
'The' drive behind the drive
None #0226 (TEC CReW Hammerheads)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1999
Location: Troy Michigan
Posts: 712
Matt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond repute
Quote:
Originally posted by f22flyboy
startShift:
leftDrive=127
rightDrive=127
gear_shifting=1
gear_count=0




also what is this here for?

p1_sw_top_prev=p1_sw_top

I see that it sets p1_sw_top_prev=0 but why not just say that?
As for time, it will depend on the program length and the number of processor 'slots' you are using. The longer the program scan, the slower the delay will be.

Gear Count =0 will set up a fresh delay since it increments to 40 and stops incrementing until the next time a gear shift is requested. Gear Count would be at 40 coming into that statement

p1_sw_top_prev=p1_sw_top
this type of statement is useful for storing the value of the switch on the previous scan and checking the current state against what you had before to see if a change has taken place, kind of a 1-shot since after the current scan they will both agree again
  #12   Spotlight this post!  
Unread 31-10-2002, 15:27
f22flyboy's Avatar
f22flyboy f22flyboy is offline
Distributor of Mayhem
#0540 (Rhythmic Disturbance)
 
Join Date: Oct 2002
Location: Richmond, VA
Posts: 199
f22flyboy will become famous soon enoughf22flyboy will become famous soon enough
how long

Can someone on this team tell us about how long the delay is?
__________________
Godwin Robotics Association- Rhythmic Disturbance

Team 540 Forums

FIRST Look... FIRST Shot... FIRST Kill.
  #13   Spotlight this post!  
Unread 31-10-2002, 16:05
Matt Reiland's Avatar
Matt Reiland Matt Reiland is offline
'The' drive behind the drive
None #0226 (TEC CReW Hammerheads)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1999
Location: Troy Michigan
Posts: 712
Matt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond repute
This is from the archives I assume it to be close

close enough for govt work...
Posted by control guy at 1/29/2001 10:29 AM EST


Student on team #250 from HVCC.


In Reply to: Re: PBASIC Loop Speed?
Posted by Lloyd Burns on 1/28/2001 4:38 AM EST:



The program loops are roughly 1/40 sec. Although, the time between loops can vary if you lose signal momentarily. Also, depending on your code, a program loop may take longer some times around than other times. Such as if you had many strings of if statements and you're having the program go here, then here, then here, etc., etc. Hope this helps.
  #14   Spotlight this post!  
Unread 31-10-2002, 16:46
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
Ok, I'm back (sort of). Actually, I'm sitting in my CSci class right now, but I don't really feel like listening, so I'm responding here.

The p1_sw_top_prev=p1_sw_top does exactly what Matt said, it stores the state for the next loop. Since almost no one can press and release a button within 1/40th of a second, we need to make sure that it is actually a "new" button press and not just someones finger left on the switch from earlier. This lets us use the top switch as a toggle. I.e. each time you press it, the gear we are in changes.

As for the timing, it ends up being about 1.5-2 seconds from the time you press the button to the time you can drive again. That is for the full 40 loops. The 10 loop part takes approx. 1/4 as long.

If you can understand this type of time-delay, you have a very good grasp on PBASIC as this type of looping isn't overly intuitive.

Anyway, let me know if there are any other sections that are unclear or don't make sense.

--Rob
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
  #15   Spotlight this post!  
Unread 31-10-2002, 22:38
SlamminSammy's Avatar
SlamminSammy SlamminSammy is offline
Registered User
no team
Team Role: College Student
 
Join Date: Jun 2002
Location: Glasgow, Scoland
Posts: 140
SlamminSammy is on a distinguished road
Send a message via AIM to SlamminSammy
Re: how long

Quote:
Originally posted by f22flyboy
Can someone on this team tell us about how long the delay is?
Just plug the code into RoboEmu and see for yourself!
__________________
The opinions stated above are not necessarily those expressed by the FIRST Robotics Program, its participating teams, or any other individual or organization.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PBASIC Syntax Question Raven_Writer Programming 4 20-08-2003 08:07
Question Obtaining Pbasic 2.5 PyroPhin Programming 3 18-01-2003 01:26
pbasic question Mike375 Programming 14 15-01-2003 06:54
pbasic question archiver 2001 5 23-06-2002 23:50
Another PBASIC Question Ian W. Programming 4 31-01-2002 21:36


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

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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