Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line normal #10

Open
wants to merge 27 commits into
base: convert-to-2D
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8621ee9
working in 2D
mohdwaseem27 Oct 7, 2023
770d4ae
Merge pull request #4 from RnDProjectsDeebul/interpolation
mohdwaseem27 Oct 7, 2023
9509512
updated turtlebot3 house map
mohdwaseem27 Oct 26, 2023
adcc437
1st experiment for accuraccy(without kidnap)
mohdwaseem27 Oct 26, 2023
c2477c2
update interpolate
mohdwaseem27 Dec 27, 2023
04b1119
get normals from line
mohdwaseem27 Jan 10, 2024
6a7361c
Merge pull request #9 from RnDProjectsDeebul/convert-to-2D
mohdwaseem27 Mar 7, 2024
b242a05
change rviz config
mohdwaseem27 Mar 7, 2024
f6015c4
change num particles'
mohdwaseem27 Mar 7, 2024
0ba7f7c
reduce max obs dist to fit for 2d
mohdwaseem27 Mar 7, 2024
76e38b3
Intead of seperating according to pos and neg keep at one place
mohdwaseem27 Mar 7, 2024
4d94743
Merge branch 'line-normal' of https://github.com/RnDProjectsDeebul/Wa…
mohdwaseem27 Mar 7, 2024
f893686
remove unnecessary prints
mohdwaseem27 Mar 7, 2024
ff00715
get better maps
mohdwaseem27 Mar 7, 2024
7b33fff
experiments for 2d
mohdwaseem27 Mar 20, 2024
e9a4f7a
add maps with 2d lidar
mohdwaseem27 Mar 29, 2024
13dd810
get 2D normals
mohdwaseem27 Mar 29, 2024
1c62fa1
change for 2d normals working
mohdwaseem27 Mar 29, 2024
24f0f7b
experiments
mohdwaseem27 Mar 29, 2024
91b8d43
experiments
mohdwaseem27 Mar 29, 2024
5890473
experiments
mohdwaseem27 Mar 31, 2024
b70b0f6
get 2d normals
mohdwaseem27 Mar 31, 2024
160734e
ad msg
mohdwaseem27 Mar 31, 2024
0048d48
robustness test
mohdwaseem27 Jun 6, 2024
c664afd
modifications and real robot
mohdwaseem27 Jul 30, 2024
c60f5ff
final changes with experiments
mohdwaseem27 Jan 5, 2025
98178d1
add report
mohdwaseem27 Feb 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,5 @@ cython_debug/
!/simulation_mapping/
!/velodyne_simulator/
!/project_proposal/
!/experiments/
!MohammedW-RnDReport.pdf
Binary file added MohammedW-RnDReport.pdf
Binary file not shown.
Binary file added experiments/RnD_experiments_analysis-2.pdf
Binary file not shown.
Binary file added experiments/RnD_experiments_analysis.pdf
Binary file not shown.
100 changes: 100 additions & 0 deletions experiments/accuracy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#!/usr/bin/env python

import rospy
from nav_msgs.msg import Odometry
from geometry_msgs.msg import PoseWithCovarianceStamped
import math
import csv
import sys
import tty
import termios

class PoseComparator:
def __init__(self):
self.odom_sub = rospy.Subscriber("/odom", Odometry, self.odom_callback)
self.pose_sub = rospy.Subscriber("/robot_pose", PoseWithCovarianceStamped, self.pose_callback)
self.latest_odom = None
self.latest_pose = None
self.record_data = False
self.rmse_values = []

def odom_callback(self, odom_msg):
self.latest_odom = odom_msg.pose.pose

self.calculate_average_distance()

def pose_callback(self, pose_msg):
self.latest_pose = pose_msg.pose.pose
self.calculate_average_distance()

def calculate_average_distance(self):
if self.latest_odom is None or self.latest_pose is None:
return

squared_error = (self.latest_odom.position.x - self.latest_pose.position.x)**2 + \
(self.latest_odom.position.y - self.latest_pose.position.y)**2 + \
(self.latest_odom.position.z - self.latest_pose.position.z)**2

rmse = math.sqrt(squared_error)

# rospy.loginfo("Root Mean Square Error (RMSE): {}".format(rmse))

# Record RMSE values if recording is enabled
if self.record_data:
self.rmse_values.append(rmse)

def start_recording(self):
rospy.loginfo("Recording started. Press 's' to stop.")

while not rospy.is_shutdown():
key = get_key()

if key == 's':
rospy.loginfo("Recording stopped.")
break

def save_to_csv(self, filename='rmse_values.csv'):
with open(filename, 'w', newline='') as csvfile:
fieldnames = ['RMSE']
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)

writer.writeheader()
for rmse in self.rmse_values:
writer.writerow({'RMSE': rmse})

rospy.loginfo("RMSE values saved to {}".format(filename))

def get_key():
# Function to get a single character from the terminal without waiting for Enter
fd = sys.stdin.fileno()
old_settings = termios.tcgetattr(fd)
try:
tty.setraw(fd)
ch = sys.stdin.read(1)
finally:
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
return ch

def main():
rospy.init_node('pose_comparator')
pose_comparator = PoseComparator()

try:
while not rospy.is_shutdown():
key = get_key()

if key == 'w' or key == 'x':
pose_comparator.record_data = True
pose_comparator.start_recording()
pose_comparator.save_to_csv()
pose_comparator.record_data = False
elif key == 's':
pose_comparator.record_data = False

rospy.spin()

except KeyboardInterrupt:
rospy.loginfo("Shutting down")

if __name__ == '__main__':
main()
Loading