alphaville / optimization-engine

Nonconvex embedded optimization: code generation for fast real-time optimization + ROS support
https://alphaville.github.io/optimization-engine/
Other
499 stars 53 forks source link

Tests fail to compile for large problems #160

Closed michael-p closed 4 years ago

michael-p commented 4 years ago

The generated icasadi crate contains two unit-tests tst_call_grad and tst_f1 that contain println! statements that print arrays that can potentially contain more than 32 element for large optimization problems. This fails to compile because Rust has Debug-Impls only for arrays with length up to 32 elements:

error[E0277]: arrays only have std trait implementations for lengths 0..=32
   --> control/path_follow/icasadi/src/lib.rs:253:40
    |
253 |     println!("D_u psi(u, xi, p) = {:#?}", grad);
    |                                           ^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[f64; 75]`
    |
    = note: required because of the requirements on the impl of `std::fmt::Debug` for `[f64; 75]`
    = note: required by `std::fmt::Debug::fmt`

error[E0277]: arrays only have std trait implementations for lengths 0..=32
   --> control/path_follow/icasadi/src/lib.rs:262:31
    |
262 |     println!("F1(u, p) = {:#?}", f1up);
    |                                  ^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[f64; 75]`
    |
    = note: required because of the requirements on the impl of `std::fmt::Debug` for `[f64; 75]`
    = note: required by `std::fmt::Debug::fmt`

error: aborting due to 2 previous errors

Probably the println!s can simple by removed :)