Skip to content

Commit

Permalink
WIP #9: A few tweaks to the simulation code
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Gloudemans committed Feb 6, 2019
1 parent b2da6b1 commit d64f504
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions simulation_tools/scripts/path_tracking_sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def __init__(self, twist_topic, pose_topic, init_pose=Pose()):
# True state of robot
self.pose = init_pose
self.desired_lin_vel = 1.0
self.desired_ang_vel = -2.12132034356
self.desired_ang_vel = 2 / -2.12132034356

# Subscriber to listen for incoming drive commands
self.twist_sub = rospy.Subscriber(twist_topic, Twist, self.set_twist)
Expand Down Expand Up @@ -62,6 +62,8 @@ def send_pose_est(self):
self.pose_pub.publish(self.pose)




if __name__ == "__main__":

# Create base image for viewing simulation
Expand Down Expand Up @@ -110,11 +112,11 @@ def send_pose_est(self):
arrow_y2 = arrow_y1 - (sin(theta) * .15)
cv2.arrowedLine(frame, (int(arrow_x1 * scale), int(arrow_y1 * scale)),
(int(arrow_x2 * scale), int(arrow_y2 * scale)), p_color, 2, tipLength=0.5)
cv2.circle(frame, (int(arrow_x1 * scale), int(arrow_y1 * scale)), 5, r_color)
cv2.circle(frame, (int(arrow_x1 * scale), int(arrow_y1 * scale)), 5, r_color, thickness=-1)

# DRAW TEST POINT
target_point = [1.7071067811865475, 0.7071067811865475]
cv2.circle(frame, (int(target_point[0] * scale), int((field_length - target_point[1]) * scale)), 5, (0, 0, 255))
cv2.circle(frame, (int(target_point[0] * scale), int((field_length - target_point[1]) * scale)), 5, (0, 0, 255), thickness=-1)

# Display image
cv2.imshow("Path tracking simulation", frame)
Expand Down

0 comments on commit d64f504

Please sign in to comment.