Skip to content

Commit 35a8bb5

Browse files
committed
fix again singularities near beginning and end of trajectory
1 parent bbb30db commit 35a8bb5

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

src/TOPP.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,7 +1822,10 @@ int ComputeProfiles(Constraints& constraints, dReal sdbeg, dReal sdend){
18221822

18231823
///////////////// Integrate from start /////////////////////
18241824
ret = IntegrateForward(constraints,0,sdbeg,constraints.integrationtimestep,resprofile,1e5,testaboveexistingprofiles,testmvc,zlajpah);
1825-
if(ret == INT_BOTTOM || resprofile.nsteps < 10) {
1825+
if(ret != INT_BOTTOM && resprofile.nsteps>2) {
1826+
constraints.resprofileslist.push_back(resprofile);
1827+
}
1828+
if(ret == INT_BOTTOM || resprofile.nsteps < 5) {
18261829
// Integration failed. However, if qd(0) = 0, there was probably a singularity, and one can try different values for sdot
18271830
std::vector<dReal> qd(constraints.trajectory.dimension);
18281831
constraints.trajectory.Evald(0,qd);
@@ -1845,11 +1848,6 @@ int ComputeProfiles(Constraints& constraints, dReal sdbeg, dReal sdend){
18451848
}
18461849
}
18471850
}
1848-
else{
1849-
if(resprofile.nsteps>1) {
1850-
constraints.resprofileslist.push_back(resprofile);
1851-
}
1852-
}
18531851
// Now if it still fails, shouganai
18541852
if(ret==INT_BOTTOM) {
18551853
message = "Start profile hit 0";
@@ -1861,7 +1859,10 @@ int ComputeProfiles(Constraints& constraints, dReal sdbeg, dReal sdend){
18611859

18621860
///////////////// Integrate from end /////////////////////
18631861
ret = IntegrateBackward(constraints,constraints.trajectory.duration,sdend,constraints.integrationtimestep,resprofile,1e5,testaboveexistingprofiles,testmvc);
1864-
if(ret == INT_BOTTOM || resprofile.nsteps < 10) {
1862+
if(ret != INT_BOTTOM && resprofile.nsteps>2) {
1863+
constraints.resprofileslist.push_back(resprofile);
1864+
}
1865+
if(ret == INT_BOTTOM || resprofile.nsteps < 5) {
18651866
// Integration failed. However, if qd(send) = 0, there was probably a singularity, and one can try different values for sdot
18661867
dReal send = constraints.trajectory.duration;
18671868
std::vector<dReal> qd(constraints.trajectory.dimension);
@@ -1889,11 +1890,6 @@ int ComputeProfiles(Constraints& constraints, dReal sdbeg, dReal sdend){
18891890

18901891
}
18911892
}
1892-
else{
1893-
if(resprofile.nsteps>1) {
1894-
constraints.resprofileslist.push_back(resprofile);
1895-
}
1896-
}
18971893
if(ret==INT_BOTTOM) {
18981894
}
18991895
// Now if it still fails, shouganai

tests/robust_torque.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@
103103
else:
104104
nfail += 1
105105
print ">>>>>>>>>>>>>>>>>>> TOPP could not retime ", nfail
106-
TOPPpy.PlotProfiles(profileslist,switchpointslist,4)
107-
TOPPopenravepy.PlotTorques(robot,traj0,traj1,0.01,taumin,taumax,3)
108-
raw_input()
106+
#TOPPpy.PlotProfiles(profileslist,switchpointslist,4)
107+
#TOPPopenravepy.PlotTorques(robot,traj0,traj1,0.01,taumin,taumax,3)
108+
#raw_input()
109109

110110

111111
print "\nNumber of failures:", nfail

0 commit comments

Comments
 (0)