Go to Post This year should be an unusual object game. You know what an unusual object is? Water. - TheBoulderite [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Spotlight this post!  
Unread 31-01-2007, 09:46
whytheheckme's Avatar
whytheheckme whytheheckme is offline
Registered User
AKA: Jacob Komar
no team
 
Join Date: Feb 2006
Rookie Year: 2005
Location: Providence, RI
Posts: 1,320
whytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond repute
Send a message via ICQ to whytheheckme Send a message via AIM to whytheheckme Send a message via MSN to whytheheckme Send a message via Yahoo to whytheheckme
Re: HELP!

OK cool.
I'm glad you are taking the initiative to do stuff, because I know a lot of people that wouldn't even want to try.

Alright. I'm going to tackle the code first, and then I'll look at your logistics.

In easyC, the 2WD Arcade block is REALLY easy. Once you place this block, it give you all of the options. It asks which port your joystick is on, which axis you want to use for both x and y, and which motors to control in which directions. No code involved. Its a GUI. This means you don't have to initialize varibles, get values, etc. easyC does it all for you.

As far as logistics. A few years back there was a simulator, but that was for the old PBASIC chip, and there is no new C simulator. It should be easy enough to set up your computer to download code to. Here is a link to the pdf with the wiring diagram:

http://www2.usfirst.org/2007comp_173...ON_DIAGRAM.pdf

All you need from this diagram is a path from the battery to the comptuer for power. You obviously don't need to hook up all of the spikes and victors and peripherals.

If you REALLY just want to get started, find a 12 volt transformer, cut whatever end is on it off, put spade connectors on the ends and hook it to the computer. This is NOT reccomended by FIRST, because it is not fused, but as long as it is a low amp power supply (i.e. <10 AMP max), it shouldn't be a problem.

OK, so here is some background.
The RC needs to be connected to the OI. The OI is where you connect your joysticks, and the RC is where you connect your motors etc, (a.k.a. The Computer.) The easiest way to do this is with the TETHER cable (The red serial cable.) This will power the OI over the tether cable without requiring additional power to the OI via a 9v transformer.

The other way to connect them is over the radio. You can use serial cables to connect the proper radios to the RC and OI (they should be labeled as to which is which)...

You then plug your computer into the Program port. This is how programs are downloaded. You need to put the processor in program mode by pressing the PROG button until the Program State light turns orange.

You can leave the serial cable plugged into the Program port to get feedback on the computer through the Terminal in easyC, if you put in PrintToScreen statements in your code. Be careful that you have control of the robot in this situations as not to rip your laptop off the desk.

Your devices are then plugged into the RC. You can plug your Speed Controllers (The Victors) into the PWM ports using the Black/Red/White wires. The Victors have varible control over the motors.

I would reccommend that you build your power system as soon as possible. This means the Distribution Block, the Black Circuit Breaker Panel, your computer, and a few devices. I say this because if you power your speed controllers, you can watch the lights change color based on the output of the PWM going to it. This can be used as an indicator as far as your program working.

What did I leave out? I'm sure I left something out somewhere...

Let me know,
Jacob

BTW, can I post this on CD? Other teams may have the same question, and I put a bit of time putting this together (I don't mind, in fact I love helping other teams, I would just like other teams to benefit.)





Quote:
Originally Posted by Asheron
Theres a problem, so far it looks to me like the team hasn't assembled a robot or a board. I do know what the parts are and have seen both the on-bot control board and the joystick control board (for lack of better terminology).

Is there some program or emulator I can send the code to that acts and gives feedback like the robot to check it until the robot is done?

I saw the serial ports ( I work 9 hours a day and will be getting about 3 hours a day with the team) and I'm assuming these are the ports I should know to recieve from and output to based on whats connected to them.

I know our drivetrain is going to be two wheel drive in the back with cart wheels (no motors attached just 360 degree rotating wheels like a grocery cart) on the front. I noticed like 4 or 5 modes in Easy C, which one would work with a two wheel drive? Just the regular 2 WD arcade? or the 2 WD tank mode?

I'm not looking at the code right now, but from what you mentioned and what I saw in the program, psuedocode would look like:

char joystick_x_axis = joystick_x_input
char joystick_y_axis = joystick_y_input

while (1) // endless loop to check for conditions
{
check for joystick position

control motion.

set pmw1 =

}

To control motion, I guess I'd have to set the motor speeds based on joystick position, so if the joystick is leaning right (signaling a right turn), I should slow down the right wheel so the left wheel would take over?

Could you provide me an example of how to control motor speeds based on joystick input?

I'm thinking, I should set the wheel for a specific motor based on subtracting the joystick x position from the joystick y position, so that the motor on the outside of the turn would be spinning faster based on the joystick position, example of what I'm thinking:

Joystick position = 45 degrees northeast (signalling right turn)
and Max motor speed and joystick control both = 255 with the starting position or no motor speed = 127

So, I'd have the left wheel moving at 200 maybe and I'd take and subtract the x -axis value of, lets say, 180, so I'd do a calculation:

set pmw1 = joystick_y_axis // 200 which is y-axis, N/S, value

set pmw2 = joystick_y_axis - (joystick x-axis - 127) // subtract from the y axis the x axis minus the 0 point).



Let me know if that logic makes sense, if not, how should it go? I'm not in front of easyC right now, I can't install it on my work computer neither can I get in to remote control the PC its on.
--
Remember, if this post was helpful, good Rep is always good....

Last edited by whytheheckme : 31-01-2007 at 09:48. Reason: Forgot something...
 


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
section 'InterruptVectorLow' type is non-overlay (was: HELP HELP HELP!!!!!) naor52 Programming 14 24-02-2007 01:19
Help: How do we get a teacher to help? (was: Help) ChaosAlchimey General Forum 13 21-01-2007 11:57


All times are GMT -5. The time now is 04:21.

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