meco-group / omg-tools

Optimal Motion Generation-tools: motion planning made easy
GNU Lesser General Public License v3.0
559 stars 97 forks source link

Vehicle settings for knot_intervals cannot be set with set_options #14

Closed timmercy closed 8 years ago

timmercy commented 8 years ago

Default knot_intervals = 10, you can change this by: vehicle = Holonomic(options={'knot_intervals':5})

But it is not possible to use this: vehicle = Holonomic() vehicle.set_options({'knot_intervals': 5}) Since 'knot_intervals' is used in vehicle.init(), which is called when making the vehicle.

Possible solution is to call vehicle.init() again when vehicle.set_options() is called?

rubenvanparys commented 8 years ago

yes indeed, I am aware of this issue... Maybe knot_intervals should not be an option, as it defines the knot sequence (ie. there is always a computation involved after setting this parameter). Maybe a distinct setter would be more appropriate (set_knot_intervals)? Or maybe a more general function (define_knots), where you can provide multiple sorts of arguments (knot_intervals, the knot sequence itself, ...)

timmercy commented 8 years ago

I think the most high-level users would never change the default knot_intervals, so I guess we should find a solution which doesn't force the user to call an extra function?

So I would make a general define_knots function, since this gives the advanced user more control over the knot sequence and make sure that this function only needs to be called explicitly if you want to change the default knots? The creation of self.knots and self.basis moves to this new function then.

It is still possible to create errors if you e.g. change the knot sequence after adding spline constraints, but maybe we should ignore that for the moment?

rubenvanparys commented 8 years ago

I think you shouldn't change your knots after you added vehicle to the problem constructor. From that moment, splines are created, based on these knots. I don't see why the user should want to change the knots after constructing the optimization problem.

So the 'define_knots()' should be called between the creation of a vehicle object and the passing to a problem object.

On 12-04-16 11:35, timmercy wrote:

I think the most high-level users would never change the default knot_intervals, so I guess we should find a solution which doesn't force the user to call an extra function?

So I would make a general define_knots function, since this gives the advanced user more control over the knot sequence and make sure that this function only needs to be called explicitly if you want to change the default knots? The creation of self.knots and self.basis moves to this new function then.

It is still possible to create errors if you e.g. change the knot sequence after adding spline constraints, but maybe we should ignore that for the moment?

— You are receiving this because you were assigned. Reply to this email directly or view it on GitHub https://github.com/meco-group/omg-tools/issues/14#issuecomment-208816472