Loading...
Searching...
No Matches
SSTPinballPlanning.cpp
48 std::vector<std::vector<double>> paddleCoords = {{1, -1}, {2.5, -4}, {1.5, -5}, {3, -7}, {1, -8}};
76 motion->state->as<ompl::base::CompoundState>()->as<ompl::base::RealVectorStateSpace::StateType>(0);
88 inPaddle = true; // In jump set if both velocity and position vectors are directed toward top of paddle
90 (x2 >= paddleY + pinballSetup.paddleWidth / 2 && x2 <= paddleY + pinballSetup.paddleWidth) && v2 > 0)
91 inPaddle = true; // In jump set if both velocity and position vectors are directed toward bottom of paddle
94 inPaddle = true; // In jump set if both velocity and position vectors are directed toward left side of paddle
95 else if ((x1 >= paddleX + (3 / 4) * pinballSetup.paddleLength && x1 <= paddleX + pinballSetup.paddleLength) &&
97 inPaddle = true; // In jump set if both velocity and position vectors are directed toward left side of paddle
108 motion->state->as<ompl::base::CompoundState>()->as<ompl::base::RealVectorStateSpace::StateType>(0);
112 for (std::vector<double> paddleCoord : pinballSetup.paddleCoords) // If ball is in any of the paddles
135 motion->state->as<ompl::base::CompoundState>()->as<ompl::base::RealVectorStateSpace::StateType>(0);
222 ->values[2] = -(v1 * 0.6 + std::copysign(u_x, v1)); // Input is in the same direction as rebound
256 auto *values = st->as<ompl::base::CompoundState>()->as<ompl::base::RealVectorStateSpace::StateType>(0)->values;
279 VelocityObjective(const ompl::base::SpaceInformationPtr &si) : ompl::base::StateCostIntegralObjective(si, false)
287 -abs(s->as<ompl::base::CompoundState>()->as<ompl::base::RealVectorStateSpace::StateType>(0)->values[2]));
290 // Return the difference in magnitude of the horizontal components of the between the previous and current velocity
296 (ompl::base::HybridStateSpace::getStateTime(s2) - ompl::base::HybridStateSpace::getStateTime(s1)));
337 jumpControlSpace); // Doesn't do anything because the bounds for jump input are just [0, 0], but here for
346 ompl::control::CompoundControlSpace *controlSpace = new ompl::control::CompoundControlSpace(hybridSpacePtr);
353 ompl::control::SpaceInformationPtr si(new ompl::control::SpaceInformation(hybridSpacePtr, controlSpacePtr));
429 ompl::base::PlannerStatus solved = cHySST.solve(ompl::base::timedPlannerTerminationCondition(30));
A state space consisting of a space and a time component.
Definition HybridStateSpace.h:51
static double getStateTime(const ompl::base::State *state)
The time value of the given state.
Definition HybridStateSpace.cpp:98
Definition of a problem to be solved. This includes the start state(s) for the system and a goal spec...
Definition ProblemDefinition.h:152
The lower and upper bounds for an Rn space.
Definition RealVectorBounds.h:48
The definition of a state in Rn.
Definition RealVectorStateSpace.h:78
A state space representing Rn. The distance function is the L2 norm.
Definition RealVectorStateSpace.h:74
void addDimension(double minBound=0.0, double maxBound=0.0)
Increase the dimensionality of the state space by 1. Optionally, bounds can be specified for this add...
Definition RealVectorStateSpace.cpp:112
Defines optimization objectives where path cost can be represented as a path integral over a cost fun...
Definition StateCostIntegralObjective.h:51
StateCostIntegralObjective(const SpaceInformationPtr &si, bool enableMotionCostInterpolation=false)
If enableMotionCostInterpolation is set to true, then calls to motionCost() will divide the motion se...
Definition StateCostIntegralObjective.cpp:39
ompl::base::State StateType
Define the type of state allocated by this space.
Definition StateSpace.h:78
A control space to allow the composition of control spaces.
Definition ControlSpace.h:202
virtual void addSubspace(const ControlSpacePtr &component)
Adds a control space as a component of the compound control space.
Definition ControlSpace.cpp:143
A control space representing the space of applicable controls.
Definition ControlSpace.h:64
void setControlSamplerAllocator(const ControlSamplerAllocator &csa)
Set the sampler allocator to use.
Definition ControlSpace.cpp:93
Definition HySST.h:64
Basic solver for ordinary differential equations of the type q' = f(q, u), where q is the current sta...
Definition ODESolver.h:200
static StatePropagatorPtr getStatePropagator(ODESolverPtr solver, const PostPropagationEvent &postEvent=nullptr)
Retrieve a StatePropagator object that solves a system of ordinary differential equations defined by ...
Definition ODESolver.h:127
The definition of a control in Rn.
Definition RealVectorControlSpace.h:66
A control space representing Rn.
Definition RealVectorControlSpace.h:62
void setBounds(const base::RealVectorBounds &bounds)
Set the bounds (min max values for each dimension) for the control.
Definition RealVectorControlSpace.cpp:58
Uniform sampler for the Rn state space.
Definition RealVectorControlSpace.h:50
Space information containing necessary information for planning with controls. setup() needs to be ca...
Definition SpaceInformation.h:71
PlannerTerminationCondition timedPlannerTerminationCondition(double duration)
Return a termination condition that will become true duration seconds in the future (wall-time).
Definition PlannerTerminationCondition.cpp:201
This namespace contains sampling based planning routines used by planning under differential constrai...
Definition Control.h:45
duration seconds(double sec)
Return the time duration representing a given number of seconds.
Definition Time.h:64
A class to store the exit status of Planner::solve().
Definition PlannerStatus.h:49