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

Bunch of logging statements, issue with converting to a Point message

parent 6741b49f
No related branches found
No related tags found
No related merge requests found
...@@ -252,7 +252,7 @@ class MotorControlNode(Node): ...@@ -252,7 +252,7 @@ class MotorControlNode(Node):
def stop_motors(self): def stop_motors(self):
self.motor.stop() self.motor.stop()
self.get_logger().info('Motors have been stopped.') # self.get_logger().info('Motors have been stopped.')
class Motor: class Motor:
def __init__(self,node, EnaA, In1A, In2A, EnaB, In1B, In2B): def __init__(self,node, EnaA, In1A, In2A, EnaB, In1B, In2B):
......
...@@ -299,18 +299,22 @@ class UWBNode(Node): ...@@ -299,18 +299,22 @@ class UWBNode(Node):
if self.mode == "Call" and self.call_mode_active: if self.mode == "Call" and self.call_mode_active:
self.get_logger().info("Call mode active.")
if self.current_tag1_position is not None and self.current_target_index < len(self.path): if self.current_tag1_position is not None and self.current_target_index < len(self.path):
self.get_logger().info(f"Current target index: {self.current_target_index}")
target_node_name = self.path[self.current_target_index] target_node_name = self.path[self.current_target_index]
target_pos = self.get_node_position(target_node_name) target_pos = self.get_node_position(target_node_name)
self.get_logger().info(f"Target position: {target_pos}")
# Publish current position # Publish current position
position_msg = Point(x=self.current_tag1_position[0], y=self.current_tag1_position[1], z=0.0) position_msg = Point(x=self.current_tag1_position[0], y=self.current_tag1_position[1], z=0.0)
self.start_publisher.publish(position_msg) self.start_publisher.publish(position_msg)
self.get_logger().info(f"Current position: {self.current_tag1_position} Success!")
# Publish target position # Publish target position
target_msg = Point(x=target_pos[0], y=target_pos[1], z=0.0) target_msg = Point(x=target_pos[0], y=target_pos[1], z=0.0)
self.target_location_pub.publish(target_msg) self.target_location_pub.publish(target_msg)
self.get_logger().info(f"Target position: {target_pos} Success!")
# Check if close to the node # Check if close to the node
dist = math.sqrt((self.current_tag1_position[0] - target_pos[0])**2 + dist = math.sqrt((self.current_tag1_position[0] - target_pos[0])**2 +
(self.current_tag1_position[1] - target_pos[1])**2) (self.current_tag1_position[1] - target_pos[1])**2)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment