Go to Post JVN, Captain Mechanical Engineer, Mr. "Software is evil", has supported the CMU camera. I'm speechless. What's next? Copioli designing in imperial? - Karthik [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
  #16   Spotlight this post!  
Unread 24-03-2004, 13:21
Kevin Karan's Avatar
Kevin Karan Kevin Karan is offline
Linux Guy
AKA: maxdamage
None #0174 (Arctic Warriors)
Team Role: Alumni
 
Join Date: Jan 2003
Location: Liverpool, NY
Posts: 141
Kevin Karan will become famous soon enoughKevin Karan will become famous soon enough
Send a message via AIM to Kevin Karan
Re: What is wrong with this code???? It won't Compile and I don't know why? Please He

indent...indent...indent
__________________
It isnt ALWAYS the programmers falt!
2004: Buckeye team website award
2002: Rutgers semi-finalists
2001: National semi-finalists
2001: Rutgers semi-finalists
1998: Manchester Rookie All-Star Award
  #17   Spotlight this post!  
Unread 24-03-2004, 13:50
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: What is wrong with this code???? It won't Compile and I don't know why? Please He

Quote:
Originally Posted by gwross
I believe the three braces are OK. If you move your cursor in turn to each of those braces and type Ctrl-M, the editor will take you to their matching opening braces. They look fine to me.
Okay, I see the if and the nested switch now. The lost formatting of the post made it darn near impossible for me to tell what the structure of the code was supposed to be. (By the way, Ctrl-M just adds a new line when I type it.)

If the trouble is with an unprintable character in the source code, the problem character probably wouldn't have survived being pasted here. But I believe that the definition of LOST_TARGET_TIMEOUT in navigate.h is a likely culprit and should be investigated.
  #18   Spotlight this post!  
Unread 24-03-2004, 15:51
Greg Ross's Avatar
Greg Ross Greg Ross is offline
Grammar Curmudgeon
AKA: gwross
FRC #0330 (Beach 'Bots)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Hermosa Beach, CA
Posts: 2,245
Greg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond repute
Send a message via AIM to Greg Ross Send a message via Yahoo to Greg Ross
Re: What is wrong with this code???? It won't Compile and I don't know why? Please He

Quote:
Originally Posted by Alan Anderson
(By the way, Ctrl-M just adds a new line when I type it.)
Are you using the MPLAB IDE? I don't think I did anything special to enable this functionality. It's also on the "Edit" menu: "Match".
__________________
Greg Ross (The Grammar Curmudgeon formerly known as gwross)
S/W Engineer, Team 330, the Beach 'Bots
<--The Grammar Curmudgeon loves this cartoon.
“Life should not be a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming "Wow! What a Ride!" Hunter S. Thompson
"Playing a practical joke means doing something mean and calling it funny." Me

Last edited by Greg Ross : 24-03-2004 at 15:55.
  #19   Spotlight this post!  
Unread 24-03-2004, 16:55
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: What is wrong with this code???? It won't Compile and I don't know why? Please He

Quote:
Originally Posted by gwross
Are you using the MPLAB IDE?
Um, no. I'm using Internet Explorer. I'm not anywhere near the computer we use to program the robot -- in fact, it's halfway to Chicago at the moment. I interpreted your mention of "the editor" as referring to viewing the HTML source of the page, where at least a little of the c file's formatting seems to be visible.
  #20   Spotlight this post!  
Unread 25-03-2004, 08:57
CrashZero's Avatar
CrashZero CrashZero is offline
Computer Nerd
#1352 (Huskie Robotics)
Team Role: Programmer
 
Join Date: Mar 2004
Location: Stratford Northwestern
Posts: 44
CrashZero will become famous soon enoughCrashZero will become famous soon enough
Exclamation Re: What is wrong with this code???? It won't Compile and I don't know why? Please Help

well here is the navigate.h file:

Code:
/*******************************************************************************
*
*	TITLE:		navigate.h 
*
*	VERSION:	1.0                          
*
*	DATE:		08-Jan-2004
*
*	AUTHOR:		Richard D. Petras
*
*	COMMENTS:
*
********************************************************************************
*
*	CHANGE LOG:
*
*	DATE         REV  DESCRIPTION
*	-----------  ---  ----------------------------------------------------------
*	03-Dec-2003  0.1  
*   08-Jan-2004  1.0  RDP The version used at the 2004 kickoff
*
*******************************************************************************/
#ifndef _navigate_h
#define _navigate_h

#include "tracker.h"

// Navigator state machine values
// These values will be stored in a global variable called 
// Navigator_State.  As each state transition is detected,
// the state will change to describe how the vehicle should
// operate.
#define WAIT_TO_DRIVE 0
#define	DRIVE_TO_CENTER 1
#define	TURN_TO_TARGET 2
#define	DRIVE_TO_TARGET 3
#define	PASSED_TARGET 4
#define	AT_TARGET 5
#define OVER_CURRENT 6

// Drive state 
// These values are stored in the drive_state variable.  They tell
// us where the beacon is with respect to each tracker on the robot.
#define DR_UNDEFINED 0
#define DR_BOTH_LEFT 1
#define DR_BOTH_RIGHT 2
#define DR_BOTH_STRAIGHT 3
#define DR_BOTH_CENTER 4
#define DR_LEFT_STRAIGHT 5
#define DR_RIGHT_STRAIGHT 6
#define DR_REFLECTION 7

// Some values for each individual tracker
#define DR_LEFT 0
#define DR_CENTER 1
#define DR_RIGHT 2

// Which pwms are our tracker servoes and drive motors?  It
// is nice to only have to change this in one place.
#define left_servo pwm10
#define right_servo pwm11
#define left_drive pwm14 
#define right_drive pwm15

// Simplify the big structure for beacon quality
// from the tracker code.
#define LL Sensor_Stats[0].Beacon_Quality[Tracker_Data[left].Beacon_Type]
#define LR Sensor_Stats[1].Beacon_Quality[Tracker_Data[left].Beacon_Type]
#define RL Sensor_Stats[2].Beacon_Quality[Tracker_Data[right].Beacon_Type]
#define RR Sensor_Stats[3].Beacon_Quality[Tracker_Data[right].Beacon_Type]

// The rest of these defines are tweekable parameters to fit
// the characteristics of different drive trains.  You might
// want to divide these into a separate set of values for the
// left and right side drives if your motor characteristics
// are sufficiently different.  This would require changing
// navigator.c, but the places to make the changes should be 
// obvious. :-)

//  Stop values
#define LSTOP 127      
#define RSTOP 127

// Fast backward
#define FBWD (LSTOP - 90)

// Slow Backward
#define SBWD (LSTOP - 55)

// Very Slow Backward
#define VSBWD (LSTOP - 10)

// Very Slow Forward
#define VSFWD (LSTOP + 10)

// Slow Forward
#define SFWD (LSTOP + 55)

// Fast Forward
#define FFWD (LSTOP + 90)

// Note: All the logic assumes the servo max points right
// Its not too hard to change the code to accomidate the other
// direction, in fact the code started out that way...

// These values are the servo settings (assuming 127 is straight
// ahead) that tells you that the beacon is between the trackers
// and about 1/2 meter ahead.  The exact values will depend on the
// baseline of your trackers.
#define LEFT_GOAL 135
#define RIGHT_GOAL 120

// These values tell you when the target is far to the left of the
// left servo, or far to the right of the right servo.  We switch
// navigator states at this point
#define LEFT_PASS 60
#define RIGHT_PASS 195

// Adjust these for your drive train

// This is the gain that is multiplied by your pointing error.
// It can be used as part of a feedback loop to steer toward the
// goal.  Note: the error calculation is included in the code
// as an example, but was not used in the actual kickoff demo.
// (we wanted to drive straight until we passed the goal)
#define DRIVE_GAIN 2

// This is a timer for the short drive away from the wall before
// we startt to turn in place toward the beacon.
#define DRIVE_TO_CENTER_TIME 5

// I bet you didn't know we were using the current sensors in the
// kickoff demo.  If the current sensor reading got above this 
// value, we might be up against the wall.  In that case we might
// want to stop driving for a short time to allow the robot to level 
// out.
#define MAX_CURRENT 700


// If we haven't seen the target with any of the trackers for 
// a while,  just start searching again by turning in place.  
//#define LOST_TARGET_TIMEOUT 100

// Declaration for the Navigate function
void Navigate(void);

#endif // _navigate_h
__________________
This is our world now... the world of the electron and the switch, the beauty of the baud. We make use of a service already existing without paying for what could be dirt-cheap if it wasn't run by profiteering gluttons, and you call us criminals. We explore... and you call us criminals. We seek after knowledge... and you call us criminals. We exist without skin color, without nationality, without religious bias... and you call us criminals. You build atomic bombs, you wage wars, you murder, cheat, and lie to us and try to make us believe it's for our own good, yet we're the criminals. Yes, I am a criminal. My crime is that of curiosity. My crime is that of judging people by what they say and think, not what they look like. My crime is that of outsmarting you, something that you will never forgive me for. I am a hacker, and this is my manifesto. You may stop me, but you can't stop us all...

quote from:

+++ The Mentor +++
  #21   Spotlight this post!  
Unread 25-03-2004, 09:34
Greg Ross's Avatar
Greg Ross Greg Ross is offline
Grammar Curmudgeon
AKA: gwross
FRC #0330 (Beach 'Bots)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Hermosa Beach, CA
Posts: 2,245
Greg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond repute
Send a message via AIM to Greg Ross Send a message via Yahoo to Greg Ross
Re: What is wrong with this code???? It won't Compile and I don't know why? Please Help

There's your problem: "#define LOST_TARGET_TIMEOUT 100" is commented out.
__________________
Greg Ross (The Grammar Curmudgeon formerly known as gwross)
S/W Engineer, Team 330, the Beach 'Bots
<--The Grammar Curmudgeon loves this cartoon.
“Life should not be a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming "Wow! What a Ride!" Hunter S. Thompson
"Playing a practical joke means doing something mean and calling it funny." Me
  #22   Spotlight this post!  
Unread 25-03-2004, 09:39
CrashZero's Avatar
CrashZero CrashZero is offline
Computer Nerd
#1352 (Huskie Robotics)
Team Role: Programmer
 
Join Date: Mar 2004
Location: Stratford Northwestern
Posts: 44
CrashZero will become famous soon enoughCrashZero will become famous soon enough
Question Re: What is wrong with this code???? It won't Compile and I don't know why? Please Help

THANK YOU GREATLY!!!

One more thing well my code is posted, In user_routines_fast.c I have the following code for auto mode:
Code:
void User_Autonomous_Code(void)
{
  while (autonomous_mode)   /* DO NOT CHANGE! */
  {
    if (statusflag.NEW_SPI_DATA)      /* 26.2ms loop area */
    {
        Getdata(&rxdata);   /* DO NOT DELETE, or you will be stuck here forever! */

        /* Add your own autonomous code here. */
			
			Navigate();			
if (NONE_IN_VIEW)
{
			if(rc_dig_in01 ==1 )
		 		{
				pwm13 = 137;
				pwm14=100;
				}
  			else
				{
				pwm13 = pwm14 = 140;
				}
			if(rc_dig_in02 == 1)
				{
				pwm13 = 100;
				pwm14 = 137;
				}
			else
				{
				pwm13 = pwm14 = 140;
				}
}				
			Generate_Pwms(pwm13,pwm14,pwm15,pwm16);

        Putdata(&txdata);   /* DO NOT DELETE, or you will get no PWM outputs! */
    }
  }
}
//I want to go from Navigate() to what is below it if none of the sensors see it how would i go about doing that??????
__________________
This is our world now... the world of the electron and the switch, the beauty of the baud. We make use of a service already existing without paying for what could be dirt-cheap if it wasn't run by profiteering gluttons, and you call us criminals. We explore... and you call us criminals. We seek after knowledge... and you call us criminals. We exist without skin color, without nationality, without religious bias... and you call us criminals. You build atomic bombs, you wage wars, you murder, cheat, and lie to us and try to make us believe it's for our own good, yet we're the criminals. Yes, I am a criminal. My crime is that of curiosity. My crime is that of judging people by what they say and think, not what they look like. My crime is that of outsmarting you, something that you will never forgive me for. I am a hacker, and this is my manifesto. You may stop me, but you can't stop us all...

quote from:

+++ The Mentor +++
  #23   Spotlight this post!  
Unread 25-03-2004, 09:56
Greg Ross's Avatar
Greg Ross Greg Ross is offline
Grammar Curmudgeon
AKA: gwross
FRC #0330 (Beach 'Bots)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Hermosa Beach, CA
Posts: 2,245
Greg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond repute
Send a message via AIM to Greg Ross Send a message via Yahoo to Greg Ross
Re: What is wrong with this code???? It won't Compile and I don't know why? Please Help

Probable the simplest would be something like this:
Code:
if ((Tracker_Data[left].Status == NONE_IN_VIEW) &&
    (Tracker_Data[right].Status == NONE_IN_VIEW)) {
			if(rc_dig_in01 ==1 )
		 		{
				pwm13 = 137;
				pwm14=100;
				}
  			else
				{
				pwm13 = pwm14 = 140;
				}
			if(rc_dig_in02 == 1)
				{
				pwm13 = 100;
				pwm14 = 137;
				}
			else
				{
				pwm13 = pwm14 = 140;
				}
}				
else Navigate();
Now, I'm SURE* that won't work as written, but it might give you some ideas.

*Potential problems:
The Tracker code probably STARTS out in NONE_IN_VIEW state, so the Navigate code will never get a chance to get a fix on the beacons. And I'm sure there are others, but I'm rushing right now, and can't think of them.
__________________
Greg Ross (The Grammar Curmudgeon formerly known as gwross)
S/W Engineer, Team 330, the Beach 'Bots
<--The Grammar Curmudgeon loves this cartoon.
“Life should not be a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming "Wow! What a Ride!" Hunter S. Thompson
"Playing a practical joke means doing something mean and calling it funny." Me
  #24   Spotlight this post!  
Unread 26-03-2004, 09:44
CrashZero's Avatar
CrashZero CrashZero is offline
Computer Nerd
#1352 (Huskie Robotics)
Team Role: Programmer
 
Join Date: Mar 2004
Location: Stratford Northwestern
Posts: 44
CrashZero will become famous soon enoughCrashZero will become famous soon enough
Exclamation Re: What is wrong with this code???? It won't Compile and I don't know why? Please Help

I can not figure out how to fix up that code and make it work; becuase as you said it starts out at NONE_IN_VIEW and would never get a chance to fix on the beacons; Any help that anyone could offer would be very much appriceated! Only less then a week left and it still doesn't work!
__________________
This is our world now... the world of the electron and the switch, the beauty of the baud. We make use of a service already existing without paying for what could be dirt-cheap if it wasn't run by profiteering gluttons, and you call us criminals. We explore... and you call us criminals. We seek after knowledge... and you call us criminals. We exist without skin color, without nationality, without religious bias... and you call us criminals. You build atomic bombs, you wage wars, you murder, cheat, and lie to us and try to make us believe it's for our own good, yet we're the criminals. Yes, I am a criminal. My crime is that of curiosity. My crime is that of judging people by what they say and think, not what they look like. My crime is that of outsmarting you, something that you will never forgive me for. I am a hacker, and this is my manifesto. You may stop me, but you can't stop us all...

quote from:

+++ The Mentor +++
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
What is your most prefered programming language? Hailfire Programming 156 19-01-2005 21:42
Printf warning during compile? actorindp Programming 4 20-02-2004 17:02
How to measure execution time? And code size? gnormhurst Programming 17 17-02-2004 08:06
Can't Compile the Default Code pressurex1 Programming 4 25-01-2004 20:26
Problem with FRC Default code AsimC Programming 2 11-01-2004 19:22


All times are GMT -5. The time now is 20:41.

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