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

#include <motor_serial.h>

Public Member Functions

void closePort ()
 
int commandAvailable ()
 
 MotorSerial (const std::string &port="/dev/ttyUSB0", uint32_t baud_rate=9600)
 
 MotorSerial (MotorSerial const &)=delete
 
bool openPort ()
 
MotorSerialoperator= (MotorSerial const &)=delete
 
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)
 
void SerialThread ()
 

Private Attributes

int error_threshold
 
serial::Serial motors
 
shared_queue< MotorMessageoutput
 
int serial_errors
 
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() [1/2]

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

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::~MotorSerial ( )

Definition at line 41 of file motor_serial.cc.

◆ MotorSerial() [2/2]

MotorSerial::MotorSerial ( MotorSerial const &  )
delete

Member Function Documentation

◆ appendOutput()

void MotorSerial::appendOutput ( MotorMessage  command)
private

Definition at line 76 of file motor_serial.cc.

◆ closePort()

void MotorSerial::closePort ( )

Definition at line 78 of file motor_serial.cc.

◆ commandAvailable()

int MotorSerial::commandAvailable ( )

Definition at line 74 of file motor_serial.cc.

◆ FRIEND_TEST()

MotorSerial::FRIEND_TEST ( MotorSerialTests  ,
serialClosedOnInterupt   
)
private

◆ openPort()

bool MotorSerial::openPort ( )

Definition at line 82 of file motor_serial.cc.

◆ operator=()

MotorSerial& MotorSerial::operator= ( MotorSerial const &  )
delete

◆ receiveCommand()

MotorMessage MotorSerial::receiveCommand ( )

Definition at line 66 of file motor_serial.cc.

◆ SerialThread()

void MotorSerial::SerialThread ( )
private

Definition at line 109 of file motor_serial.cc.

◆ transmitCommand()

int MotorSerial::transmitCommand ( MotorMessage  command)

Definition at line 47 of file motor_serial.cc.

◆ transmitCommands()

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

Definition at line 55 of file motor_serial.cc.

Member Data Documentation

◆ error_threshold

int MotorSerial::error_threshold
private

Definition at line 70 of file motor_serial.h.

◆ motors

serial::Serial MotorSerial::motors
private

Definition at line 61 of file motor_serial.h.

◆ output

shared_queue<MotorMessage> MotorSerial::output
private

Definition at line 63 of file motor_serial.h.

◆ serial_errors

int MotorSerial::serial_errors
private

Definition at line 69 of file motor_serial.h.

◆ serial_thread

boost::thread MotorSerial::serial_thread
private

Definition at line 65 of file motor_serial.h.


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


ubiquity_motor
Author(s):
autogenerated on Thu Nov 16 2023 03:30:56