zoukankan      html  css  js  c++  java
  • 实操 | std_msgs/Empty and std_srv_msgs/Empty

    It is interesting and aslo necessary to disscuss about the two types in ROS, std_msgs/Empty and std_srv_msgs/Empty.

    The two message type are indicating there are nothing to transmit but a trigger signal.

    In a Publisher / Subscriber use case, std_msgs/Empty could be useful when we only want to trigger an event.

    For example,

    in C++:

    #include <std_msgs/Empty.h>
    
    int main(int argc, char **argv){
    
        init(argc, argv, "takeoff_fly");
        Nodehandle n;
        std_msg::Empty myMsg;
        Publisher takeOff=n.advertise<std_msgs::Empty>("/ardrone/takeoff",1);
        takeOff.publish(myMsg);
        spinOnce();
    
        return 0;
    }

    in Python:

    from std_msgs.msg import Empty as EmptyMsg
    takeOff = rospy.Publisher('/ardrone/takeoff', EmptyMsg, queue_size=1)

    ...

  • 相关阅读:
    jq insertBefore 的返回值
    微信公众号-定位之地址逆解析&导航
    微信JS-SDK
    Vue
    ES6-函数的扩展
    ES6-数组的扩展
    JSP
    JS
    HTML+CSS
    jdbc操作数据库
  • 原文地址:https://www.cnblogs.com/casperwin/p/8339363.html
Copyright © 2011-2022 走看看