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

Supressing the no pwm/pwm errors

parent 9145d01b
No related branches found
No related tags found
1 merge request!2Manual control user interface
......@@ -9,8 +9,7 @@ class MotorController(Node):
self.subscription = self.create_subscription(Twist,'cmd_vel',self.cmd_vel_callback,10)
self.wheel_radius = 0.05 # meters
self.wheel_base = 0.30
self.left_pwm = 0
self.right_pwm = 0
self.get_logger().info("hello")
......@@ -33,28 +32,27 @@ class MotorController(Node):
# left_pwm = int((left_speed + 1.0) / 2.0 * 100)
# right_pwm = int((right_speed + 1.0) / 2.0 * 100)
if omega == 1:
self.left_pwm = -50
self.right_pwm = 50
left_pwm = -50
right_pwm = 50
elif omega == -1:
self.left_pwm = 50
self.right_pwm = -50
left_pwm = 50
right_pwm = -50
if v == 0.5:
self.left_pwm = 75
self.right_pwm = 75
left_pwm = 75
right_pwm = 75
elif v == -0.5:
self.left_pwm = -75
self.right_pwm = -75
if v == 0 and omega == 0:
self.left_pwm = 0
self.right_pwm = 0
left_pwm = -75
right_pwm = -75
self.get_logger().info(f"Left PWM: {self.left_pwm}, Right PWM: {self.right_pwm}")
if v == 0 and omega == 0:
left_pwm = 0
right_pwm = 0
self.get_logger().info("STOP command received. Motors stopped.")
self.get_logger().info(f"Left PWM: {left_pwm}, Right PWM: {right_pwm}")
# Set motor directions based on sign of speeds
# left_direction = 1 if left_speed >= 0 else 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment