gusimplewhiteboard
wb_kinematic_motor.h
Go to the documentation of this file.
1
9/*
10 *
11 * This class represents the e-Puck's motor. (Individual motors)
12 *
13 * Through the Whiteboard, the controller posts current odometry values when the
14 * motor's encoder is enabled, and the remote enables/disables the encoder and can
15 * also turn the motor on/off.
16 *
17 *
18 * Class Hierarchy:
19 * (C++) EPuckRobotControlStatus
20 * (C) wb_epuck_robot
21 * (C) wb_differential_robot
22 * (C) wb_kinematic_motor <= This class
23 *
24 ********************************************************************************
25 *
26 * Copyright 2015 Rene Hexel
27 * MiPal @ Griffith University
28 * All rights reserved.
29 *
30 * Redistribution and use in source and binary forms, with or without
31 * modification, are permitted provided that the following conditions
32 * are met:
33 *
34 * 1. Redistributions of source code must retain the above copyright
35 * notice, this list of conditions and the following disclaimer.
36 *
37 * 2. Redistributions in binary form must reproduce the above
38 * copyright notice, this list of conditions and the following
39 * disclaimer in the documentation and/or other materials
40 * provided with the distribution.
41 *
42 * 3. All advertising materials mentioning features or use of this
43 * software must display the following acknowledgement:
44 *
45 * This product includes software developed by Dimitri Joukoff
46 * (MiPal @ Griffith University).
47 *
48 * 4. Neither the name of the author nor the names of contributors
49 * may be used to endorse or promote products derived from this
50 * software without specific prior written permission.
51 *
52 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
53 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
54 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
55 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
56 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
57 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
58 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
59 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
60 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
61 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
62 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
63 *
64 * -----------------------------------------------------------------------
65 * This program is free software; you can redistribute it and/or
66 * modify it under the above terms or under the terms of the GNU
67 * General Public License as published by the Free Software Foundation;
68 * either version 2 of the License, or (at your option) any later version.
69 *
70 * This program is distributed in the hope that it will be useful,
71 * but WITHOUT ANY WARRANTY; without even the implied warranty of
72 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
73 * GNU General Public License for more details.
74 *
75 * You should have received a copy of the GNU General Public License
76 * along with this program; if not, see http://www.gnu.org/licenses/
77 * or write to the Free Software Foundation, Inc., 51 Franklin Street,
78 * Fifth Floor, Boston, MA 02110-1301, USA.
79 *
80 */
81
82#ifndef WB_MOTOR
83#define WB_MOTOR
84
85#include <sys/types.h>
86#include <gu_util.h>
87
88#define DEFAULT_KINEMATIC_SPEED 0
89#define DEFAULT_KINEMATIC_ACCELERATION 0
90
94 PROPERTY(int16_t, speed)
97 PROPERTY(int16_t, accel)
99 PROPERTY(uint16_t, odo)
100
103 PROPERTY(bool, motorOn)
106 PROPERTY(bool, encoderOn)
108// PROPERTY(uint16_t, padding)
109#ifdef __cplusplus
111 wb_kinematic_motor() : _speed(DEFAULT_KINEMATIC_SPEED), _accel(DEFAULT_KINEMATIC_ACCELERATION), _odo(0), _motorOn(true), _encoderOn(false) {}
112 /* _padding(0) // Not needed I think */
113
116 _speed(other._speed),
117 _accel(other._accel),
118 _odo(other._odo),
119 _motorOn(other._motorOn),
120 _encoderOn(other._encoderOn) {}
121
124 _speed = other._speed;
125 _accel = other._accel;
126 _odo = other._odo;
127 _motorOn = other._motorOn;
128 _encoderOn = other._encoderOn;
129 return *this;
130 }
131#endif
132};
133
134#endif
Basic kinematic motor (i.e.
PROPERTY(int16_t, speed) PROPERTY(int16_t
Speed setting -32767 to 32767 in mm/s.
wb_kinematic_motor & operator=(const wb_kinematic_motor &other)
Assignment Operator.
wb_kinematic_motor(const wb_kinematic_motor &other)
Copy Constructor.
#define DEFAULT_KINEMATIC_ACCELERATION
#define DEFAULT_KINEMATIC_SPEED