欢迎来到三一文库! | 帮助中心 三一文库31doc.com 一个上传文档投稿赚钱的网站
三一文库
全部分类
  • 研究报告>
  • 工作总结>
  • 合同范本>
  • 心得体会>
  • 工作报告>
  • 党团相关>
  • 幼儿/小学教育>
  • 高等教育>
  • 经济/贸易/财会>
  • 建筑/环境>
  • 金融/证券>
  • 医学/心理学>
  • ImageVerifierCode 换一换
    首页 三一文库 > 资源分类 > DOCX文档下载  

    Gazebo机器人仿真学习探索笔记(六)工具和实用程序.docx

    • 资源ID:11699848       资源大小:254.47KB        全文页数:28页
    • 资源格式: DOCX        下载积分:6
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录 QQ登录   微博登录  
    二维码
    微信扫一扫登录
    下载资源需要6
    邮箱/手机:
    温馨提示:
    用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP免费专享
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    Gazebo机器人仿真学习探索笔记(六)工具和实用程序.docx

    Gazebo机器人仿真学习探索笔 记(六)工具和实用程序Gazebo檄器人仿真擘曾探索肇IB (六)工具和实用程序Gazebo附带了许多工具和实用程序。这些教程说明了这些可用的工具,以及如何使用它们。主要有:1记录和播放2日志过滤3应用力/扭矩4 HDF5数据集官网介绍通俗具体,非常容易,请参考附件。附件-官方教程Logging and playbackOverviewThis tutorial explains how to use the Gazebo logging capabilities to record your simulation and then reproduce it afterwards, using either the GUI or the command line.Gazebo log filesGazebo log files are compressed Jog files which contain an initial full description of the wholeworld, followed by a series of nworld states0.The initial description contains complete information about everything in the world, from the scene to the entities presentAfter 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 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 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 where your log file will be saved by clicking the Browse button. Bydefault, 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 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 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 lineFrom the 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 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 -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.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.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 1And 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. 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-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 playback.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 seconds 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 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_pendulum/2016-01-25T15:09:49. 677400/gzserver/state.logYoull see the full initial SDF representation of the world, something like this:<?xml version=,1.0,?><gazebo_log><header><log_version>1.0</log_version><gazebo_version>7.0.0-prel</gazebo_version><rand_seed>10622214</rand_seed><log_start>43 380000000</log_start><log_end>69 651000000</log_end></header><chunk encoding=1 txt1 ><! CDATA <sdf version =,1.6,><world name=,defaults(.)<light name=,sun, type=fdirectionalf>(.)</light><model name=1 ground_plane1 >(.)</model><modelname= double_pendulum_with_base >(.)</model> </world></sdf>></chunk>一 Press space to continue, Tq* 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: <chunk encoding=1 txt1 ><! CDATA<sdf version=,1.6,><state world_name=T default1 ><sim_time>43 380000000</sim_time><real_time>43 478499228</real_time><wall_time>1453763389 677873530</wall_time><iterations>43380</iterations><modelname= double_pendulum_with_base ><pose> 1.140-1.074-0.0000.000-0.0000.000</posexscale>1.000 1.000 1.000</scalexlink name=f base * ><pose>1.13998 -1.07367 -0.00000 0.000000.00000-0.00042</posexvelocity>-0.0000 0.0000 -0.0005 0.00040.00300.0001 </velocityx/linkxlinkname=,lower_link,xpose>1.38969 -1.79815 1.41059-2.453510.00000-0.00042</posexvelocity>0.0042 -0.2557 0.2659 1.96940.00480.0001 </velocity></linkxlinkname= upper_link ><pose>1.13999-1.073672.100002.33144-0.00000-0.00042</posexvelocity>0.0063 -0.0008 -0.0005 -0.3739 0.00320.0001</velocity></link></modelxmodelname=1 ground_plane1 ><pose>0.000 0.000 0.0000.000 -0.000 0.000 </posexscale>1.000 1.0001.000</scalexlink name=llmk,xpose>0.00000 0.00000 0.00000 0.00000 -0.00000 0.00000 </posexvelocity>0.0000 0.0000 0.0000 0.0000 -0.00000.0000 </velocity></link></model></state></sdf> ></chunk> " Press space to continue, fqf to quit 一Note that there *s no information for the sun orthe ground_plane, since they are 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 header, 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 log orgz log -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 command line optiongzserver -r worlds/pr2.worldAfter 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/gazebo/log/20130725T07:29:05.122275/gzse rver/state.logYou can verify this log file by replaying it in Gazebo.gazebo -p -Agazebo/log/gzserver/state.logStep 2: Filter a state 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.Try echoing the recorded state log file to screen.gz log -e -f -/.gazebo/log/*/gzserver/state.log You should see a lot of information scroll by.Now lefs remove all velocity, acceleration, and force information from the log file. This willleave just pose information.gz log -e -f -Agazebo/log/*/gzserver/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 -Agazebo/log/gzserver/state.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 -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.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 the 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 theSimple 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 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 linkOn 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 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 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 mwww.shanxiwang.netoving as you do it. Press Enter a few times to and the box will rotate. Hold Enter to repeatedly apply the force and make the box spin fastenThe 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 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 button will zero the X, Y, Z and 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: 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 relatively large forces are needed in order to apply a signifleant impulse.TorqueX, Y, Z: Each field specifies how much torquewill 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 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 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 will 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) framework are used tocompare 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 implementation of the whole physics engine.Example UsageInstall hdf5sudo apt-get install libhdf5-devBuild GazeboThis HDF5 instrument tool requires building Gazebo from source, with the cmake parameter HDF5_INSTRUMENT default False as True. Learn how to build Gazebo from sourcecd -/gazebomkdir buildcd buildcmake -DHDF5_INSTRUMENT=True./make -j4sudo make installCollect DatasetsUse only gzserver./test/integration/INTEGRATION_physics_inert ia_ratioUse the world filegazebo -/gazebo/worlds/friction_demo.worldThen a file named ode_frames.hdf5 will be generated at the directory exactly where the above command is run.View the HDF5 filehdfvivew is used to open the hdf5 files. You can install it via the terminal:sudo apt-get install hdfviewThen open the stored file with: hdfview ode_frames.hdf5A hierarchical file shows up:Nof

    注意事项

    本文(Gazebo机器人仿真学习探索笔记(六)工具和实用程序.docx)为本站会员(时光煮雨)主动上传,三一文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知三一文库(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    经营许可证编号:宁ICP备18001539号-1

    三一文库
    收起
    展开