Go to Post The best metrics are your own. Do you see the impact of your efforts in your community? Do you feel like you should/could have won Chairman's, but another team was even more deserving? That's how you know FIRST is really working. - dcarr [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 14-02-2004, 14:39
tophq's Avatar
tophq tophq is offline
mastr of autodsk (or not)
AKA: Chris Payk
#0703 (Inferno)
Team Role: Programmer
 
Join Date: Dec 2003
Location: Saginaw, MI
Posts: 19
tophq is an unknown quantity at this point
C Programming Question

Ok, before I begin let me start off by saying that I have checked around to find the answer ot my question and I have not found a suitable answer, this may be due to the lack of my attention span though...lol. Ok my problem is I'm trying to use the trim wheel on the joystick to set the robot into autonomous mode. Now I first added the
Code:
unsigned char wheel_right
to the user_routines.h header file and I still keep getting errors. It says "wheel_right is not defined" when I try to build it. I also tried adding the code directly before the function but when I do that it says I have multiple definitions and it still won't build. Where and how do I need to define and declare my variables. Any help would be greatly appreciated.
  #2   Spotlight this post!  
Unread 14-02-2004, 14:52
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,856
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: C Programming Question

Quote:
Originally Posted by tophq
Ok, before I begin let me start off by saying that I have checked around to find the answer ot my question and I have not found a suitable answer, this may be due to the lack of my attention span though...lol. Ok my problem is I'm trying to use the trim wheel on the joystick to set the robot into autonomous mode. Now I first added the
Code:
unsigned char wheel_right
to the user_routines.h header file and I still keep getting errors. It says "wheel_right is not defined" when I try to build it. I also tried adding the code directly before the function but when I do that it says I have multiple definitions and it still won't build. Where and how do I need to define and declare my variables. Any help would be greatly appreciated.
The trim wheels are only used to trim the joystick neutral point. The robot controller cannot see the trim values.
Use one of the joystick buttons instead, say p1_sw_top, like:
Code:
if (p1_sw_top)  User_Autonomous_Code
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #3   Spotlight this post!  
Unread 14-02-2004, 14:57
tophq's Avatar
tophq tophq is offline
mastr of autodsk (or not)
AKA: Chris Payk
#0703 (Inferno)
Team Role: Programmer
 
Join Date: Dec 2003
Location: Saginaw, MI
Posts: 19
tophq is an unknown quantity at this point
Re: C Programming Question

Thanx
  #4   Spotlight this post!  
Unread 15-02-2004, 13:44
tophq's Avatar
tophq tophq is offline
mastr of autodsk (or not)
AKA: Chris Payk
#0703 (Inferno)
Team Role: Programmer
 
Join Date: Dec 2003
Location: Saginaw, MI
Posts: 19
tophq is an unknown quantity at this point
Re: C Programming Question

just one more more question (maybe more depending on the answer...lol). im trying to write a practice autonomous code for the robot. my plan is to use the 'p1_sw_trig' button to enable a set of actions (in this case just to move the motor forward, then stop, then backward, then stop again using the counter function. im getting really weird syntax errors that i have no idea what's happening.

Code:
int counter = 0;
short end_program =  0;

void Process_Data_From_Local_IO(void)
{

if (end_program != 1)
	{
	counter++;

	if ((p1_sw_trig == 1) && (counter <= 120))
	{
	pwm01 = 127;
	}
	else if ((p1_sw_trig == 1) && (counter > 120))
	{
	pwm01 = 255;
	}
	else if ((p1_sw_trig == 1) && (counter > 240))
	{
	pwm01 = 127;
	}
	else if ((p1_sw_trig == 1) && (counter > 360))
	{
	pwm01 = 0;
	}
	else if ((p1_sw_trig == 1) && (counter > 480))
	{
	pwm01 = 127;
	end_program = 1;
	}
}


/********************************************************/
/********************************************************/
/********************************************************/
  <-------------------
the arrow points to the line that the syntax error was shown at. i put the code under the 'Process_Data_From_Local_IO' code because when i'd put it in the 'User_Autonomous_Code' it would give me an error at the 'Process_Data_From_Local_IO' line. let me know if im doing something wrong (obviously i am...lol). im pretty much a beginning programmer (HTML and TI-83...lol). any help you can give will help greatly.
  #5   Spotlight this post!  
Unread 15-02-2004, 13:53
blindguyinanorg's Avatar
blindguyinanorg blindguyinanorg is offline
Matt Spencer
AKA: Sexy Beast
#1007 (Team Generals)
Team Role: Engineer
 
Join Date: Feb 2004
Location: Snellville GA
Posts: 93
blindguyinanorg has a little shameless behaviour in the past
Send a message via AIM to blindguyinanorg
Re: C Programming Question

to your first post....if you need a variable in two classes than in the second you declare it:

code:
extern vartype variable;


in the second you forgot to close the IF statement with a }

add id bfore the comments if you want to maintain pretty code


the error is at that line bcause its either the end of the class or right before another method

Last edited by blindguyinanorg : 15-02-2004 at 13:58.
  #6   Spotlight this post!  
Unread 15-02-2004, 13:59
tophq's Avatar
tophq tophq is offline
mastr of autodsk (or not)
AKA: Chris Payk
#0703 (Inferno)
Team Role: Programmer
 
Join Date: Dec 2003
Location: Saginaw, MI
Posts: 19
tophq is an unknown quantity at this point
Re: C Programming Question

yeah im using 2 different computers so i couldn't copy and paste it. i just typed it up at warp speed because i need to get this figured out before 4 today. there aren't any mistyped statements in the real code. and as for the answer you gave me for the first problem...thanks but i didn't need it anymore.
  #7   Spotlight this post!  
Unread 15-02-2004, 14:43
tophq's Avatar
tophq tophq is offline
mastr of autodsk (or not)
AKA: Chris Payk
#0703 (Inferno)
Team Role: Programmer
 
Join Date: Dec 2003
Location: Saginaw, MI
Posts: 19
tophq is an unknown quantity at this point
Unhappy Re: C Programming Question

does anyone else have any suggestions for a solution? like i said, i MUST get this down by 4 today. i've spent all yesterday (6+ hours) and now today (another 6+ hours) on this thing. our robot will be up and running very soon and i want to try to tweak the autonomous as much as possible and as of now, i can't even figure out how to create an autonomous mode.
  #8   Spotlight this post!  
Unread 16-02-2004, 12:56
tophq's Avatar
tophq tophq is offline
mastr of autodsk (or not)
AKA: Chris Payk
#0703 (Inferno)
Team Role: Programmer
 
Join Date: Dec 2003
Location: Saginaw, MI
Posts: 19
tophq is an unknown quantity at this point
Re: C Programming Question

man...nm...i forgot to post it but i got the solution. pay no head to this thread now.
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
A few questions on programming the Control System Avarik Control System 21 08-02-2004 11:42
A question about control system options computhief263 Control System 7 04-02-2004 14:46
Q&A Discuss: Quick C Programming Q CD47-Bot Extra Discussion 6 16-11-2003 11:16
PBasic Question Melissa H. Programming 28 17-11-2002 18:53
Programming question archiver 2001 6 23-06-2002 22:57


All times are GMT -5. The time now is 00:05.

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