Public Member Functions | Private Member Functions | Private Attributes | List of all members
MotorSerial Class Reference

#include <motor_serial.h>

Public Member Functions

int commandAvailable ()
 
 MotorSerial (const std::string &port="/dev/ttyUSB0", uint32_t baud_rate=9600, double loopRate=100)
 
 MotorSerial (const MotorSerial &other)
 
MotorSerialoperator= (const MotorSerial &)
 
MotorMessage receiveCommand ()
 
int transmitCommand (MotorMessage command)
 
int transmitCommands (const std::vector< MotorMessage > &commands)
 
 ~MotorSerial ()
 

Private Member Functions

void appendOutput (MotorMessage command)
 
 FRIEND_TEST (MotorSerialTests, serialClosedOnInterupt)
 
MotorMessage getInputCommand ()
 
int inputAvailable ()
 
void SerialThread ()
 

Private Attributes

shared_queue< MotorMessageinput
 
serial::Serial motors
 
shared_queue< MotorMessageoutput
 
ros::Rate serial_loop_rate
 
boost::thread serial_thread
 

Detailed Description

Copyright (c) 2016, Ubiquity Robotics All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

Neither the name of ubiquity_motor nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition at line 43 of file motor_serial.h.

Constructor & Destructor Documentation

MotorSerial::MotorSerial ( const std::string &  port = "/dev/ttyUSB0",
uint32_t  baud_rate = 9600,
double  loopRate = 100 
)

Copyright (c) 2016, Ubiquity Robotics All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

Neither the name of ubiquity_motor nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition at line 35 of file motor_serial.cc.

MotorSerial::~MotorSerial ( )

Definition at line 42 of file motor_serial.cc.

MotorSerial::MotorSerial ( const MotorSerial other)

Member Function Documentation

void MotorSerial::appendOutput ( MotorMessage  command)
private

Definition at line 80 of file motor_serial.cc.

int MotorSerial::commandAvailable ( )

Definition at line 67 of file motor_serial.cc.

MotorSerial::FRIEND_TEST ( MotorSerialTests  ,
serialClosedOnInterupt   
)
private
MotorMessage MotorSerial::getInputCommand ( )
private

Definition at line 71 of file motor_serial.cc.

int MotorSerial::inputAvailable ( )
private

Definition at line 69 of file motor_serial.cc.

MotorSerial& MotorSerial::operator= ( const MotorSerial )
MotorMessage MotorSerial::receiveCommand ( )

Definition at line 58 of file motor_serial.cc.

void MotorSerial::SerialThread ( )
private

Definition at line 82 of file motor_serial.cc.

int MotorSerial::transmitCommand ( MotorMessage  command)

Definition at line 48 of file motor_serial.cc.

int MotorSerial::transmitCommands ( const std::vector< MotorMessage > &  commands)

Definition at line 53 of file motor_serial.cc.

Member Data Documentation

shared_queue<MotorMessage> MotorSerial::input
private

Definition at line 62 of file motor_serial.h.

serial::Serial MotorSerial::motors
private

Definition at line 59 of file motor_serial.h.

shared_queue<MotorMessage> MotorSerial::output
private

Definition at line 64 of file motor_serial.h.

ros::Rate MotorSerial::serial_loop_rate
private

Definition at line 67 of file motor_serial.h.

boost::thread MotorSerial::serial_thread
private

Definition at line 66 of file motor_serial.h.


The documentation for this class was generated from the following files:


ubiquity_motor
Author(s):
autogenerated on Mon Jun 10 2019 15:37:24