Hello everyone
i want to define a feedforward controller by InterpolataryCubicSpline function
my control points are: x=[0 0.3 0.5 0.75 1] y=[0 -10 0 10 0]
and my code is:
ConditionalController{
states = "EarlyStance LateStance Liftoff Swing Landing"
FeedForwardController{
include = hip_flexion*
InterpolataryCubicSpline{
control_points = 5
control_point_y = {Y0=0 Y1=-10 Y2=0 Y3=10 Y4=0}
control_point_dt = {T0=0 T1=0.3 T2=0.2 T3=0.25 T4=0.25}
cyclic = 1
}
}
}
but i got this error:
GaitStateController:
FeedForwardController:
Could not find key: mean or init_mean
and another question is how should i define tangent_begin_type? i tried to use it like tangent_begin_type="0" but that was not correct
InterpolataryCubicSpline
- Thomas Geijtenbeek
- Posts: 462
- Joined: Wed Mar 12, 2014 8:08 am
Re: InterpolataryCubicSpline
You cannot initialize the individual control point parameters from within this function. If you want different initial values for each control point, you can do so via a "Parameters" section inside the SimulationObjective, or via a custom .par init_file inside the CmaOptimizer.
- hossein barati
- Posts: 5
- Joined: Mon Feb 27, 2023 2:11 am
Re: InterpolataryCubicSpline
Thank you so much, it worked very well.
but i still have problem with defining control_point_tangent and tangent_begin_type
could you please give an example to show how to put values for these two Parameters? (e.g. for 5 control points)
but i still have problem with defining control_point_tangent and tangent_begin_type
could you please give an example to show how to put values for these two Parameters? (e.g. for 5 control points)
- hossein barati
- Posts: 5
- Joined: Mon Feb 27, 2023 2:11 am
Re: InterpolataryCubicSpline
In continuation of the previous post, i defined the function like this:
InterpolataryCubicSpline{
control_points = 8
control_point_y = ~10
control_point_dt = ~0.2
control_point_tangent = {0 0 0 0 0 0 0 0}
flat_extrapolation = 1
cyclic = 1
}
and i got this error:
Error parsing line 162: Expected '=', ':', '{' or '['
i tried all the possible forms for putting the values of control_point_tangent but it didn't work.
is this Parameter working?!
InterpolataryCubicSpline{
control_points = 8
control_point_y = ~10
control_point_dt = ~0.2
control_point_tangent = {0 0 0 0 0 0 0 0}
flat_extrapolation = 1
cyclic = 1
}
and i got this error:
Error parsing line 162: Expected '=', ':', '{' or '['
i tried all the possible forms for putting the values of control_point_tangent but it didn't work.
is this Parameter working?!
- Thomas Geijtenbeek
- Posts: 462
- Joined: Wed Mar 12, 2014 8:08 am
Re: InterpolataryCubicSpline
To be honest, I'm not sure how the InterpolataryCubicSpline works exactly, as it was a contribution from another developer (Alex Zhou). I've emailed him with a request to look at your issue.
Re: InterpolataryCubicSpline
I found a few old test cases scattered around, here are a few examples that may get you started.
I did not retest these functions but you can try or modify some of them for your purposes.
FeedForwardController {
name = ctrl1
symmetric = 1
InterpolataryCubicSpline {
spline_type = CatmullRomSpline
tangent_begin_type = Zero
tangent_end_type = Zero
zero_start = 1
zero_end = 1
#cyclic = 1
#offset_time = 0.0~0.02<-0.1,0.1>
#scale_time = 1.4~0.1<1.2,1.6>
control_points = 3
#control_point_y = 0.5~0.2<0,1> # Initial y value of control points
control_point_dt = 0.3~0.05<0.2,0.4> # initial delta time between control points
coefficient0 = -0.5#~0.2<-0.5,0> #extension
coefficient1 = 0.0
coefficient2 = 0.5#~0.02<0,0.5>, #flexion
#delta_time0 = 0.05~0.005<0.01,0.1>
}
}
FeedForwardController {
name = ctrl2
symmetric = 1
InterpolataryCubicSpline {
spline_type = CubicHermiteSpline
cyclic = 1
offset_time = 0.1~0.025<0.05,0.2>
#scale_time = 1.4~0.1<1.2,1.6>
control_points = 4
#control_point_y = 0.5~0.2<0,1> # Initial y value of control points
control_point_dt = 0.25~0.05<0.2,0.4> # initial delta time between control points
delta_time2 = 0.7~0.2<0.5,1.0>
coefficient0 = 0.0
coefficient1 = -0.5~0.1<-1.0,0> #extension
coefficient2 = 0.0
coefficient3 = 0.0
tangent0 = 0.0
tangent1 = 0.0
tangent2 = 0.0
tangent3 = 0.0
}
}
FeedForwardController {
name = ctr3
symmetric = 1
InterpolataryCubicSpline {
spline_type = NatCubSpline
zero_start = 1
zero_end = 1
#flat_extrapolation = 1 #zero_end will auto set to flat_extrapolation true
control_points = 5
#control_point_y = 0.5~0.2<0,1> # Initial y value of control points
control_point_dt = 0.125~0.02<0.01,1> # initial delta time between control points
coefficient0 = -0.5~0.2<-1,0>
coefficient1 = -0.1~0.02<-1,0>
coefficient2 = 0.0
coefficient3 = 0.1~0.02<0,1>
coefficient4 = 0.5~0.2<0,1>
delta_time0 = 0.05~0.005<0.01,0.1>
}
}
I did not retest these functions but you can try or modify some of them for your purposes.
FeedForwardController {
name = ctrl1
symmetric = 1
InterpolataryCubicSpline {
spline_type = CatmullRomSpline
tangent_begin_type = Zero
tangent_end_type = Zero
zero_start = 1
zero_end = 1
#cyclic = 1
#offset_time = 0.0~0.02<-0.1,0.1>
#scale_time = 1.4~0.1<1.2,1.6>
control_points = 3
#control_point_y = 0.5~0.2<0,1> # Initial y value of control points
control_point_dt = 0.3~0.05<0.2,0.4> # initial delta time between control points
coefficient0 = -0.5#~0.2<-0.5,0> #extension
coefficient1 = 0.0
coefficient2 = 0.5#~0.02<0,0.5>, #flexion
#delta_time0 = 0.05~0.005<0.01,0.1>
}
}
FeedForwardController {
name = ctrl2
symmetric = 1
InterpolataryCubicSpline {
spline_type = CubicHermiteSpline
cyclic = 1
offset_time = 0.1~0.025<0.05,0.2>
#scale_time = 1.4~0.1<1.2,1.6>
control_points = 4
#control_point_y = 0.5~0.2<0,1> # Initial y value of control points
control_point_dt = 0.25~0.05<0.2,0.4> # initial delta time between control points
delta_time2 = 0.7~0.2<0.5,1.0>
coefficient0 = 0.0
coefficient1 = -0.5~0.1<-1.0,0> #extension
coefficient2 = 0.0
coefficient3 = 0.0
tangent0 = 0.0
tangent1 = 0.0
tangent2 = 0.0
tangent3 = 0.0
}
}
FeedForwardController {
name = ctr3
symmetric = 1
InterpolataryCubicSpline {
spline_type = NatCubSpline
zero_start = 1
zero_end = 1
#flat_extrapolation = 1 #zero_end will auto set to flat_extrapolation true
control_points = 5
#control_point_y = 0.5~0.2<0,1> # Initial y value of control points
control_point_dt = 0.125~0.02<0.01,1> # initial delta time between control points
coefficient0 = -0.5~0.2<-1,0>
coefficient1 = -0.1~0.02<-1,0>
coefficient2 = 0.0
coefficient3 = 0.1~0.02<0,1>
coefficient4 = 0.5~0.2<0,1>
delta_time0 = 0.05~0.005<0.01,0.1>
}
}
- hossein barati
- Posts: 5
- Joined: Mon Feb 27, 2023 2:11 am
Re: InterpolataryCubicSpline
Thanks a lot
it helped me so much.
it helped me so much.