@@ -108,7 +108,7 @@ TOP::TOP(decimal_t Tf_, int N_)
108
108
x0 << 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 ;
109
109
xg << 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 ;
110
110
111
- // TODO(acauligi): read off params server
111
+ // Defaults are ISS params (will be written by planner_scp_gusto_nodelet)
112
112
radius_ = 0.26 ;
113
113
mass = 9.583788668 ;
114
114
J << 0.153427995 , 0 , 0 ,
@@ -1055,12 +1055,26 @@ void TOP::SetSimpleConstraints() {
1055
1055
}
1056
1056
1057
1057
if (enforce_state_bounds || enforce_obs_avoidance_const) {
1058
+ if (enforce_state_bounds) {
1059
+ std::cout << " [TOP::SetSimpleConstraints] MinPos: " << MinPos ().transpose () << std::endl;
1060
+ std::cout << " [TOP::SetSimpleConstraints] MaxPos: " << MaxPos ().transpose () << std::endl;
1061
+ }
1062
+ if (enforce_obs_avoidance_const) {
1063
+ if (keep_out_zones_.size () == 0 ) {
1064
+ std::cout << " ERROR: No keep-out zones provided for obstacle avoidance constraints. Ignoring." << std::endl;
1065
+ } else {
1066
+ std::cout << " [TOP::SetSimpleConstraints] ko box min: " << keep_out_zones_.back ().min ().transpose ()
1067
+ << std::endl;
1068
+ std::cout << " [TOP::SetSimpleConstraints] ko box max: " << keep_out_zones_.back ().max ().transpose ()
1069
+ << std::endl;
1070
+ }
1071
+ }
1058
1072
for (size_t ii = 0 ; ii < N; ii++) {
1059
1073
for (size_t jj = 0 ; jj < 3 ; jj++) { // x, y, z only for now
1060
1074
decimal_t lb = MinPos ()[jj];
1061
1075
decimal_t ub = MaxPos ()[jj];
1062
1076
1063
- if (enforce_obs_avoidance_const) {
1077
+ if (enforce_obs_avoidance_const && (keep_out_zones_. size () > 0 ) && (!is_granite || (jj != 2 )) ) {
1064
1078
// Obstacle avoidance logic
1065
1079
Eigen::AlignedBox3d box = keep_out_zones_.back ();
1066
1080
Eigen::Vector3d ko_min = box.min ();
@@ -3144,7 +3158,9 @@ int main() {
3144
3158
bool test_warm_start = false ;
3145
3159
3146
3160
bool test_state_bound_constraints = false ;
3147
- bool test_obs_avoidance_translation = true ;
3161
+ bool test_obs_avoidance_translation = false ;
3162
+
3163
+ bool granite_obs_avoidance = true ;
3148
3164
3149
3165
int num_problems = 0 ;
3150
3166
@@ -3525,6 +3541,47 @@ int main() {
3525
3541
}
3526
3542
}
3527
3543
3544
+ if (granite_obs_avoidance) {
3545
+ scp::TOP* top;
3546
+ top = new scp::TOP (20 ., 401 );
3547
+ top->is_granite = true ;
3548
+ top->enforce_obs_avoidance_const = true ;
3549
+ top->use_nn_warm_start = false ;
3550
+ top->x0 << -0.3 , 0.3 , -0.67 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 ;
3551
+ top->xg << 0.2 , -0.3 , -0.67 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 ;
3552
+ if (top->is_granite ) {
3553
+ top->radius_ = 0.26 ;
3554
+ top->mass = 18.9715 ;
3555
+ top->J << 0.2517 , 0.0 , 0.0 , 0.0 , 0.2517 , 0.0 , 0.0 , 0.0 , 0.2517 ;
3556
+ top->Jinv = top->J .inverse ();
3557
+
3558
+ Eigen::AlignedBox3d kiz;
3559
+ kiz.extend (Eigen::Vector3d (-1 , -1 , -0.75 ));
3560
+ kiz.extend (Eigen::Vector3d (1 , 1 , -0.6 ));
3561
+ top->keep_in_zones_ .push_back (kiz);
3562
+
3563
+ top->x_min (0 ) = -1.0 ;
3564
+ top->x_max (0 ) = 1.0 ;
3565
+ top->x_min (1 ) = -1.0 ;
3566
+ top->x_max (1 ) = 1.0 ;
3567
+ top->x_min (2 ) = -0.75 ;
3568
+ top->x_max (2 ) = -0.6 ;
3569
+ }
3570
+
3571
+ Eigen::AlignedBox3d smallObstacle;
3572
+ smallObstacle.extend (Eigen::Vector3d (-0.25 , -0.25 , -2 ));
3573
+ smallObstacle.extend (Eigen::Vector3d (0 ., 0 ., 0 ));
3574
+ top->keep_out_zones_ .push_back (smallObstacle);
3575
+
3576
+ if (!top->Solve ()) {
3577
+ std::cout << " Problem could not be solved!" << std::endl;
3578
+ } else {
3579
+ std::cout << " Problem solved!" << std::endl;
3580
+ top->WriteTrajectoryToFile (" output_granite_obs_avoidance" );
3581
+ }
3582
+ std::cout << " --------------------------------------------" << std::endl;
3583
+ }
3584
+
3528
3585
// scp::TOP* top;
3529
3586
// top = new scp::TOP(20., 801);
3530
3587
// for (int ii = 0; ii < 100; ii++) {
0 commit comments