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

Error in adding rectangle constraints in MATLAB #207

Closed Subhankhan41 closed 2 years ago

Subhankhan41 commented 3 years ago

Is your feature request related to a problem? Please describe. Consider a mobile robot is subject to state and input constraints. How can we set constraints on them?

Describe the solution you'd like I want to add constraints on input control signal (linear velocity and angular velocity) and states(x, y, theta). Could you please give an example in MATLAB?

Describe alternatives you've considered I have looked in to the closed issue "Min/Max constraint for OpEnConstraints in Matlab #12". However, I'm struggling to add these in the example codes. I modified the main.rs file and added rectangle constraints on Matlab file OpEnConstraints.m, However, I'm always getting error as main.rs updates each time. This is what I'm getting:

error[E0425]: cannot find value `bounds` in this scope
  --> src/main.rs:82:37
   |
82 |         let problem = Problem::new(&bounds, df, f);
   |                                     ^^^^^^ not found in this scope

warning: unused import: `constraints::*`
 --> src/main.rs:3:27
  |
3 | use optimization_engine::{constraints::*, panoc::*, *};
  |                           ^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default
alphaville commented 3 years ago

@Subhankhan41, could you please provide the code you are trying to run so as to be able to reproduce the error?

Subhankhan41 commented 3 years ago

Hello, Thank you for the reply. Please find the following .txt files( which are .m files):

1- Example navigation of Kinematic model of mobile robot example1.txt 2- constraints OpEnConstraints.txt 3- Build build.txt For the build/navigation/src/main.rs, I did the modification as follows: let UMIN : Vec = vec![-1.0; NU]; let UMAX : Vec = vec![1.0; NU]; let bounds = Rectangle::new(UMIN, UMAX); However, it gets updated each time as the file is auto-generated.

@alphaville I would highly appreciate if you please resolve this issue Thanks

Subhankhan41 commented 3 years ago

@alphaville hello again, sorry for asking again but have you resolved it?

alphaville commented 2 years ago

@Subhankhan41 the issue has been resolved in #265. We will test and merge it soon.

The MATLAB interface is experimental; there are several developments in the the Python interface (additional algorithms, better and more stable implementations, etc) that are missing from the MATLAB interface. If you're fine with this, I would recommend switching to Python for now.