I received a 6 on the quiz. How should I edit my code so that the movement is more square-like?
server code
scrubbed
client code
scrubbed
I received a 6 on the quiz. How should I edit my code so that the movement is more square-like?
server code
scrubbed
client code
scrubbed
Hi @linsu.han,
You should use smaller values for the velocities.
self.msg.angular.z = .05
and
self.msg.linear.x = 0.3
The bot has inertia, so expecially with spinning, it becomes very inaccurate for faster turning speeds.
And using rate.sleep() is kind of weird. Try something like this instead:
def move_straight(self, side):
self.msg.linear.x = 0.3
self.msg.angular.z = 0
while self.pub.get_num_connections() < 1:
# wait for a connection to publisher
rospy.sleep(0.01)
self.pub.publish(self.msg)
rospy.sleep(side)
I donβt know what magic you used to find those numbers, but it worked. Thank you!
faced the same problem
Is it okay to put the self.pub.get_num_connections
check in the handler?
def handler(self, request):
while self.pub.get_num_connections() < 1:
# wait for a connection to publisher
rospy.sleep(0.01)
try:
print(request)
for i in range(request.repetitions):
for i in range(4):
self.move_straight(request.side)
self.turn_90_deg()