-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathackerman.h
More file actions
56 lines (42 loc) · 1.29 KB
/
ackerman.h
File metadata and controls
56 lines (42 loc) · 1.29 KB
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
#ifndef ACKERMAN_H
#define ACKERMAN_H
#include "ackerman.h"
#include "geometry.h"
#include <math.h>
#include <string>
#include <sstream>
#include <iostream>
#include "geometry.h"
using namespace std;
class Ackerman {
public:
struct Arc {
double steer_radians;
double arc_radians;
double r;
double arc_len;
double curvature; // radians per unit length of arc
};
double w; // width of front wheelbase
double l;
double x; // x and y are at center of rear wheels
double y;
double heading;
Ackerman(double front_wheelbase_width = 1.0, double wheelbase_length = 1.0, Point front_position=Point(0,0), Angle heading = Angle::radians(0));
Point front_left_position() const;
Point front_position() const;
Point rear_position() const;
void move_right_wheel(Angle outside_wheel_angle, double wheel_distance, double new_heading = NAN);
void move_relative_to_heading(Point p);
Arc arc_to_relative_location(double x,double y);
string to_string() const;
};
// calculates an arc where the front wheel will travel to
// point x ahead and point y t left
void test_arc_to_relative_location(double l, double x, double y);
void arc_to_relative_location_tests();
void move_left_wheel_tests();
void test_ackerman();
void test_ackerman2();
void test_pose();
#endif // ACKERMAN_H