-
Notifications
You must be signed in to change notification settings - Fork 0
/
Motor.cpp
57 lines (48 loc) · 1.05 KB
/
Motor.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "Motor.h"
/** \brief The default constructor of motor
*
* \param void
*
*/
Motor::Motor(void) :
pMotorCtrlHandle(NULL),
index(0),
vel(0.0),
acc(0.0),
bIsReversed(false)
{
;
}
/** \brief This function will initialize all the parameters
*
* \param index int The index number of the motor
* \param pMotoControl CPhidgetMotorControlHandle* The handle of the phidget motor
* \return void
*
*/
void Motor::init(int index, CPhidgetMotorControlHandle *pMotorCtrlHandle, bool bIsReversed)
{
// set the default value
vel = 0.0;
acc = 0.0;
this->index = index;
this->bIsReversed = bIsReversed;
// set the handle pointer value
this->pMotorCtrlHandle = pMotorCtrlHandle;
// stop the motor
stop();
printf("Motor::init, index = %d\n", this->index);
}
/** \brief Stop the motor and clean up everything allocated
*
* \param void
* \return void
*
*/
void Motor::fin(void)
{
// stop the motor
stop();
// set the handle pointer value
this->pMotorCtrlHandle = NULL;
}