Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tune Pass Speed with Pass Distance #2918

Merged
Merged
Show file tree
Hide file tree
Changes from 95 commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
021d61d
added pass speed cost function
sauravbanna May 13, 2023
1657a93
testing
sauravbanna May 17, 2023
3f9dc79
testing
sauravbanna May 18, 2023
1c08c7d
test
sauravbanna May 20, 2023
4f21d2e
test
sauravbanna May 20, 2023
b59eb7d
testing
sauravbanna May 20, 2023
ae4adab
testing
sauravbanna May 22, 2023
f40af89
testing
sauravbanna May 26, 2023
d482e6b
test
sauravbanna May 26, 2023
6f34861
fix
sauravbanna May 27, 2023
9010163
fixed cost function
sauravbanna May 27, 2023
84c3a4f
formatting
sauravbanna May 27, 2023
ebbeb5e
Merge branch 'master' of github.com:UBC-Thunderbots/Software into sau…
sauravbanna May 27, 2023
c5e34df
fix
sauravbanna May 27, 2023
b34e972
test
sauravbanna May 27, 2023
5021ade
test
sauravbanna May 28, 2023
a9725ec
test
sauravbanna Jun 3, 2023
fd34328
Merge branch 'master' of github.com:UBC-Thunderbots/Software into sau…
sauravbanna Jun 3, 2023
023d854
fix tests
sauravbanna Jun 3, 2023
c72e46c
formatting + docs
sauravbanna Jun 3, 2023
044e7a2
formatting + docs
sauravbanna Jun 3, 2023
a8bd1c1
test
sauravbanna Jun 12, 2023
babac45
Merge branch 'master' of github.com:UBC-Thunderbots/Software into sau…
sauravbanna Jun 12, 2023
ff36d13
test
sauravbanna Jun 13, 2023
5cc2e7f
added tests for backward passes
sauravbanna Jun 16, 2023
4a15972
uncomment + formatting
sauravbanna Jun 16, 2023
0ca8c80
docs
sauravbanna Jun 16, 2023
3327f89
fix
sauravbanna Jun 16, 2023
5893fe8
added new field tets for passing
sauravbanna Jun 17, 2023
ff478bf
fix
sauravbanna Jun 17, 2023
80e07c2
fixed tests
sauravbanna Jun 18, 2023
e3dfe1d
fix
sauravbanna Jun 24, 2023
d97fe64
fix
sauravbanna Jun 24, 2023
00e1e55
Merge branch 'master' of github.com:UBC-Thunderbots/Software into sau…
sauravbanna Jun 24, 2023
b473d69
fix tests
sauravbanna Jun 24, 2023
d02f173
fix?
sauravbanna Jun 24, 2023
0ccf164
fix?
sauravbanna Jun 24, 2023
ad6ff93
fix tests
sauravbanna Jun 29, 2023
45771d3
Merge branch 'master' of github.com:UBC-Thunderbots/Software into sau…
sauravbanna Oct 14, 2023
37d3785
Merge branch 'master' of github.com:UBC-Thunderbots/Software into sau…
sauravbanna Nov 19, 2023
629a936
Merge branch 'master' of github.com:UBC-Thunderbots/Software into sau…
sauravbanna Feb 3, 2024
3844cb2
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] Feb 3, 2024
77d2354
implemented new pass changes
sauravbanna Feb 3, 2024
6954b80
Merge branch 'master' of github.com:UBC-Thunderbots/Software into sau…
sauravbanna Feb 3, 2024
62dda73
Merge branch 'saurav_banna/pass_speed_cost' of github.com:sauravbanna…
sauravbanna Feb 3, 2024
7df5317
fix
sauravbanna Feb 3, 2024
03d8344
removed unecessary changes
sauravbanna Feb 4, 2024
fbb2563
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] Feb 4, 2024
ee2b01b
formatting
sauravbanna Feb 4, 2024
b14e6c6
Merge branch 'master' of github.com:UBC-Thunderbots/Software into sau…
sauravbanna Feb 10, 2024
6e99bc1
Merge branch 'saurav_banna/pass_speed_cost' of github.com:sauravbanna…
sauravbanna Feb 10, 2024
de6aaa2
fix types
sauravbanna Feb 10, 2024
0c3c936
fix
sauravbanna Feb 11, 2024
423c981
testing changes
sauravbanna Feb 11, 2024
a1f5fcc
fix
sauravbanna Feb 11, 2024
67d5c57
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] Feb 11, 2024
c2c1a22
removed unecessary changes
sauravbanna Feb 11, 2024
7b127db
fix
sauravbanna Feb 14, 2024
55fb728
Revert "fix"
sauravbanna Feb 14, 2024
dba41a4
merge
sauravbanna Feb 14, 2024
7cffa2c
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] Feb 14, 2024
de1b49a
formatting
sauravbanna Feb 14, 2024
7ad435b
Merge branch 'saurav_banna/pass_speed_cost' of
sauravbanna Feb 14, 2024
ea5d942
fix bug
sauravbanna Feb 14, 2024
716e001
fix
sauravbanna Feb 17, 2024
38f0ee6
bug
sauravbanna Feb 17, 2024
17c02ae
merge
sauravbanna Mar 10, 2024
c5ffe99
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] Mar 10, 2024
88ce00f
fix tests
sauravbanna Mar 14, 2024
283a02a
Merge branch 'saurav_banna/pass_speed_cost' of github.com:sauravbanna…
sauravbanna Mar 14, 2024
608f743
Merge branch 'master' of github.com:UBC-Thunderbots/Software into sau…
sauravbanna Mar 14, 2024
482a18d
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] Mar 14, 2024
5862749
merge
sauravbanna Mar 15, 2024
bdcccc1
Merge branch 'saurav_banna/pass_speed_cost' of github.com:sauravbanna…
sauravbanna Mar 15, 2024
96672f0
fix build
sauravbanna Mar 15, 2024
62fa115
test
sauravbanna Mar 16, 2024
0e35e7e
fix
sauravbanna Mar 16, 2024
732d579
fix
sauravbanna Mar 20, 2024
94fd82b
Merge branch 'master' of github.com:UBC-Thunderbots/Software into sau…
sauravbanna Mar 20, 2024
29144df
merge
sauravbanna Mar 23, 2024
43ee59a
address comments
sauravbanna Mar 23, 2024
e26305a
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] Mar 23, 2024
f84b0bd
merge + fix
sauravbanna Mar 30, 2024
b4354db
Merge branch 'saurav_banna/pass_speed_cost' of github.com:sauravbanna…
sauravbanna Mar 30, 2024
4b68c6d
fix
sauravbanna Mar 30, 2024
e009c65
fix
sauravbanna Mar 30, 2024
8ec3a81
fix comments
sauravbanna Apr 6, 2024
186c564
fix
sauravbanna May 4, 2024
9b6a39d
fix bounds
sauravbanna May 4, 2024
2a38293
Merge branch 'master' of github.com:UBC-Thunderbots/Software into sau…
sauravbanna May 11, 2024
2ea63fa
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] May 11, 2024
0032638
fix test issues
sauravbanna May 11, 2024
f3d59aa
Merge branch 'saurav_banna/pass_speed_cost' of github.com:sauravbanna…
sauravbanna May 11, 2024
9357893
move tests
sauravbanna May 11, 2024
3acee00
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] May 11, 2024
6f7cffd
fix nit
sauravbanna May 25, 2024
34d9e5b
fix semicolons
sauravbanna May 25, 2024
decf751
fix tests
sauravbanna May 25, 2024
e65f394
make validation stricter
sauravbanna May 25, 2024
904d9a5
fix names
sauravbanna May 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/extlibs/er_force_sim/src/amun/simulator/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ qt_cc_library(
"//extlibs/er_force_sim/src/core:core_qt",
"//extlibs/er_force_sim/src/protobuf:protobuf_qt",
"//proto:ssl_simulation_cc_proto",
"//shared:constants",
"@bullet",
"@qt//:qt_core",
"@qt//:qt_gui",
Expand Down
71 changes: 41 additions & 30 deletions src/extlibs/er_force_sim/src/amun/simulator/simball.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,29 +36,32 @@ SimBall::SimBall(RNG *rng, btDiscreteDynamicsWorld *world)
m_world(world),
current_ball_state(STATIONARY),
set_transition_speed(true),
rolling_speed(-1.0)
rolling_speed(-1.0f)
{
// see http://robocup.mi.fu-berlin.de/buch/rolling.pdf for correct modelling
m_sphere = new btSphereShape(BALL_RADIUS * SIMULATOR_SCALE);
m_sphere =
new btSphereShape(static_cast<float>(BALL_MAX_RADIUS_METERS) * SIMULATOR_SCALE);

btVector3 localInertia(0, 0, 0);
// FIXME measure inertia coefficient
m_sphere->calculateLocalInertia(BALL_MASS, localInertia);
m_sphere->calculateLocalInertia(BALL_MASS_KG, localInertia);

btTransform startWorldTransform;
startWorldTransform.setIdentity();
startWorldTransform.setOrigin(btVector3(0, 0, BALL_RADIUS) * SIMULATOR_SCALE);
startWorldTransform.setOrigin(
btVector3(0.0f, 0.0f, static_cast<float>(BALL_MAX_RADIUS_METERS)) *
SIMULATOR_SCALE);
m_motionState = new btDefaultMotionState(startWorldTransform);

btRigidBody::btRigidBodyConstructionInfo rbInfo(BALL_MASS, m_motionState, m_sphere,
btRigidBody::btRigidBodyConstructionInfo rbInfo(BALL_MASS_KG, m_motionState, m_sphere,
localInertia);

// parameters seem to be ignored...
m_body = new btRigidBody(rbInfo);
// see simulator.cpp
// TODO (#2512): Check these values with real life
m_body->setRestitution(BALL_RESTITUTION);
m_body->setFriction(BALL_SLIDING_FRICTION);
m_body->setFriction(BALL_SLIDING_FRICTION_NEWTONS);

// \mu_r = -a / g = 0.0357 (while rolling)
// rollingFriction in bullet is too unstable to be useful
Expand All @@ -79,10 +82,11 @@ void SimBall::begin(bool robot_collision)
// custom implementation of rolling friction
const btVector3 p = m_body->getWorldTransform().getOrigin();
const btVector3 velocity = m_body->getLinearVelocity();
if (p.z() < BALL_RADIUS * 1.1 * SIMULATOR_SCALE)
if (p.z() < static_cast<float>(BALL_MAX_RADIUS_METERS) * 1.1f * SIMULATOR_SCALE)
{ // ball is on the ground
bool is_stationary = velocity.length() < STATIONARY_BALL_SPEED * SIMULATOR_SCALE;
bool should_roll = velocity.length() < rolling_speed * SIMULATOR_SCALE;
bool is_stationary =
velocity.length() < STATIONARY_BALL_SPEED_METERS_PER_SECOND * SIMULATOR_SCALE;
bool should_roll = velocity.length() < rolling_speed * SIMULATOR_SCALE;

if (robot_collision)
{
Expand All @@ -106,15 +110,15 @@ void SimBall::begin(bool robot_collision)
{
case STATIONARY:
m_body->setLinearVelocity(btVector3(0, 0, 0));
m_body->setFriction(BALL_SLIDING_FRICTION);
m_body->setFriction(BALL_SLIDING_FRICTION_NEWTONS);
set_transition_speed = true;
break;
case ROBOT_COLLISION:
m_body->setFriction(BALL_SLIDING_FRICTION);
m_body->setFriction(BALL_SLIDING_FRICTION_NEWTONS);
set_transition_speed = true;
break;
case SLIDING:
m_body->setFriction(BALL_SLIDING_FRICTION);
m_body->setFriction(BALL_SLIDING_FRICTION_NEWTONS);
if (set_transition_speed)
{
rolling_speed =
Expand All @@ -126,13 +130,15 @@ void SimBall::begin(bool robot_collision)

// just apply rolling friction, normal friction is somehow handled by
// bullet
const btScalar rollingDeceleration = BALL_ROLLING_FRICTION_DECELERATION;
const btScalar rollingDeceleration =
BALL_ROLLING_FRICTION_DECELERATION_METERS_PER_SECOND_SQUARED;
btVector3 force(velocity.x(), velocity.y(), 0.0f);
force.safeNormalize();
m_body->applyCentralImpulse(-force * rollingDeceleration *
SIMULATOR_SCALE * BALL_MASS * SUB_TIMESTEP);
SIMULATOR_SCALE * BALL_MASS_KG *
SUB_TIMESTEP);

m_body->setFriction(0.0);
m_body->setFriction(0.0f);
set_transition_speed = false;
break;
}
Expand Down Expand Up @@ -187,11 +193,13 @@ void SimBall::begin(bool robot_collision)
ErForceVector pos;
coordinates::fromVision(m_move, pos);
// move ball by hand
btVector3 force(pos.x, pos.y, m_move.z() + BALL_RADIUS);
btVector3 force(pos.x, pos.y,
m_move.z() + static_cast<float>(BALL_MAX_RADIUS_METERS));
force = force - m_body->getWorldTransform().getOrigin() / SIMULATOR_SCALE;
m_body->activate();
m_body->applyCentralImpulse(force * BALL_MASS * 0.1 * SIMULATOR_SCALE);
m_body->setDamping(0.99, 0.99);
m_body->applyCentralImpulse(force * static_cast<float>(BALL_MASS_KG) * 0.1f *
SIMULATOR_SCALE);
m_body->setDamping(0.99f, 0.99f);
}
else
{
Expand All @@ -200,7 +208,7 @@ void SimBall::begin(bool robot_collision)
// set position
ErForceVector cPos;
coordinates::fromVision(m_move, cPos);
float height = BALL_RADIUS;
float height = static_cast<float>(BALL_MAX_RADIUS_METERS);
if (m_move.has_z())
{
height += m_move.z();
Expand Down Expand Up @@ -231,7 +239,7 @@ void SimBall::begin(bool robot_collision)
m_body->setAngularVelocity(btVector3(0, 0, 0));
}
m_body->activate();
m_body->setDamping(0.0, 0.0);
m_body->setDamping(0.0f, 0.0f);
m_move.Clear(); // clear move command
// reset is neccessary, as the command is only sent once
// without one canceling it
Expand All @@ -240,7 +248,7 @@ void SimBall::begin(bool robot_collision)
else
{
// ball is slowed down by rolling friction, not damping!
m_body->setDamping(0.0, 0.0);
m_body->setDamping(0.0f, 0.0f);
}
}

Expand All @@ -250,7 +258,8 @@ static float positionOfVisiblePixels(btVector3 &p, const btVector3 &simulatorBal
const btVector3 &simulatorCameraPosition,
const btCollisionWorld *const m_world)
{
const float simulatorBallRadius = BALL_RADIUS * SIMULATOR_SCALE;
const float simulatorBallRadius =
static_cast<float>(BALL_MAX_RADIUS_METERS) * SIMULATOR_SCALE;

// axis and angle for rotating the plane towards the camera
btVector3 cameraDirection =
Expand Down Expand Up @@ -337,9 +346,9 @@ bool SimBall::addDetection(SSLProto::SSL_DetectionBall *ball, btVector3 pos, flo
btVector3 positionOffset)
{
// setup ssl-vision ball detection
ball->set_confidence(1.0);
ball->set_pixel_x(0);
ball->set_pixel_y(0);
ball->set_confidence(1.0f);
ball->set_pixel_x(0.0f);
ball->set_pixel_y(0.0f);

btTransform transform;
m_motionState->getWorldTransform(transform);
Expand All @@ -348,7 +357,7 @@ bool SimBall::addDetection(SSLProto::SSL_DetectionBall *ball, btVector3 pos, flo
btVector3(cameraPosition.x(), cameraPosition.y(), cameraPosition.z()) *
SIMULATOR_SCALE;

float visibility = 1;
float visibility = 1.f;
// the camera uses the mid point of the visible pixels as the mid point of the
// ball if some parts of the ball aren't visible the position this function
// adjusts the position accordingly (hopefully)
Expand All @@ -365,11 +374,12 @@ bool SimBall::addDetection(SSLProto::SSL_DetectionBall *ball, btVector3 pos, flo

const float SCALING_LIMIT = 0.9f;
// reflects the cameras resolution
const unsigned PIXEL_PER_AREA = 10; // i do not know in what unit area is,
const float PIXEL_PER_AREA = 10.0f; // i do not know in what unit area is,
// just make it similar to a real game
const float BALL_MAX_RADIUS_METERS_FLOAT = static_cast<float>(BALL_MAX_RADIUS_METERS);

float modZ = std::min(SCALING_LIMIT * cameraPosition.z(),
std::max(0.f, pos.z() - BALL_RADIUS));
std::max(0.f, pos.z() - BALL_MAX_RADIUS_METERS_FLOAT));
float modX = (pos.x() - cameraPosition.x()) *
(cameraPosition.z() / (cameraPosition.z() - modZ)) +
cameraPosition.x();
Expand All @@ -381,9 +391,10 @@ bool SimBall::addDetection(SSLProto::SSL_DetectionBall *ball, btVector3 pos, flo
std::sqrt((cameraPosition.z() - modZ) * (cameraPosition.z() - modZ) +
(cameraPosition.x() - pos.x()) * (cameraPosition.x() - pos.x()) +
(cameraPosition.y() - pos.y()) * (cameraPosition.y() - pos.y()));
float denomSqrt = (distBallCam * 1000) / FOCAL_LENGTH - 1;
float denomSqrt = (distBallCam * 1000.f) / FOCAL_LENGTH - 1.f;
float basePixelArea =
(BALL_RADIUS * BALL_RADIUS * 1000000 * M_PI) / (denomSqrt * denomSqrt);
(BALL_MAX_RADIUS_METERS_FLOAT * BALL_MAX_RADIUS_METERS_FLOAT * 1000000 * M_PI) /
(denomSqrt * denomSqrt);
float area =
visibility *
std::max(0.0f, (basePixelArea +
Expand Down
14 changes: 1 addition & 13 deletions src/extlibs/er_force_sim/src/amun/simulator/simball.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,9 @@

#include "extlibs/er_force_sim/src/protobuf/command.pb.h"
#include "extlibs/er_force_sim/src/protobuf/sslsim.h"
#include "shared/constants.h"
#include "simfield.h"

static const float BALL_RADIUS = 0.0215f;
static const float BALL_MASS = 0.046f;

// these values are set in coordination with other objects the ball will collide with.
// the resulting coefficient of friction is the product of both objects friction value.
static constexpr float BALL_SLIDING_FRICTION = 1.f;
static constexpr float BALL_RESTITUTION = 1.f;

static constexpr float BALL_ROLLING_FRICTION_DECELERATION = 0.5;
static constexpr float FRICTION_TRANSITION_FACTOR = 5.0 / 7.0;
static constexpr float STATIONARY_BALL_SPEED = 0.01;


class RNG;
namespace SSLProto
{
Expand Down
21 changes: 15 additions & 6 deletions src/extlibs/er_force_sim/src/amun/simulator/simrobot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,16 +412,24 @@ void SimRobot::begin(SimBall *ball, double time)
if (m_isCharged && m_sslCommand.has_kick_speed() && m_sslCommand.kick_speed() > 0 &&
canKickBall(ball))
{
float power = 0.0;
const float angle = m_sslCommand.kick_angle() / 180 * M_PI;
const float dirFloor = std::cos(angle);
const float dirUp = std::sin(angle);
float power = 0.0;
const float angle = m_sslCommand.kick_angle() / 180 * M_PI;
const float dirFloor = std::cos(angle);
const float dirUp = std::sin(angle);
const float kickSpeedBoundThreshold = 1.0;

stopDribbling();

if (m_sslCommand.kick_angle() == 0)
{
power = qBound(0.05f, m_sslCommand.kick_speed(), m_specs.shot_linear_max());
// we subtract the current speed of the ball from the intended kick speed
// this ensures the ball leaves the robot at exactly the speed we want
power = qBound(0.05f,
ball->speed().length() < kickSpeedBoundThreshold
? m_sslCommand.kick_speed() -
(ball->speed().length() / SIMULATOR_SCALE)
: m_sslCommand.kick_speed(),
m_specs.shot_linear_max());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Could you split the lower bound into a separate if statement?

}
else
{
Expand All @@ -448,7 +456,8 @@ void SimRobot::begin(SimBall *ball, double time)
const float speedCompensation = getSpeedCompensation();

ball->kick(t * btVector3(0, dirFloor * power + speedCompensation, dirUp * power) *
(1 / time) * SIMULATOR_SCALE * BALL_MASS);
(1.0f / static_cast<float>(time)) * SIMULATOR_SCALE *
static_cast<float>(BALL_MASS_KG));
// discharge
m_isCharged = false;
m_shootTime = 0.0;
Expand Down
5 changes: 3 additions & 2 deletions src/extlibs/er_force_sim/src/amun/simulator/simulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -977,8 +977,9 @@ void Simulator::teleportRobotToFreePosition(SimRobot *robot)
btVector3 robotPos = robot->position() / SIMULATOR_SCALE;
btVector3 direction =
(robotPos - m_data->ball->position() / SIMULATOR_SCALE).normalize();
float distance = 2 * (BALL_RADIUS + robot->specs().radius());
bool valid = true;
float distance =
2.0f * (static_cast<float>(BALL_MAX_RADIUS_METERS) + robot->specs().radius());
bool valid = true;
do
{
valid = true;
Expand Down
2 changes: 1 addition & 1 deletion src/extlibs/er_force_sim/src/amun/simulator/simulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
const float SIMULATOR_SCALE = 10.0f;
const float SUB_TIMESTEP = 1 / 200.f;
const float COLLISION_MARGIN = 0.04f;
const unsigned FOCAL_LENGTH = 390;
const float FOCAL_LENGTH = 390.f;


class QByteArray;
Expand Down
8 changes: 8 additions & 0 deletions src/proto/message_translation/tbots_protobuf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def create_world_state(
blue_robot_locations: list[tbots_cpp.Point],
ball_location: tbots_cpp.Point,
ball_velocity: tbots_cpp.Vector,
blue_robot_orientations: list[float] = [],
) -> WorldState:
"""Initializes the world from a list of robot locations and ball location/velocity.

Expand All @@ -20,6 +21,7 @@ def create_world_state(
:param blue_robot_locations: A list of blue robot locations
:param ball_location: Location of the ball
:param ball_velocity: Velocity of the ball
:param blue_robot_orientations: A list of blue robots orientations

"""
world_state = WorldState()
Expand All @@ -35,11 +37,17 @@ def create_world_state(
)

for robot_id, robot_location in enumerate(blue_robot_locations):
orientation = 0
try:
orientation = blue_robot_orientations[robot_id]
except IndexError:
pass
world_state.blue_robots[robot_id].CopyFrom(
RobotState(
global_position=Point(
x_meters=robot_location.x(), y_meters=robot_location.y()
),
global_orientation=Angle(radians=orientation),
)
)

Expand Down
7 changes: 6 additions & 1 deletion src/proto/parameters.proto
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ message PassingConfig
];
// The minimum pass speed (in m/s)
required double min_pass_speed_m_per_s = 6
[default = 4.3, (bounds).min_double_value = 0.0, (bounds).max_double_value = 5.0];
[default = 1, (bounds).min_double_value = 0.0, (bounds).max_double_value = 5.0];
// The maximum pass speed (in m/s)
required double max_pass_speed_m_per_s = 7 [
default = 6.0,
Expand All @@ -130,6 +130,11 @@ message PassingConfig
[default = 2, (bounds).min_int_value = 0, (bounds).max_int_value = 100];
// Cost visualization parameters
required CostVisualizationConfig cost_vis_config = 10;
// The max speed at which a pass should be received
LiCody marked this conversation as resolved.
Show resolved Hide resolved
required double max_receive_speed = 11
[default = 2.0, (bounds).min_double_value = 1.0, (bounds).max_double_value = 4.0];
required double backwards_pass_distance = 13
[default = 0.5, (bounds).min_double_value = 0.0, (bounds).max_double_value = 2.0];
}

message GoalieTacticConfig
Expand Down
21 changes: 20 additions & 1 deletion src/shared/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ static const double BALL_MAX_RADIUS_METERS = 0.0215;
static const double MAX_FRACTION_OF_BALL_COVERED_BY_ROBOT = 0.2;

// The mass of a standard golf ball, as defined by https://en.wikipedia.org/wiki/Golf_ball
static const double BALL_MASS_KG = 0.004593;
constexpr double BALL_MASS_KG = 0.004593;
// The max allowed speed of the robot when the stop command is issued, in meters per
// second
static const double STOP_COMMAND_ROBOT_MAX_SPEED_METERS_PER_SECOND = 1.5;
Expand All @@ -83,6 +83,25 @@ static const double ENEMY_ROBOT_MAX_ACCELERATION_METERS_PER_SECOND_SQUARED = 4.0

static const double ACCELERATION_DUE_TO_GRAVITY_METERS_PER_SECOND_SQUARED = 9.81;

/*Simulator Constants*/

// these values are set in coordination with other objects the ball will collide with.
// the resulting coefficient of friction is the product of both objects friction value.

// the sliding friction the ball experiences in Newtons
constexpr double BALL_SLIDING_FRICTION_NEWTONS = 1.0;
// the restitution of the ball
constexpr double BALL_RESTITUTION = 1.0;
// the transition factor where the ball goes from sliding to rolling
constexpr double FRICTION_TRANSITION_FACTOR = 5.0 / 7.0;
// the stationary ball speed in m/s
constexpr double STATIONARY_BALL_SPEED_METERS_PER_SECOND = 0.01;
// the deceleration the ball experiences due to rolling friction in m/s^2
constexpr double BALL_ROLLING_FRICTION_DECELERATION_METERS_PER_SECOND_SQUARED = 0.5;
// the deceleration the ball experiences due to sliding friction in m/s^2
constexpr double BALL_SLIDING_FRICTION_DECELERATION_METERS_PER_SECOND_SQUARED =
BALL_SLIDING_FRICTION_NEWTONS / BALL_MASS_KG;

/* Unit Conversion */
static const double MILLIMETERS_PER_METER = 1000.0;
static const double METERS_PER_MILLIMETER = 1.0 / 1000.0;
Expand Down
5 changes: 5 additions & 0 deletions src/software/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ pybind_library(
"//proto/message_translation:ssl_geometry",
"//proto/message_translation:tbots_geometry",
"//shared:robot_constants",
"//software:constants",
"//software/ai/passing:eighteen_zone_pitch_division",
"//software/ai/passing:pass",
"//software/ai/passing:pass_evaluation",
"//software/ai/passing:pass_generator",
"//software/estop:threaded_estop_reader",
"//software/geom:angle",
"//software/geom:point",
Expand Down
Loading
Loading