This repository has been archived by the owner on Oct 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathCiA402SetupData.cpp
52 lines (36 loc) · 1.55 KB
/
CiA402SetupData.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
#include "CiA402SetupData.h"
CiA402SetupData::CiA402SetupData()
{
}
CiA402SetupData::CiA402SetupData(int new_encRes,float new_mlRatio, float new_SampSL,float motor_current_limit,float drive_current_limit)
{
mlRatio = new_mlRatio;// Transmission ratio between the motor displacement in SI units and load displacement
encRes = new_encRes;// Nº pulses for incremental encoder quadrature (lines X 4)
SampSL = new_SampSL;// speed/position loop sampling period of the motor Control (sampling_slow_loop)
current_limit = 32767-(65520*motor_current_limit)/(2*drive_current_limit);// current_limit. CAnOpen programming iPOS 5.5.7. Object 207Fh: Current limit
float count_sec = encRes/60.0;
float rad2rpm = 60.0/(2.0*M_PI);
// Motor_Position[IU]=Scaling_factors_velocity*Load_Position[SI]
Scaling_Factors_Position = mlRatio*encRes/(2.0*M_PI);
// Motor_Speed[IU]=Scaling_factors_velocity*Load_Speed[SI]
Scaling_Factors_Velocity = rad2rpm*count_sec*mlRatio*SampSL;
cout << "Scaling_Factors_Velocity - " << Scaling_Factors_Velocity << endl;
// Motor_Accel[IU]=Scaling_factors_velocity*Load_Accel[SI]
Scaling_Factors_Acceleration = Scaling_Factors_Velocity*SampSL;
}
float CiA402SetupData::getScaling_Factors_Velocity() const
{
return Scaling_Factors_Velocity;
}
float CiA402SetupData::getScaling_Factors_Position() const
{
return Scaling_Factors_Position;
}
float CiA402SetupData::getScaling_Factors_Acceleration() const
{
return Scaling_Factors_Acceleration;
}
int CiA402SetupData::getEncRes() const
{
return encRes;
}