PoseInterpolator.h
Go to the documentation of this file.
// This file is a part of the OpenSurgSim project.
// Copyright 2013-2015, SimQuest Solutions Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SURGSIM_BLOCKS_POSEINTERPOLATOR_H
#define SURGSIM_BLOCKS_POSEINTERPOLATOR_H
#include <memory>
#include <string>
#include "SurgSim/DataStructures/OptionalValue.h"
#include "SurgSim/Framework/Behavior.h"
#include "SurgSim/Math/RigidTransform.h"
namespace SurgSim
{
namespace Framework
{
class SceneElement;
}
}
namespace SurgSim
{
namespace Blocks
{
class PoseInterpolator : public SurgSim::Framework::Behavior
{
public:
explicit PoseInterpolator(const std::string& name);
void setStartingPose(const SurgSim::Math::RigidTransform3d& transform);
void setEndingPose(const SurgSim::Math::RigidTransform3d& transform);
void setTarget(std::shared_ptr<SurgSim::Framework::SceneElement> target);
void setDuration(double t);
double getDuration() const;
void setLoop(bool val);
bool isLoop() const;
void setPingPong(bool val);
bool isPingPong() const;
void update(double dt) override;
private:
SurgSim::DataStructures::OptionalValue<SurgSim::Math::RigidTransform3d> m_optionalStartPose;
SurgSim::Math::RigidTransform3d m_startingPose;
SurgSim::Math::RigidTransform3d m_endingPose;
std::shared_ptr<SurgSim::Framework::SceneElement> m_target;
double m_duration;
double m_currentTime;
bool m_pingpong;
bool m_loop;
bool doWakeUp() override;
bool doInitialize() override;
void doRetire() override;
};
}; // Blocks
}; // Surgsim
#endif
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Blocks::PoseInterpolator::m_loop
bool m_loop
Whether to loop.
Definition: PoseInterpolator.h:113
SurgSim::Blocks::PoseInterpolator::m_optionalStartPose
SurgSim::DataStructures::OptionalValue< SurgSim::Math::RigidTransform3d > m_optionalStartPose
Optional value to take the from rigid transform.
Definition: PoseInterpolator.h:92
SurgSim::DataStructures::OptionalValue< SurgSim::Math::RigidTransform3d >
Behavior.h
SurgSim::Blocks::PoseInterpolator::m_startingPose
SurgSim::Math::RigidTransform3d m_startingPose
Target of the interpolation.
Definition: PoseInterpolator.h:95
SurgSim::Blocks::PoseInterpolator::m_pingpong
bool m_pingpong
Whether to pingpong.
Definition: PoseInterpolator.h:110
RigidTransform.h
Definitions of 2x2 and 3x3 rigid (isometric) transforms.
SurgSim::Blocks::PoseInterpolator::m_target
std::shared_ptr< SurgSim::Framework::SceneElement > m_target
Target for the interpolated RigidTransform.
Definition: PoseInterpolator.h:101
SurgSim::Math::RigidTransform3d
Eigen::Transform< double, 3, Eigen::Isometry > RigidTransform3d
A 3D rigid (isometric) transform, represented as doubles.
Definition: RigidTransform.h:46
SurgSim::Blocks::PoseInterpolator::m_endingPose
SurgSim::Math::RigidTransform3d m_endingPose
Start of the interpolation.
Definition: PoseInterpolator.h:98
SurgSim::Framework::Behavior
Behaviors perform actions.
Definition: Behavior.h:40
OptionalValue.h
SurgSim::Blocks::PoseInterpolator
Perform linear interpolation on two poses.
Definition: PoseInterpolator.h:41
SurgSim::Blocks::PoseInterpolator::m_duration
double m_duration
Duration of the interpolation.
Definition: PoseInterpolator.h:104
SurgSim::Blocks::PoseInterpolator::m_currentTime
double m_currentTime
How far through the interpolation we are.
Definition: PoseInterpolator.h:107