![]() |
May I Please Have Some Help?
Hey guys, I am a part of this club in my school, and we are taking place in the 2014 robotics competition. We can not test our code yet because we are waiting on our build team to finalize a design. However, we have some code written and were wondering if it would work in theory.
Thank you all so much, FriendzonedJim Code:
/*----------------------------------------------------------------------------*/ |
Re: May I Please Have Some Help?
Here's a few notes, based on what it seems like I would want to code to do. If you described what you wanted the robot to do, it would be much easier to review the code.
You're using PWM 3 & 4 for both RobotDrive and your Talons. This will crash immediately. elasticEncoder is never started or used. ledRing is never turned on. encoders do not necessarily return an angle directly. With the current code, the Pickup Talon will be on until the encoder counts 42 ticks. If you have a 250 count encoder, this will be about 60 degrees. If you have a 360 count encoder, you don't have to worry about it. There isn't a way to move the pickup in the opposite direction. The encoder will start at 0 when the robot is turned on. If your pickup isn't always in the same position when you turn on, you won't get the results you want The autonomous won't run. autonomousContinuous isn't called by the iterative framework anymore. The equivalent is autonomousPeriodic. However, you can't have delays in Periodic methods. Instead, save a time variable in autonomousInit, and then check in autonomousPeriodic if the desired time has elapsed. |
Re: May I Please Have Some Help?
A quick review: I'm not sure, but I think you may need a time delay in your teleopPeriodic() function, and perhaps a while statement wrapping the whole thing.
I noticed that your pickup motor speed, at 50%, may be a bit high to maintain control of the ball. I'd start smaller, and build it up when the bot is built. Lastly, think about how you're using the pickup encoder. It's not giving you an angle with the get() method, it's giving you a count, and it's an int. Angle is a double. While that will work in Java, of course, unless you're very lucky with the robot gears, the count will not be the same as the angle. If I see something else, I'll let you know. |
Re: May I Please Have Some Help?
Quote:
|
Re: May I Please Have Some Help?
If you are trying to control a pickup arm to an angle, you will need to implement a PID controller that will requires understanding the PID class, or knowing enough about PID to slap together your own rudimentary solution.
EX. (I'm a Labview/Python programmer, don't expect this to be exact) Code:
double error = 0; //outside loopIn PID language, your angle is your setpoint. I didn't do it in this code, but to switch between having your arm in or out you would switch your setpoint between 0 and 41.6. PID documentation: http://robotics.francisparker.org/ja...ontroller.html Note that your integrated error will be based on a 50ms loop, lower your I coeff accordingly. Also, I forgot, you need to reset your integrated error once in a while. Like when you're within a certain tolerance of your setpoint. http://robotics.francisparker.org/ja...ibj/Timer.html Also, here's the timer class I was using for this example. |
Re: May I Please Have Some Help?
@Joe Ross thanks for the tip about the talons.. I'll be sure to change that. The LEDRing is controlled by a button on a joystick. This is the encoder we are using: http://www.andymark.com/product-p/am-0791.htm which looks like it has 360 steps. Our pickup system is like the robot in 3 days build except we are using a cim to control the angle instead of pneumatics. Thus, we are planning for it to start straight up, and then all we need to do is rotate it down a certain amount at the beginning of the match and leave it there.
Thanks for the autonomous tip. There is not a lot of information out there about autonomous mode with the iterativerobot template. The elastic encoder is going to measure how tightly our surgical tubing is winded up for our launch system. I have not implemented it because we are still not sure on the details of how our launch system works. @Woolly our pickup system is not an arm, but I will definitely look into how PID systems work. |
Re: May I Please Have Some Help?
Quote:
|
| All times are GMT -5. The time now is 02:36. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi