JSim 2026.06.01-p(1)
Loading...
Searching...
No Matches
frcsim::FieldObstacle Struct Reference

Convenience wrapper for constructing EnvironmentalBoundary-based obstacles. More...

#include <obstacle.hpp>

Static Public Member Functions

static FieldObstacle makePlane (const Vector3 &point_m, const Quaternion &orientation, double restitution=0.3, double friction=0.6, int user_id=0)
 Creates an infinite plane obstacle.
static FieldObstacle makeBox (const Vector3 &center_m, const Vector3 &half_extents_m, const Quaternion &orientation=Quaternion(), double restitution=0.3, double friction=0.6, int user_id=0)
 Creates an oriented box obstacle.
static FieldObstacle makeCylinder (const Vector3 &center_m, double radius_m, double half_height_m, const Quaternion &orientation=Quaternion(), double restitution=0.3, double friction=0.6, int user_id=0)
 Creates an oriented cylinder obstacle aligned to local Z.

Public Attributes

EnvironmentalBoundary boundary {}

Detailed Description

Convenience wrapper for constructing EnvironmentalBoundary-based obstacles.

Member Function Documentation

◆ makeBox()

FieldObstacle frcsim::FieldObstacle::makeBox ( const Vector3 & center_m,
const Vector3 & half_extents_m,
const Quaternion & orientation = Quaternion(),
double restitution = 0.3,
double friction = 0.6,
int user_id = 0 )
inlinestatic

Creates an oriented box obstacle.

Parameters
center_mBox center in world coordinates.
half_extents_mPositive half-lengths along local X/Y/Z axes.
orientationBox orientation quaternion.
restitutionNormal restitution coefficient. Default 0.3 keeps collisions plausibly inelastic for most FRC-style field interactions while still allowing visible bounce in high-speed impacts.
frictionTangential friction coefficient. Default 0.6 gives balanced tangential damping (less endless sliding along walls, without overly abrupt sticking in grazing contacts).
user_idOptional tag for custom behavior grouping. Default 0 means "unclassified"; assign other values when you need to identify this obstacle in custom behavior or telemetry code.

Quaternion note: use Quaternion::fromEuler(roll, pitch, yaw) to rotate away from axis alignment.

◆ makeCylinder()

FieldObstacle frcsim::FieldObstacle::makeCylinder ( const Vector3 & center_m,
double radius_m,
double half_height_m,
const Quaternion & orientation = Quaternion(),
double restitution = 0.3,
double friction = 0.6,
int user_id = 0 )
inlinestatic

Creates an oriented cylinder obstacle aligned to local Z.

Parameters
center_mCylinder center in world coordinates.
radius_mCylinder radius.
half_height_mHalf of cylinder height along local Z.
orientationCylinder orientation quaternion.
restitutionNormal restitution coefficient. Default 0.3 for the same reason as other boundary factories: generally damped contacts that still show rebound at speed.
frictionTangential friction coefficient. Default 0.6 to represent typical non-ice, non-rubberized field contact behavior.
user_idOptional tag for custom behavior grouping. Default 0; set to a custom ID when this cylinder must be distinguished from other obstacles during contact handling.

Example:

auto q = Quaternion::fromEuler(0.0, 0.0, 1.57079632679); // rotate 90 deg
about Z auto post = FieldObstacle::makeCylinder(Vector3(2.0, 1.0, 0.6),
0.15, 0.6, q);
static FieldObstacle makeCylinder(const Vector3 &center_m, double radius_m, double half_height_m, const Quaternion &orientation=Quaternion(), double restitution=0.3, double friction=0.6, int user_id=0)
Creates an oriented cylinder obstacle aligned to local Z.
Definition obstacle.hpp:112
3D vector utility used throughout JSim physics.
Definition vector.hpp:22

◆ makePlane()

FieldObstacle frcsim::FieldObstacle::makePlane ( const Vector3 & point_m,
const Quaternion & orientation,
double restitution = 0.3,
double friction = 0.6,
int user_id = 0 )
inlinestatic

Creates an infinite plane obstacle.

Parameters
point_mA point on the plane in world coordinates.
orientationPlane orientation; local +Z is treated as outward normal.
restitutionNormal restitution coefficient. Default is 0.3, chosen as a conservative "not perfectly rigid" value for common field elements (wood, polycarbonate, carpet transitions). Lower values reduce bounce and help objects settle; higher values increase rebound speed and can make trajectories livelier but less damped.
frictionTangential friction coefficient. Default is 0.6, which approximates moderate grip so glancing contacts lose tangential speed without unrealistically sticking. Lower values permit more sliding; higher values increase scrub/rolling slowdown.
user_idOptional tag for custom behavior grouping. Default is 0 (no special grouping). Use non-zero IDs to classify boundaries for custom contact logic, filtering, analytics, or game-specific rules.

Member Data Documentation

◆ boundary

EnvironmentalBoundary frcsim::FieldObstacle::boundary {}

Underlying boundary object consumed by BallGamepieceSim.


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