@@ -80,26 +80,26 @@ def list_verified_robot_specifications() -> dict:
80
80
)
81
81
)
82
82
def connect_to_robot (
83
- ip : Optional [ str ] = None ,
84
- port : Optional [ Union [int , str ]] = None ,
83
+ ip : str = ROSBRIDGE_IP ,
84
+ port : Union [int , str ] = ROSBRIDGE_PORT ,
85
85
ping_timeout : float = 2.0 ,
86
86
port_timeout : float = 2.0 ,
87
87
) -> dict :
88
88
"""
89
89
Connect to a robot by setting the IP and port for the WebSocket connection, then testing connectivity.
90
90
91
91
Args:
92
- ip (Optional[ str] ): The IP address of the rosbridge server. Defaults to "127.0.0.1" (localhost).
93
- port (Optional[ int] ): The port number of the rosbridge server. Defaults to 9090.
92
+ ip (str): The IP address of the rosbridge server. Defaults to "127.0.0.1" (localhost).
93
+ port (int): The port number of the rosbridge server. Defaults to 9090.
94
94
ping_timeout (float): Timeout for ping in seconds. Default = 2.0.
95
95
port_timeout (float): Timeout for port check in seconds. Default = 2.0.
96
96
97
97
Returns:
98
98
dict: Connection status with ping and port check results.
99
99
"""
100
100
# Set default values if None
101
- actual_ip = ip if ip is not None else "127.0.0.1"
102
- actual_port = int (port ) if port is not None else 9090
101
+ actual_ip = str ( ip ). strip () if ip else ROSBRIDGE_IP
102
+ actual_port = int (port ) if port else ROSBRIDGE_PORT
103
103
104
104
# Set the IP and port
105
105
ws_manager .set_ip (actual_ip , actual_port )
0 commit comments