Skip to content

Instantly share code, notes, and snippets.

@harmishhk
Last active August 29, 2015 14:23
Show Gist options
  • Save harmishhk/4851f9e1e0b1a16fc9e5 to your computer and use it in GitHub Desktop.
Save harmishhk/4851f9e1e0b1a16fc9e5 to your computer and use it in GitHub Desktop.
human-robot following graphs
# human-robot following graphs

human-robot following graphs

intended to use for ISER'15 paper

procedure to produce graphs

  • record a ros-bag file with tf topic
  • run the bag using, e.g. rosbag play test.bag
  • generate bag files for human and robot using, e.g. rosrun tf tf_csv test.bag /from /to > human.csv (ref)
  • you may need to cleanup csv files a bit, i.e. removing lines at start and at end
  • convet data using julia convert.jl
  • got to plotly, upload data and create 3d scattered plot!

example graph is here

to embed graph you can use template given in index.html file

# read data
dh = readdlm("slow_fast_human.csv",',')
dr = readdlm("slow_fast_robot.csv",',')
# filter time
start_time = 1433867246 # you may need to change this
dhm = [dh[:,1]-start_time dh[:,2:end]]
drm = [dr[:,1]-start_time dr[:,2:end]]
# make both data have same number of rows,
# you man need to change here as well
if size(dhm)[1] > size(drm)[1]
dhm = dhm[size(dhm)[1]-size(drm)[1]+1:end,:]
else
drm = drm[size(drm)[1]-size(dhm)[1]+1:end,:]
end
# combine data
drhm = hcat(drm[:,1:3], dhm[:,1:3])
# write combined data to a file
writecsv("drhm.csv", drhm)
<!DOCTYPE html>
<html>
<head>
<title>spencer speed tests</title>
<meta charset="UTF-8">
<script type="text/javascript">
function newSrc() {
var e = document.getElementById("plotSelectMenu");
var newSrc = e.options[e.selectedIndex].value;
document.getElementById("plotFrame").src=newSrc;
}
</script>
</head>
<body>
<center>
<div>
<select id="plotSelectMenu">
<option value="https://plot.ly/~harmishhk/34.embed?width=1200&height=1000">slwo_fast</option>
<!-- <option value="https://plot.ly/~harmishhk/34.embed?width=1200&height=1000">slwo_fast</option>
<option value="https://plot.ly/~harmishhk/34.embed?width=1200&height=1000">slwo_fast</option> -->
</select>
<button type="button" onClick="newSrc();">load</button>
</div>
<div>
<iframe id="plotFrame" width="1200" height="1000" frameborder="0" seamless="seamless" scrolling="no" src="https://plot.ly/~harmishhk/34.embed?width=1200&height=1000" ></iframe>
<script data-plotly="harmishhk:34" src="https://plot.ly/embed.js" async></script>
</div>
</center>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment