Skip to content

Commit 539423b

Browse files
added offset for gps to center of robot
1 parent 94029df commit 539423b

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/jetson_pkg/jetson_pkg/gps_apriltag_comparison.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,13 @@ def coords_distance(self, apriltag_coords: Twist, gps_coords: Twist):
5050
apriltagX = apriltag_coords.linear.x
5151
apriltagY = apriltag_coords.linear.y
5252

53-
gpsX = gps_coords.linear.x
54-
gpsY = gps_coords.linear.y
53+
54+
gpsX = gps_coords.linear.x - math.cos(apriltag_coords.angular.y) * 0.39
55+
gpsY = gps_coords.linear.y - math.sin(apriltag_coords.angular.y) * 0.39
56+
57+
58+
59+
5560

5661
#turns the x and y into a circle
5762
distance = math.sqrt((apriltagX - gpsX)**2 + (apriltagY - gpsY)**2)
File renamed without changes.

src/jetson_pkg/jetson_pkg/jetson_apriltag.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ def timer_callback(self):
7878
msg_no_offset.linear.x = relative_x
7979
msg_no_offset.linear.z = relative_z
8080
msg_no_offset.linear.y = relative_y
81+
msg_no_offset.angular.y = thetar
8182

8283
self.get_logger().debug(f'{msg_no_offset}')
8384
self.publisher_.publish(msg_no_offset)

0 commit comments

Comments
 (0)