Go to Post 254 isn't just good at building their robot. They're also good at taking pictures of it. - Chickenonastick [more]
Home
Go Back   Chief Delphi > Other > VEX
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 29-06-2007, 23:23
ManicMechanic ManicMechanic is offline
Registered User
AKA: Yolande
VRC #0438 (Metal Gear)
Team Role: Mentor
 
Join Date: Dec 2005
Rookie Year: 2003
Location: CA
Posts: 213
ManicMechanic has a reputation beyond reputeManicMechanic has a reputation beyond reputeManicMechanic has a reputation beyond reputeManicMechanic has a reputation beyond reputeManicMechanic has a reputation beyond reputeManicMechanic has a reputation beyond reputeManicMechanic has a reputation beyond reputeManicMechanic has a reputation beyond reputeManicMechanic has a reputation beyond reputeManicMechanic has a reputation beyond reputeManicMechanic has a reputation beyond repute
Too many R/C commands in a loop?

The attached program uses 8 commands in a loop, with the first 4 allowing the left joystick in R/C to shift a holonomic drive up/down left/right, the last 4 allowing channel 5 to spin the bot. When I insert the first 4 commands in the loop, the bot shifts properly. The last 4 commands in the same loop (without the first 4) spins it properly. But all 8 commands in the loop causes the bot to go berserk. Does 8 commands force it to sample too frequently? And how do I work around the problem? When I insert 2 loops sequentially, it never makes it to the second, because the first condition is always true.

A secondary problem: how do I copy and paste text in EasyC? I had to do a screen shot to post the program.
Attached Thumbnails
Click image for larger version

Name:	holo program.JPG
Views:	88
Size:	18.7 KB
ID:	5602  
__________________
He is no fool who gives what he cannot keep to gain that which he cannot lose. - Jim Elliot
Reply With Quote
  #2   Spotlight this post!  
Unread 02-07-2007, 00:52
EHaskins EHaskins is offline
Needs to change his user title.
AKA: Eric Haskins
no team (CARD #6 (SCOE))
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Elkhorn, WI USA
Posts: 998
EHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond repute
Send a message via MSN to EHaskins
Re: Too many R/C commands in a loop?

1) The second four commands are overriding the first four.

I wrote this code from memory, so if it isn't perfect don't yell at me.
Code:
#include "Main.h"

void main ( void )
{
      int x; 
      int y; 
      int r; 
      int nw; 
      int ne; 
      int sw; 
      int se; 

      //Get inputs
      x = GetRxInput ( 1 , 1 ) ;
      y = GetRxInput ( 1 , 2 ) ;
      r = GetRxInput ( 1 , 3 ) ;

      // convert the inputs so 0 is neutral.
      x -= 127 ;
      y -= 127 ;
      r -= 127 ;

      // compute outputs
      nw = x + y - r ;
      se = x + y + r ;
      ne = x - y - r ;
      sw = x - y + r ;

      //Set outputs
      SetPWM ( 1 , nw + 127 ) ;
      SetPWM ( 2 , ne + 127 ) ;
      SetPWM ( 3 , sw + 127 ) ;
      SetPWM ( 4 , se + 127 ) ;
}
You should also add code so that you don't try to send the motors values less than 0 or over 255.
2) This is how you get text from EasyC.

a. Select the Project tab under the list of functions.
b. Right click on the function you want to get text from, and click Open C file.
c. Highlight the code, right click, select Copy OR Ctrl+C.

NOTE: You should post programming questions in the programming section of the forum, even if your questions are Vex specific.
__________________
Eric Haskins KC9JVH
Reply With Quote
Reply


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
Too many photos with CD-Media? miketwalker General Forum 23 31-05-2006 16:16
pic: TOO MANY TETRAS!!!! Ali Ahmed Extra Discussion 12 22-01-2005 10:06
Too Many People In The Pit Jay05 General Forum 7 09-03-2003 10:46


All times are GMT -5. The time now is 03:55.

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