玩命加载中 . . .

ROS参数服务器


YAML文件

joint1_gains: {p: 7.0, i: 8.0, d: 9.0}

源文件

#include <ros/ros.h>

int main(int argc, char** argv)
{
    ros::init(argc, argv, "read_param_node");
    ros::NodeHandle n;
    double P_gain, D_gain, I_gain;

    ROS_WARN("rosparam start");
    if (n.getParam("/gains/p", P_gain)) {
        ROS_WARN("proportional gain set to %f", P_gain);
    }
    else {
        ROS_WARN("Can't load param of P");
    }
    ros::spin()
    return 0;
}

launch文件

<launch>
    <rosparam command="load" file="$(find ros_learning)/param/gains.yaml"/>
    <node name="read_param_node" pkg="ros_learning" type="read_param_node" output="screen" />
</launch>

文章作者: kunpeng
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 kunpeng !
  目录