Project

General

Profile

Revision 560d2317

ID560d231775789e9cd435c6d85515171a9375c811

Added by Thomas Mullins over 11 years ago

Added forward/backward support to motors node

View differences:

scout/motors/src/motors.h
33 33
 * @author Colony Project, CMU Robotics Club
34 34
 * @author Benjamin Wasserman
35 35
 * @author Alex Zirbel
36
 * @author Tom Mullins
36 37
 **/
37 38

  
38 39
#ifndef _MOTORS_H_
39 40
#define _MOTORS_H_
40 41

  
42
#include <fstream>
41 43
#include <motors/set_motors.h>
42 44
#include <motors/query_motors.h>
43 45

  
......
53 55
bool motors_query(motors::query_motors::Request &req,
54 56
                  motors::query_motors::Response &res);
55 57

  
56
/** @brief Converts speeds from speeds in units to absolute speeds. **/
57
int motors_rel_to_abs(int rel_speed, int units);
58

  
59
/** @brief Converts speeds from absolute speeds to speeds in units. **/
60
int motors_abs_to_rel(int rel_speed, int units);
58
class Motor
59
{
60
  public:
61
    Motor(const char* pwmfile, const char* in1file, const char* in2file);
62
    int get_speed();
63
    void set_speed(int speed);
64
  private:
65
    int speed; /**< The current speed of the motor */
66
    std::fstream fpwm; /**< The device file controlling PWM */
67
    std::fstream fin1; /**< The device file controlling IN1 */
68
    std::fstream fin2; /**< The device file controlling IN2 */
69
};
61 70

  
62 71
#endif

Also available in: Unified diff