Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
ballistics.hpp
Go to the documentation of this file.
1/*****************************************************************************/
2/********** !!! WARNING: CODE GENERATED BY TAPROOT. DO NOT EDIT !!! **********/
3/*****************************************************************************/
4
5/*
6 * Copyright (c) 2020-2021 Advanced Robotics at the University of Washington <robomstr@uw.edu>
7 *
8 * This file is part of Taproot.
9 *
10 * Taproot is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * Taproot is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with Taproot. If not, see <https://www.gnu.org/licenses/>.
22 */
23
24#ifndef TAPROOT_BALLISTICS_HPP_
25#define TAPROOT_BALLISTICS_HPP_
26
27#include <cmath>
28
29#include "modm/math/geometry/vector.hpp"
30
32{
41{
42 virtual modm::Vector3f projectForward(float dt) const = 0;
43
52 inline static float quadraticKinematicProjection(float dt, float s, float v, float a)
53 {
54 return s + v * dt + 0.5f * a * powf(dt, 2.0f);
55 }
56};
57
59{
61 modm::Vector3f position,
62 modm::Vector3f velocity,
63 modm::Vector3f acceleration)
67 {
68 }
69
70 modm::Vector3f position; // m
71 modm::Vector3f velocity; // m/s
72 modm::Vector3f acceleration; // m/s^2
73
80 inline modm::Vector3f projectForward(float dt) const override
81 {
82 return modm::Vector3f(
86 }
87};
88
107 const modm::Vector3f &targetPosition,
108 float bulletVelocity,
109 float *travelTime,
110 float *turretPitch,
111 const float pitchAxisOffset = 0);
112
136 const AbstractKinematicState &targetInitialState,
137 float bulletVelocity,
138 uint8_t numIterations,
139 float *turretPitch,
140 float *turretYaw,
141 float *projectedTravelTime,
142 const float pitchAxisOffset = 0);
143
144} // namespace tap::algorithms::ballistics
145
146#endif // TAPROOT_BALLISTICS_HPP_
Definition ballistics.cpp:29
bool findTargetProjectileIntersection(const AbstractKinematicState &targetInitialState, float bulletVelocity, uint8_t numIterations, float *turretPitch, float *turretYaw, float *projectedTravelTime, const float pitchAxisOffset)
Definition ballistics.cpp:76
bool computeTravelTime(const modm::Vector3f &targetPosition, float bulletVelocity, float *travelTime, float *turretPitch, const float pitchAxisOffset)
Definition ballistics.cpp:30
static float quadraticKinematicProjection(float dt, float s, float v, float a)
Definition ballistics.hpp:52
virtual modm::Vector3f projectForward(float dt) const =0
modm::Vector3f position
Definition ballistics.hpp:70
modm::Vector3f acceleration
Definition ballistics.hpp:72
modm::Vector3f projectForward(float dt) const override
Definition ballistics.hpp:80
modm::Vector3f velocity
Definition ballistics.hpp:71
SecondOrderKinematicState(modm::Vector3f position, modm::Vector3f velocity, modm::Vector3f acceleration)
Definition ballistics.hpp:60