peripherals  1.4.2
RoadNarrows Robotics Hardware Peripherals Package
MotDummy.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Package: RoadNarrows Robotics Peripherals
4 //
5 // Library: libmot
6 //
7 // File: MotDummy.cxx
8 //
9 /*! \file
10  *
11  * $LastChangedDate: 2013-02-13 16:41:34 -0700 (Wed, 13 Feb 2013) $
12  * $Rev: 2683 $
13  *
14  * \brief Dummy Motor Controller Implamentation.
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  * \copyright
22  * \h_copy 2012-2017. RoadNarrows LLC.\n
23  * http://www.roadnarrows.com\n
24  * All Rights Reserved
25  */
26 // Permission is hereby granted, without written agreement and without
27 // license or royalty fees, to use, copy, modify, and distribute this
28 // software and its documentation for any purpose, provided that
29 // (1) The above copyright notice and the following two paragraphs
30 // appear in all copies of the source code and (2) redistributions
31 // including binaries reproduces these notices in the supporting
32 // documentation. Substantial modifications to this software may be
33 // copyrighted by their authors and need not follow the licensing terms
34 // described here, provided that the new terms are clearly indicated in
35 // all files where they apply.
36 //
37 // IN NO EVENT SHALL THE AUTHOR, ROADNARROWS LLC, OR ANY MEMBERS/EMPLOYEES
38 // OF ROADNARROW LLC OR DISTRIBUTORS OF THIS SOFTWARE BE LIABLE TO ANY
39 // PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
40 // DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
41 // EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN ADVISED OF
42 // THE POSSIBILITY OF SUCH DAMAGE.
43 //
44 // THE AUTHOR AND ROADNARROWS LLC SPECIFICALLY DISCLAIM ANY WARRANTIES,
45 // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
46 // FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN
47 // "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO
48 // PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
49 //
50 ////////////////////////////////////////////////////////////////////////////////
51 #include "rnr/mot/Mot.h"
52 #include "rnr/mot/MotDummy.h"
53 int rnr::MotDummy::setSpeed(int id, int speed)
54 {
55  if (id < 0 || id > MOTDUMMY_NUM_OUTPUTS-1)
56  {
57  return -1;
58  }
59  m_speed[id] = speed;
60  return 0;
61 }
62 
63 int rnr::MotDummy::getAttrSpeed(int *minSpeed,int *maxSpeed, int *stepSize)
64 {
65  *minSpeed= m_nMinSpeed;
66  *maxSpeed= m_nMaxSpeed;
67  *stepSize= m_nSpeedStepSize;
68  return 0;
69 }
70 
71 int rnr::MotDummy::getAttrBrake(int *minBrake,int *maxBrake, int *stepSizeBrake)
72 {
73  *minBrake= m_nMinBrake;
74  *maxSpeed= m_nMaxBrake;
75  *stepSizeBrake= m_nBrakeStepSize;
76  return 0;
77 }
Dummy Motor Controller Interface.
Common Motor Controller Interface.