## page was renamed from stdr_simulator/Tutorials/Using YAML files ## For instruction on writing tutorials ## http://www.ros.org/wiki/WritingTutorials #################################### ##FILL ME IN #################################### ## for a custom note with links: ## note = ## for the canned note of "This tutorial assumes that you have completed the previous tutorials:" just add the links ## note.0= ## descriptive title for the tutorial ## title = Create resources using files ## multi-line description to be displayed in search ## description = How to create a robot using a Yaml or an XML file ## the next tutorial description (optional) ## next = ## links to next tutorial (optional) ## next.0.link= ## next.1.link= ## what level user is this tutorial for ## level= IntermediateCategory ## keywords = #################################### <<IncludeCSTemplate(TutorialCSHeaderTemplate)>> <<TOC(4)>> === Creating a laser sensor with an XML file === You can create a laser sensor in the following way (hokuyo.xml file): {{{ <laser> <laser_specifications> <max_range>4</max_range> <num_rays>270</num_rays> <pose> <x>0</x> <y>0</y> <theta>0</theta> </pose> <noise> <noise_specifications> <noise_mean>0</noise_mean> <noise_std>0.03</noise_std> </noise_specifications> </noise> </laser_specifications> </laser> }}} Of course, thanks to the recursive file parsing of [[stdr_parser|stdr_parser]] you can use the '''gauss_small.xml''' noise file, which exists in the [[stdr_resources|stdr_resources]] package: {{{ <laser> <laser_specifications> <max_range>4</max_range> <max_angle> <pose> <x>0</x> <y>0</y> <theta>0</theta> </pose> <noise> <filename>gauss_small.xml</filename> </noise> </laser_specifications> </laser> }}} === Creating a robot with the two laser sensors === In order to create a robot that employs two of the laser sensors that you build in the previous step, you can simply write the following XML file: {{{ <robot> <robot_specifications> <footprint> <radius>0.3</radius> </footprint> <laser> <filename>hokuyo.xml</filename> </laser> <laser> <filename>hokuyo.xml</filename> </laser> </robot_specifications> <robot> }}} The problem here is that the orientation of the two laser sensors will be the same, and specifically equal to 0, as stated in the '''hokuyo.xml''' resource file. In order to fix that, each value of an "internal" node, can be overriden in the following way: {{{ <robot> <robot_specifications> <footprint> <radius>0.3</radius> </footprint> <laser> <filename>hokuyo.xml</filename> <laser_specifications> <pose> <theta>1.57</theta> </pose> </laser_specifications> </laser> <laser> <filename>hokuyo.xml</filename> <laser_specifications> <pose> <theta>-1.57</theta> </pose> </laser_specifications> </laser> </robot_specifications> <robot> }}} In that way the orientations of the LRFs are changed. In a similar way we can alterate the number of rays or the maximum distance of the second LRF: {{{ <robot> <robot_specifications> <footprint> <radius>0.3</radius> </footprint> <laser> <filename>hokuyo.xml</filename> <laser_specifications> <pose> <theta>1.57</theta> </pose> </laser_specifications> </laser> <laser> <filename>hokuyo.xml</filename> <laser_specifications> <pose> <theta>-1.57</theta> </pose> <max_range>10</max_range> <num_rays>180</num_rays> </laser_specifications> </laser> </robot_specifications> <robot> }}} ## AUTOGENERATED DO NOT DELETE ## TutorialCategory ## FILL IN THE STACK TUTORIAL CATEGORY HERE