This program is for an autonomous robot for the competition at the Hochschule Luzern. We are one of the 32 teams. <a href="http://cruisingcrepe.wordpress.com/">http://cruisingcrepe.wordpress.com/</a> The postition control is based on this Documentation: Control of Wheeled Mobile Robots: An Experimental Overview from Alessandro De Luca, Giuseppe Oriolo, Marilena Vendittelli. For more information see here: <a href="http://www.dis.uniroma1.it/~labrob/pub/papers/Ramsete01.pdf">http://www.dis.uniroma1.it/~labrob/pub/papers/Ramsete01.pdf</a>

Dependencies:   mbed

Fork of autonomousRobotAndroid by Christian Burri

Committer:
chrigelburri
Date:
Sat Mar 23 13:52:48 2013 +0000
Revision:
6:48eeb41188dd
Parent:
3:92ba0254af87
Child:
11:775ebb69d5e1
mit link und rechten Radradius

Who changed what in which revision?

UserRevisionLine numberNew contents of line
chrigelburri 0:31f7be68e52d 1 #ifndef _MAXON_ESCON_H_
chrigelburri 0:31f7be68e52d 2 #define _MAXON_ESCON_H_
chrigelburri 0:31f7be68e52d 3
chrigelburri 0:31f7be68e52d 4 #include "mbed.h"
chrigelburri 0:31f7be68e52d 5 #include "Hallsensor.h"
chrigelburri 0:31f7be68e52d 6 #include "defines.h"
chrigelburri 0:31f7be68e52d 7
chrigelburri 0:31f7be68e52d 8 /**
chrigelburri 0:31f7be68e52d 9 * @author Christian Burri
chrigelburri 0:31f7be68e52d 10 *
chrigelburri 0:31f7be68e52d 11 * @section LICENSE
chrigelburri 0:31f7be68e52d 12 *
chrigelburri 1:6cd533a712c6 13 * Copyright &copy; 2013 HSLU Pren Team #1 Cruising Crêpe
chrigelburri 0:31f7be68e52d 14 * All rights reserved.
chrigelburri 0:31f7be68e52d 15 *
chrigelburri 0:31f7be68e52d 16 * @section DESCRIPTION
chrigelburri 0:31f7be68e52d 17 *
chrigelburri 3:92ba0254af87 18 * This class implements the driver for the Maxon ESCON servo driver.
chrigelburri 3:92ba0254af87 19 * For more information see on the Datasheet:
chrigelburri 0:31f7be68e52d 20 *
chrigelburri 0:31f7be68e52d 21 * Datasheet:
chrigelburri 3:92ba0254af87 22 * <a href="http://escon.maxonmotor.com">http://escon.maxonmotor.com</a>
chrigelburri 0:31f7be68e52d 23 */
chrigelburri 0:31f7be68e52d 24 class MaxonESCON
chrigelburri 0:31f7be68e52d 25 {
chrigelburri 0:31f7be68e52d 26
chrigelburri 2:d8e1613dc38b 27 private:
chrigelburri 0:31f7be68e52d 28
chrigelburri 2:d8e1613dc38b 29 /** To Enable the amplifier */
chrigelburri 2:d8e1613dc38b 30 DigitalOut _enb;
chrigelburri 0:31f7be68e52d 31 /** Duty Cycle to set the speed */
chrigelburri 0:31f7be68e52d 32 PwmOut _pwm;
chrigelburri 0:31f7be68e52d 33 /** Hallsensor Class */
chrigelburri 0:31f7be68e52d 34 Hallsensor* _hall;
chrigelburri 0:31f7be68e52d 35 /** Ready output from ESCON */
chrigelburri 0:31f7be68e52d 36 DigitalIn _isenb;
chrigelburri 0:31f7be68e52d 37 /** Actual speed from ESCON analog Output 1 */
chrigelburri 0:31f7be68e52d 38 AnalogIn _actualSpeed;
chrigelburri 0:31f7be68e52d 39 /** increment the Hallpattern */
chrigelburri 0:31f7be68e52d 40 int _pulses;
chrigelburri 0:31f7be68e52d 41
chrigelburri 0:31f7be68e52d 42 public:
chrigelburri 0:31f7be68e52d 43
chrigelburri 3:92ba0254af87 44 /** Create a motor control object.
chrigelburri 6:48eeb41188dd 45 * @param enb DigitalOut, set high for enable
chrigelburri 6:48eeb41188dd 46 * @param isenb DigitalIn, high for enable
chrigelburri 6:48eeb41188dd 47 * @param pwm PwmOut pin, set the velocity
chrigelburri 6:48eeb41188dd 48 * @param actualSpeed AnalogIn filtered signal for ActualSpeed from Motor
chrigelburri 6:48eeb41188dd 49 * @param hall The object of the hallsensor from Motor
chrigelburri 6:48eeb41188dd 50 */
chrigelburri 0:31f7be68e52d 51 MaxonESCON(PinName enb,
chrigelburri 0:31f7be68e52d 52 PinName isenb,
chrigelburri 0:31f7be68e52d 53 PinName pwm,
chrigelburri 0:31f7be68e52d 54 PinName actualSpeed,
chrigelburri 0:31f7be68e52d 55 Hallsensor *hall);
chrigelburri 0:31f7be68e52d 56
chrigelburri 3:92ba0254af87 57 /** Set the speed of the motor with a pwm for 10%..90%.
chrigelburri 6:48eeb41188dd 58 * 50% PWM is 0rpm.
chrigelburri 6:48eeb41188dd 59 * Caclulate from [1/s] in [1/min] and the Factor of the ESCON.
chrigelburri 6:48eeb41188dd 60 * @param speed The speed of the motor as a normalised value, given in [1/s]
chrigelburri 6:48eeb41188dd 61 */
chrigelburri 0:31f7be68e52d 62 void setVelocity(float speed);
chrigelburri 0:31f7be68e52d 63
chrigelburri 3:92ba0254af87 64 /**Return the speed from ESCON.
chrigelburri 6:48eeb41188dd 65 * 0 rpm is defined in the Analog input as 1.65V
chrigelburri 6:48eeb41188dd 66 * @return speed of the motor, given in [1/s]
chrigelburri 6:48eeb41188dd 67 */
chrigelburri 0:31f7be68e52d 68 float getActualSpeed(void);
chrigelburri 0:31f7be68e52d 69
chrigelburri 0:31f7be68e52d 70 /** Set the period of the pwm duty cycle.
chrigelburri 6:48eeb41188dd 71 * Wrapper for PwmOut::period()
chrigelburri 6:48eeb41188dd 72 * @param period Pwm duty cycle, given in [s].
chrigelburri 6:48eeb41188dd 73 */
chrigelburri 0:31f7be68e52d 74 void period(float period);
chrigelburri 0:31f7be68e52d 75
chrigelburri 3:92ba0254af87 76 /** Set the Motor to a enable sate.
chrigelburri 6:48eeb41188dd 77 * @param enb <code>false</code> for disable <code>true</code> for enable.
chrigelburri 6:48eeb41188dd 78 */
chrigelburri 3:92ba0254af87 79 void enable(bool enb);
chrigelburri 0:31f7be68e52d 80
chrigelburri 0:31f7be68e52d 81 /**Tests if the servo drive is enabled.
chrigelburri 6:48eeb41188dd 82 * @return <code>true</code> if the drive is enabled,
chrigelburri 6:48eeb41188dd 83 * <code>false</code> otherwise.
chrigelburri 6:48eeb41188dd 84 */
chrigelburri 0:31f7be68e52d 85 bool isEnabled(void);
chrigelburri 0:31f7be68e52d 86
chrigelburri 3:92ba0254af87 87 /** Return the number of Pulses.
chrigelburri 6:48eeb41188dd 88 * @return Pulses, given in [count]
chrigelburri 6:48eeb41188dd 89 */
chrigelburri 0:31f7be68e52d 90 int getPulses(void);
chrigelburri 0:31f7be68e52d 91
chrigelburri 3:92ba0254af87 92 /** Set the Pulses of the Motor, given in [count]
chrigelburri 6:48eeb41188dd 93 * @return Pulses, given in [count]
chrigelburri 6:48eeb41188dd 94 */
chrigelburri 0:31f7be68e52d 95 int setPulses(int setPos);
chrigelburri 0:31f7be68e52d 96 };
chrigelburri 0:31f7be68e52d 97
chrigelburri 0:31f7be68e52d 98 #endif