Gazebo機器人仿真學習探索筆記(六)工具和實用程序
《Gazebo機器人仿真學習探索筆記(六)工具和實用程序》由會員分享,可在線閱讀,更多相關《Gazebo機器人仿真學習探索筆記(六)工具和實用程序(28頁珍藏版)》請在裝配圖網(wǎng)上搜索。
1、Gazebo機器人仿真學習探索筆 記(六)工具和實用程序 Gazebo檄器人仿真擘曾探索肇IB (六) 工具和實用程序 Gazebo附帶了許多工具和實用程序。這些教程 說明了這些可用的工具,以及如何使用它們。 主要有: 1記錄和播放 2日志過濾 3應用力/扭矩 4 HDF5數(shù)據(jù)集 官網(wǎng)介紹通俗具體,非常容易,請參考附件。 附件-官方教程 Logging and playback Overview This tutorial explains how to use the Gazebo logging capabilities to record your simul
2、ation and then reproduce it afterwards, using either the GUI or the command line. Gazebo log files Gazebo log files are compressed Jog files which contain an initial full description of the whole world, followed by a series of nworld states0. The initial description contains complete information
3、 about everything in the world, from the scene to the entities present After that, every time something changes in simulation, a new world state is recorded. World states are much simpler, as they only contain information about what changed, such as: Simulation statistics such as the current simul
4、ation time and the number of physics iterations. Current state of each model in the scene, as well as the state of each link and joint in the model. This includes information such as instantaneous pose, velocity, acceleration and forces. Current pose of each light in the world. Tip: You can find
5、the whole spec for the world state here. In this tutorial we will record a few log files and then take a peek inside them at the end. Record a log Logging from the GUI Start your simulation. Here, as an example, we have a simple world with a double pendulum. Click on the logging icon on the top
6、 right, or hit Ctrl+D to bring up the Data Logger. You can choose the directory where your log file will be saved by clicking the Browse button. By default, log files Go to the -/.gazebo/log directory. In this example, we will save it in the -/logs/double_pendulum/ directory. Click on the red
7、 button to start recording. You should see the number of bytes in your log file increasing on the right. Note: For efficiency, only models and lights which move over time are logged. If your scene is static, the number of bytes in your log file will not increase. This also means that the number of
8、samples in your log file may be different from the number of iterations in simulation. Click on the red button again to stop logging. Expand Recordings to see the path to the state.log file which was generated. It will be inside a time-stamped directory. Logging from the command line From th
9、e command line, it is possible to log the whole simulation from the moment Gazebo starts running until it stops, or to trigger logging from an arbitary time. Logging the whole simulation As an example, you can record the random_velocity.world as follows: gazebo -r -record_path -/logs/random_veloc
10、ity worlds/random_velocity. world You can see a list of all of the available logging options by running gazebo -help. -p [—play] arg: Play a log file. -r [ -record ]: Record a log from the moment Gazebo is opened until it is closed. -record_encoding arg: Compression encoding format for log data
11、. The options are zlib (default), bz2 and txt. The log file will only be terminated when Gazebo is closed. You can check the file was created by looking into the path given: $ Is -/logs/random_velocity/ state.log Logging part of the simulation Gazebo also provides the gz log tool, which can be
12、used to trigger logging at any moment. While Gazebo is running, open another terminal and run the following to start recording: gz log -d 1 And to stop: gz log -d 0 Check out gz log -help for other options. Play back a log file Once you have a log file, you can replay it visually or introspect
13、 it in several ways. Visualize in GUI Currently, it is not possible to open a log file from the GUI, so playback must be started from the command line. Simply start Gazebo using the -p option to specify a log file, such as the one we recorded earlier: gazebo -u -p -/logs/double_pendulum/2016-01-
14、25T15\:09\:49. 677400/gzserver/state.log Tip: The -u option starts the log paused. Gazebo will open in playback mode. You can play, pause, rewind and step through the playback. Use Play / Pause to stop the playback. Use Rewind / Forward to skip to the beginning / end of the file. Use Step back
15、/ Step forward to skip samples. The number of samples skipped each time you press a step button can be changed in the box below. Samples might be any number of iterations and seconds apart. Drag the current time marker and drop it to skip through the log. Input a current time on the right to skip
16、to that sample. Command line tools As mentioned above, the gz log tool provides several options for introspecting your log file. Check out this tutorial for log filtering, for example. Here, lets quickly go over how you would take a look at the recorded states. Well use -s to step through a reco
17、rded file, like this:
gz log -s -f
-/logs/double_pendulum/2016-01-25T15\:09\:49. 677400/gzserver/state.log
Youll see the full initial SDF representation of the world, something like this:
18、azebo_version>
19、e1 >
(...)
20、hat has changed in the world. Heres an example of a state: 21、del
name= double_pendulum_with_base > 22、ink,xpose>1.38969 -1.79815 1.41059 -2.45351 0.00000 -0.00042
0.0042 -0.2557 0.2659 1.9694
0.0048 0.0001 23、nk> 24、unk> ■" Press space to continue, fqf to quit ■一
Note that there *s no information for the sun or
the ground_plane, since they are not moving.
Log filtering
Introduction
State logs are recordings of world state information from Gazebo. State includes pose, velocity, acceleration, and forces appl 25、ied to all links of all models. Gazebo will only record state information for models that change over time. A state log file contains a header, the initial world description, and a time series of state.
Gazebo Log Command line tool
Gazebo ships with a logging utility that is accessed via the gz lo 26、g command.
View the help information using:
gz help log or
gz log -h
Example Usage
Tip: Check out the tutorial on logging and playback for an overview of ways to record a log-
Step 1: Create a state log file
Start by removing old log files
rm -rf -/.gazebo/log/*
We will use the PR2 world to 27、 create a state log file.
Start by running the Gazebo server with the -r command line option
gzserver -r worlds/pr2.world
After a few seconds, stop the server using ctrl-c.
A new time stamped directory should exist in -Agazebo/log with one subdirectory and a state.log file. Here is an example
? 28、/?gazebo/log/2013?07?25T07\:29\:05.122275/gzse rver/state.log
You can verify this log file by replaying it in Gazebo.
gazebo -p -Agazebo/log/^/gzserver/state.log
Step 2: Filter a state log file
The gz log command line tool provides mechanisms for stepping through a log file and echoing the conte 29、nts of a log file to screen. The echo to screen feature can be combined with a filter to produce a log file that contains specific information such as just the pose of models and links.
Try echoing the recorded state log file to screen.
gz log -e -f -/.gazebo/log/*/gzserver/state.log You should se 30、e a lot of information scroll by.
Now lefs remove all velocity, acceleration, and force information from the log file. This will
leave just pose information.
gz log -e -f -Agazebo/log/*/gzserver/state.log
-filter *.pose/*.pose
The -filter option is a flexible command line argument to extract in 31、formation from a log file.
It is also possible to filter based on simulation time using a Hz filter. For example, we can output state information at 30 Hz using:
gz log -e -f -Agazebo/log/^/gzserver/state.log -z 30
These filters can be combined and piped to a file for playback. This may take some 32、 time depending on the size of the state.log.
gz log -e -f -Agazebo/log/*/gzserver/state.log -z 30 -filter *.pose/*.pose > /tmp/filtered_state.log This log file can then be replayed in Gazebo gazebo -p /tmp/filtered_state.log
Applying Force/Torque
Introduction
This tutorial will explain how to a 33、pply force and/or torque to models during simulation using the graphical user interface.
Applying force and torque examples
Lets go through an example of applying force and torque to simple models. Open Gazebo and from the insert tab, insert a Simple Arm into the scene. Then, from the top toolbar, 34、 insert a box. Make sure the simulation is not paused.
Apply force to a link
We want to apply force to a specific link in the
Simple Arm model. On the World tree, right-click arm_wrist_lift and choose Apply Force/Torque. A dialog will pop up and youTll see a straight arrow and a curved arrow 35、attach to the arm.
On the dialog, write 100 N on the Y field under Force and press Enter, the arm will start rotating slightly. The force was applied in the links Y direction for a single time-step, which is in the order of milliseconds, thus the need for such a large force.
Apply torque to a 36、link
On Apply to link, select arm_elbow_pan9 the arrows will move to this link. Under torque, write 100 Nm on the Z field and press Apply
Torque a few times to see the arm rotate slightly.
Apply force with an offset
Now lets apply force to the box. Right-click the box in the scene and choose 37、 Apply Force/Torque. A new dialog will pop up.
Under Force, type 1000 N on the X field. Then under Application point, press the up arrow in the Y field until it reaches 1 m, youll see the arrow oving as you do it. Press Enter a few times to and the box will rotate. Hold Enter to repeatedly apply th 38、e force and make the box spin fasten
The interface explained
Note: If you apply force and/or torque while the simulation is paused, they will accumulate and be applied all at once when the simulation is unpaused.
Force
X, Y, Z: Each field specifies how much force will be applied on that dire 39、ction. The frame is fixed to the link.
Mag: The total magnitude of the force which will be applied, which is the Euclidean norm of the 3 forces above. Changing the magnitude changes the XYZ fields proportionally, maintaining the force direction.
Clear: Pressing this button will zero the X, Y, Z an 40、d Mag 加Ids.
Application point: By default, force is applied to the links center of mass. Here you can edit the X, Y and Z fields to give the force an offset with respect to the links origin expressed in the links frame. Select Center of mass again to Oil the XYZ fields with its coordinates.
Tip: R 41、ight-click the model and choose View -> Center of mass to see its position. You might want to also make the model transparent for that.
Apply Force: Click this to apply only force for one time step. Keep in mind that time steps are in the order of milliseconds, so relatively large forces are needed 42、 in order to apply a signifleant impulse.
Torque
X, Y, Z: Each field specifies how much torque
will be applied about that axis. The frame is fixed to the link.
Mag: The total magnitude of the torque which will be applied, which is the Euclidean norm of the 3 torques above. Changing the magnitude 43、 changes the XYZ fields proportionally, maintaining the torque direction.
Clear: Pressing this button will zero the X, Y, Z and Mag 加Ids.
Apply Torque: Click this to apply only torque for one time step. Keep in mind that time steps are in the order of milliseconds, so relatively large torques are 44、needed in order to apply a significant angular impulse.
Note: Torque is always applied about the center of mass.
Apply All
Force and torque are applied at the same time,
i.e. apply a wrench. Hold enter or click it repeatedly to apply multiple times.
Rotation tool
The arrows directions will alw 45、ays match the directions specified in the dialog. From the dialog, the direction can be changed by editing the numbers on the XYZ fields. From the scene, the direction can be changed by dragging the pink circles around the arrows.
Tip: The pink circles are attached to the highlighted arrow. To rota 46、te the other arrow, first click it to attach the circles to it and then drag them normally.
Instrument HDF5 Datasets
Introduction
Instrument tools are provided to dump physical data into HDF5 format. The datasets, together with the Benchmark Problems for Multibody Dynamis (BPMD) framework are use 47、d to
compare different methods in solving multibody systems with bilateral joints and unilateral frictional contacts in an unbiased way. These datasets will help researchers to concentrate on analysis of existing methods and construction of more accurate solvers, without worrying about implementati 48、on of the whole physics engine.
Example Usage
Install hdf5
sudo apt-get install libhdf5-dev
Build Gazebo
This HDF5 instrument tool requires building Gazebo from source, with the cmake parameter HDF5_INSTRUMENT [default False] as True. Learn how to build Gazebo from source
cd -/gazebo
mkdir bu 49、ild
cd build
cmake -DHDF5_INSTRUMENT=True../
make -j4
sudo make install
Collect Datasets
Use only gzserver
./test/integration/INTEGRATION_physics_inert ia_ratio
Use the world file
gazebo -/gazebo/worlds/friction_demo.world
Then a file named ode_frames.hdf5 will be generated at the director 50、y exactly where the above command is run.
View the HDF5 file
hdfvivew is used to open the hdf5 files. You can install it via the terminal:
sudo apt-get install hdfview
Then open the stored file with: hdfview ode_frames.hdf5
A hierarchical file shows up:
Nofe: The instrument tool will save hier 51、archical
dafa for each time sfep? so it will be slow to write -he data info the ode—frames.hdf5 m9 Be pa-ienL especially for complex simulafion scenarios such as AUas robots or many body simulation.
手二總一 KW, TJ? 一 E常L v,il
-1 三三- 累 一 “蕤 一■ L kgs。
- 溫馨提示:
1: 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
2: 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
3.本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
5. 裝配圖網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 川渝旅游日記成都重慶城市介紹推薦景點美食推薦
- XX國有企業(yè)黨委書記個人述責述廉報告及2025年重點工作計劃
- 世界濕地日濕地的含義及價值
- 20XX年春節(jié)節(jié)后復工安全生產(chǎn)培訓人到場心到崗
- 大唐女子圖鑒唐朝服飾之美器物之美繪畫之美生活之美
- 節(jié)后開工第一課輕松掌握各要點節(jié)后常見的八大危險
- 廈門城市旅游介紹廈門景點介紹廈門美食展示
- 節(jié)后開工第一課復工復產(chǎn)十注意節(jié)后復工十檢查
- 傳統(tǒng)文化百善孝為先孝道培訓
- 深圳城市旅游介紹景點推薦美食探索
- 節(jié)后復工安全生產(chǎn)培訓勿忘安全本心人人講安全個個會應急
- 預防性維修管理
- 常見閥門類型及特點
- 設備預防性維修
- 2.乳化液泵工理論考試試題含答案