コード例 #1
0
ファイル: JointSpinner.cs プロジェクト: b2220333/unity_ros2
 void Update()
 {
     if (Joint != null)
     {
         jointPosition         += Time.deltaTime * JointVelocity;
         jointStateMsg.position = new List <double> {
             jointPosition
         };
         publisher.Publish(jointStateMsg);
     }
 }
コード例 #2
0
 new void FixedUpdate()
 {
     if (lastPublishTime.Delay(1.0f / PublisherFrequency).IsInThePast)
     {
         lastPublishTime = clock.Now;
         Vector3 unityPosition = Quaternion.Inverse(ParentFrame.rotation) * (ChildFrame.position - ParentFrame.position);
         message.pose.position.Unity2Ros(unityPosition);
         //TODO(sam): Figure out why z is y in numpy quaternion
         message.pose.orientation.Unity2Ros(Quaternion.Inverse(ParentFrame.rotation) * ChildFrame.rotation);
         message.header.Update(clock);
         publisher.Publish(message);
     }
 }
コード例 #3
0
    void Update()
    {
        poseWithCovarianceStampedMessage.header.Update(clock);
        if (UseLocalTransform)
        {
            poseWithCovarianceStampedMessage.pose.pose.LocalUnity2Ros(transform);
        }
        else
        {
            poseWithCovarianceStampedMessage.pose.pose.Unity2Ros(transform);
        }

        publisher.Publish(poseWithCovarianceStampedMessage);
    }
コード例 #4
0
    new void FixedUpdate()
    {
        robotPose.pose.LocalUnity2Ros(BaseRigidbody.transform);
        robotTwist.twist.Unity2Ros(BaseRigidbody);

        odometryMsg.header.Update(clock);
        odometryPublisher.Publish(odometryMsg);

        if (PublishTf)
        {
            tfTransformStamped.header.Update(clock);
            tfTransformStamped.header.PostDate(tfPostDateMilliseconds);
            tfTransformStamped.transform.LocalUnity2Ros(BaseRigidbody.transform);
            tfPublisher.Publish(tfMsg);
        }
    }
コード例 #5
0
    void Update()
    {
        List <string> jointNames     = new List <string>();
        List <double> jointPositions = new List <double>();
        List <double> jointVelocity  = new List <double>();
        List <double> jointEffort    = new List <double>();

        foreach (JointInterface jointInterface in GetComponentsInChildren <JointInterface>())
        {
            jointNames.Add(jointInterface.JointName);
            jointPositions.Add(jointInterface.Position);
            jointVelocity.Add(jointInterface.Velocity);
            jointEffort.Add(jointInterface.Effort);
        }

        jointStateMsg.name     = jointNames;
        jointStateMsg.position = jointPositions;
        jointStateMsg.velocity = jointVelocity;
        jointStateMsg.effort   = jointEffort;

        jointStateMsg.header.Update(clock);
        jointStatePublisher.Publish(jointStateMsg);
    }