版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Gazebo机器人仿真学习探索笔 记(六)工具和实用程序Gazebo機器人仿真學習探索筆記(六) 工具和实用程序Gazebo附带了许多工具和实用程序。这些教程 说明了这些可用的工具,以及如何使用它们。 主要有:1记录和播放2日志过滤3应用力/扭矩4 HDF5数据集官网介绍通俗具体,非常容易,请参考附件。附件-官方教程Loggi ng and playbackOverviewThis tutorial explains how to use the Gazebo logging capabilities to record your simulation and then reproduce i
2、t afterwards, using either the GUI or the comma nd line.Gazebo log filesGazebo log files are compressedog files which contain an initial full description of the whole world, followed by a series of world states.The in itial descripti on contains complete in formati on about everyth ing in the world,
3、 from the sce ne to the en tities prese nt.After that, every time something changes in simulati on, a new world state is recorded. World states are much simpler, as they only contain in formati on about what cha nged, such as:Simulation statistics such as the current simulation time and the number o
4、f physics iterati ons.Curre nt state of each model in the sce ne, as well as the state of each link and joint in the model. This in cludes in formati on such as in sta ntan eous pose, velocity, accelerati on and forces.Curre nt pose of each light in the world.Tip: You can find the whole spec for the
5、 world state here.In this tutorial we will record a few log files and then take a peek in side them at the end.Record a logLoggi ng from the GUIStart your simulation. Here, as an example, we have a simple world with a double pen dulum.Click on the logging icon on the top right, or hit Ctrl+D to brin
6、g up the Data Logger.You can choose the directory where your log file will be saved by click ing the Browse butt on. By default, log files Go to the /.gazebo/log directory .In this example, we will save it in the /logs/double_pe ndulum/ directory.Click on the red butt on to start recordi ng. You sho
7、uld see the number of bytes in your log file in creas ing on the right.Note: For efficiency, only models and lights which move over time are logged. If your sce ne is static, the n umber of bytes in your log file will not in crease. This also means that the n umber of samples in your log file may be
8、 different from the nu mber of iterati ons in simulati on.Click on the red butt on aga in to stop loggi ng.Expand Recordings to see the path to the state.log file which was gen erated. It will be in side a time-stamped directory.Loggi ng from the comma nd lineFrom the comma nd lin e, it is possible
9、to log the whole simulation from the moment Gazebo starts running un til it stops, or to trigger loggi ng from an arbitary time.Loggi ng the whole simulati onAs an example, you can record therandom_velocity.world as follows: gazebo -r -record_path /logs/random_velocity worlds/ra ndom_velocity.worldY
10、ou can see a list of all of the available logging opti ons by running gazebo -help.-p -play arg: Play a log file.-r -record : Record a log from the momentGazebo is opened until it is closed.-record_encoding arg: Compression encoding format for log data. The options are zlib (default), bz2 and txt.Th
11、e log file will only be terminated when Gazebo is closed. You can check the file was created by look ing into the path give n:$ ls /logs/ra ndom_velocity/state.logLoggi ng part of the simulati onGazebo also provides the gz log tool, which can be used to trigger loggi ng at any mome nt. While Gazebo
12、is running, open another terminal and run the followi ng to start record ing:gz log -d 1And to stop:gz log -d 0Check out gz log -help for other opti ons.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 poss
13、ible to open a log file from the GUI, so playback must be started from the comma nd li ne. Simply start Gazebo using the -p opti on to specify a log file, such as the one we recorded earlier:gazebo-u-p/logs/double_pe ndulum/2016-01-25T15:09:49. 677400/gzserver/state.logTip: The -u opti on starts the
14、 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 begi nning / end of the file.Use Step back / Step forward to skip samples. The number of samples skipped each time you pr
15、ess a step butt on can be cha nged in the box below. Samples might be any number of iterati ons and sec onds apart.Drag the current time marker and drop it to skip through the log.In put a curre nt time on the right to skip to that sample.Comma nd line toolsAs mentioned above, the gz log tool provid
16、es 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 recorded file, like this:gzlog-s-f/logs/double_pe ndulum/2016-01-25T15:09:49. 677400/gz
17、server/state.logYoull see the full initial SDF representation of the world, something like this:v?xml versio n=1.0?1.0vgazebo_versi on 7.0.0pre1 1062221443 38000000069 651000000v/headerchu nk en codi ng=txtx!CDATAvworld n ame=default()()(.)(.) v/sdfx/chu nk -Press space to continue, q to quit -As yo
18、u press space, you will step through the subseque nt states. Youll note that the states are more compact and only contain information about what has cha nged in the world. Heres an example of a state: chu nk en codi ng=txtx!CDATA43 38000000043 478499228 1453763389 677873530 433801.140-1.074-0.0000.0
19、00-0.0000.0001.000 1.000 1.0001.13998 -1.07367 -0.00000 0.000000.00000-0.00042v/pose-0.0000 0.0000 -0.0005 0.0004 0.00300.0001v/velocityx/|i nkv|i nkname=lower_li nkxpose1.38969-1.798151.41059-2.453510.00000-0.00042v/pose0.0042 -0.2557 0.2659 1.9694 0.00480.0001v/velocityx/li nkxli nkname=upper_li n
20、kvpose1.13999-1.073672.100002.33144-0.00000-0.000420.0063 -0.0008 -0.0005 -0.3739 0.00320.00010.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 v/pose0.0000 0.0000 0.0000 0.0000 -0.0000 0.0000 x/ch unk-Press space to continue, q to quit -Note that
21、 theres no information for the sun orthe gro un d_pla ne, since they are not mov ing.Log filteri ngIn troductio nState 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
22、 information for models that change over time. A state log file contains a header, the initial world descripti on, and a time series of state.Gazebo Log Comma nd line toolGazebo ships with a logging utility that is accessed via the gz log comma nd.View the help information using:gz help log or gz lo
23、g -hExample UsageTip: Check out the tutorial on logging and playback for an overview 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 comma nd
24、 line opti ongzserver -r worlds/pr2.worldAfter a few sec on ds, stop the server using 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/2013-07-25T07:29:05.122275/gzse rver/state.logYou can verify this log file
25、 by replaying it in Gazebo.gazebo -p /.gazebo/log/*/gzserver/state.logStep 2: Filter a state log fileThe gz log comma nd line tool provides mecha ni sms for stepp ing through a log file and echo ing the contents of a log file to scree n. The echo to screen feature can be combined with a filter to pr
26、oduce a log file that contains specific information such as just the pose of models and lin ks.Try echoing the recorded state log file to screen.gz log -e -f /.gazebo/log/*/gzserver/stateog You should see a lot of in formati on scroll by.Now lets remove all velocity, acceleration, and force informat
27、ion from the log file. This willleave just pose information.gz log -e -f /.gazebo/log/*/gzserver/stateog -filter *.pose/*.poseThe -filter opti on is a flexible comma nd line argume nt to extract in formati on from a log file.It is also possible to filter based on simulation time using a Hz filter. F
28、or example, we can output state information at 30 Hz using:gz log -e -f /.gazebo/log/*/gzserver/state.log -z 30These filters can be comb ined and piped to a file for playback. This may take some time depe nding on the size of the stateog.gz log -e -f /.gazebo/log/*/gzserver/state.log -z 30 -filter *
29、.pose/*.pose /tmp/filtered_stateog This log file can the n be replayed in Gazebo gazebo -p /tmp/filtered_stateog Appl ying Force/TorqueIn troductio nThis tutorial will explain how to apply force and/or torque to models during simulation using the graphical user in terface.Appl ying force and torque
30、examplesLets 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 sce ne. The n, from the top toolbar, i nsert a box. Make sure the simulati on is not paused.Apply force to a linkWe want to apply force to a specific li
31、nk 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 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 slightl
32、y. The force was applied in the lin ks Y directi on for a sin gle time-step, which is in the order of millisec on ds, thus the n eed 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 p
33、ress ApplyTorque a few times to see the arm rotate slightly.Apply force with an offsetNow lets apply force to the box. Right-click the box in the sce ne 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 i
34、n the Y field until it reaches 1 m, youll see the arrow mwww.sha nxiwa ng.n etovi ng as you do it. Press Enter a few times to and the box will rotate. Hold En ter to repeatedly apply the force and make the box spin faster.The in terface expla inedNote: If you apply force an d/or torque while the sim
35、ulation is paused, they will accumulate and be applied all at once when the simulation is unpaused.ForceX, Y, Z: Each field specifies how much force will be applied on that directi on. The frame is fixed to the link.Mag: The total magnitude of the force which will be applied, which is the Euclidea n
36、 norm of the 3 forces above. Changing the magnitude cha nges the XYZ fieldsproportio nally,mai ntai ning the force directi on.Clear: Press ing this butt on will zero the X, Y, Z and Mag fields.Applicati on point: By default, force is applied to the lin ks cen ter of mass. Here you can edit the X, Y
37、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 fields with its coord inates.Tip: Right-click the model and choose View - Center of mass to see its position. You might want to also make the model tran
38、 spare nt 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 millisec on ds, so relatively large forces are n eeded in order to apply a sig nifica nt impulse.TorqueX, Y, Z: Each field specifies how much torque will be applied abou
39、t that axis. The frame is fixed to the link.Mag: The total magnitude of the torque which will be applied, which is the Euclidea n norm of the 3 torques above. Changing the magnitude cha ngesthe XYZ fields proportio nally,mai ntai ning the torque directi on.Clear: Press ing this butt on will zero the
40、 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 millisec on ds, so relatively large torques are needed in order to apply a sig nifica nt an gular impulse.Note: Torque is always applied about the cen ter of mass
41、.Apply AllForce and torque are applied at the same time, i.e. apply a wren ch. Hold en ter or click it repeatedly to apply multiple times.Rotati on toolThe arrows directions will always match the directions specified in the dialog. From the dialog, the directi on can be cha nged by edit ing the nu m
42、bers on the XYZ fields. From the sce ne, the directi on can be cha nged by draggi ng 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 no rmally.In strume nt HDF5 DatasetsIn troductio nIn strume nt tools are provided to dump physical data into HDF5 format. The datasets, together with the Benchmark Problems for Multibody Dynamis (BPMD) framework are used to compare differe nt methods in solv i
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 译林版英语三年级下册Unit4 第2课时 Story time分层作业(有答案)
- 2025 八年级道德与法治下册法治与人工智能伦理规范课件
- 旅游景区服务规范与质量提升指南
- 烟草制品生产线操作手册
- 金融资产评估操作指南
- 健康养生行业服务规范与操作流程
- 汽车美容维修服务流程规范
- 旅行社服务操作标准
- 电力设备运行与故障排除指南
- 企业安全防护与应急管理指南
- 锰及化合物职业健康安全防护须知
- 2026年北京市房山区公安招聘辅警考试试题及答案
- 生死观与死亡教育
- 中建物资管理手册
- 嘉里大通物流公司员工行为规范指南
- 2025及未来5年中国橡胶膏剂市场调查、数据监测研究报告
- 快易冷储罐知识培训课件
- 新能源材料与器件制备技术 课件 第5章 锂离子电池正极材料
- 消防监控证试题及答案
- LY-T 3398-2024 草原等级评定技术规程
- 棋牌室转让合同协议书
评论
0/150
提交评论