PsiSwarm Library  0.8
motors.h
1 /* University of York Robotics Laboratory PsiSwarm Library: Motor Functions Header File
2  *
3  * Copyright 2016 University of York
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
7  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS
8  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9  * See the License for the specific language governing permissions and limitations under the License.
10  *
11  * File: motors.h
12  *
13  * (C) Dept. Electronics & Computer Science, University of York
14  * James Hilder, Alan Millard, Alexander Horsfield, Homero Elizondo, Jon Timmis
15  *
16  * PsiSwarm Library Version: 0.8
17  *
18  * October 2016
19  *
20  *
21  */
22 
23 #ifndef MOTORS_H
24 #define MOTORS_H
25 
46 class Motors
47 {
48 public:
49 
53  void set_left_motor_speed(float speed);
54 
58  void set_right_motor_speed(float speed);
59 
62  void brake_left_motor(void);
63 
66  void brake_right_motor(void);
67 
70  void brake(void);
71 
75  void stop(void);
76 
80  void forward(float speed);
81 
85  void backward(float speed);
86 
90  void turn(float speed);
91 
95  void init_motors(void);
96 
97  // New time based functions (added in library v0.3)
98 
104  void time_based_forward(float speed, int microseconds, char brake);
105 
111  void time_based_turn(float speed, int microseconds, char brake);
112 
113  int time_based_turn_degrees(float speed, float degrees, char brake);
114  float get_maximum_turn_angle(int microseconds);
115  int get_time_based_turn_time(float speed, float degrees);
116 
117 private:
118  void IF_check_time_for_existing_time_based_action();
119  void IF_end_time_based_action();
120  void IF_update_motors();
121  float IF_calibrated_left_speed(float speed);
122  float IF_calibrated_right_speed(float speed);
123  float IF_calibrated_speed(float speed);
124 
125 };
126 #endif
Definition: motors.h:46
void time_based_turn(float speed, int microseconds, char brake)
Definition: motors.cpp:115
void init_motors(void)
Definition: motors.cpp:299
void brake_right_motor(void)
Definition: motors.cpp:49
void brake(void)
Definition: motors.cpp:56
void turn(float speed)
Definition: motors.cpp:92
void time_based_forward(float speed, int microseconds, char brake)
Definition: motors.cpp:103
void set_left_motor_speed(float speed)
Definition: motors.cpp:28
void backward(float speed)
Definition: motors.cpp:83
void stop(void)
Definition: motors.cpp:65
void brake_left_motor(void)
Definition: motors.cpp:42
void set_right_motor_speed(float speed)
Definition: motors.cpp:35
void forward(float speed)
Definition: motors.cpp:74