Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 9f5cc665f2
Fetching contributors…

Cannot retrieve contributors at this time

77 lines (58 sloc) 2.517 kB
/**************************************************************************
* Copyright 2012 KISS Institute for Practical Robotics *
* *
* This file is part of libkovan. *
* *
* libkovan is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 2 of the License, or *
* (at your option) any later version. *
* *
* libkovan is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with libkovan. Check the LICENSE file in the project root. *
* If not, see <http://www.gnu.org/licenses/>. *
**************************************************************************/
#ifndef _MOTORS_P_HPP_
#define _MOTORS_P_HPP_
#include "port.hpp"
namespace Private
{
struct PID;
class PublishListener;
class Motor
{
public:
enum ControlMode {
Unknown,
PID,
PWM
};
enum Direction {
PassiveStop = 0,
Reverse,
Forward,
ActiveStop
};
~Motor();
void setPid(const port_t& port, const short& p, const short& i, const short& d, const short& pd, const short& id, const short& dd);
void setControlMode(const Motor::ControlMode& mode);
Motor::ControlMode controlMode() const;
void pid(const port_t& port, short& p, short& i, short& d, short& pd, short& id, short& dd);
void setPwm(const port_t& port, unsigned char speed);
void setPwmDirection(const port_t& port, const Motor::Direction& dir);
unsigned char pwm(const port_t& port);
Motor::Direction pwmDirection(const port_t& port) const;
void stop(const port_t& port);
unsigned short backEMF(const unsigned char& port);
static Motor *instance();
private:
Motor();
PublishListener *m_listener;
};
}
#endif
Jump to Line
Something went wrong with that request. Please try again.