|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#46
|
||||
|
||||
|
Re: 2016 Bosch motor 6004 RA3 194-06
Quote:
Quote:
Quote:
-Kevin |
|
#47
|
|||
|
|||
|
Re: 2016 Bosch motor 6004 RA3 194-06
Thanks Kevin
Quote:
Does that sound correct? The rest of this makes a bit more sense now that I know we are indeed dealing with a hall effect sensor. Thanks much. |
|
#48
|
|||
|
|||
|
Re: 2016 Bosch motor 6004 RA3 194-06
I would like to buy this motor any good sources to buy this exact model?
Thank you in advance |
|
#49
|
||||
|
||||
|
Re: 2016 Bosch motor 6004 RA3 194-06
Quote:
|
|
#50
|
||||
|
||||
|
Re: 2016 Bosch motor 6004 RA3 194-06
Please read previous post in this thread addressing this question.
|
|
#51
|
||||
|
||||
|
Re: 2016 Bosch motor 6004 RA3 194-06
As mentioned you must supply a power source for the hall circuit since it doesn't feed of the motor power inputs.
Just as a reference I made a comparison of reading the hall signal with 12V and 6V input (power supply wouldn't go any lower). At 12V the difference from peak to valley is ~3.9V. It's ~1.6V with 6V input. May explain why the Robo Rio is having trouble reading at the lower voltage. |
|
#52
|
|||
|
|||
|
Re: 2016 Bosch motor 6004 RA3 194-06
Today after hooking up the oscilloscope we were able to verify a few things and start getting values to count.
Wiring We took a standard PWM cable and connected as follows: Red wire to the 200 Ohm resistor and then to Pin #2 of the motor. The White wire connects to the motor side of the resistor/Pin #2. Then Black wire to Pin #4. Plugged this into an Analog Channel on the RoboRio (5V power supply). Code We used a AnalogTrigger (Java) to tie into the analog signal and set its limits based off the values we were getting from the oscilloscope. Code:
AnalogTrigger trigger = new AnalogTrigger(0); trigger.setLimitsVoltage(3.5, 5.0); boolean inWindow = trigger.getInWindow(); Last edited by cedwards : 18-02-2016 at 18:17. |
|
#53
|
|||
|
|||
|
Re: 2016 Bosch motor 6004 RA3 194-06
Saw a typo above; it's 174.9:1 gearing, of course.
Here's a sample C++ code using the counter so no ticks of the encoder are missed. Code:
// Position of BOSCH AHC-2 12V 6004.RA3.194-06 174.9:1 gear w/ encoder 1 tick per motor revolution on roboRIO analog 5 volt bus // FRC Team 4237 Lakeshore High School // Sample program merely rotates 1 revolution then reverses for 1 revolution and does so forever. #include "WPILib.h" class Robot: public SampleRobot { public: Robot(); void OperatorControl(); float CheckDirectionChange(float); int GetPosition(); private: CANTalon* mCANTalon; // motor AnalogTrigger mAnalogTrigger; // create an encoder pulse trigger Counter* mCounter; // count the encoder pulse triggers in current direction float mSpeedPrevious; // to remember previous direction int mPosition; // position accumulator to remember previous position before last direction change }; Robot::Robot() : mAnalogTrigger(0) { mCANTalon = new CANTalon(0); mAnalogTrigger.SetLimitsVoltage(3.5, 3.8); // values higher than the highest minimum (pulse floor), lower than the lowest maximum (pulse ceiling) mCounter = new Counter(&mAnalogTrigger); mSpeedPrevious = 0.; mPosition = 0; } float Robot::CheckDirectionChange(float NewSpeed) { // update position accumulator if changing direction // encoder doesn't know the direction so we have to remember the direction for it if ((mSpeedPrevious < 0 && NewSpeed >= 0) || (mSpeedPrevious >= 0 && NewSpeed < 0)) { mPosition = GetPosition(); // changing directions so save what we have mCounter->Reset(); // and start counting in the new direction mSpeedPrevious = NewSpeed; // return input speed for ease of use (may include it in the Set() argument => Set(CheckDirectionChange(speed))) } return NewSpeed; } int Robot::GetPosition() { // position from previous direction change plus what's been accumulated so far in this direction if (mSpeedPrevious >= 0) return mPosition + mCounter->Get(); // been going forward so add counter return mPosition - mCounter->Get(); // been going backward so subtract counter } void Robot::OperatorControl() { bool blockForward, blockReverse; // soft limit switches for this example int mPos=0; float speed = 1.0; // initial speed for this example mCounter->Reset(); // example back and forth nearly 1 revolution (174.9) while(IsEnabled() && IsOperatorControl()) { mPos = GetPosition(); printf("Position %d, Speed %f\n", mPos, speed); if (mPos >= 175) blockForward = true; // example check for at limit switch else blockForward = false; if (mPos <= 0) blockReverse = true; // example check for at limit switch else blockReverse = false; if (blockForward) speed = -1.; // example if at a limit switch go back the other way if (blockReverse) speed = +1.; // call CheckDirectionChange with same speed as Set() with (or before or after) every motor Set() to update position if reversing direction mCANTalon->Set(CheckDirectionChange(speed)); // refresh or change speed, update position if changing direction Wait(0.01); // ticks won't be lost but wait less to see them all here and respond faster } } START_ROBOT_CLASS(Robot) Last edited by SLAB-Mr.Thomas : 22-02-2016 at 10:17. Reason: had time to add some comments in the code |
|
#54
|
||||
|
||||
|
Re: 2016 Bosch motor 6004 RA3 194-06
Thanks cedwards and SLAB-Mr.Thomas for sharing your results. Looks like your having success getting this to work with 5V. I'll try to get the spec sheet updated once we have a confirmation this is working ok with the CRio and we aren't missing too many counts.
|
|
#55
|
|||
|
|||
|
Re: 2016 Bosch motor 6004 RA3 194-06
We are a team using this motor. we would like to get more of them. is there a team or a place we can go to get it?
|
|
#56
|
||||
|
||||
|
Re: 2016 Bosch motor 6004 RA3 194-06
If anyone needs spare motors we have another order in process. These will be distributed through AndyMark as a donated item.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|