9 #include "imstkDeviceClient.h" 10 #include "imstkPbdObject.h" 11 #include "imstkPbdObjectGrasping.h" 12 #include "imstkSurfaceMesh.h" 14 #include <unordered_map> 43 void cleanUp() =
delete;
58 double startTime = 0.0;
59 double duration = 0.0;
71 Vec3d startPosition = Vec3d::Zero();
72 Vec3d stopPosition = Vec3d::Zero();
83 Vec3d startPosition = Vec3d::Zero();
84 Vec3d centerPosition = Vec3d::Zero();
98 std::shared_ptr<PbdObjectGrasping> objectGrasping;
99 std::shared_ptr<PbdObject> tool;
110 std::shared_ptr<PbdObject> object;
111 Vec3d translation = Vec3d::Zero();
112 std::vector<bool> pin{
true,
true,
true };
113 std::vector<int> vertexIds;
114 std::vector<Vec3d> currPos;
125 std::shared_ptr<PbdObject> object;
126 Mat3d defGrad = Mat3d::Identity();
128 double strainRate = 0.0;
129 double poissons = 0.49;
130 std::vector<bool> pin{
true,
true,
true };
131 std::vector<int> vertexIds;
155 std::shared_ptr<PbdObject> object;
156 std::vector<int> vertexIds;
157 std::vector<Vec3d> holdPosition;
164 double m_currentTime = 0.0;
165 bool m_complete =
false;
166 std::vector<Command*> m_commands;
187 bool addLinearMovement(Vec3d startPos, Vec3d stopPos,
double startTime,
double duration);
196 bool addCircularMovement(Vec3d startPos, Vec3d centerPos,
double startTime,
double duration);
205 bool addGrasping(std::shared_ptr<PbdObject> tool, std::shared_ptr<PbdObjectGrasping> objectGrasping,
double startTime,
double duration);
216 bool addLinearVertexMovement(std::shared_ptr<PbdObject>
object, std::vector<int> vertexIds, Vec3d translation, std::vector<bool> pin,
double startTime,
double duration);
229 bool addDeformation(std::shared_ptr<PbdObject>
object, std::vector<int> initPos,
double strain,
DeformationType defType,
double poisson, std::vector<bool> pin,
double startTime,
double duration);
232 std::vector<int> findVertex(std::shared_ptr<PointSet> mesh, std::vector<Vec3d> initPos);
248 bool addHoldCommand(std::shared_ptr<PbdObject>
object,
double startTime,
double duration, std::vector<int> vertexIds);
The device client's represents the device and provides an interface to acquire data from a device...
~ProgrammableClient() override
Destructor.
Command for holding a subset of vertices at a specific position.
bool addGrasping(std::shared_ptr< PbdObject > tool, std::shared_ptr< PbdObjectGrasping > objectGrasping, double startTime, double duration)
Add a grasp command to run.
Command for linear movement of a subset of vertices from an object.
bool addHoldCommand(std::shared_ptr< PbdObject > object, double startTime, double duration, std::vector< int > vertexIds)
Add a hold command to run.
double getTotalDuration()
Returns to total duration of all commands.
bool addWaitCommand(double startTime, double duration)
Add a wait command to run.
bool addCircularMovement(Vec3d startPos, Vec3d centerPos, double startTime, double duration)
Add a circular movement command to run.
bool isFinished()
Returns true if all commands have finished executing. Returns false otherwise.
bool addLinearMovement(Vec3d startPos, Vec3d stopPos, double startTime, double duration)
Add a linear movement command to run.
DeformationType
Enum for type of deformation.
bool addDeformation(std::shared_ptr< PbdObject > object, std::vector< int > initPos, double strain, DeformationType defType, double poisson, std::vector< bool > pin, double startTime, double duration)
Add a defomation command to run.
Quatd m_orientation
Orientation of the end effector.
CommandState
Enum for current state of command.
Command for linear movement of an analytical geometry.
Command for waiting. Used to let system continue running with no active commands. ...
void setDeltaTime(double dt)
Set the dt of the system. Should be the same as the simulation dt.
ProgrammableClient(const std::string &name="")
Constructor.
bool addLinearVertexMovement(std::shared_ptr< PbdObject > object, std::vector< int > vertexIds, Vec3d translation, std::vector< bool > pin, double startTime, double duration)
Add a linear vertex movement command to run.
void update() override
Update all commands.
Command for grasping an object.
General struct for command. Command will call activate when start time is reached, call updateDevice while active, and call complete when duration is over.
Command for applying deformationt to a subset of vertices from an object.
Command for circular movement of an analytical geometry.
Allows setting the pose of the device from external caller without a real device connected.