basic_robotics.interfaces.udp_bridge module
Handle UDP Communications as a CommsObject.
- class basic_robotics.interfaces.udp_bridge.UDPObject(name, ip: str = '192.168.1.1', rx_port: int = 8000, tx_port: int = 9000, timeout: float = 0.1)[source]
Bases:
CommsObjectCreate a new CommsObject that handles UDP Communication.
- __init__(name, ip: str = '192.168.1.1', rx_port: int = 8000, tx_port: int = 9000, timeout: float = 0.1) UDPObject[source]
Create a new UDP CommsObject.
- Parameters:
- Returns:
CommsObject instance
- sendData(message: str, port: int = None) None[source]
Send a message.
- Parameters:
message (Str) – data to be sent along the connection
port (int, Optional) – port to transmit. Defaults to None.
- getData()[source]
Receive a message.
- Returns:
msg – data retrieved, if any success: boolean for whether or not data was retrieved
- setIP(ip: str) None[source]
Set the IP address of the comms handle.
- Parameters:
ip – String - ip to bind to
- setRxPort(port: int) None[source]
Set the Rx port of the comms handle.
- Parameters:
port – Int - port to bind to
- setTxPort(port: int) None[source]
Set the Tx port of the comms handle.
- Parameters:
port – Int - port to bind to
- openCom() bool[source]
Open a Communications Channel.
- Returns:
bool – Success of Opening the Channel
- closeCom() bool[source]
Close a Communications Channel.
- Returns:
bool – Success of Closing the Channel