![]() |
Autonomous help please
Following all the information I can find, it appears that having the robot execute something in autonomous mode is as simple as placing the code, such as pwm01 = 200; into the autonomous portion of the default code (where it indicates, place autonomous code here) in fast user routines. My team has a dongle built up to switch the robot between user and autonomous mode (I know this switch works as indicated by a blinking disable light on the operator interface). I have written small changes to the default code and successufully uploaded them to the robot, so no problems getting the code to the robot. All I was trying to do is confirm some kind of autonomous operation of the robot, such as: pwm01=pwm02=200; but I got nothing :ahh: . Any help anyone can provide would be greatly appreciated. I did search the forums, but could not find anyone else having similar problems.
Thanks ~David |
Re: Autonomous help please
up
|
Re: Autonomous help please
Could you post what your code says in user_routines? My guess is that you have something located in the wrong place. Have you tried using debug statements to print the current values of those PWMs on the output screen, and/or used the Dashboard viewer? If you post the code I'd know more about what your problem is.
|
Re: Autonomous help please
There is really no code to show. In the user routines fast, there is a statement to put your autonomous code here. I place pwm## = 200;. I load the code into the robot. I put the robot into autonomous mode (using the switch built up as instructed, and it does work) and nothing happens (i.e. the motors programmed to drive forward do nothing). Im just at a loss, as to why the autonomous code does not execute. :ahh: :confused: :ahh: :( :ahh:
|
Re: Autonomous help please
Quote:
|
Re: Autonomous help please
from user_routines.c (this is just the default 1 stick drive) we have our base built and are currently driving it around, so I know the PWMs are hooked up accordingly.
pwm13 = pwm14 = Limit_Mix(2000 + p1_y + p1_x - 127); pwm15 = pwm16 = Limit_Mix(2000 + p1_y - p1_x + 127); from user_routines_fast.c: 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. */ pwm13 = pwm14 = 200; pwm15 = pwm16 = 200; Putdata(&txdata); /* DO NOT DELETE, or you will get no PWM outputs! */ } } } you can see from above, all I did was tell the robot to drive foward if in autonomous, but nothing happened :ahh: . Thanks for any help you can provide. Has anyone else had this problem? ~David |
Re: Autonomous help please
Quote:
In User_Autonomous_Code() they left out a call to Generate_Pwms(). That function sets the outputs for pwm13 - 16. If you're using one of those outputs then the value you set isn't getting sent to the motor. Insert the line "Generate_Pwms(pwm13,pwm14,pwm15,pwm16);" right before "Putdata(&txdata);" in User_Autonomous_Code(). If that doesn't work, try putting a printf() in User_Autonomous_Code() to make sure that function is being executed. |
Re: Autonomous help please
Quote:
I think you nailed it Sean, thanks. The blinking light is yellow. I wasn't aware of the Generate_Pwm() function. I will give that a try. Thanks. ~David |
| All times are GMT -5. The time now is 00:31. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi