Resetting
In both the Javascript and Python interfaces, the Solver
class has a reset
method that allows the user to reset the state
of the solver given new objective
, weights
and a new robot state
. In this case, the robot state
only needs to supply the joints
and origin
field, as shown in the initialization
example.
Parameter | Type | Optional | Description |
---|---|---|---|
state | State | no | The new state will replace the original one in the next cycle of calculation |
weights | look-up table of float value indexed by string key | no | The new weights will replace the original one in the next cycle of calculation |
- Javascript
- Python
- Rust
solver.reset(
// A new state with origin and joint properties
{
origin:{
translation:[0,0,0],
rotation:[1,0,0,0]
},
joints:{
panda_joint1:0.0,
panda_joint2:0.0,
...
}
},
// Weights
{
myObjective:0.5
}
)
solver.reset(
state=State(
origin=Transform.identity(),
joints={
"panda_joint1":0.0,
"panda_joint2":0.0,
...
}
),
weights={}
)
let mut joints: HashMap<String,f64> = HashMap::new();
joints.insert(
"panda_joint1".into(),
0.0
);
joints.insert(
"panda_joint2".into(),
0.0
)
...
let new_state: State = State::new(
Isometry3::identity(), // Origin
joints, // Joint Values
frames: HashMap::new(), // Ignored, so just pass in an empty map
proximity: vec![],
center_of_mass: vec![0.0,0.0,0.0] // Ignored, so just pass in a 3-vector of zeros
);
let mut new_weights: HashMap<String,f64> = HashMap::new();
new_weights.insert(
"myObjective".into(),
0.5
);
solver.reset(
new_state,
new_weights
);