Start state is not valid based on planner's state validator

9 views (last 30 days)
costmap = vehicleCostmap(DCMap,'CellSize',res);
%% Create Hybrid A* Path Planner
% the stateSpaceSE2 object stores parameters and states in the SE(2) state space,
% which is composed of state vectors represented by [x, y, θ]. x and y are
% Cartesian coordinates, and θ is the orientation angle.
space = stateSpaceSE2;
space.StateBounds = [-100 100; -100 100; -pi pi]; % [x,y,θ]
validator = validatorVehicleCostmap(space); % state validator based on 2-D costmap
% save the results in validator
validator.Map = costmap; % save costmap
validator.ValidationDistance = 1; % save validation distance
MinTurningRadius = 3; % minimum turning radius [m]
MotionPrimitiveLength = 2*pi*MinTurningRadius/4; % motion primitive length [m]
% create the hybrid A* path planner
planner = plannerHybridAStar(validator,'MinTurningRadius',MinTurningRadius,'MotionPrimitiveLength',MotionPrimitiveLength);
startPose = [50 5 0]; % Define the start position
goalPose = [5 0 0]; %Define the goal position
refPath = plan(planner,startPose,goalPose);
I get the above error and this is how the map looks like with the coordinates. I am using a vehicleCostmap instead of occupancy map here. The vehicleCostmap worked for a previous map.

Answers (1)

Divija Aleti
Divija Aleti on 23 Jun 2021
Hi Kashish,
From the figure, I can see that your map's x-bounds are [-40 40] and y-bounds are [-25 25].
The coordinates of your start position are [50 5]. But the upper limit for x as given by the map's bounds is 40 and the x-coordinate of the start position is greater than that. Hence the error.
I suggest you to choose a start position which falls inside the map's boundaries and doesn't coincide with any obstacle.
Hope this helps!
Regards,
Divija

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!