|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Programming
Posted by Nick at 1/15/2001 9:28 PM EST
Student on team #240, Mach V, from Jefferson Monroe High School and Visteon. Joe, Our team is attempting to mimic the drive system on your robot in 2000. How did you run through the logic of the programming. I'm having trouble figuring it out. |
|
#2
|
|||
|
|||
|
I would tell you but I would have to kill you ;-)
Posted by Joe Johnson at 1/15/2001 10:15 PM EST
Engineer on team #47, Chief Delphi, from Pontiac Central High School and Delphi Automotive Systems. In Reply to: Programming Posted by Nick on 1/15/2001 9:28 PM EST: How our code works is a trade secret that our team is not willing to share at this time. Sorry. I will say this much, it is a very complicated coding problem to make a robot that behaves as the driver wants and to make the operator interface such that the driver can clearly communicate what it is he/she is wanting the machine to do. I recommend that teams spend a lot of time thinking about how to do both of these things. I will wish you good luck, but I am not going to share our solution just yet. No hard feelings I hope. Joe J. P.S. It took me 40 hours to get the code right last year. The result was a reasonably compact 9 lines of code. Thinking is the key. The coding is easy once you get your mind straight. |
|
#3
|
|||
|
|||
|
Well, no sleep for a while
Posted by Nick at 1/15/2001 10:24 PM EST
Student on team #240, Mach V, from Jefferson Monroe High School and Visteon. In Reply to: I would tell you but I would have to kill you ;-) Posted by Joe Johnson on 1/15/2001 10:15 PM EST: I'm already insane with programming the gyro sensor. By any chance what so ever is there PBASIC code to change the joysticks inputs to parametric or am I at least on the right track? |
|
#4
|
|||
|
|||
|
parametric?
Posted by Joe Johnson at 1/15/2001 10:32 PM EST
Engineer on team #47, Chief Delphi, from Pontiac Central High School and Delphi Automotive Systems. In Reply to: Well, no sleep for a while Posted by Nick on 1/15/2001 10:24 PM EST: What do you mean "parametric"? Joe J. |
|
#5
|
|||
|
|||
|
Try this.
Posted by Matt Berube at 1/16/2001 7:48 AM EST
Engineer on team #49, Delphi Knights, from Buena Vista High School and Delphi Automotive. In Reply to: Well, no sleep for a while Posted by Nick on 1/15/2001 10:24 PM EST: : I'm already insane with programming the gyro sensor. By any chance what so ever is there PBASIC code to change the joysticks inputs to parametric or am I at least on the right track? You might want to take some time to try to understand this then try to plot it in something like Excel or Matlab. I don't understand why it works but it will give you an output that roughly corresponds to the angle of the joystick. I wish I understood it better myself. Feel free to e-mail me at matthew.berube@delphiato.com if you have specific questions. ' Steer Rear_Steer_Output = 127 'set dead band in center only if (p1_y>124 and p1_y124 and p1_x127 and p1_x127) then mode9steer3: Rear_Steer_Output = ((1127-(((127*(P1_x-127))/SQR((P1_x-127)*(P1_x-127)+((127-P1_y)*(127-P1_y)*2))))) MIN 1000 MAX 1254) - 1000 mode9steer3: if not(p1_y>127 and p1_x>127) then mode9steer4: Rear_Steer_Output = ((1127+(((127*(P1_x-127))/SQR( (P1_x-127)*(P1_x-127)+((P1_y-127)*(P1_y-127)*2) ) ))) MIN 1000 MAX 1254) - 1000 mode9steer4: (ps) this is kinda hard to read. It basically is breaking the joystick up into 4 quadrants and the equation for the output is : X / ( X^2 + Y^2)^0.5 Matt B. T49 |
|
#6
|
|||
|
|||
|
Re: Try this.
Posted by Nick at 1/16/2001 7:43 PM EST
Student on team #240, Mach V, from Jefferson Monroe High School and Visteon. In Reply to: Try this. Posted by Matt Berube on 1/16/2001 7:48 AM EST: Thanks, maybe I can sleep tonight. I think I have found another way. Basically I changed the joystick grid to polar coordinates (cos y/sin x). |
|
#7
|
|||
|
|||
|
Yah, I tried that too :=)
Posted by Matt Berube at 1/19/2001 7:54 AM EST
Engineer on team #49, Delphi Knights, from Buena Vista High School and Delphi Automotive. In Reply to: Re: Try this. Posted by Nick on 1/16/2001 7:43 PM EST: : Thanks, maybe I can sleep tonight. I think I have found another way. Basically I changed the joystick grid to polar coordinates (cos y/sin x). There is NO WAY to do trig functions. I even tried a Taylor series aproximation. It gets way too complicated. Try messing with the equation I gave you. It is not exactly liniarly (sp) proportional to the joystick angle, but it is pretty close. my $0.02 Matt B. T49 |
|
#8
|
|||
|
|||
|
don't be silly...
Posted by Joe Johnson at 1/19/2001 10:11 PM EST
Engineer on team #47, Chief Delphi, from Pontiac Central High School and Delphi Automotive Systems. In Reply to: Yah, I tried that too :=) Posted by Matt Berube on 1/19/2001 7:54 AM EST: Yes you can do trig in PBASIC. The problem is a little messy if you need to do an inverse trig function, but this can be arranged too. The most confusing part when you first try to use them is that the measurement of angle is in a very funky unit. Basically the circle is divided up from 0 to 255, so the angles are measured in increments of 1.4 degrees -- not the easiest unit of measure but it works in a pinch. By the way, when we need to convert the X-Y coords of the joystick into "polar" coords of Radius-Theta, we found that it was close enough for us to just use the following function as the "radius" rather than go through all the bother of computing the "true" radius Radius = abs(Y1 - $80) MIN abs(X1 - $80) This function returns the "square" that the joystick is on rather than the "cirle" that is is on, but again it is close enough for robot control AND it is a LOT simpler to code than all the nonsense needed to get the "true" answer. There are similar simplifications that can get you the angle of the joystick. I leave those as an exercise for the reader. Joe J. |
|
#9
|
|||
|
|||
|
Hex makes my brain hurt! (EOM)
Posted by Matt Berube at 1/20/2001 12:14 AM EST
Engineer on team #49, Delphi Knights, from Buena Vista High School and Delphi Automotive. In Reply to: don't be silly... Posted by Joe Johnson on 1/19/2001 10:11 PM EST: Hex makes my brain hurt! (EOM) |
|
#10
|
|||
|
|||
|
Hex make life EASIER!
Posted by Joe Johnson at 1/21/2001 12:44 PM EST
Engineer on team #47, Chief Delphi, from Pontiac Central High School and Delphi Automotive Systems. In Reply to: Hex makes my brain hurt! (EOM) Posted by Matt Berube on 1/20/2001 12:14 AM EST: I belive that in the long run, it is easier to use hex in your PBASIC Code. The numbers work out easier. The overflows and underflows are easier to spot. The positions of various bits in the byte are easier to work with. Once you get the Zen of PBASIC, you will definitely perfer to use hexidecimal numbers over decimal. One man's opinion. Joe J. |
|
#11
|
|||
|
|||
|
PS I understand. Thanks anyway. EOM
Posted by Nick at 1/15/2001 10:26 PM EST
Student on team #240, Mach V, from Jefferson Monroe High School and Visteon. In Reply to: I would tell you but I would have to kill you ;-) Posted by Joe Johnson on 1/15/2001 10:15 PM EST: PS I understand. Thanks anyway. EOM |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Programming Compatition | Angela06 | Programming | 30 | 08-04-2005 23:12 |
| multi-bank programming problem | GregC | Programming | 3 | 14-02-2003 16:13 |
| Pneumatics electrical wiring and programming | archiver | 2001 | 1 | 23-06-2002 23:10 |
| Error found in programming for the pump and pressure switch | sjharobotics | Programming | 4 | 06-02-2002 17:46 |
| pbasic programming | punarhero | Programming | 4 | 21-01-2002 23:32 |