Exemplo n.º 1
0
    void Start()
    {
        foreach (TfFrame tfFrame in GetComponentsInChildren <TfFrame>())
        {
            tfFrameDict.Add(TfNamespace + tfFrame.ChildFrameId, tfFrame);
        }

        QualityOfServiceProfile qos = new QualityOfServiceProfile(QosProfiles.SENSOR_DATA);

        Subscription <tf2_msgs.msg.TFMessage> tfSubscription = node.CreateSubscription <tf2_msgs.msg.TFMessage>(
            "/tf", (msg) =>
        {
            UpdateTransforms(msg);
        },
            qos);

        Subscription <tf2_msgs.msg.TFMessage> tfStaticSubscription = node.CreateSubscription <tf2_msgs.msg.TFMessage>(
            "/tf_static", (msg) =>
        {
            UpdateTransforms(msg);
        }
            );
    }
Exemplo n.º 2
0
        public void SubscriptionQosSensorDataDepth()
        {
            int count = 0;
            QualityOfServiceProfile qosProfile = new QualityOfServiceProfile(QosProfiles.SENSOR_DATA);

            node.CreateSubscription <std_msgs.msg.Int32>("subscription_test_topic",
                                                         (msg) => { count += 1; },
                                                         qosProfile);

            std_msgs.msg.Int32 published_msg = new std_msgs.msg.Int32();
            published_msg.data = 42;

            for (int i = 0; i < 6; i++)
            {
                publisher.Publish(published_msg);
            }

            for (int i = 0; i < 11; i++)
            {
                Rclcs.SpinOnce(node, 0.1);
            }

            Assert.That(count, Is.EqualTo(5));
        }