Go to Post We're all human, we all make mistakes. How you deal with mistakes and problems, is what really elevates successful people, robotics teams, organizations, etc. above the rest. - artdutra04 [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
  #1   Spotlight this post!  
Unread 22-02-2004, 19:03
David Bryan David Bryan is offline
Registered User
#0818 (Steel Armadillo)
 
Join Date: Jan 2002
Location: Warren Consolidated Schools
Posts: 8
David Bryan is an unknown quantity at this point
Smile Need help with Variables ?


We wrote a routine in user_routines_fast.c and user_routines.c for autonomous.

Here are the definitions in
user_routines_fast.c:

long Left_Encoder_Count = 0;
long Right_Encoder_Count = 0;
int lh_encoder_max;
unsigned int rh_encoder_max;
long int rh_en_count;
long int lh_en_count;
float target_ratio;
float actual_ratio;
unsigned char autorun_status = 1;
#define lh_en Left_Encoder_Count;
#define rh_en Right_Encoder_Count;
#define pwm1_lh pwm01
#define pwm2_rh pwm02
int pw2_rhpos;
int pw2_rhneg;
/* delete all of thse ---- float lh_30turnfactor ; */
int onecnt = 0; /* one tenth of a second counter */
int rhcnt = 0;
int lhcnt = 0;
int rhcnt1000 = 0;
float actual_factor = 0;
float rh_adjust_factor = 0;
int rh_speed_var = 220;

these are the variables in
user_routines.c

int pwadd = 0;
int pwadd2 = 0;
char heat = 'c';
unsigned float pwadd3 = 300;
int pwadd4 = 0;
int p1xvar2;
int p1yvar2;
int p1xcoef = 150; /*max no =100 50 takes 14 scans to catch up*/
int p1ycoef = 150; /*con 100 takes 6 scans to catch up 150 = 5 SCANS*/
int p1yfl; /* p1x filter */
int p1xfl; /* p1y filter */

float lh_30turnfactor ;
int onecnt = 0; /* one tenth of a second counter */
int rhcnt = 0;
int lhcnt = 0;
int rhcnt1000 = 0;



float actual_factor = 0;
float rh_adjust_factor = 0;
int rh_speed_var = 220;

float pwadd5 = 1;
int pwadd6 = 0;
rom const char *StrPtr = "Hello world!";
/* int x = 15;
*int y = 0x50;
*long z = 0xdeadface; */
extern long Left_Encoder_Count; /* tm 226 see these in fast.c*/
#define lenco Left_Encoder_Count
extern long Right_Encoder_Count; /* tm 226 see these in fast.c*/
#define renco Right_Encoder_Count
#define Deadband 15
#define DriveFilter .3

#define p1_x_right p1_x
#define p1_y_fwd p1_y
#define p1_sw_trig_plow_out p1_sw_trig
#define p1_sw_top_plow_in p1_sw_top
/*p1_wheel p1_sw_aux1
p1_sw_aux2 */
#define p2_x_winch p2_x
#define p2_y_mast_fwd p2_y
#define p2_wheel_mast_up p2_wheel
#define p2sw_trig_claw_sov p2_sw_trig
#define p2sw_top_unclaw_sov p2_sw_top
#define p2_sw_aux1_compr_on p2_sw_aux1
#define p2_sw_aux2_compr_off p2_sw_aux2

#define p3_x_right p3_x
#define p3_y_fwd p3_y

#define rl1a_mast_back_sov relay1_fwd
#define rl1b_claw_sov relay1_rev /* 2/18/04 */
#define rl2a_plow_mtr relay2_fwd
#define rl2b_plow_mtr relay2_rev
#define rl3a_winch_mtr relay3_fwd
#define rl3b_winch_mtr relay3_rev
#define rl4a_compresr relay4_fwd
#define rl5a_mast_mtr relay5_fwd
#define rl5b_mast_mtr relay5_rev
#define rc_din2_lh_sw rc_dig_in02
#define rc_din3_rh_sw rc_dig_in03
#define rc_din4_plow_out_ls rc_dig_in04
#define rc_din15_plow_in_ls rc_dig_in15
#define rc_din6_mast_ls_dn rc_dig_in06
#define rc_din7_mast_ls_up rc_dig_in07
#define rc_din11_pres_sw rc_dig_in11
#define pwm1_lh pwm01
#define pwm2_rh pwm02
#define pw3_winch pwm03
#define pw4_mast pwm04

I thought that the variables used in user_routines_fast.c could be defined as "extern"
also for use in user_routines.c. At least it did work for these variables:

user_routines_fast.c:

long Left_Encoder_Count = 0;
long Right_Encoder_Count = 0;

user_routines.c:
extern long Left_Encoder_Count; /* tm 226 see these in fast.c*/

extern long Right_Encoder_Count; /* tm 226 see these in fast.c*/

When we compile we get an error message as shown below:
if (autorun_status == 1)
/* State 1 - Initialize for straight movement for seven feet fast 5.0 --*/

{
pwm1_lh = 127; /* Stop left motor */
pwm2_rh = 127; /* Stop right motor */

rh_en = 0; /* Reset actual encoder count we get an error on this line!!!*/
lh_en = 0; /* Reset actual encoder count */
rh_en_count = 0; /* Reset saved encoder count */
lh_en_count = 0; /* Reset saved encoder count */

rh_encoder_max = 771; /* Initialize max encoder counts for step 1 */
lh_encoder_max = 771; /* Initialize max encoder counts for step 1 */
target_ratio = 1.0; /* 1.0 straight, 1.1 turns left (more rh) .9 turns right */

pwm1_lh = 180; /* Set inital left motor speed */
pwm2_rh = 180; /* Set initial right motor speed */

autorun_status = 2; } /* or send to #3 and try that */
/* State 2 - Maintain target ratio for seven feet */

Sorry, but we cannot see anything wrong with the syntax of
rh_en = 0;
??????

I think we need help in defining variables used in user_routines_fast.c versus those used in user_routines.c.

Thanks to anyone who can help!!
David Bryan 818
 


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
Joystick Variables fred Programming 8 20-02-2004 10:58
Global Variables, anyone? Darkman_X000 Programming 3 05-02-2004 22:11
Simple problem with variables sear_yoda Programming 4 05-02-2004 09:12
Help On Coding 2K1 Controller GregTheGreat Programming 9 05-12-2003 18:35
VB Program to monitor robot variables DanL Programming 7 15-02-2002 22:35


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

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