void Update() { if (Joint != null) { jointPosition += Time.deltaTime * JointVelocity; jointStateMsg.position = new List <double> { jointPosition }; publisher.Publish(jointStateMsg); } }
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); } }
void Update() { poseWithCovarianceStampedMessage.header.Update(clock); if (UseLocalTransform) { poseWithCovarianceStampedMessage.pose.pose.LocalUnity2Ros(transform); } else { poseWithCovarianceStampedMessage.pose.pose.Unity2Ros(transform); } publisher.Publish(poseWithCovarianceStampedMessage); }
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); } }
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); }