Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,7 @@ pyrightconfig.json
.vs/

# camera
/camera/*
camera/*

# tests
tests/
12 changes: 6 additions & 6 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,26 +79,26 @@ def list_verified_robot_specifications() -> dict:
)
)
def connect_to_robot(
ip: Optional[str] = None,
port: Optional[Union[int, str]] = None,
ip: str = ROSBRIDGE_IP,
port: Union[int, str] = ROSBRIDGE_PORT,
ping_timeout: float = 2.0,
port_timeout: float = 2.0,
) -> dict:
"""
Connect to a robot by setting the IP and port for the WebSocket connection, then testing connectivity.

Args:
ip (Optional[str]): The IP address of the rosbridge server. Defaults to "127.0.0.1" (localhost).
port (Optional[int]): The port number of the rosbridge server. Defaults to 9090.
ip (str): The IP address of the rosbridge server. Defaults to "127.0.0.1" (localhost).
port (int): The port number of the rosbridge server. Defaults to 9090.
ping_timeout (float): Timeout for ping in seconds. Default = 2.0.
port_timeout (float): Timeout for port check in seconds. Default = 2.0.

Returns:
dict: Connection status with ping and port check results.
"""
# Set default values if None
actual_ip = ip if ip is not None else "127.0.0.1"
actual_port = int(port) if port is not None else 9090
actual_ip = str(ip).strip() if ip else ROSBRIDGE_IP
actual_port = int(port) if port else ROSBRIDGE_PORT

# Set the IP and port
ws_manager.set_ip(actual_ip, actual_port)
Expand Down
13 changes: 13 additions & 0 deletions utils/robot_specifications/local_rosbridge.yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of this local_rosbridge.yaml?
Is it meant to to be a config for turtlesim? or is it a template for users to create their own?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a config to connect to a general rosbridge server. Can be used as a template or as test file to connect to turtlesim.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Robot configuration template
# Replace this text with specific instructions and information about your robot.
# Include details on how to control it, important topics, and any special commands.
# For example:
# - Control commands (e.g., movement, actions)
# - Sensor topics (e.g., camera, lidar)
# - Safety guidelines
# - Any custom messages or services used by the robot

name: local_rosbridge
alias: turtlesim # Optional alias for easier reference
type: sim # or 'real' for simulation
prompts: The local_rosbridge is a generic local turtlesim robot.