Skip to content

Commit

Permalink
adjust variables names
Browse files Browse the repository at this point in the history
  • Loading branch information
NestorDP committed Dec 4, 2024
1 parent 22f336f commit 5136aa5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions littlebot_base/scripts/littlebot_fake.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ def __init__(self, serial_port):
self.littlebot_msg = LittlebotProtocol.LittlebotProtocol()
self.radius = 0.037
self.delta_time = 0.1
self.left_command_vel = 0.0
self.right_command_vel = 0.0

def serial_configuration(self, serial_port):
return serial.Serial(serial_port, baudrate=115200)

def linear_velocity_to_angular_position(self, linear_velocity, time):
angular_velocity = linear_velocity / self.radius
angular_position = angular_velocity * time
Expand All @@ -36,7 +38,7 @@ def send_status(self):
self.littlebot_msg.right_status_vel = self.right_command_vel
self.littlebot_msg.right_status_pos = self.linear_velocity_to_angular_position(self.right_command_vel, self.delta_time)

encoded_data = self.START_CHARACTER + self.self.littlebot_msg.SerializeToString() + self.END_CHARACTER
encoded_data = self.START_CHARACTER + self.littlebot_msg.SerializeToString() + self.END_CHARACTER
self.ser.write(encoded_data)

threading.Timer(self.delta_time, self.send_status).start()
Expand All @@ -50,7 +52,6 @@ def receive_command_callback(self, encoded_data_received):
self.left_command_vel = self.littlebot_msg.left_command_vel
self.right_command_vel = self.littlebot_msg.right_command_vel


def read_from_serial(self):
while True:
data = self.ser.read()
Expand Down

0 comments on commit 5136aa5

Please sign in to comment.