




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、Gazebo機(jī)器人仿真學(xué)習(xí)摸索筆記(六)工具和實(shí)用程序Gazebo附帶了許多工具和實(shí)用程序。 這些教程闡明了這些可用旳工具,以及如何使用它們。重要有:1 記錄和播放2 日記過濾3 應(yīng)用力/扭矩4 HDF5數(shù)據(jù)集官網(wǎng)簡(jiǎn)介通俗具體,非常容易,請(qǐng)參照附件。附件-官方教程Logging and playbackOverviewThis tutorial explains how to use the Gazebo logging capabilities to record your simulation and then reproduce it afterwards, using either t
2、he GUI or the command line.Gazebo log filesGazebo log files are compressed .log files which contain an initial full description of the whole world, followed by a series of world states.The initial description contains complete information about everything in the world, from the scene to the entities
3、 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 simulation time and the number of physics iterations.Current state of
4、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 the whole spec for the world state here.In this tutorial we will record
5、 a few log files and then take a peek inside them at the end.Record a logLogging from the GUIStart your simulation. Here, as an example, we have a simple world with a double pendulum.Click on the logging icon on the top right, or hit Ctrl+D to bring up the Data Logger.You can choose the directory wh
6、ere 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 button to start recording. You should see the number of bytes in your log file increasing o
7、n 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 samples in your log file may be different from the number of iterations in simulation.Click on
8、 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 lineFrom the command line, it is possible to log the whole simulation from the moment Gazebo starts running until it
9、stops, or to trigger logging from an arbitary time.Logging the whole simulationAs an example, you can record the random_velocity.world as follows:gazebo -r -record_path /logs/random_velocity worlds/random_velocity.worldYou can see a list of all of the available logging options by running gazebo -hel
10、p.-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. The options are zlib (default), bz2 and txt.The log file will only be terminated when Gazebo is closed. You can check the file
11、 was created by looking into the path given:$ ls /logs/random_velocity/state.logLogging part of the simulationGazebo also provides the gz log tool, which can be used to trigger logging at any moment. While Gazebo is running, open another terminal and run the following to start recording:gz log -d 1A
12、nd to stop:gz log -d 0Check out gz log -help for other options.Play back a log fileOnce you have a log file, you can replay it visually or introspect it in several ways.Visualize in GUICurrently, it is not possible to open a log file from the GUI, so playback must be started from the command line. S
13、imply start Gazebo using the -p option to specify a log file, such as the one we recorded earlier:gazebo -u -p /logs/double_pendulum/-01-25T15:09:49.677400/gzserver/state.logTip: The -u option starts the log paused.Gazebo will open in playback mode. You can play, pause, rewind and step through the p
14、layback.Use Play / Pause to stop the playback.Use Rewind / Forward to skip to the beginning / end of the file.Use Step back / 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 s
15、econds apart.Drag the current time marker and drop it to skip through the log.Input a current time on the right to skip to that sample.Command line toolsAs mentioned above, the gz log tool provides several options for introspecting your log file. Check out this tutorial for log filtering, for exampl
16、e.Here, lets quickly go over how you would take a look at the recorded states.Well use -s to step through a recorded file, like this:gz log -s -f /logs/double_pendulum/-01-25T15:09:49.677400/gzserver/state.logYoull see the full initial SDF representation of the world, something like this:1.07.0.0pre
17、11062221443 69 !CDATA (.) (.) (.) (.) - Press space to continue, q to quit -As you press space, you will step through the subsequent states. Youll note that the states are more compact and only contain information about what has changed in the world. Heres an example of a state:!CDATA43 43 433801.14
18、0 -1.074 -0.000 0.000 -0.000 0.000 1.000 1.000 1.0001.13998 -1.07367 -0.00000 0.00000 0.00000 -0.00042 -0.0000 0.0000 -0.0005 0.0004 0.0030 0.0001 1.38969 -1.79815 1.41059 -2.45351 0.00000 -0.00042 0.0042 -0.2557 0.2659 1.9694 0.0048 0.0001 1.13999 -1.07367 2.10000 2.33144 -0.00000 -0.00042 0.0063 -
19、0.0008 -0.0005 -0.3739 0.0032 0.0001 0.000 0.000 0.000 0.000 -0.000 0.000 1.000 1.000 1.0000.00000 0.00000 0.00000 0.00000 -0.00000 0.00000 0.0000 0.0000 0.0000 0.0000 -0.0000 0.0000 - Press space to continue, q to quit -Note that theres no information for the sun or the ground_plane, since they are
20、 not moving.Log filteringIntroductionState logs are recordings of world state information from Gazebo. State includes pose, velocity, acceleration, and forces applied to all links of all models. Gazebo will only record state information for models that change over time. A state log file contains a h
21、eader, the initial world description, and a time series of state.Gazebo Log Command line toolGazebo ships with a logging utility that is accessed via the gz log command.View the help information using:gz help logorgz log -hExample UsageTip: Check out the tutorial on logging and playback for an overv
22、iew of ways to record a log.Step 1: Create a state log fileStart by removing old log filesrm -rf /.gazebo/log/*We will use the PR2 world to create a state log file.Start by running the Gazebo server with the -r command line optiongzserver -r worlds/pr2.worldAfter a few seconds, stop the server using
23、 ctrl-c.A new time stamped directory should exist in /.gazebo/log with one subdirectory and a state.log file. Here is an example/.gazebo/log/-07-25T07:29:05.122275/gzserver/state.logYou can verify this log file by replaying it in Gazebo.gazebo -p /.gazebo/log/*/gzserver/state.logStep 2: Filter a sta
24、te log fileThe gz log command line tool provides mechanisms for stepping through a log file and echoing the contents 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.Tr
25、y echoing the recorded state log file to screen.gz log -e -f /.gazebo/log/*/gzserver/state.logYou should see a lot of information scroll by.Now lets remove all velocity, acceleration, and force information from the log file. This will leave just pose information.gz log -e -f /.gazebo/log/*/gzserver/
26、state.log -filter *.pose/*.poseThe -filter option is a flexible command line argument to extract information 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 /.gazebo/log/*/gzserver/stat
27、e.log -z 30These filters can be combined and piped to a file for playback. This may take some time depending on the size of the state.log.gz log -e -f /.gazebo/log/*/gzserver/state.log -z 30 -filter *.pose/*.pose /tmp/filtered_state.logThis log file can then be replayed in Gazebogazebo -p /tmp/filte
28、red_state.logApplying Force/TorqueIntroductionThis tutorial will explain how to apply force and/or torque to models during simulation using the graphical user interface.Applying force and torque examplesLets go through an example of applying force and torque to simple models. Open Gazebo and from th
29、e insert tab, insert a Simple Arm into the scene. Then, from the top toolbar, insert a box. Make sure the simulation is not paused.Apply force to a linkWe 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 di
30、alog will pop up and youll see a straight arrow and a curved arrow 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 millisecon
31、ds, thus the need for such a large force.Apply torque to a linkOn Apply to link, select arm_elbow_pan, 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 offsetNow lets apply force to the
32、box. Right-click the box in the scene and choose 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
33、will rotate. Hold Enter to repeatedly apply the force and make the box spin faster.The interface explainedNote: 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.ForceX, Y, Z: Each field specifies how much
34、 force will be applied on that direction. 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
35、button will zero the X, Y, Z and Mag fields.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 fill the XYZ fiel
36、ds with its coordinates.Tip: Right-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 relativ
37、ely large forces are needed in order to apply a significant impulse.TorqueX, 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. Ch
38、anging the magnitude changes the XYZ fields proportionally, maintaining the torque direction.Clear: Pressing this button will zero the X, Y, Z and Mag fields.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
39、large torques are needed in order to apply a significant angular impulse.Note: Torque is always applied about the center of mass.Apply AllForce and torque are applied at the same time, i.e. apply a wrench. Hold enter or click it repeatedly to apply multiple times.Rotation toolThe arrows directions w
40、ill always 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 rotate the other arrow, first click it to attach the circles to it and then drag them normally.Instrument HDF5 DatasetsIntroductionInstrument tools are provided to dump physical data into HDF5 format. The datasets, together with the Benchmark Problems for Multibody Dynamis (BPMD) fra
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 8 大自然謝謝您 教學(xué)設(shè)計(jì)-2023-2024學(xué)年道德與法治一年級(jí)下冊(cè)統(tǒng)編版
- 生命生態(tài)安全教案家庭樹
- 商場(chǎng)場(chǎng)地出租協(xié)議8篇
- 一年級(jí)語文上冊(cè) 第一單元 識(shí)字(一)3 口耳目教學(xué)設(shè)計(jì) 新人教版
- Module5 Unit1 How many?(教學(xué)設(shè)計(jì))-2024-2025學(xué)年外研版(三起)英語三年級(jí)上冊(cè)
- 七年級(jí)語文上冊(cè) 第二單元 綜合性學(xué)習(xí) 有朋自遠(yuǎn)方來教學(xué)設(shè)計(jì) 新人教版
- 超輕黏土培訓(xùn)
- 2023八年級(jí)數(shù)學(xué)上冊(cè) 第十五章 分式15.2 分式的運(yùn)算15.2.1 分式的乘除第2課時(shí) 分式的乘除混合運(yùn)算與分式的乘方教學(xué)設(shè)計(jì)(新版)新人教版
- 2024-2025學(xué)年高中物理 第二章 力 第六節(jié) 力的分解教學(xué)設(shè)計(jì) 教科版必修1
- Unit7 study skills教學(xué)設(shè)計(jì)-2023-2024學(xué)年牛津譯林版七年級(jí)英語下冊(cè)
- 6.3.1 平面向量基本定理 課件(共15張PPT)
- 安全安全檢查表分析(SCL)記錄表(設(shè)備、設(shè)施)
- 城市濕地公園設(shè)計(jì)導(dǎo)則2017
- 小學(xué)巡課記錄表
- 社會(huì)團(tuán)體民辦非清算審計(jì)報(bào)告模板
- 消防管道隱蔽工程驗(yàn)收?qǐng)?bào)審表(表格記錄)
- 地質(zhì)災(zāi)害群測(cè)群防講義
- 高頻變壓器標(biāo)準(zhǔn)工時(shí)對(duì)照表
- 建筑工程質(zhì)量檢測(cè)收費(fèi)項(xiàng)目及標(biāo)準(zhǔn)表67262
- 232425黃昆固體物理教案
- 金蝶資產(chǎn)負(fù)債表公式設(shè)置
評(píng)論
0/150
提交評(píng)論