Skip to content

Commit

Permalink
oops reverted too far
Browse files Browse the repository at this point in the history
  • Loading branch information
TiaSinghania committed Jun 27, 2024
1 parent 57ad779 commit 9520c84
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 264 deletions.
34 changes: 22 additions & 12 deletions rb_ws/src/buggy/paths/rosbag_to_pose_csv.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
#! /usr/bin/env python3
import rosbag
import argparse
import uuid
import json
import csv

import rosbag
from tf.transformations import euler_from_quaternion


def main():
"""
bag_file is an input that reads the path to the bag file
output_file is an argument that reads the path to the output file
subsample is the number of points to be selected to be converted to waypoints
"""
# Read in bag path from command line
parser = argparse.ArgumentParser()
parser.add_argument("bag_file", help="Path to bag file")
Expand All @@ -26,31 +31,36 @@ def main():
i = 0

# Loop through bag
for topic, msg, t in bag.read_messages(topics="/nav/odom"):
for _, msg, _ in bag.read_messages(topics="/nav/odom"):
# Skip waypoints
if i % args.subsample != 0:
i += 1
continue
i += 1

# TODO: Check Orientation
lat = msg.pose.pose.position.x
lon = msg.pose.pose.position.y
orientation_q = msg.pose.pose.orientation

orientation_list = [orientation_q.x, orientation_q.y, orientation_q.z, orientation_q.w]
(roll, pitch, yaw) = euler_from_quaternion (orientation_list)

orientation_list = [
orientation_q.x,
orientation_q.y,
orientation_q.z,
orientation_q.w,
]
(_, _, yaw) = euler_from_quaternion(orientation_list)

waypoints.append([str(lat), str(lon), str(yaw)])

# Write to csv file
with open(args.output_file, 'w', newline='') as csvfile:
writer = csv.writer(csvfile, delimiter=',',
quotechar='|', quoting=csv.QUOTE_MINIMAL)
with open(args.output_file, "w", newline="") as csvfile:
writer = csv.writer(
csvfile, delimiter=",", quotechar="|", quoting=csv.QUOTE_MINIMAL
)
for row in waypoints:
writer.writerow(row)



if __name__ == "__main__":
main()
main()
95 changes: 0 additions & 95 deletions rb_ws/src/buggy/scripts/auton/brake_controller.py

This file was deleted.

107 changes: 0 additions & 107 deletions rb_ws/src/buggy/scripts/auton/pure_pursuit_controller.py

This file was deleted.

25 changes: 0 additions & 25 deletions rb_ws/src/buggy/scripts/validation/log_battery.py

This file was deleted.

25 changes: 0 additions & 25 deletions rb_ws/src/buggy/scripts/validation/log_battery_tester.py

This file was deleted.

0 comments on commit 9520c84

Please sign in to comment.