basic_robotics.interfaces.comms_object module

Base Class for Communications Bridges in Basic-Robotics.

class basic_robotics.interfaces.comms_object.CommsObject(name: str = 'CommObj', type: str = 'UDP')[source]

Bases: object

Base Class for a variety of communications types with standard interfaces.

__init__(name: str = 'CommObj', type: str = 'UDP') → CommsObject[source]

Create a new CommsObject.

Parameters:
  • name (str, optional) – Name of this Comm Object. Defaults to “CommObj”.

  • type (str, optional) – Type of this Comm Object. Defaults to “UDP”.

Returns:

CommsObject – _description_

getRxSuccess() → bool[source]

Get success of last data receiving attempt.

Returns:

bool – data read success

getTxSuccess() → bool[source]

Get success of last data writing attempt.

Returns:

bool – data write success

sendData(data) → bool[source]

Send data.

Parameters:

data – data to be sent

Returns:

bool – message send success

getData()[source]

Receive data.

Returns:

Any – Message Data

setName(name: str) → None[source]

Set the name of the object.

Parameters:

name (str) – Name of the Comms Object

getName() → str[source]

Return the name of the object.

Returns:

str – Name of the object

openCom() → bool[source]

Open a Communications Channel.

Returns:

bool – Success of Opening the Channel

closeCom() → None[source]

Close a Communications Channel.

Returns:

bool – Success of Closing the Channel