




已阅读5页,还剩6页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Gazebo機器人仿真學習探索筆記(六)工具和实用程序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 .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 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 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. 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 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 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 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 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:gz log -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:1.07.0.0pre11062221443 38000000069 651000000!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 38000000043 4784992281453763389 677873530433801.140 -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 -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 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 logorgz 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 /.gazebo/log with one subdirectory and a state.log file. Here is an example/.gazebo/log/2013-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 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.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/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/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 /.gazebo/log/*/gzserver/state.log -z 30 -filter *.pose/*.pose /tmp/filtered_state.logThis log file can then be replayed in Gazebogazebo -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 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 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_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 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 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 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 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 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 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. Changing 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 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 (
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 通信费补贴管理办法
- 社区棋牌室节假日顾客满意度调查方案
- 贵州丰收奖管理办法
- 纪律审查组管理办法
- 资产建账管理暂行办法
- 个性化医疗设备制造2025年3D打印技术应用前景深度剖析
- 工业企业安全培训讲义课件
- 光伏电站逆变器选型与配置方案
- 安全培训管理条例课件
- 建筑垃圾处理设备维护管理方案
- Unit1Developingideaslittlewhitelies课件-高中英语外研版必修第三册
- 培训反馈意见表
- 四年级上册心理健康教育课件-健康的情绪表达 全国通用(共16张PPT)
- 商业银行资产管理与负债管理
- 电力系统分析孙淑琴案例吉玲power程序实验指导书
- 集成电路版图设计(适合微电子专业)
- 高标准农田建设项目施工组织设计 (5)
- 发动机装调工技师考试资料
- 轻型动力触探试验记录表
- ASME_B36.10M美标钢管外径壁厚对照表
- 桌牌桌签模板正反桌牌会议室三字两字桌牌word版
评论
0/150
提交评论