Skip to content
Snippets Groups Projects
Commit edf2f455 authored by Paul-Winpenny's avatar Paul-Winpenny
Browse files

Added the manual control changes from the BLE branch, I am going to prune that branch.

parent fce8b229
No related branches found
No related tags found
No related merge requests found
......@@ -33,7 +33,8 @@ class RoboBinConnectionHandler:
"CALLOVER": self.handle_call_over,
"CUSTOM": self.handle_custom_message,
"REQUEST_MAP": self.handle_request_map,
"SET_LAYOUT": self.handle_set_layout
"SET_LAYOUT": self.handle_set_layout,
"MANUALCTRL": self.handle_manual_control
}
......@@ -112,15 +113,25 @@ class RoboBinConnectionHandler:
print(f"Loaded map '{self.current_layout}' successfully.")
return map_data
# Attempt to load the default layout if the specified layout is missing
map_data = self.load_layout(self.default_layout)
if map_data:
print(f"Specified layout not found. Loaded default layout '{self.default_layout}'.")
return map_data
# Both the specified and default layouts are missing
print("Error: Neither specified nor default layout found.")
return None
def handle_manual_control(self, client_socket, message):
directions = {
"W": (1,0,0),
"A": (0,0,1),
"S": (-1,0,0),
"D": (0,0,-1)
}
print("Manual control message received: {}".format(message))
#EIther W,A,S,D
#Format into cmd_vel(linear,angular) for ros2 node
response = b"Manual control message received."+ str(directions[message.decode()[0]])
print("Sending response to manual control message.")
def handle_request_map(self, client_socket, _):
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment