peripherals  1.4.2
RoadNarrows Robotics Hardware Peripherals Package
MotRoboteqSmall.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Package: RoadNarrows Robotics Peripherals
4 //
5 // Library: libhid
6 //
7 // File: hid.h
8 //
9 /*! \file
10  *
11  * $LastChangedDate: 2013-04-02 15:23:46 -0600 (Tue, 02 Apr 2013) $
12  * $Rev: 2806 $
13  *
14  * \brief Common Human Interface Device Interface.
15  *
16  * \author: Robin Knight (robin.knight@roadnarrows.com)
17  * \author: Daniel Packard (daniel@roadnarrows.com)
18  * \author: Jessica Trujillo (jessica@roadnarrows.com)
19  * \author: Maurice Woods III (maurice@roadnarrows.com)
20  *
21  *
22  * \copyright
23  * \h_copy 2012-2017. RoadNarrows LLC.\n
24  * http://www.roadnarrows.com\n
25  * All Rights Reserved
26  */
27 // Permission is hereby granted, without written agreement and without
28 // license or royalty fees, to use, copy, modify, and distribute this
29 // software and its documentation for any purpose, provided that
30 // (1) The above copyright notice and the following two paragraphs
31 // appear in all copies of the source code and (2) redistributions
32 // including binaries reproduces these notices in the supporting
33 // documentation. Substantial modifications to this software may be
34 // copyrighted by their authors and need not follow the licensing terms
35 // described here, provided that the new terms are clearly indicated in
36 // all files where they apply.
37 //
38 // IN NO EVENT SHALL THE AUTHOR, ROADNARROWS LLC, OR ANY MEMBERS/EMPLOYEES
39 // OF ROADNARROW LLC OR DISTRIBUTORS OF THIS SOFTWARE BE LIABLE TO ANY
40 // PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
41 // DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
42 // EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN ADVISED OF
43 // THE POSSIBILITY OF SUCH DAMAGE.
44 //
45 // THE AUTHOR AND ROADNARROWS LLC SPECIFICALLY DISCLAIM ANY WARRANTIES,
46 // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
47 // FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN
48 // "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO
49 // PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
50 //
51 ////////////////////////////////////////////////////////////////////////////////
52 
53 
54 #ifndef _MOT_ROBOTEQ_SMALL_H
55 #define _MOT_ROBOTEQ_SMALL_H
56 
57 #include <vector>
58 #include "rnr/rnrconfig.h"
59 #include "rnr/units.h"
60 #include "rnr/mot/Mot.h"
61 
62 namespace rnr
63 {
64  class MotRoboteqSmall : public Mot
65  {
66  public:
67  MotRoboteqSmall() : Mot()
68  {
69  m_fd = 0;
70  m_ntimeout = 1000000;
71  m_nbaudRate = 115200;
72  }
73 
74  MotRoboteqSmall(float maxSpeed, float minSpeed, float speedStepSize, float maxBrake, float minBrake, float brakeStepSize) : Mot(maxSpeed, minSpeed, speedStepSize, maxBrake, minBrake, brakeStepSize)
75  {
76  }
77 
78  virtual ~MotRoboteqSmall()
79  {
80  close();
81  }
82 
83  int open(const std::string &devName, int baudRate);
84  int close();
85  int sendCommand(int fd, byte_t *buf, int nBytes, int timeout);
86  int recvResponse(int fd, byte_t *buf,int timeout);
87  bool motIDIsValid(int motID);
88  int setSpeed(int motID, float speed, units_t units=units_norm);
89  int setSpeed(VecSpeedTupples vecSpeedTupple, units_t units=units_norm);
90  int setSpeedRaw(int motID, int speed);
91  int setSpeedRaw(VecSpeedRawTupples vecSpeedRawTupple);
92  int stop(int motID);
93  int stop();
94  int eStop();
95  int eStopRelease();
96  int getCurrent(int motID, units_t units=units_amp);
97  int getCurrentLimits();
98  int setCurrentLimits(int motID, int current, units_t units=units_amp);
99  int getVoltageLimits();
100  int setVoltageLimits(int lowVoltage, int overVoltage);
101  int getVoltage();
102  int setSpeedProfile(int motID, int accel, int decel=DEF_DEC);
103 
104  protected:
105  int m_fd;
106  int m_ntimeout;
107  int m_nbaudRate;
108  };
109 }
110 
111 
112 
113 
114 #endif // _MOT_ROBOTEQ_SMALL_H
int setVoltageLimits(int lowVoltage, int overVoltage)
Function sets the minimum and maximum limits for applied voltage for all motors.
int eStop()
Function simultaneously halts motor rotation for all motors by setting speeds to zero.
int getCurrent(int motID, units_t units=units_amp)
Function retrieves value for current load on a single motor.
int eStopRelease()
Function releases emergency stop condition and allows normal ops.
int setSpeedProfile(int motID, int accel, int decel=DEF_DEC)
Function retrieves value for voltage applied to a single motor.
Definition: Mot.h:63
int setSpeed(int motID, float speed, units_t units=units_norm)
Description.
int setCurrentLimits(int motID, int current, units_t units=units_amp)
Function sets minimum and maximum limits for current.
int open(const std::string &devName, int baudRate)
Function opens serial communication with motor controller device.
bool motIDIsValid(int motID)
Function sends commands to the motor controller and receives responses from the motor controller...
int close()
Function closes serial communication with motor controller device.
int getVoltageLimits()
Function retrieves value for current load on a single motor.
RoadNarrows Robotics standard namespace.
Definition: HID.h:65
int getCurrentLimits()
Function determines if a motor controller can monitor current.
int stop(int motID)
Function stops motor specified.
Common Motor Controller Interface.
int getVoltage()
Function retrieves value for voltage applied to a single motor.