Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
C-SLAM-PE
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Shengkang (William) Chen
C-SLAM-PE
Commits
d9436392
Commit
d9436392
authored
7 years ago
by
Shengkang (William) Chen
Browse files
Options
Downloads
Patches
Plain Diff
added script to transfer cam-ref measurement to center-ref measurment
parent
e37916d6
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
meas_cam_to_center.py
+38
-0
38 additions, 0 deletions
meas_cam_to_center.py
read_csv.py
+3
-3
3 additions, 3 deletions
read_csv.py
untitled0.py
+38
-0
38 additions, 0 deletions
untitled0.py
with
79 additions
and
3 deletions
meas_cam_to_center.py
0 → 100644
+
38
−
0
View file @
d9436392
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 15 22:52:36 2018
@author: william
"""
import
getpass
import
csv
from
datetime
import
datetime
import
math
compname
=
getpass
.
getuser
()
datapath
=
"
/home/
"
+
compname
+
"
/full_tests/full_test1/
"
f_x
=
open
(
datapath
+
"
Robot1_Measurement_x.dat
"
,
"
w+
"
)
f_x
.
write
(
"
# Time [sec]
\t\t
object id
\t\t
range [m]
\t\t
bearing [rad]
\n
"
)
start_time
=
input_data
[
0
][
9
]
#start_time = "2018-08-09 07.00.28.980 AM"
l
=
0.1
#distance between cam and the center of the robot
print
(
"
Experiment start time:
"
,
start_time
)
dt_obj
=
datetime
.
strptime
(
start_time
,
"
%Y-%m-%d %I.%M.%S.%f %p
"
)
time_tuple
=
dt_obj
.
timetuple
()
timestamp
=
dt_obj
.
timestamp
()
print
(
repr
(
timestamp
))
with
open
(
datapath
+
"
Robot1_Measurement_cam.dat
"
,
'
r+
'
)
as
measure_file
:
for
line
in
measure_file
:
if
line
[
0
]
!=
'
#
'
:
time
=
float
(
line
.
split
()[
0
])
subject_ID
=
line
.
split
()[
1
]
r_cam
=
float
(
line
.
split
()[
2
])
bearing
=
float
(
line
.
split
()[
3
])
phi
=
math
.
atan2
((
r_cam
*
math
.
cos
(
bearing
)
+
l
),
(
r_cam
*
math
.
sin
(
bearing
)))
r_cen
=
r_cam
*
math
.
sin
(
bearing
)
/
math
.
sin
(
phi
)
f_x
.
write
(
str
(
time
)
+
'
\t\t
'
+
subject_ID
+
'
\t\t
'
+
str
(
r_cen
)
+
'
\t\t
'
+
str
(
phi
)
+
'
\n
'
)
f_x
.
close
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
read_csv.py
+
3
−
3
View file @
d9436392
...
...
@@ -31,11 +31,11 @@ def quaternion_to_euler_angle(w, x, y, z):
compname
=
getpass
.
getuser
()
datapath
=
"
/home/
"
+
compname
+
"
/full_tests/
"
f_r2
=
open
(
datapath
+
"
/full_test5/
Robot1_Groundtruth.dat
"
,
"
w+
"
)
datapath
=
"
/home/
"
+
compname
+
"
/full_tests/
full_test1/
"
f_r2
=
open
(
datapath
+
"
Robot1_Groundtruth.dat
"
,
"
w+
"
)
f_r2
.
write
(
"
# Time [sec]
\t\t\t
x [m]
\t\t
y [m]
\t\t
orientation [rad]
\n
"
)
input_data
=
list
(
csv
.
reader
(
open
(
datapath
+
"
/full_test5/
gt.csv
"
,
"
r+
"
)))
input_data
=
list
(
csv
.
reader
(
open
(
datapath
+
"
gt.csv
"
,
"
r+
"
)))
num_rows
=
len
(
input_data
)
start_time
=
input_data
[
0
][
9
]
#start_time = "2018-08-09 07.00.28.980 AM"
...
...
This diff is collapsed.
Click to expand it.
untitled0.py
0 → 100644
+
38
−
0
View file @
d9436392
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 15 22:52:36 2018
@author: william
"""
import
getpass
import
csv
from
datetime
import
datetime
import
math
compname
=
getpass
.
getuser
()
datapath
=
"
/home/
"
+
compname
+
"
/full_tests/
"
f_r2
=
open
(
datapath
+
"
/full_test5/Robot1_Groundtruth.dat
"
,
"
w+
"
)
f_r2
.
write
(
"
# Time [sec]
\t\t\t
x [m]
\t\t
y [m]
\t\t
orientation [rad]
\n
"
)
input_data
=
list
(
csv
.
reader
(
open
(
datapath
+
"
/full_test5/gt.csv
"
,
"
r+
"
)))
num_rows
=
len
(
input_data
)
start_time
=
input_data
[
0
][
9
]
#start_time = "2018-08-09 07.00.28.980 AM"
print
(
"
Experiment start time:
"
,
start_time
)
dt_obj
=
datetime
.
strptime
(
start_time
,
"
%Y-%m-%d %I.%M.%S.%f %p
"
)
time_tuple
=
dt_obj
.
timetuple
()
timestamp
=
dt_obj
.
timestamp
()
print
(
repr
(
timestamp
))
with
open
(
meas_path
,
'
r+
'
)
as
measure_file
:
for
line
in
measure_file
:
if
line
[
0
]
!=
'
#
'
and
(
self
.
end_time
+
2
>=
float
(
line
.
split
()[
0
])
>=
self
.
start_time
):
time
=
round
(
float
(
line
.
split
()[
0
]),
3
)
subject_ID
=
int
(
line
.
split
()[
1
])
measurment_range
=
float
(
line
.
split
()[
2
])
bearing
=
float
(
line
.
split
()[
3
])
f_r2
.
close
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment