Skip to content

Commit

Permalink
added simulation flag, use robot resolution constructor, clean up sce…
Browse files Browse the repository at this point in the history
…ne files
  • Loading branch information
adeguet1 committed Mar 4, 2020
1 parent 2df34f5 commit b582ab2
Show file tree
Hide file tree
Showing 16 changed files with 77 additions and 90 deletions.
10 changes: 8 additions & 2 deletions code/mtsDerivedIntuitiveResearchKitPSM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ void mtsDerivedIntuitiveResearchKitPSM::Configure(const std::string &filename)
CMN_ASSERT(RobotInterface);
RobotInterface->AddCommandWrite(&mtsDerivedIntuitiveResearchKitPSM::SetConstraintMotionEnable, this, "SetConstraintMotionEnable");
RobotInterface->AddCommandRead(&mtsDerivedIntuitiveResearchKitPSM::GetSlackVector, this, "GetSlackForceDirection");
RobotInterface->AddCommandRead(&mtsDerivedIntuitiveResearchKitPSM::GetSimulation, this, "GetSimulation");
}
}

Expand Down Expand Up @@ -136,8 +137,8 @@ void mtsDerivedIntuitiveResearchKitPSM::SetupVF()
mController->AddVFPlane(mPlaneRight);

// mesh constraint
mMeshFile = cisstMesh(true);
if (mMeshFile.LoadMeshFromSTLFile("/home/dvrk-pc/dvrk_ws/src/USAblation/mesh/Skull.STL")==-1){
mMeshFile = cisstMesh(0.5,true); // 0.5 mm error for PSM
if (mMeshFile.LoadMeshFromSTLFile("/home/dvrk-pc/dvrk_ws/src/USAblation/mesh/Skull.stl")==-1){
CMN_LOG_CLASS_RUN_ERROR << "Cannot load STL file" << std::endl;
cmnThrow("Cannot load STL file");
}
Expand Down Expand Up @@ -315,6 +316,11 @@ void mtsDerivedIntuitiveResearchKitPSM::GetSlackVector(vct3 &force) const
force.Assign(mSlackVector);
}

void mtsDerivedIntuitiveResearchKitPSM::GetSimulation(bool &status) const
{
status = mSimulated;
}

void mtsDerivedIntuitiveResearchKitPSM::ComputeSlackVector(vctDoubleVec &jointInc, vctDoubleVec &jointSlack)
{
mSlackVector.Zeros();
Expand Down
12 changes: 9 additions & 3 deletions code/mtsDerivedTeleOperationPSM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ void mtsDerivedTeleOperationPSM::Configure(const std::string & CMN_UNUSED(filena
PSMSetConstraintMotionEnable);
interfacePSM->AddFunction("GetSlackForceDirection",
PSMGetSlackForceDirection);
interfacePSM->AddFunction("GetSimulation",
PSMGetSimulation);

// Same for MTM
mtsInterfaceRequired * interfaceMTM = GetInterfaceRequired("MTM");
Expand Down Expand Up @@ -156,9 +158,13 @@ void mtsDerivedTeleOperationPSM::RunEnabled(void)
// Re-orient based on rotation between MTM and PSM
force = mRegistrationRotation.Inverse() * force;
// set force to MTM
prmForceCartesianSet wrenchMTM;
wrenchMTM.Force().Ref<3>(0) = force;
mMTM.SetWrenchBody(wrenchMTM);
bool psmSimulated;
PSMGetSimulation(psmSimulated);
if (!psmSimulated){
prmForceCartesianSet wrenchMTM;
wrenchMTM.Force().Ref<3>(0) = force;
mMTM.SetWrenchBody(wrenchMTM);
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions include/mtsDerivedIntuitiveResearchKitPSM.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class mtsDerivedIntuitiveResearchKitPSM : public mtsIntuitiveResearchKitPSM
virtual void SetSimulation(const bool & status);
virtual void SetSkullToPSMTransform(const vctFrm4x4 & transform);
virtual void GetSlackVector(vct3 & force) const;
virtual void GetSimulation(bool & status) const;
bool mConstraintMotionEnabled;
bool mSimulated;
prmPositionCartesianGet mProxyCartesianPosition;
Expand Down
1 change: 1 addition & 0 deletions include/mtsDerivedTeleOperationPSM.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class mtsDerivedTeleOperationPSM: public mtsTeleOperationPSM
mtsFunctionWrite MTMSetWrenchBodyOrientationAbsolute;
mtsFunctionWrite PSMSetConstraintMotionEnable;
mtsFunctionRead PSMGetSlackForceDirection;
mtsFunctionRead PSMGetSimulation;

vctFrm4x4 mPSMProxyMeasuredCartesianPosition;
vct3 elasticityGain;
Expand Down
122 changes: 56 additions & 66 deletions scene/2020-02-06-Scene.mrml

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions scene/Displacement to color.txt

This file was deleted.

3 changes: 0 additions & 3 deletions scene/Displacement to color_1.txt

This file was deleted.

3 changes: 0 additions & 3 deletions scene/Displacement to color_2.txt

This file was deleted.

3 changes: 0 additions & 3 deletions scene/Displacement to color_3.txt

This file was deleted.

Binary file removed scene/Locator_Skull To PSM.vtk
Binary file not shown.
Binary file modified scene/Master Scene View.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion scene/Measured.fcsv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Markups fiducial file version = 4.8
# CoordinateSystem = 0
# columns = id,x,y,z,ow,ox,oy,oz,vis,sel,lock,label,desc,associatedNodeID
vtkMRMLMarkupsFiducialNode_1,199.771,-21.4751,58.122,0,0,0,1,1,1,0,,,
vtkMRMLMarkupsFiducialNode_1,195.099,-28.4652,76.0968,0,0,0,1,1,1,0,,,
5 changes: 0 additions & 5 deletions scene/Plane.fcsv

This file was deleted.

2 changes: 1 addition & 1 deletion scene/Servo.fcsv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Markups fiducial file version = 4.8
# CoordinateSystem = 0
# columns = id,x,y,z,ow,ox,oy,oz,vis,sel,lock,label,desc,associatedNodeID
vtkMRMLMarkupsFiducialNode_2,200.054,-21.4196,57.7781,0,0,0,1,1,1,0,,,
vtkMRMLMarkupsFiducialNode_2,233.122,29.9612,68.9746,0,0,0,1,1,1,0,,,
Binary file modified scene/Skull.stl
Binary file not shown.
Binary file added scene/Skull_with_path.stl
Binary file not shown.

0 comments on commit b582ab2

Please sign in to comment.