![]() |
Globe Motor Programming Questions
I am the (extremely) green head student programmer for 1646. I have very little practical experience programming in C, and I would appreciate any help anyone can provide.
::Long Intake of Breath:: Now for the question. We have recently installed a globe motor onto our robot and I need to know how to program it. I would greatly appreciate any advice or links provided by more experienced programmers. |
Re: Globe Motor Programming Questions
First you need to wire the globe motor to a speed controller, then connect a PWM wire from the speed controller to one of the PWM output on the robot controller... to controller the motor from your program you set the PWM output to a certain value..
Assuming you connected the speed controller to PWM output 1 pwm01 = 0; // Full backward pwm01 = 127; // Neutral (motor doesnt move) pwm01 = 255; // Full foward If you connect it to another output just change the pwm number (pwm01, pwm02, pwm03, etc...) You can choose any value between 0 and 255 to move the motor at different speeds and directions... You can also map it to a joystick.. pwm01 = p1_y; This is set the motor speed to the value of the y axis on port 1 Hope that enough to get you started... :) |
Re: Globe Motor Programming Questions
Thanks a lot. This should be very helpful.
|
Re: Globe Motor Programming Questions
Quote:
|
Re: Globe Motor Programming Questions
On my team we have set PWM outputs to 255 and there were no known problems that occured because of it. It may be because PWM 1 to PWM 10 all have some other byte that is sent before it and none of them were ever valued at 0xFF, or maybe it is automatically adjusted in the Putdata function.
I am relatively new at this, so I'm not really sure what if what I am talking about here is entirely correct. |
Re: Globe Motor Programming Questions
All the responses here so far have been generally applicable to any of the motors in the FRC kit of parts. Do you still have a question that relates specifically to the Globe motor?
|
Re: Globe Motor Programming Questions
Quote:
|
Re: Globe Motor Programming Questions
We do not use 255 for a pwm output since it may cause an issue.
Also be aware that there is a dead band of ~ 4 pwm counts around the neutral (pwmXX=127) position. Thus 123-131 tend not to move the motor. Also, The speed of the motor going full forward may (probably will) differ from full speed reverse. |
Re: Globe Motor Programming Questions
Quote:
Code:
... |
Re: Globe Motor Programming Questions
Quote:
|
Re: Globe Motor Programming Questions
Yeah it does, i was originally only referring to taking out the deadband. I just edited my post and added the limit code in.
-Q |
Re: Globe Motor Programming Questions
To respond to the original question; the type of motor is not incredibly important as long as it runs on a PWM signal. What you need to do is set your PWMs as shown in the first response and assuming you are using the FRC robot controller and default MP labs code it will convert that data into a usable signal for any standard PWM motor.
|
Re: Globe Motor Programming Questions
We've generally avoided getting the pwms too close to 255. We just put in some code that says something like:
if(p1_y >= 250) pwm01 = 250 this has worked well for us in the past, as if the pwm output exeeds 255, then it will loop back onto itself and tear up your motors. A pwm output of 256 is essentially 0. If I'm wrong, please correct me. |
Re: Globe Motor Programming Questions
You're correct that if pwm01 gets set to a number greater than 255 it will wrap around to zero and you'll suddenly go from full forward to full reverse.
A note on using a pwm value of 255. The reason to avoid using the value 255 is that sequential 255's in a transmission packet is the standard indication of the beginning of a packet, so if pwm03 and pwm04 (which are side-by-side in the transmission packet) were both transmitted as 255 the packet handler would think pwm05 was really the start of a transmission packet and the OI would be handed really bogus data. Those of you allowing 255 are protected from the adverse effects, because the Master code takes all your carefully set values of 255 and changes them to 254 anyway. You can test this by setting the pwm values to 255 in your code, then using the Dashboard to see what values actually arrives at the OI. |
Re: Globe Motor Programming Questions
Quote:
However, the point that the motor type is not particularly important is absolutely correct. *Technically speaking, it is a pulsating signal at a relatively high frequency, so high that the motor reacts to the current as it would react to a variable DC signal. |
| All times are GMT -5. The time now is 03:15. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi