Librairie pour contrôler un moteur connecté à une contrôleur SDC21XX
Dependencies: CANopen_Node Roboteq_SDC_serie
Revision 0:1c0bc44980e0, committed 2016-06-01
- Comitter:
- kkoichy
- Date:
- Wed Jun 01 15:03:34 2016 +0000
- Commit message:
- V1.0; Created class and basic methods to controll a motor connected to a SDC21XX motor driver
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CANopen_Node.lib Wed Jun 01 15:03:34 2016 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/kkoichy/code/CANopen_Node/#f98581f4455d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Roboteq_SDC_serie.lib Wed Jun 01 15:03:34 2016 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/kkoichy/code/Roboteq_SDC_serie/#95b0238d75a3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SDC21XX_Motor.cpp Wed Jun 01 15:03:34 2016 +0000 @@ -0,0 +1,61 @@ +#include "SDC21XX_Motor.h" + + +namespace mbed { + + SDC21XX_Motor::SDC21XX_Motor(uint8_t _node_id, CAN * _can, uint8_t _channel, uint32_t _reductor): channel(_channel), reductor(_reductor), RB(_node_id, _can) + { + + } + void SDC21XX_Motor::GoAngle(int16_t _angle) + { + RB.SetPosition(_angle*1024/360*reductor, channel); + } + + int16_t SDC21XX_Motor::GetAngle() + { + return RB.ReadAbsoluteEncoderCount(channel); + } + + void SDC21XX_Motor::SetChannel(uint8_t _channel) + { + channel = _channel; + } + + uint8_t SDC21XX_Motor::GetChannel(void) + { + return channel; + } + + void SDC21XX_Motor::SetReductor(uint32_t _reductor) + { + reductor = _reductor; + } + + uint32_t SDC21XX_Motor::GetReductor(void) + { + return reductor; + } + + void SDC21XX_Motor::SetNodeID(uint8_t _node_id) + { + RB.SetNodeID(_node_id); + } + + uint8_t SDC21XX_Motor::GetNodeID(void) + { + return RB.GetNodeID(); + } + + void SDC21XX_Motor::SetCan(CAN * _can) + { + RB.SetCan(_can); + } + + CAN* SDC21XX_Motor::GetCan(void) + { + return RB.GetCan(); + } + + +}//end namespace \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SDC21XX_Motor.h Wed Jun 01 15:03:34 2016 +0000 @@ -0,0 +1,41 @@ +#ifndef SDC21XX_MOTOR_H +#define SDC21XX_MOTOR_H + +#include "mbed.h" +#include "Roboteq.h" + +namespace mbed { + + class SDC21XX_Motor { + + public : + + SDC21XX_Motor(uint8_t _node_id, CAN * _can, uint8_t _channel, uint32_t _reductor); + void GoAngle(int16_t _angle); + int16_t GetAngle(); + void SetChannel(uint8_t _channel); + uint8_t GetChannel(void); + void SetReductor(uint32_t _reductor); + uint32_t GetReductor(void); + void SetNodeID(uint8_t _node_id); + uint8_t GetNodeID(void); + void SetCan(CAN * _can); + CAN* GetCan(void); + + private : + + protected : + + Roboteq RB; + uint8_t channel; + uint32_t reductor; + + + };//end class + + + + +}//end namespace + +#endif \ No newline at end of file