Skip to content

Commit

Permalink
Split sending and receving ports
Browse files Browse the repository at this point in the history
  • Loading branch information
usedhondacivic committed Oct 27, 2024
1 parent c6d4eb1 commit a953360
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion little_red_rover/little_red_rover/hal.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ def __init__(self):
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.socket.bind(("0.0.0.0", 8001))

self.send_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

self.subscription = rospy.Subscriber("cmd_vel", Twist, self.cmd_vel_callback)

self.joint_state_publisher = rospy.Publisher(
Expand Down Expand Up @@ -133,7 +135,7 @@ def cmd_vel_callback(self, msg: Twist):
packet.cmd_vel.v = msg.linear.x
packet.cmd_vel.w = msg.angular.z

self.socket.sendto(packet.SerializeToString(), ("192.168.4.1", 8001))
self.send_socket.sendto(packet.SerializeToString(), ("192.168.4.1", 8001))


def main(args=None):
Expand Down

0 comments on commit a953360

Please sign in to comment.