File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,10 @@ class Kinematics{
12
12
float wheel_track;
13
13
float wheel_diameter;
14
14
float wheel_radius;
15
+ float rads_to_rpm;
16
+ float rpm_to_rads;
17
+ float rads_to_degs;
18
+ float degs_to_rads;
15
19
16
20
17
21
public:
@@ -23,16 +27,23 @@ class Kinematics{
23
27
wheel_track=_wheel_track;
24
28
wheel_diameter=_wheel_diameter;
25
29
wheel_radius=wheel_diameter/2.0 ;
30
+
31
+ rads_to_rpm=60.0 /(2.0 *PI);
32
+ rpm_to_rads=2.0 *PI/60.0 ;
33
+
34
+ rads_to_degs=180.0 /PI;
35
+ degs_to_rads=PI/180.0 ;
36
+
26
37
}
27
38
28
39
void forward (const float linear, const float angular){
29
- left_velocity=(2 *linear_velocity-angular_velocity *wheel_track)/(wheel_diameter);
30
- right_velocity=(2 *linear_velocity+angular_velocity *wheel_track)/(wheel_diameter);
40
+ left_velocity=(2 *linear-angular *wheel_track)/(wheel_diameter);
41
+ right_velocity=(2 *linear+angular *wheel_track)/(wheel_diameter);
31
42
}
32
43
33
- void inverse (const float left_velocity , const float right_velocity ){
34
- linear_velocity=(left_velocity+right_velocity )*wheel_radius/2.0 ;
35
- angular_velocity=(-left_velocity+right_velocity )*wheel_radius/wheel_track;
44
+ void inverse (const float left_vel , const float right_vel ){
45
+ linear_velocity=(left_vel+right_vel )*wheel_radius/2.0 ;
46
+ angular_velocity=(-left_vel+right_vel )*wheel_radius/wheel_track;
36
47
}
37
48
38
49
float getLeftVelocity (){
You can’t perform that action at this time.
0 commit comments