Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of autonomousRobotAndroid by
MaxonESCON.h
00001 #ifndef _MAXON_ESCON_H_ 00002 #define _MAXON_ESCON_H_ 00003 00004 #include "Hallsensor.h" 00005 #include "defines.h" 00006 00007 /** 00008 * @author Christian Burri 00009 * 00010 * @copyright Copyright (c) 2013 HSLU Pren Team #1 Cruising Crêpe 00011 * All rights reserved. 00012 * 00013 * @brief 00014 * 00015 * This class implements the driver for the Maxon ESCON servo driver. 00016 * For more information see the Datasheet: 00017 * <a href="http://escon.maxonmotor.com">http://escon.maxonmotor.com</a> 00018 * 00019 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 00020 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00021 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00022 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00023 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 00024 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 00025 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 */ 00027 class MaxonESCON 00028 { 00029 00030 private: 00031 00032 /** @brief To Enable the amplifier */ 00033 DigitalOut _enb; 00034 /** @brief Duty Cycle to set the speed */ 00035 PwmOut _pwm; 00036 /** @brief Hallsensor Class */ 00037 Hallsensor* _hall; 00038 /** @brief Ready output from ESCON */ 00039 DigitalIn _isenb; 00040 /** @brief Actual speed from ESCON analog Output 1 */ 00041 AnalogIn _actualSpeed; 00042 /** @brief increment the Hallpattern */ 00043 int _pulses; 00044 00045 public: 00046 00047 /** 00048 * @brief Create a motor control object. 00049 * @param enb DigitalOut, set high for enable 00050 * @param isenb DigitalIn, high for enable 00051 * @param pwm PwmOut pin, set the velocity 00052 * @param actualSpeed AnalogIn filtered signal for ActualSpeed from Motor 00053 * @param hall The object of the hallsensor from Motor 00054 */ 00055 MaxonESCON(PinName enb, 00056 PinName isenb, 00057 PinName pwm, 00058 PinName actualSpeed, 00059 Hallsensor *hall); 00060 00061 /** 00062 * @brief Set the speed of the motor with a pwm for 10%..90%. 00063 * 50% PWM is 0rpm. 00064 * Caclulate from [1/s] in [1/min] and the factor of the ESCON. 00065 * @param speed The speed of the motor as a normalised value, given in [1/s] 00066 */ 00067 void setVelocity(float speed); 00068 00069 /** 00070 * @brief Return the speed from ESCON. 00071 * 0 rpm is defined in the analog input as 1.65V 00072 * @return speed of the motor, given in [1/s] 00073 */ 00074 float getActualSpeed(void); 00075 00076 /** 00077 * @brief Set the period of the pwm duty cycle. 00078 * Wrapper for PwmOut::period() 00079 * @param period Pwm duty cycle, given in [s]. 00080 */ 00081 void period(float period); 00082 00083 /** 00084 * @brief Set the motor to a enable sate. 00085 * @param enb <code>false</code> for disable <code>true</code> for enable. 00086 */ 00087 void enable(bool enb); 00088 00089 /** 00090 * @brief Tests if the servo drive is enabled. 00091 * @return <code>true</code> if the drive is enabled, 00092 * <code>false</code> otherwise. 00093 */ 00094 bool isEnabled(void); 00095 00096 /** 00097 * @brief Return the number of pulses. 00098 * @return Pulses, given in [count] 00099 */ 00100 int getPulses(void); 00101 00102 /** 00103 * @brief Set the pulses of the motor, given in [count] 00104 * @return Pulses, given in [count] 00105 */ 00106 int setPulses(int setPos); 00107 }; 00108 00109 #endif
Generated on Wed Jul 13 2022 04:37:19 by
1.7.2
