## page was renamed from hokuyo_node/Tutorials/UsingDynparamWithTheHokuyoLaser ## page was renamed from hokuyo_node/Tutorials/UsingDynparam ## 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= [[ja/hokuyo_node/Tutorials/UsingTheHokuyoNode|How to use Hokuyo laser scanners with the hokuyo_node]] ## note.1= [[ja/hokuyo_node/Tutorials/UsingReconfigureGUIToChangeHokuyoLaserParameters|How to dynamically reconfigure the hokuyo_node using reconfigure_gui]] ## descriptive title for the tutorial ## title = コマンドラインかコードからどのようにしてhokuyo_nodeを動的に再設定を行うか。 ## multi-line description to be displayed in search ## description = このチュートリアルを終えると、コマンドラインかコードからhokuyo_nodeのパラメータを再設定できるようになるでしょう。 ## 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 = reconfigure, Hokuyo, parameters, laser driver, laser, laser scanner, laser scan #################################### ## laser, parameters, laser parameters, laser, param, laser configuration, reconfigure laser, tilt scan, base scan <<IncludeCSTemplate(TutorialCSHeaderTemplate)>> <<TableOfContents(4)>> === コンパイル === 依存関係を取得し、dynamic_reconfigureをコンパイルすることから始める。 {{{ $ rosdep install dynamic_reconfigure $ rosmake dynamic_reconfigure }}} === コマンドラインからdynamic_reconfigure === 以下の実行によって、コマンドラインからdynamic_reconfigureを呼び出すことでhokuyo_nodeを再設定することができます。: {{{ rosrun dynamic_reconfigure dynparam set /<node_name> <param> <value> }}} 例えば、もし、nodeが{{{hokuyo_node}}}と呼ばれて、パラメータが{{{min_ang}}}であるなら、呼び出し方は以下のようになります。: {{{ rosrun dynamic_reconfigure dynparam set /hokuyo_node min_ang -1.0 }}} [[hokuyo_node|hokuyo_node]]のパラメータで試してみください。 パラメータをセットしたことによる結果を見ることができます。 [[rviz]]で[[laser_pipeline/Tutorials/IntroductionToWorkingWithLaserScannerData|レーザスキャンを可視化する]]. <<Anchor(LaunchFile)>> === dynparamをlaunchファイルから使う === launchファイルからすでに実行されているnodeのパラメータをset_from_parameterコマンドをdynparamと使うことでセットすることが可能です。 例えば、hokuyoのスキャン範囲をセットするときは、以下のlaunchファイルを使うことができます。: {{{ <launch> <node name="$(anon dynparam)" pkg="dynamic_reconfigure" type="dynparam" args="set_from_parameters hokuyo_node"> <param name="min_ang" type="double" value="-1.0" /> <param name="max_ang" type="double" value="1.0" /> </node> </launch> }}} <<Anchor(PythonAPI)>> === Pythonのコードからdynamic_reconfigureを使う === 以下をインポートすることで、Pythonのスクリプトからhokuyo_nodeのパラメータを変えることもできます。: {{{ import dynamic_reconfigure.client }}} 以下ののnodeを作成し、 {{{ rospy.init_node('myconfig_py', anonymous=True) }}} クライアントのインスタンスを作成します。({{{node_to_reconfigure}}}は、再設定するnodeの名前を入れます。ここでは'hokuyo_node'を入れたりするということです。) {{{ client = dynamic_reconfigure.client.Client(<node_to_reconfigure>) }}} そしたら、変更を行いたいパラメータの辞書式配列と渡し、update_configurationを呼びます: {{{ params = { 'my_string_parameter' : 'value', 'my_int_parameter' : 5 } config = client.update_configuration(params) }}} 上記のconfig変数はパラメータのアップデート後に、nodeのすべての設定を持ちます。 === C++のコードからdynparamを使う === まだ、実装されていません。`system`を現在を使用してください。例えば、以下を呼び出すと、narrow stereo camera がテクスチャイメージを生産するように変更します。: {{{ system("rosrun dynamic_reconfigure dynparam set_from_parameters camera_synchronizer_node narrow_stereo_trig_mode 3"); }}} ## AUTOGENERATED DO NOT DELETE ## TutorialCategory ## LaserDriverCategory ## DynamicReconfigureCategory ## DriverCommonCategory