예제 #1
0
        public void ReceiveTF_SingleMessage_ReturnsSameTranslation()
        {
            ROSConnection ros = ROSConnection.GetOrCreateInstance();

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

            TFSystem.TFTopicState topic = system.GetOrCreateTFTopic();
            TFStream stream             = system.GetOrCreateFrame(simple_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),
                                                                             simple_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);
        }
 public TFTopicState(string tfTopic = "/tf")
 {
     m_TFTopic = tfTopic;
     ROSConnection.GetOrCreateInstance().Subscribe <TFMessageMsg>(tfTopic, ReceiveTF);
 }
 void Start()
 {
     // start the ROS connection
     ros = ROSConnection.GetOrCreateInstance();
     ros.RegisterPublisher <PosRotMsg>(topicName);
 }
 void Start()
 {
     ros = ROSConnection.GetOrCreateInstance();
     ros.RegisterRosService <PositionServiceRequest, PositionServiceResponse>(serviceName);
     destination = cube.transform.position;
 }
        public PrefabVisual(string topic, GameObject prefab)
        {
            m_Prefab = prefab;

            ROSConnection.GetOrCreateInstance().Subscribe <PoseMsg>(topic, AddMessage);
        }
 void Start()
 {
     // Get ROS connection static instance
     m_Ros = ROSConnection.GetOrCreateInstance();
     m_Ros.Subscribe <RobotMoveActionGoal>(rosRobotCommandsTopicName, ExecuteRobotCommands);
 }
 public void SetUp()
 {
     m_Cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
     m_Ros  = ROSConnection.GetOrCreateInstance();
     m_Ros.listenForTFMessages = false;
 }
 // Start is called before the first frame update
 void Start()
 {
     ROSConnection.GetOrCreateInstance().Subscribe <RosTFMessage>("/tf", TFChange);
 }
예제 #9
0
 void Start()
 {
     // register the service with ROS
     ROSConnection.GetOrCreateInstance().ImplementService <ObjectPoseServiceRequest, ObjectPoseServiceResponse>(m_ServiceName, GetObjectPose);
 }
 // Start is called before the first frame update
 void Start()
 {
     ROSConnection.GetOrCreateInstance().Subscribe <RosOdom>("/odom", OdomChange);
 }
예제 #11
0
 void Start()
 {
     ROSConnection.GetOrCreateInstance().Subscribe <RosColor>("color", ColorChange);
 }