コード例 #1
0
        public void ReceiveTF_FrameWithParent_ReturnsSameTranslation()
        {
            ROSConnection ros = ROSConnection.GetOrCreateInstance();

            ros.ConnectOnStart = false;
            TFSystem system = TFSystem.GetOrCreateInstance();

            TFSystem.TFTopicState topic = system.GetOrCreateTFTopic();
            TFStream stream             = system.GetOrCreateFrame(composite_frame_id);

            Assert.AreEqual(stream.Name, simple_frame_id);
            Assert.AreEqual(stream.Parent.Name, parent_frame_id);
            TimeMsg time          = MakeTimeMsg(4567, 890);
            Vector3 unityPosition = new Vector3(1, 2, 3);

            topic.ReceiveTF(new TFMessageMsg(new TransformStampedMsg[] { new TransformStampedMsg(
                                                                             MakeHeaderMsg(time, parent_frame_id),
                                                                             composite_frame_id,
                                                                             new TransformMsg(unityPosition.To <FLU>(), new QuaternionMsg()
                                                                                              )) }));

            TFFrame frame = stream.GetWorldTF(time.ToLongTime());

            Assert.AreEqual(frame.translation.x, unityPosition.x);
            Assert.AreEqual(frame.translation.y, unityPosition.y);
            Assert.AreEqual(frame.translation.z, unityPosition.z);
            Vector3 gameObjectPos = stream.GameObject.transform.position;

            Assert.AreEqual(gameObjectPos.x, unityPosition.x);
            Assert.AreEqual(gameObjectPos.y, unityPosition.y);
            Assert.AreEqual(gameObjectPos.z, unityPosition.z);
        }
コード例 #2
0
 public TFFrame GetWorldTF(TimeMsg time)
 {
     return(GetWorldTF(time.ToLongTime()));
 }
コード例 #3
0
 public TFFrame GetTransform(string frame_id, TimeMsg time, string tfTopic = "/tf")
 {
     return(GetTransform(frame_id, time.ToLongTime(), tfTopic));
 }
コード例 #4
0
 public TFFrame GetLocalTF(TimeMsg time)
 {
     return(GetLocalTF(time.ToLongTime()));
 }