BB2B-nw works!
This commit is contained in:
parent
9b421c0044
commit
0b7bbd0497
@ -36,17 +36,17 @@ touch_right.SetPosition(Spherical(0.12, Direction.Degrees(30, 0)))
|
||||
while True:
|
||||
# The left wheel turns forward when nothing is touched on the right side
|
||||
# and turn backward when the roboid hits something on the right
|
||||
wheel_speed_left = 600 #-600 if touch_right.touched_something else 600
|
||||
wheel_speed_left = -600 if touch_right.touched_something else 600
|
||||
# The right wheel does the same, but instead is controlled by
|
||||
# touches on the left side
|
||||
wheel_speed_right = -600 if touch_left.touched_something else 600
|
||||
# When both sides are touching something, both wheels will turn backward
|
||||
# and the roboid will move backwards
|
||||
bb2b.SetWheelVelocity(wheel_speed_left, wheel_speed_right)
|
||||
if touch_left.touched_something:
|
||||
print(f'{wheel_speed_left} {wheel_speed_right} {bb2b.linear_velocity.distance} {bb2b.linear_velocity.direction.horizontal}')
|
||||
if touch_left.touched_something or touch_right.touched_something:
|
||||
print(f'{wheel_speed_left} {wheel_speed_right} {bb2b.linear_velocity.distance} {bb2b.angular_velocity.distance}')
|
||||
|
||||
# Update the roboid state
|
||||
participant.Update()
|
||||
# and sleep for 100ms
|
||||
time.sleep(1.0)
|
||||
time.sleep(0.1)
|
||||
|
@ -6,8 +6,8 @@ class Angle:
|
||||
|
||||
@staticmethod
|
||||
def Normalize(angle):
|
||||
while angle <= -180:
|
||||
while angle < -180:
|
||||
angle += 360
|
||||
while angle > 180:
|
||||
while angle >= 180:
|
||||
angle -= 360
|
||||
return angle
|
@ -133,7 +133,7 @@ class LocalParticipant(Participant):
|
||||
if buffer_size <= 0:
|
||||
return True
|
||||
|
||||
print(f'{self.name} send {self.buffer[0]} to {owner.ip_address} {owner.port}')
|
||||
# print(f'{self.name} send {self.buffer[0]} to {owner.ip_address} {owner.port}')
|
||||
self.udp_socket.sendto(self.buffer[:buffer_size], (owner.ip_address, owner.port))
|
||||
return True
|
||||
|
||||
@ -216,7 +216,7 @@ class LocalParticipant(Participant):
|
||||
print(f'received model url: {msg.url}')
|
||||
|
||||
def ProcessBinaryMsg(self, msg: BinaryMsg):
|
||||
print('received binary data')
|
||||
# print('received binary data')
|
||||
thing: Thing = self.Get(msg.network_id, msg.thing_id)
|
||||
if thing != None:
|
||||
thing.ProcessBinary(msg.data)
|
||||
|
Loading…
x
Reference in New Issue
Block a user