Skip to content

Commit d946e8e

Browse files
committed
fix(README): Examples updated with PlannerConfig
1 parent 5e4d7cc commit d946e8e

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,9 @@ const goal = new oxmpl.Goal(
119119
// Create problem and run planner
120120
const problem = new oxmpl.ProblemDefinition(space, start, goal);
121121
const validityChecker = new oxmpl.StateValidityChecker(isStateValid);
122+
const planner_config = new oxmpl.PlannerConfig(123);
122123

123-
const planner = new oxmpl.RRT(0.5, 0.05);
124+
const planner = new oxmpl.RRT(0.5, 0.05, planner_config);
124125
planner.setup(problem, validityChecker);
125126

126127
try {
@@ -141,7 +142,7 @@ Here is a complete example of solving a 2D planning problem with a custom collis
141142

142143
```python
143144
import math
144-
from oxmpl_py.base import RealVectorState, RealVectorStateSpace, ProblemDefinition
145+
from oxmpl_py.base import RealVectorState, RealVectorStateSpace, ProblemDefinition, PlannerConfig
145146
from oxmpl_py.geometric.planners import RRT
146147

147148
def is_state_valid(state: RealVectorState) -> bool:
@@ -167,8 +168,12 @@ start_state = RealVectorState([-5.0, -5.0])
167168
goal_region = MyCircularGoal(space, x=5.0, y=5.0, radius=0.5)
168169

169170
problem_def = ProblemDefinition.from_real_vector(space, start_state, goal_region)
171+
planner_config = PlannerConfig(seed=123)
170172

171-
planner = RRT(max_distance=0.5, goal_bias=0.05, problem_definition=problem_def)
173+
planner = RRT(max_distance=0.5,
174+
goal_bias=0.05,
175+
problem_definition=problem_def,
176+
planner_config=planner_config)
172177
planner.setup(is_state_valid)
173178

174179
try:
@@ -188,7 +193,7 @@ use std::{f64::consts::PI, sync::Arc, time::Duration};
188193
use oxmpl::base::{
189194
error::StateSamplingError,
190195
goal::{Goal, GoalRegion, GoalSampleableRegion},
191-
planner::{Path, Planner},
196+
planner::{Path, Planner, PlannerConfig},
192197
problem_definition::ProblemDefinition,
193198
space::{RealVectorStateSpace, StateSpace},
194199
state::RealVectorState,
@@ -288,7 +293,7 @@ fn main() {
288293
wall_thickness: 0.5,
289294
});
290295

291-
let mut planner = RRT::new(0.5, 0.0);
296+
let mut planner = RRT::new(0.5, 0.0, &PlannerConfig{ seed: Some(123) });
292297

293298
planner.setup(problem_definition, validity_checker.clone());
294299

0 commit comments

Comments
 (0)