Initial commit - test serial
This commit is contained in:
@ -0,0 +1,38 @@
|
||||
/**
|
||||
* Copyright 2020 Jonathan Bayless
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be found
|
||||
* in the LICENSE file or at https://opensource.org/licenses/MIT.
|
||||
*/
|
||||
#ifndef _PHYSICAL_MODEL_PASSTHROUGH_MODEL_HPP_
|
||||
#define _PHYSICAL_MODEL_PASSTHROUGH_MODEL_HPP_
|
||||
|
||||
#include "physicalmodel/physicalmodel.hpp"
|
||||
|
||||
namespace squiggles {
|
||||
class PassthroughModel : public PhysicalModel {
|
||||
public:
|
||||
/**
|
||||
* Defines a Physical Model that imposes no constraints of its own.
|
||||
*/
|
||||
PassthroughModel() = default;
|
||||
|
||||
Constraints constraints([[maybe_unused]] const Pose pose,
|
||||
[[maybe_unused]] double curvature,
|
||||
double vel) override {
|
||||
return Constraints(vel);
|
||||
};
|
||||
|
||||
std::vector<double>
|
||||
linear_to_wheel_vels([[maybe_unused]] double lin_vel,
|
||||
[[maybe_unused]] double curvature) override {
|
||||
return std::vector<double>{};
|
||||
}
|
||||
|
||||
std::string to_string() const override {
|
||||
return "PassthroughModel {}";
|
||||
}
|
||||
};
|
||||
} // namespace squiggles
|
||||
|
||||
#endif
|
@ -0,0 +1,43 @@
|
||||
/**
|
||||
* Copyright 2020 Jonathan Bayless
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be found
|
||||
* in the LICENSE file or at https://opensource.org/licenses/MIT.
|
||||
*/
|
||||
#ifndef _PHYSICAL_MODEL_PHYSICAL_MODEL_HPP_
|
||||
#define _PHYSICAL_MODEL_PHYSICAL_MODEL_HPP_
|
||||
|
||||
#include "constraints.hpp"
|
||||
#include "geometry/pose.hpp"
|
||||
|
||||
namespace squiggles {
|
||||
class PhysicalModel {
|
||||
public:
|
||||
/**
|
||||
* Calculate a set of stricter constraints for the path at the given state
|
||||
* than the general constraints based on the robot's kinematics.
|
||||
*
|
||||
* @param pose The 2D pose for this state in the path.
|
||||
* @param curvature The change in heading at this state in the path in 1 /
|
||||
* meters.
|
||||
* @param vel The linear velocity at this state in the path in meters per
|
||||
* second.
|
||||
*/
|
||||
virtual Constraints
|
||||
constraints(const Pose pose, double curvature, double vel) = 0;
|
||||
|
||||
/**
|
||||
* Converts a linear velocity and desired curvature into the component for
|
||||
* each wheel of the robot.
|
||||
*
|
||||
* @param linear The linear velocity for the robot in meters per second.
|
||||
* @param curvature The change in heading for the robot in 1 / meters.
|
||||
*/
|
||||
virtual std::vector<double> linear_to_wheel_vels(double linear,
|
||||
double curvature) = 0;
|
||||
|
||||
virtual std::string to_string() const = 0;
|
||||
};
|
||||
} // namespace squiggles
|
||||
|
||||
#endif
|
@ -0,0 +1,45 @@
|
||||
/**
|
||||
* Copyright 2020 Jonathan Bayless
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be found
|
||||
* in the LICENSE file or at https://opensource.org/licenses/MIT.
|
||||
*/
|
||||
#ifndef _PHYSICAL_MODEL_TANK_MODEL_HPP_
|
||||
#define _PHYSICAL_MODEL_TANK_MODEL_HPP_
|
||||
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
|
||||
#include "physicalmodel/physicalmodel.hpp"
|
||||
|
||||
namespace squiggles {
|
||||
class TankModel : public PhysicalModel {
|
||||
public:
|
||||
/**
|
||||
* Defines a model of a tank drive or differential drive robot.
|
||||
*
|
||||
* @param itrack_width The distance between the the wheels on each side of the
|
||||
* robot in meters.
|
||||
* @param ilinear_constraints The maximum values for the robot's movement.
|
||||
*/
|
||||
TankModel(double itrack_width, Constraints ilinear_constraints);
|
||||
|
||||
Constraints
|
||||
constraints(const Pose pose, double curvature, double vel) override;
|
||||
|
||||
std::vector<double> linear_to_wheel_vels(double lin_vel,
|
||||
double curvature) override;
|
||||
|
||||
std::string to_string() const override;
|
||||
|
||||
private:
|
||||
double vel_constraint(const Pose pose, double curvature, double vel);
|
||||
std::tuple<double, double>
|
||||
accel_constraint(const Pose pose, double curvature, double vel) const;
|
||||
|
||||
double track_width;
|
||||
Constraints linear_constraints;
|
||||
};
|
||||
} // namespace squiggles
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user