complete motor

Dependencies:   BufferedSerial motor_sn7544

Committer:
Jeonghoon
Date:
Thu Nov 21 11:39:20 2019 +0000
Revision:
13:3ac8d2472417
Parent:
11:2228e8931266
complete motor

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jeonghoon 11:2228e8931266 1 /*
Jeonghoon 11:2228e8931266 2 * Copyright (C) 2010, Willow Garage, Inc.
Jeonghoon 11:2228e8931266 3 *
Jeonghoon 11:2228e8931266 4 * Redistribution and use in source and binary forms, with or without
Jeonghoon 11:2228e8931266 5 * modification, are permitted provided that the following conditions are met:
Jeonghoon 11:2228e8931266 6 * * Redistributions of source code must retain the above copyright notice,
Jeonghoon 11:2228e8931266 7 * this list of conditions and the following disclaimer.
Jeonghoon 11:2228e8931266 8 * * Redistributions in binary form must reproduce the above copyright
Jeonghoon 11:2228e8931266 9 * notice, this list of conditions and the following disclaimer in the
Jeonghoon 11:2228e8931266 10 * documentation and/or other materials provided with the distribution.
Jeonghoon 11:2228e8931266 11 * * Neither the names of Willow Garage, Inc. nor the names of its
Jeonghoon 11:2228e8931266 12 * contributors may be used to endorse or promote products derived from
Jeonghoon 11:2228e8931266 13 * this software without specific prior written permission.
Jeonghoon 11:2228e8931266 14 *
Jeonghoon 11:2228e8931266 15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Jeonghoon 11:2228e8931266 16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Jeonghoon 11:2228e8931266 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Jeonghoon 11:2228e8931266 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
Jeonghoon 11:2228e8931266 19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
Jeonghoon 11:2228e8931266 20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
Jeonghoon 11:2228e8931266 21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
Jeonghoon 11:2228e8931266 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
Jeonghoon 11:2228e8931266 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
Jeonghoon 11:2228e8931266 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
Jeonghoon 11:2228e8931266 25 * POSSIBILITY OF SUCH DAMAGE.
Jeonghoon 11:2228e8931266 26 */
Jeonghoon 11:2228e8931266 27
Jeonghoon 11:2228e8931266 28 #ifndef ROSLIB_MESSAGE_OPERATIONS_H
Jeonghoon 11:2228e8931266 29 #define ROSLIB_MESSAGE_OPERATIONS_H
Jeonghoon 11:2228e8931266 30
Jeonghoon 11:2228e8931266 31 #include <ostream>
Jeonghoon 11:2228e8931266 32
Jeonghoon 11:2228e8931266 33 namespace ros
Jeonghoon 11:2228e8931266 34 {
Jeonghoon 11:2228e8931266 35 namespace message_operations
Jeonghoon 11:2228e8931266 36 {
Jeonghoon 11:2228e8931266 37
Jeonghoon 11:2228e8931266 38 template<typename M>
Jeonghoon 11:2228e8931266 39 struct Printer
Jeonghoon 11:2228e8931266 40 {
Jeonghoon 11:2228e8931266 41 template<typename Stream>
Jeonghoon 11:2228e8931266 42 static void stream(Stream& s, const std::string& indent, const M& value)
Jeonghoon 11:2228e8931266 43 {
Jeonghoon 11:2228e8931266 44 (void)indent;
Jeonghoon 11:2228e8931266 45 s << value << "\n";
Jeonghoon 11:2228e8931266 46 }
Jeonghoon 11:2228e8931266 47 };
Jeonghoon 11:2228e8931266 48
Jeonghoon 11:2228e8931266 49 // Explicitly specialize for uint8_t/int8_t because otherwise it thinks it's a char, and treats
Jeonghoon 11:2228e8931266 50 // the value as a character code
Jeonghoon 11:2228e8931266 51 template<>
Jeonghoon 11:2228e8931266 52 struct Printer<int8_t>
Jeonghoon 11:2228e8931266 53 {
Jeonghoon 11:2228e8931266 54 template<typename Stream>
Jeonghoon 11:2228e8931266 55 static void stream(Stream& s, const std::string& indent, int8_t value)
Jeonghoon 11:2228e8931266 56 {
Jeonghoon 11:2228e8931266 57 (void)indent;
Jeonghoon 11:2228e8931266 58 s << static_cast<int32_t>(value) << "\n";
Jeonghoon 11:2228e8931266 59 }
Jeonghoon 11:2228e8931266 60 };
Jeonghoon 11:2228e8931266 61
Jeonghoon 11:2228e8931266 62 template<>
Jeonghoon 11:2228e8931266 63 struct Printer<uint8_t>
Jeonghoon 11:2228e8931266 64 {
Jeonghoon 11:2228e8931266 65 template<typename Stream>
Jeonghoon 11:2228e8931266 66 static void stream(Stream& s, const std::string& indent, uint8_t value)
Jeonghoon 11:2228e8931266 67 {
Jeonghoon 11:2228e8931266 68 (void)indent;
Jeonghoon 11:2228e8931266 69 s << static_cast<uint32_t>(value) << "\n";
Jeonghoon 11:2228e8931266 70 }
Jeonghoon 11:2228e8931266 71 };
Jeonghoon 11:2228e8931266 72
Jeonghoon 11:2228e8931266 73 } // namespace message_operations
Jeonghoon 11:2228e8931266 74 } // namespace ros
Jeonghoon 11:2228e8931266 75
Jeonghoon 11:2228e8931266 76 #endif // ROSLIB_MESSAGE_OPERATIONS_H