JSim 2026.06.01-p(1)
Loading...
Searching...
No Matches
frcsim::Gamepiece Class Reference

Generic runtime gamepiece abstraction. More...

#include <gamepiece.hpp>

Inheritance diagram for frcsim::Gamepiece:
frcsim::BallPhysicsSim3D frcsim::Ball frcsim::Season2025Gamepiece frcsim::Season2026Gamepiece

Public Types

enum class  State { kAirborne , kGrounded , kHeld }
using Config = BallPhysicsSim3D::Config
using Properties = BallPhysicsSim3D::BallProperties

Public Member Functions

 Gamepiece ()=default
 Gamepiece (const BallPhysicsSim3D::Config &cfg, const BallPhysicsSim3D::BallProperties &props)
void setGamepieceState (State s)
State getGamepieceState () const
bool pick (const PickupRequest &req)
 Attempt to pick up the gamepiece into a carrier. Delegates to BallPhysicsSim3D::requestPickup and flips state to kHeld on success.
void place (const Vector3 &pos)
 Place the gamepiece at world position and mark as grounded.
void outtake (const Vector3 &muzzle_position_m, const Vector3 &muzzle_velocity_mps, const Vector3 &muzzle_spin_radps=Vector3::zero())
 Outtake (launch) the gamepiece into free flight and mark as airborne.
void step (double dt_s)
 Step wrapper that applies low-cost behavior for grounded/held.
void setTypeName (const std::string &name)
const std::string & typeName () const
bool isBall () const
 BallPhysicsSim3D ()=default
 BallPhysicsSim3D (const Config &config)
 BallPhysicsSim3D (const Config &config, const BallProperties &ball_properties)
Public Member Functions inherited from frcsim::BallPhysicsSim3D
 BallPhysicsSim3D ()=default
 BallPhysicsSim3D (const Config &config)
 BallPhysicsSim3D (const Config &config, const BallProperties &ball_properties)
const Configconfig () const
 Returns active, sanitized configuration.
void setConfig (const Config &config)
 Replaces configuration after value sanitization and clamping.
const BallPropertiesballProperties () const
 Returns active, sanitized ball properties.
void setBallProperties (const BallProperties &props)
 Replaces ball properties after sanitization.
const BallStatestate () const
 Returns current ball state.
void setState (const BallState &state)
 Replaces state and sanitizes non-finite values.
void setCarrierPose (const Vector3 &carrier_position_m, const Vector3 &carrier_velocity_mps=Vector3::zero())
 Updates carrier pose used when the ball is in held mode.
bool requestPickup (const PickupRequest &pickup_request)
 Attempts to pick up and hold the ball.
void release ()
 Releases the ball from held mode without changing velocity.
void shoot (const Vector3 &muzzle_position_m, const Vector3 &muzzle_velocity_mps, const Vector3 &muzzle_spin_radps=Vector3::zero())
 Places the ball at a muzzle pose and sets launch velocity/spin.
void step (double dt_s)
 Advances simulation by dt seconds.

Detailed Description

Generic runtime gamepiece abstraction.

For now this type is a thin specialization of BallPhysicsSim3D to provide a single top-level gamepiece abstraction that can be extended later for other hitbox families (boxes, custom CAD meshes, etc.).

Member Typedef Documentation

◆ Config

◆ Properties

Member Enumeration Documentation

◆ State

enum class frcsim::Gamepiece::State
strong
Enumerator
kAirborne 
kGrounded 
kHeld 

Constructor & Destructor Documentation

◆ Gamepiece() [1/2]

frcsim::Gamepiece::Gamepiece ( )
default

◆ Gamepiece() [2/2]

frcsim::Gamepiece::Gamepiece ( const BallPhysicsSim3D::Config & cfg,
const BallPhysicsSim3D::BallProperties & props )
inline

Member Function Documentation

◆ BallPhysicsSim3D() [1/3]

◆ BallPhysicsSim3D() [2/3]

frcsim::BallPhysicsSim3D::BallPhysicsSim3D ( const Config & config)
inlineexplicit

◆ BallPhysicsSim3D() [3/3]

frcsim::BallPhysicsSim3D::BallPhysicsSim3D ( const Config & config,
const BallProperties & ball_properties )
inline

◆ getGamepieceState()

State frcsim::Gamepiece::getGamepieceState ( ) const
inline

◆ isBall()

bool frcsim::Gamepiece::isBall ( ) const
inline

Returns true when this gamepiece should use the ball physics path.

◆ outtake()

void frcsim::Gamepiece::outtake ( const Vector3 & muzzle_position_m,
const Vector3 & muzzle_velocity_mps,
const Vector3 & muzzle_spin_radps = Vector3::zero() )
inline

Outtake (launch) the gamepiece into free flight and mark as airborne.

◆ pick()

bool frcsim::Gamepiece::pick ( const PickupRequest & req)
inline

Attempt to pick up the gamepiece into a carrier. Delegates to BallPhysicsSim3D::requestPickup and flips state to kHeld on success.

◆ place()

void frcsim::Gamepiece::place ( const Vector3 & pos)
inline

Place the gamepiece at world position and mark as grounded.

◆ setGamepieceState()

void frcsim::Gamepiece::setGamepieceState ( State s)
inline

◆ setTypeName()

void frcsim::Gamepiece::setTypeName ( const std::string & name)
inline

Set a human-readable type name for this gamepiece (e.g. "generic_sphere").

◆ step()

void frcsim::Gamepiece::step ( double dt_s)
inline

Step wrapper that applies low-cost behavior for grounded/held.

◆ typeName()

const std::string & frcsim::Gamepiece::typeName ( ) const
inline

Get the registered type name (may be empty).


The documentation for this class was generated from the following file: