Skip to content

Commit 2356b81

Browse files
committed
Merge remote-tracking branch 'origin/feature/sdg/ros2-actions' into feature/sdg/ros2-actions
2 parents 5f959e9 + d1ba26b commit 2356b81

File tree

3 files changed

+23
-7
lines changed

3 files changed

+23
-7
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,4 +178,7 @@ pyrightconfig.json
178178
.vs/
179179

180180
# camera
181-
/camera/*
181+
camera/*
182+
183+
# tests
184+
tests/

server.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,26 +80,26 @@ def list_verified_robot_specifications() -> dict:
8080
)
8181
)
8282
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,
8585
ping_timeout: float = 2.0,
8686
port_timeout: float = 2.0,
8787
) -> dict:
8888
"""
8989
Connect to a robot by setting the IP and port for the WebSocket connection, then testing connectivity.
9090
9191
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.
9494
ping_timeout (float): Timeout for ping in seconds. Default = 2.0.
9595
port_timeout (float): Timeout for port check in seconds. Default = 2.0.
9696
9797
Returns:
9898
dict: Connection status with ping and port check results.
9999
"""
100100
# 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
103103

104104
# Set the IP and port
105105
ws_manager.set_ip(actual_ip, actual_port)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Robot configuration template
2+
# Replace this text with specific instructions and information about your robot.
3+
# Include details on how to control it, important topics, and any special commands.
4+
# For example:
5+
# - Control commands (e.g., movement, actions)
6+
# - Sensor topics (e.g., camera, lidar)
7+
# - Safety guidelines
8+
# - Any custom messages or services used by the robot
9+
10+
name: local_rosbridge
11+
alias: turtlesim # Optional alias for easier reference
12+
type: sim # or 'real' for simulation
13+
prompts: The local_rosbridge is a generic local turtlesim robot.

0 commit comments

Comments
 (0)