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

Add playback event recorder #633

Merged
merged 53 commits into from
Dec 10, 2020
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
7c98542
add playback event recorder system
iche033 Sep 18, 2020
13eb102
record videos for artifact proximity events
iche033 Sep 18, 2020
8c623c2
comment out paused
iche033 Sep 22, 2020
a978062
add support for spawning light on playback
iche033 Sep 22, 2020
2e4379d
Merge branch 'citadel' into playback_event_recorder
Sep 23, 2020
758ba7d
Merge branch 'citadel' into playback_event_recorder
Sep 23, 2020
7755171
play for a few seconds for scene to load
iche033 Sep 25, 2020
0551bda
Merge branch 'playback_event_recorder' of github.com:osrf/subt into p…
iche033 Sep 25, 2020
2b7448d
add support for follow mode
iche033 Sep 29, 2020
5491210
add doc
iche033 Sep 29, 2020
d20a8a3
record rock_fall events
iche033 Oct 1, 2020
9d532d9
rock fall event recording working
iche033 Oct 1, 2020
90f2a7d
merge events
iche033 Oct 1, 2020
01df54d
Merge branch 'citadel' into playback_event_recorder
nkoenig Oct 5, 2020
49cf846
update staging area detector event, add static camera placements for …
iche033 Oct 6, 2020
560902e
Merge branch 'playback_event_recorder' of github.com:osrf/subt into p…
iche033 Oct 6, 2020
dce762e
fix build
iche033 Oct 6, 2020
2207112
path tracer launch fix and colors
angelacmaio Oct 6, 2020
e608a45
Removed whitespace
nkoenig Oct 8, 2020
cc0780c
Merge branch 'playback_event_recorder' of github.com:osrf/subt into p…
nkoenig Oct 8, 2020
0eb7c51
Merged with citadel
nkoenig Oct 8, 2020
a6cdf10
tweak staging area camera pose
iche033 Oct 8, 2020
c087357
update rockfall camera pose
iche033 Oct 8, 2020
1f6a8dc
edit filename order
angelacmaio Oct 9, 2020
436fba0
rtf=1 in path tracer
angelacmaio Oct 9, 2020
64eb3c7
update timing
iche033 Oct 9, 2020
48c6b93
Merge branch 'playback_event_recorder' of github.com:osrf/subt into p…
iche033 Oct 9, 2020
7be59b4
bring back other events, merge seek begin and seek event states, adju…
iche033 Oct 9, 2020
03ddf4a
bring back artifact proximity events
iche033 Oct 13, 2020
612e32b
add detector name to event
iche033 Oct 13, 2020
e98d4b5
update scene init timing
iche033 Oct 13, 2020
bfd6df2
fix recording msg
iche033 Oct 13, 2020
73920b3
update filename
iche033 Oct 14, 2020
35acfe7
comment out gui section
iche033 Oct 14, 2020
2653caa
add region of interest events
iche033 Oct 15, 2020
c38abf4
fix msg
iche033 Oct 16, 2020
290075b
compare extra type when merging events
iche033 Oct 16, 2020
f6fb6a4
update scene broadcaster rate
iche033 Oct 17, 2020
f6138f6
wait until all robots are spawned before recording
iche033 Oct 17, 2020
93c93f0
revert playback hz change
iche033 Oct 17, 2020
997a743
append buffer time to the end
iche033 Oct 17, 2020
4cc98ea
sub to recorder stats msg to get better timing of video recording
iche033 Oct 21, 2020
d3f8f38
allow catchup on recording
iche033 Oct 24, 2020
08f1c38
update catch up time frame
iche033 Oct 24, 2020
df35512
update script path
iche033 Oct 26, 2020
a56cd9a
push back staging event
iche033 Oct 26, 2020
d4d6808
fix rockfall pose
iche033 Oct 28, 2020
f038a2e
add README.md
iche033 Nov 3, 2020
2f817c9
Merge branch 'citadel' into playback_event_recorder
Dec 10, 2020
1be9229
Migrating improvements from cave circuit analysis
Dec 10, 2020
03e1a44
Merge branch 'edifice' into playback_event_recorder_nate
Dec 10, 2020
3e0f5a5
Fix build
Dec 10, 2020
bf7703b
Documentation
Dec 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions subt_example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ add_executable(teleop_node src/teleop_node.cc)
add_dependencies(teleop_node ${catkin_EXPORTED_TARGETS})
target_link_libraries(teleop_node ${catkin_LIBRARIES})

# add_subdirectory(src/truth_controller)


###########
## Tests ##
Expand Down
31 changes: 30 additions & 1 deletion subt_ign/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ target_link_libraries(
add_executable(validate_visibility_table
src/validate_visibility_table.cc)
target_link_libraries(validate_visibility_table
PRIVATE
PRIVATE
Visibility
)
install(TARGETS validate_visibility_table
Expand Down Expand Up @@ -343,6 +343,35 @@ install(TARGETS ${gas_emitter_detector_plugin_name}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})

# Create the libPlaybackEventRecorder.so library.
set(playback_event_recorder_name PlaybackEventRecorder)
add_library(${playback_event_recorder_name} SHARED
src/PlaybackEventRecorder.cc
src/PlaybackEventRecorder.cc
)

target_include_directories(${playback_event_recorder_name}
PRIVATE
${CATKIN_DEVEL_PREFIX}/include)
target_link_libraries(${playback_event_recorder_name}
PRIVATE
ignition-gazebo${IGN_GAZEBO_VER}::core
ignition-common3::ignition-common3
ignition-launch2::ignition-launch2
ignition-math6::ignition-math6
ignition-msgs5::ignition-msgs5
ignition-plugin1::loader
ignition-transport8::ignition-transport8
sdformat9::sdformat9
${catkin_LIBRARIES}
${YAML_CPP_LIBRARIES}
)

install(TARGETS ${playback_event_recorder_name}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})

# Create log_checker executable.
add_executable(log_checker src/LogChecker.cc)
target_link_libraries(log_checker
Expand Down
3 changes: 3 additions & 0 deletions subt_ign/launch/path_tracer.ign
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
<% elsif $worldName.include?('urban_circuit_') &&
!$worldName.include?('practice') %>
<world_file>urban_circuit/<%= worldNumber %>/<%= $worldName %>.sdf</world_file>
<% elsif $worldName.include?('cave_circuit_') &&
!$worldName.include?('practice') %>
<world_file>cave_circuit/<%= worldNumber %>/<%= $worldName %>.sdf</world_file>
<% else %>
<world_file><%= $worldName %>.sdf</world_file>
<% end %>
Expand Down
104 changes: 104 additions & 0 deletions subt_ign/scripts/playback_event_recorder/playback_event_recorder.sdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<?xml version='1.0'?>
<!--
Playback event recorder.

This world is used by the record_playback_events.bash script.
Videos will be saved to a timestamped directory inside the directory
where the bash script is run.

To set whether or not the gui camera should follow the entity
during video recording, change the <camera_follow> sdf parameter in the
PlaybackEventRecorder plugin to either true or false.

Usage: bash record_playback_events.bash <path_to_log_dir>
-->

<sdf version='1.6'>

<world name='default'>
<gui fullscreen="0">
<!-- 3D scene -->
<plugin filename="GzScene3D" name="3D View">
<ignition-gui>
<title>3D View</title>
<property type="bool" key="showTitleBar">false</property>
<property type="string" key="state">docked</property>
</ignition-gui>
<engine>ogre2</engine>
<scene>scene</scene>
<ambient_light>0.4 0.4 0.4</ambient_light>
<background_color>0.8 0.8 0.8</background_color>
<camera_pose>6 0 6 0 0.5 3.14</camera_pose>
</plugin>

<!-- Play / pause / step -->
<plugin filename="WorldControl" name="World control">
<ignition-gui>
<title>World control</title>
<property type="bool" key="showTitleBar">false</property>
<property type="bool" key="resizable">false</property>
<property type="double" key="height">72</property>
<property type="double" key="width">121</property>
<property type="double" key="z">1</property>

<property type="string" key="state">floating</property>
<anchors target="3D View">
<line own="left" target="left"/>
<line own="bottom" target="bottom"/>
</anchors>
</ignition-gui>

<play_pause>true</play_pause>
<step>true</step>
<start_paused>true</start_paused>
</plugin>

<!-- Time / RTF -->
<plugin filename="WorldStats" name="World stats">
<ignition-gui>
<title>World stats</title>
<property type="bool" key="showTitleBar">false</property>
<property type="bool" key="resizable">false</property>
<property type="double" key="height">110</property>
<property type="double" key="width">290</property>
<property type="double" key="z">1</property>

<property type="string" key="state">floating</property>
<anchors target="3D View">
<line own="right" target="right"/>
<line own="bottom" target="bottom"/>
</anchors>
</ignition-gui>

<sim_time>true</sim_time>
<real_time>true</real_time>
<real_time_factor>true</real_time_factor>
<iterations>true</iterations>
</plugin>
</gui>

<plugin filename='ignition-gazebo-scene-broadcaster-system'
name='ignition::gazebo::systems::SceneBroadcaster'>
</plugin>
<plugin
filename='ignition-gazebo-log-system'
name='ignition::gazebo::systems::LogPlayback'>
<path>tmp_record</path>
</plugin>

<plugin
filename="ignition-gazebo-user-commands-system"
name="ignition::gazebo::systems::UserCommands">
</plugin>

<plugin
filename="libPlaybackEventRecorder.so"
name="subt::PlaybackEventRecorder">
<log_path>tmp_record</log_path>
<exit_on_finish>true</exit_on_finish>
<spawn_light>true</spawn_light>
</plugin>

</world>
</sdf>

Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash

# The playback event recorder creates videos for events that are stored
# in the events.yml log file in the state log directory. The script launches
# ign gazebo in playback mode and creates videos using the gui camera video
# recording feature. For each event, it seeks playback to some time before the
# event, moves the camera to the desired location, and starts recording until
# some time after the event.

echo "==================================="
echo "Staring Playback Event Recorder"
echo "==================================="

if [ -z "$1" ]; then
echo "Usage: bash ./record_playback_events.bash [path_to_log_dir]"
exit 0
fi

logDirPath=$1

if [ ! -d "$logDirPath" ]; then
echo "Directory does not exist: $logDirPath"
exit 0
fi

scriptDir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
tmpDir="$scriptDir/tmp_record"

echo "Creating tmp dir for recording: $tmpDir"

if [ -d "$tmpDir" ]; then
rm -fr $tmpDir
fi

ln -s $logDirPath $tmpDir

echo "Starting log playback and video recording"

export IGN_GAZEBO_SYSTEM_PLUGIN_PATH=$LD_LIBRARY_PATH
sdfName="playback_event_recorder"
ign gazebo -v 4 $sdfName.sdf

echo "Video recording ended. Shutting down playback"

pgrep -f $sdfName | xargs kill -9 &> /dev/null

videoDir=$(date +%s)
echo "Moving mp4 videos to dir: $videoDir"
mkdir $videoDir
mv *.mp4 $videoDir

# remove tmp dir
if [ -d "$tmpDir" ]; then
rm -fr $tmpDir
fi
echo "Done"

Loading