Skip to content

Commit

Permalink
intermediate commit on localization notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
gkueppers committed Oct 12, 2023
1 parent bffa9b8 commit fd3517f
Show file tree
Hide file tree
Showing 6 changed files with 555 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
venv
my_venv
__pycache__
.db3
.ipynb_checkpoints
.idea
section_2_sensor_data_processing/tensorflow_datasets
Expand Down
Empty file added bag/.gitkeep
Empty file.
2 changes: 2 additions & 0 deletions docker/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ papermill
jupyterlab-tour
nodejs
jupyterlab
rosbags
squaternion
1 change: 1 addition & 0 deletions index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"| 5 | Object Detection | Required |[Exercise](section_2_sensor_data_processing/5_object_detection.ipynb) | Available on edX |\n",
"| 6 | Point Cloud Occupancy Grid Mapping | Required |[Exercise](section_2_sensor_data_processing/6_grid_mapping.ipynb) | Available on edX |\n",
"| 7 | Camera-based Semantic Grid Mapping | Required |[Exercise](section_2_sensor_data_processing/7_cam_semantic_grid_mapping.ipynb) | Available on edX |\n",
"| 8 | Localization | Required |[Exercise](section_2_sensor_data_processing/8_localization.ipynb) | Available on edX |\n",
"\n",
"\n",
"\n",
Expand Down
526 changes: 526 additions & 0 deletions section_2_sensor_data_processing/8_localization.ipynb

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions section_2_sensor_data_processing/localization/trajectory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from squaternion import Quaternion

class TrajectoryPoint2D:
def __init__(self):
self.x=None
self.y=None
self.psi=None
self.t=None

def from_odometry(self, odometry):
self.x = odometry.pose.pose.position.x
self.y = odometry.pose.pose.position.y
self.t = odometry.header.stamp.sec+odometry.header.stamp.nanosec*1e-9
self.psi = self.quaternion_to_yaw(odometry.pose.pose.orientation)

def from_pose(self, pose):
self.x = pose.pose.position.x
self.y = pose.pose.position.y
self.t = pose.header.stamp.sec+pose.header.stamp.nanosec*1e-9
self.psi = self.quaternion_to_yaw(pose.pose.orientation)

def quaternion_to_yaw(self, quaternion):
q = Quaternion(quaternion.w,quaternion.x,quaternion.y,quaternion.z)
e = q.to_euler(degrees=True)
return e[2]

0 comments on commit fd3517f

Please sign in to comment.