|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Code problems
I just uploaded my code and ended up with a few problems
1)When I hold the trigger on the right joystick (p1) the robot decideds to turn in a circle (1 wheel forwards and the other backwards) 2)When I go full on with p1 it ends up overlapping and going in reverse 3)There is rhythmic pulsing coming from the pwms (i hooked up a servo and it kept moving without any joystick interaction) here is my user_routines.c file |
|
#2
|
|||||
|
|||||
|
Re: Code problems
Quote:
Code:
static char lookup[128] = (0,0,0,0,0,0,1,1,2,2,2,3,4,4...); Quote:
|
|
#3
|
||||
|
||||
|
Re: Code problems
1) Are your motors wired correctly? If you uncomment the code at lines 401-2 does it behave as you would expect? If so, there's a software problem that needs looking into...If not, and it turns in circles, tip it up on end and note which motor(s) are driving the wrong direction. Reverse the motor wires at the M+ M- terminals of the speed controller.
2) One problem that I see is that what happens if p1_y == 254 (i.e. full forward)? Following your code, dist would equal 1, making dist = 254-127...which is 127. You then use dist in your lookup table, however, you don't have an entry for 127...you when you go full reverse (p1_y == 0). 3) Not sure about this one...It may be an issue with using pwm13-16...Is there a reason that you are using pwm13-16 other than the fact that you're electrically connected there? If not, I would suggest that you relocate that functionality to any unused pwm1-12 that you have. The reasoning is described in this thread. I can't guarantee that that's your problem there, but it may help. <EDIT> Looks like Alan responded while I was typing...</EDIT> |
|
#4
|
|||
|
|||
|
Re: Code problems
So could I just add this at the end?
lookup[127]=127; and how would your array work, and why does it go to 128 ------- But the motors are doing the thing that the servos are [edit] The trigger is not supposed to make it do anything other then track [/edit] Last edited by doyler : 15-02-2005 at 12:19. |
|
#5
|
||||
|
||||
|
Re: Code problems
Quote:
Quote:
Quote:
Quote:
I see a const int called speed_setting at line 46...did you mean to use this instead? On a programming side note, the const ints steering_comp and speed_setting would be better written as Code:
#define STEERING_COMP 30 #define SPEED_SETTING 150 |
|
#6
|
|||
|
|||
|
Re: Code problems
When i tried to put
#define STEERING_COMP 30 //steering compenstation (0 to 127) #define SPEED_SETTING 150 //forward speed setting (127 to 254) in user_routines.h I was getting compiler errors that steering_comp wasn't defined |
|
#7
|
||||
|
||||
|
Re: Code problems
Quote:
|
|
#8
|
|||
|
|||
|
Re: Code problems
why would this give me a syntax error?
(this is in user_routines_fast) Code:
if (SPEED_SETTING < 128 || speed_control > 254) //Check speed_setting for valid forward speed SPEED_SETTING = 150; //If not valid number set to default Last edited by doyler : 15-02-2005 at 15:54. |
|
#9
|
||||
|
||||
|
Re: Code problems
Quote:
<EDIT>Disregard this post...don't know what I was thinking, but this won't help at all </EDIT>Last edited by Dave Scheck : 15-02-2005 at 16:12. |
|
#10
|
|||||
|
|||||
|
Re: Code problems
Code:
#define SPEED_SETTING 150 //forward speed setting (127 to 254) Code:
if (SPEED_SETTING < 128 || speed_control > 254) //Check speed_setting for valid forward speed SPEED_SETTING = 150; //If not valid number set to default Errors in your code I marked in red. Last edited by AIBob : 15-02-2005 at 16:04. |
|
#11
|
|||
|
|||
|
Re: Code problems
I don't think it should be a constant
This is my user_routines* |
|
#12
|
||||
|
||||
|
Re: Code problems
Quote:
|
|
#13
|
|||||
|
|||||
|
Re: Code problems
Quote:
user_routines.h: Code:
#define SPEED_SETTING 150 //forward speed setting (127 to 254) Quote:
Last edited by AIBob : 15-02-2005 at 16:16. |
|
#14
|
||||
|
||||
|
Re: Code problems
I think this is what you are trying to do in user_routines_fast_DDT.c.
Code:
if(speed_control < 128 || speed_control > 254)
speed_control = SPEED_SETTING ;
|
|
#15
|
|||
|
|||
|
Re: Code problems
Where would I put compressor code this year, last year it was in relayControl() in user_routines.c?
Also, why would i still be getting the jumps How would I stop my trigger from doing stuff Last edited by doyler : 15-02-2005 at 17:41. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Team THRUST - Kevin's Code and Camera Code Combine | Chris_Elston | Programming | 3 | 31-01-2005 22:28 |
| heres the code. y this not working | omega | Programming | 16 | 31-03-2004 15:18 |
| Wierd gyro code problems...pls help | Salik Syed | Programming | 4 | 14-03-2004 01:29 |
| IR reflective (tape) sensor code problems | Argoth | Programming | 8 | 07-02-2004 21:32 |
| problems assigning unsigned chars in FRC Code | LoyolaCubs | Programming | 6 | 26-01-2004 23:21 |