예제 #1
0
 public override void deserialize(MemoryStream stream, std_msgs.msg.Bool data)
 {
     using (BinaryReader reader = new BinaryReader(stream))
     {
         Halodi.CDR.CDRDeserializer cdr = new Halodi.CDR.CDRDeserializer(reader);
         read(data, cdr);
     }
 }
예제 #2
0
 public override void serialize(std_msgs.msg.Bool data, MemoryStream stream)
 {
     using (BinaryWriter writer = new BinaryWriter(stream))
     {
         Halodi.CDR.CDRSerializer cdr = new Halodi.CDR.CDRSerializer(writer);
         write(data, cdr);
     }
 }
예제 #3
0
 public void SetBoolData()
 {
     std_msgs.msg.Bool msg = new std_msgs.msg.Bool();
     Assert.That(msg.Data, Is.False);
     msg.Data = true;
     Assert.That(msg.Data, Is.True);
     msg.Data = false;
     Assert.That(msg.Data, Is.False);
 }
예제 #4
0
        public static int getCdrSerializedSize(std_msgs.msg.Bool data, int current_alignment)
        {
            int initial_alignment = current_alignment;

            current_alignment += 1 + Halodi.CDR.CDRCommon.alignment(current_alignment, 1);



            return(current_alignment - initial_alignment);
        }
예제 #5
0
        public static void InitPublisher(ref rcl_publisher_t publisher, ref rcl_node_t node, IntPtr publisherOptions)
        {
            RCLReturnEnum ret;

            publisher        = NativeMethods.rcl_get_zero_initialized_publisher();
            publisherOptions = NativeMethods.rclcs_publisher_create_default_options();
            IMessageInternals msg = new std_msgs.msg.Bool();
            IntPtr            typeSupportHandle = msg.TypeSupportHandle;

            ret = (RCLReturnEnum)NativeMethods.rcl_publisher_init(ref publisher, ref node, typeSupportHandle, "publisher_test_topic", publisherOptions);
        }
예제 #6
0
        public static void InitSubscription(ref rcl_subscription_t subscription, IntPtr subscriptionOptions, ref rcl_node_t node)
        {
            RCLReturnEnum ret;

            subscription        = NativeMethods.rcl_get_zero_initialized_subscription();
            subscriptionOptions = NativeMethods.rclcs_subscription_create_default_options();
            IMessageInternals msg = new std_msgs.msg.Bool();
            IntPtr            typeSupportHandle = msg.TypeSupportHandle;

            ret = (RCLReturnEnum)NativeMethods.rcl_subscription_init(ref subscription, ref node, typeSupportHandle, "/subscriber_test_topic", subscriptionOptions);
            Assert.That(ret, Is.EqualTo(RCLReturnEnum.RCL_RET_OK), Utils.PopRclErrorString());
        }
예제 #7
0
        public void PublisherPublish()
        {
            RCLReturnEnum   ret;
            rcl_publisher_t publisher        = new rcl_publisher_t();
            IntPtr          publisherOptions = new IntPtr();

            PublisherInitialize.InitPublisher(ref publisher, ref node, publisherOptions);
            IMessageInternals msg = new std_msgs.msg.Bool();

            ret = (RCLReturnEnum)NativeMethods.rcl_publish(ref publisher, msg.Handle);
            Assert.That(ret, Is.EqualTo(RCLReturnEnum.RCL_RET_OK), Utils.PopRclErrorString());
            PublisherInitialize.ShutdownPublisher(ref publisher, ref node, publisherOptions);
        }
예제 #8
0
        public void PublisherPublish()
        {
            RCLReturnEnum           ret;
            rcl_publisher_t         publisher        = NativeMethods.rcl_get_zero_initialized_publisher();
            rcl_publisher_options_t publisherOptions = NativeMethods.rcl_publisher_get_default_options();

            std_msgs.msg.Bool msg = new std_msgs.msg.Bool();
            IntPtr            typeSupportHandle = msg.TypeSupportHandle;

            ret = (RCLReturnEnum)NativeMethods.rcl_publisher_init(ref publisher, ref node, typeSupportHandle, "/publisher_test_topic", ref publisherOptions);
            ret = (RCLReturnEnum)NativeMethods.rcl_publish(ref publisher, msg.Handle);
            Assert.That(ret, Is.EqualTo(RCLReturnEnum.RCL_RET_OK), Utils.PopRclErrorString());
            ret = (RCLReturnEnum)NativeMethods.rcl_publisher_fini(ref publisher, ref node);
            Assert.That(ret, Is.EqualTo(RCLReturnEnum.RCL_RET_OK), Utils.PopRclErrorString());
        }
예제 #9
0
        public void SetSubscriptionQosProfile()
        {
            rcl_subscription_t subscription        = NativeMethods.rcl_get_zero_initialized_subscription();
            IntPtr             subscriptionOptions = NativeMethods.rclcs_subscription_create_default_options();

            NativeMethods.rclcs_subscription_set_qos_profile(subscriptionOptions, 0);

            IMessageInternals msg = new std_msgs.msg.Bool();
            IntPtr            typeSupportHandle = msg.TypeSupportHandle;

            NativeMethods.rcl_subscription_init(ref subscription, ref node, typeSupportHandle, "/subscriber_test_topic", subscriptionOptions);

            Assert.That(NativeMethods.rcl_subscription_is_valid(ref subscription), Is.True);

            NativeMethods.rcl_subscription_fini(ref subscription, ref node);
            NativeMethods.rclcs_subscription_dispose_options(subscriptionOptions);
        }
예제 #10
0
        public void SetBoolData()
        {
            var msg     = new std_msgs.msg.Bool();
            var msgCopy = new std_msgs.msg.Bool();

            msg.ReadNativeMessage();
            Assert.That(msg.Data, Is.False);

            msg.Data = true;
            msg.WriteNativeMessage();
            msgCopy.ReadNativeMessage(msg.Handle);
            Assert.That(msgCopy.Data, Is.True);

            msg.Data = false;
            msg.WriteNativeMessage();
            msgCopy.ReadNativeMessage(msg.Handle);
            Assert.That(msgCopy.Data, Is.False);
        }
예제 #11
0
 public void CreateMessage()
 {
     std_msgs.msg.Bool msg = new std_msgs.msg.Bool();
 }
예제 #12
0
 public static void Copy(std_msgs.msg.Bool src, std_msgs.msg.Bool target)
 {
     target.Set(src);
 }
예제 #13
0
 public static void read(std_msgs.msg.Bool data, Halodi.CDR.CDRDeserializer cdr)
 {
     data.data = cdr.read_type_7();
 }
예제 #14
0
 public static void write(std_msgs.msg.Bool data, Halodi.CDR.CDRSerializer cdr)
 {
     cdr.write_type_7(data.data);
 }
예제 #15
0
 public static int getCdrSerializedSize(std_msgs.msg.Bool data)
 {
     return(getCdrSerializedSize(data, 0));
 }