gazebosim / gazebo-classic

Gazebo classic. For the latest version, see https://github.com/gazebosim/gz-sim
http://classic.gazebosim.org/
Other
1.19k stars 480 forks source link

Record utility fails to capture velocity, acceleration, wrench #3144

Open shonigmann opened 2 years ago

shonigmann commented 2 years ago

I'm trying to record logs of simulations to be able to automatically extract model dynamics for monte-carlo type simulations. The log utility seems perfect for this case, as it can be started with gzserver and run for a given number of iterations... however, I cannot for the life of me replicate the results demonstrated in the Gazebo Log Filtering and Logging Playback tutorials, which state and show that you can record pose, velocity, acceleration, and wrench data for links in the simulation. Inspecting the generated log files, I notice that only pose data is captured. Filtering explicitly for the other terms shows that they are 0 for each log update.

OS: Ubuntu 20.04 Gazebo version: 11.9.0

Steps to reproduce:

# remove existing logs
rm -rf ~/.gazebo/log/*  

# run cart_demo world; note the debug info shows non-zero velocities
gzserver -r worlds/cart_demo.world --verbose  

#kill after a few seconds of data have been collected

# echo log file, filtering for velocity
gz log -e -f ~/.gazebo/log/*/gzserver/state.log --filter */*.velocity -z 10

Expected output: non-zero velocity logged for each link

Actual output:

<chunk encoding='txt'><![CDATA[
<sdf version='1.7'>
<state world_name='default'>
<sim_time>1 224000000</sim_time>
<real_time>1 279422157</real_time>
<wall_time>1638826147 920945581</wall_time>
<iterations>1224</iterations>
<model name='ground_plane'>
<link name='link'>
<velocity>0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000</velocity>
</link>
</model>
<model name='test_model'>
<link name='bar_1'>
<velocity>0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000</velocity>
</link>
<link name='bar_2'>
<velocity>0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000</velocity>
</link>
<link name='bar_3'>
<velocity>0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000</velocity>
</link>
<link name='cylinder_link'>
<velocity>0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000</velocity>
</link>
<link name='link'>
<velocity>0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000</velocity>
</link>
<link name='sphere_link'>
<velocity>0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000</velocity>
</link>
<link name='wheel_1'>
<velocity>0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000</velocity>
</link>
...
HKenta commented 2 years ago

Hi,

I use gazebo9, but I'm also faced this trouble. Did you solve this, or get any information?

shonigmann commented 2 years ago

for my purposes, I ended up writing a plugin that wrote data to a .csv file using the Gazebo Physics Link API

You can find it here, if it's helpful: https://github.com/shonigmann/gazebo_plugins/blob/main/src/gazebo_log_state.cpp

HKenta commented 2 years ago

Thank you for replying. It seems helpful, I'll check it.