示例#1
0
        public void TestTransformStampedMessage()
        {
            Assert.True(BuiltIns.GetMessageType <MyTransformStamped>() == MyTransformStamped.RosMessageType);
            Assert.True(BuiltIns.GetMd5Sum <MyTransformStamped>() == BuiltIns.GetMd5Sum <TransformStamped>());

            time             now  = time.Now();
            TransformStamped real = new TransformStamped()
            {
                Header       = new Header(1, now, "Frame"),
                ChildFrameId = "Abcd",
                Transform    = Transform.Identity
            };

            MyTransformStamped wrapped = new MyTransformStamped()
            {
                Header       = new Header(1, now, "Frame"),
                ChildFrameId = "Abcd",
                Transform    = Transform.Identity
            };

            byte[] messageBytes      = real.SerializeToArray();
            byte[] otherMessageBytes = wrapped.SerializeToArray();

            Assert.True(messageBytes.SequenceEqual(otherMessageBytes));

            var otherWrapped = wrapped.DeserializeFromArray(messageBytes);

            Assert.True(wrapped.Header == real.Header);
            Assert.True(wrapped.ChildFrameId == real.ChildFrameId);
            Assert.True(wrapped.Transform == real.Transform);
        }
示例#2
0
 public ServiceInfo(string callerId, string service, T?generator = default)
     : this(
         callerId, service,
         BuiltIns.GetMd5Sum <T>(),
         BuiltIns.GetServiceType <T>(),
         generator
         )
 {
 }
示例#3
0
 public TopicInfo(string callerId, string topic, IDeserializable <T> generator)
     : this(
         BuiltIns.DecompressDependencies(generator.GetType()),
         callerId, topic,
         BuiltIns.GetMd5Sum(generator.GetType()),
         BuiltIns.GetMessageType(generator.GetType()),
         generator
         )
 {
 }
示例#4
0
 public TopicInfo(string callerId, string topic)
     : this(
         BuiltIns.DecompressDependencies <T>(),
         callerId, topic,
         BuiltIns.GetMd5Sum <T>(),
         BuiltIns.GetMessageType <T>(),
         null
         )
 {
 }
示例#5
0
        public void TestInteractiveMarkerMessage()
        {
            Assert.True(BuiltIns.GetMessageType(typeof(MyInteractiveMarker)) == MyInteractiveMarker.RosMessageType);
            Console.WriteLine(MyInteractiveMarker.RosDefinition);
            Assert.True(
                BuiltIns.GetMd5Sum(typeof(MyInteractiveMarker)) == BuiltIns.GetMd5Sum(typeof(InteractiveMarker)));

            time now  = time.Now();
            var  real = new InteractiveMarker()
            {
                Pose        = Pose.Identity,
                Name        = "Abcd",
                Description = "Efgh",
                MenuEntries = new MenuEntry[] { new(), new() },