chrono::utils Namespace Reference

Description

Chrono core utilities.

Classes

class  ChAbsorbedPowerVertical
 Filter for vertical absorbed power. More...
 
class  ChAnalogueFilter
 Base class for simulated analogue filters in the time domain. More...
 
class  ChBenchmarkFixture
 Generic benchmark fixture for Chrono tests. More...
 
class  ChBenchmarkTest
 Base class for a Chrono benchmark test. More...
 
class  ChButterworthHighpass
 Butterworth high-pass filter. More...
 
class  ChButterworthLowpass
 Butterworth low-pass filter. More...
 
class  ChChaseCamera
 Utility class for a generic chase camera which can be associated with any ChBody in a Chrono system. More...
 
class  ChControllerPID
 Simple PID controller. More...
 
class  ChConvexHull2D
 Simple 2D convex hull class. More...
 
class  ChFilterD
 Caclulate the time derivation of an input signal: H(s) = Td * s. More...
 
class  ChFilterI
 Calculate the integral of an input signal in the time domain: H(s) = 1 / ( Ti * s) More...
 
class  ChFilterPD1
 PD1 controller: H(s) = Kdt1 * ( Td1 * s + 1 ) More...
 
class  ChFilterPDT1
 PDT1 controller: H(s) = Kp * ( Td1 * s + 1 ) / ( T1 * s + 1) More...
 
class  ChFilterPT1
 Delay an input signal: H(s) = Kpt1 / ( T1 * s + 1 ) More...
 
class  ChGenerator
 Provides functionality for generating sets of bodies with positions drawn from a specified sampler and various mixture properties. More...
 
class  ChGridSampler
 Sampler for 3D volumes using a regular (equidistant) grid. More...
 
class  ChHCPSampler
 Sampler for 3D volumes using a Hexagonally Close Packed structure. More...
 
class  ChISO2631_1_Wd
 Combined filter Wd. More...
 
class  ChISO2631_1_Wf
 Combined filter Wf. More...
 
class  ChISO2631_1_Wk
 Combined filter Wk. More...
 
class  ChISO2631_5_Wxy
 ISO2631-5 weighting filter for shock like signal in horizontal direction. More...
 
class  ChISO2631_5_Wz
 ISO2631-5 weighting filter for shock like signal in vertical direction. More...
 
class  ChISO2631_Shock_SeatCushionLogger
 Easy to use class for evaluation of ISO 2361-5 shock load on sitting vehicle occupants. More...
 
class  ChISO2631_Vibration_SeatCushionLogger
 Easy to use class for evaluation of ISO 2361-1 vibration load on sitting vehicle occupants Input: 3 seat accelerations x,y,z in [m/s^2]. More...
 
class  ChMixtureIngredient
 Encapsulation of an ingredient of one of the supported types in a mixture. More...
 
class  ChMotionFilter
 Base class for smoothing basic motion laws with discrete time-domain nonlinear filters. More...
 
class  ChMotionFilterSecondOrder
 Second-order nonlinear filter for smoothing basic motion laws (e.g. More...
 
class  ChMotionFilterThirdOrder
 Third-order nonlinear filter for smoothing basic motion laws (e.g. More...
 
class  ChMovingAverage
 Moving average filter for smoothing a data array. More...
 
class  ChPDGrid
 Simple 3D grid utility class for use by the Poisson Disk sampler. More...
 
class  ChPDSampler
 Sampler for 3D domains (box, sphere, or cylinder) using Poisson Disk Sampling. More...
 
class  ChProfileIterator
 An iterator to navigate through the tree. More...
 
class  ChProfileManager
 The Manager for the Profile system. More...
 
class  ChProfileNode
 A node in the Profile Hierarchy Tree. More...
 
class  ChProfileSample
 Simple way to profile a function's scope. More...
 
class  ChRunningAverage
 Moving average filter for smoothing running data. More...
 
class  ChSampler
 Base class for different types of point samplers. More...
 
class  ChSocket
 Base class for sockets. Sockets have at least an ID and a port. More...
 
class  ChSocketCommunication
 Class for socket communication interface. More...
 
class  ChSocketFramework
 A single object of this class must be instantiated before using all classes related to sockets, because it initializes some platform-specific settings. More...
 
class  ChSocketHostInfo
 Class for storing information about a TCP host in socket communication, e.g. with an IP address. More...
 
class  ChSocketTCP
 ChSocket for TCP communications. More...
 
class  ChValidation
 This class provides functionality for validation of simulation results. More...
 
class  ChWriterCSV
 ChWriterCSV Simple class to output to a Comma-Separated Values ASCII file. More...
 
class  CompositeInertia
 Utility class for calculating inertia properties of a composite body. More...
 

Typedefs

typedef Types< double >::PointVector PointVectorD
 
typedef Types< float >::PointVector PointVectorF
 
typedef std::vector< std::string > Headers
 Vector of data file headers.
 
typedef std::valarray< double > DataVector
 Vector of data points.
 
typedef std::vector< DataVectorData
 Data table.
 

Enumerations

enum  hostType { NAME, ADDRESS }
 
enum  MixtureType {
  SPHERE, ELLIPSOID, BOX, CYLINDER,
  CONE, CAPSULE
}
 Enumeration of various geometric shapes available for mixtures.
 
enum  POVRayShapeType {
  SPHERE = 0, SPHERE, ELLIPSOID = 1, ELLIPSOID,
  BOX = 2, BOX, CYLINDER = 3, CYLINDER,
  CONVEXHULL = 4, TRIANGLEMESH = 5, BARREL = 6, CAPSULE = 7,
  CAPSULE, CONE = 8, CONE, ROUNDEDBOX = 9,
  ROUNDEDCYL = 10, BEZIER = 11
}
 
enum  POVRayLinkType {
  REVOLUTE = 0, SPHERICAL = 1, PRISMATIC = 2, UNIVERSAL = 3,
  DISTANCE = 4, ENGINE = 5, SPRING = 6, TSDA = 7,
  CYLINDRICAL = 8, REV_SPH = 9
}
 
enum  POVRayLineType { SEGMENT = 0, COIL = 1 }
 
enum  SamplingType { SamplingType::REGULAR_GRID, SamplingType::POISSON_DISK, SamplingType::HCP_PACK }
 Volumetric sampling method. More...
 
enum  ChNormType { L2_NORM, RMS_NORM, INF_NORM }
 Norm types for validation.
 

Functions

double SignedArea (const ChVector2d &p1, const ChVector2d &p2, const ChVector2d &p3)
 
int Orientation (const ChVector2d &p1, const ChVector2d &p2, const ChVector2d &p3)
 
bool InBetween (const ChVector2d &p1, const ChVector2d &p2, const ChVector2d &p3)
 
void Profile_Get_Ticks (unsigned long int *ticks)
 
float Profile_Get_Tick_Rate (void)
 
std::ostream & operator<< (std::ostream &io, ChSocket &s)
 
void AddSphereGeometry (ChBody *body, ChContactMaterialSharedPtr material, double radius, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool visualization=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add a sphere collision shape and optionally a corresponding visualization asset to the specified body. More...
 
void AddEllipsoidGeometry (ChBody *body, ChContactMaterialSharedPtr material, const ChVector3d &axes, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool visualization=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add an ellipsoid collision shape and optionally a corresponding visualization asset to the specified body. More...
 
void AddBoxGeometry (ChBody *body, ChContactMaterialSharedPtr material, const ChVector3d &size, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool visualization=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add a box collision shape and optionally a corresponding visualization asset to the specified body. More...
 
void AddBiSphereGeometry (ChBody *body, ChContactMaterialSharedPtr material, double radius, double cDist, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool visualization=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add a bisphere collision shape and optionally a corresponding visualization asset to the specified body. More...
 
void AddCapsuleGeometry (ChBody *body, ChContactMaterialSharedPtr material, double radius, double height, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool visualization=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add a capsule shape and optionally a corresponding visualization asset to the specified body. More...
 
void AddCylinderGeometry (ChBody *body, ChContactMaterialSharedPtr material, double radius, double height, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool visualization=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add a cylinder shape and optionally a corresponding visualization asset to the specified body. More...
 
void AddCylinderGeometry (ChBody *body, ChContactMaterialSharedPtr material, double radius, const ChVector3d &p1, const ChVector3d &p2, bool visualization=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add a cylinder shape and optionally a corresponding visualization asset to the specified body. More...
 
void AddConeGeometry (ChBody *body, ChContactMaterialSharedPtr material, double radius, double height, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool visualization=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add a cone shape and optionally a corresponding visualization asset to the specified body. More...
 
bool AddTriangleMeshGeometry (ChBody *body, ChContactMaterialSharedPtr material, const std::string &obj_filename, const std::string &name, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool visualization=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add a triangular mesh collision shape and optionally a corresponding visualization asset to the specified body. More...
 
bool AddTriangleMeshConvexDecomposition (ChBody *body, ChContactMaterialSharedPtr material, const std::string &obj_filename, const std::string &name, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), float skin_thickness=0.0f, bool use_original_asset=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add convex hull collision shapes and optionally a corresponding visualization asset to the specified body.
 
bool AddTriangleMeshConvexDecompositionV2 (ChBody *body, ChContactMaterialSharedPtr material, const std::string &obj_filename, const std::string &name, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool use_original_asset=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add convex hull collision shapes and optionally a corresponding visualization asset to the specified body.
 
bool AddTriangleMeshConvexDecompositionSplit (ChSystem *system, ChContactMaterialSharedPtr material, const std::string &obj_filename, const std::string &name, const ChVector3d &pos, const ChQuaterniond &rot, double total_mass)
 Add convex hull collision shapes and optionally a corresponding visualization asset to the specified body.
 
void AddTriangleGeometry (ChBody *body, ChContactMaterialSharedPtr material, const ChVector3d &vertA, const ChVector3d &vertB, const ChVector3d &vertC, const std::string &name, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool visualization=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add a triangle collision shape and optionally a corresponding visualization asset to the specified body. More...
 
void AddRoundedBoxGeometry (ChBody *body, ChContactMaterialSharedPtr material, const ChVector3d &size, double srad, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool visualization=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add a rounded box (sphere-swept box) collision shape and optionally a corresponding visualization asset to the specified body. More...
 
void AddRoundedCylinderGeometry (ChBody *body, ChContactMaterialSharedPtr material, double radius, double height, double srad, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool visualization=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add a rounded cylinder (sphere-swept cylinder) collision shape and optionally a corresponding visualization asset to the specified body. More...
 
void AddTorusGeometry (ChBody *body, ChContactMaterialSharedPtr material, double radius, double thickness, int segments=20, int angle=360, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool visualization=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add a torus collision shape (compound object created with capsules) and optionally a corresponding visualization asset to the specified body.
 
void AddBoxContainer (std::shared_ptr< ChBody > body, ChContactMaterialSharedPtr material, const ChFrame<> &frame, const ChVector3d &size, double thickness, const ChVector3i faces, bool visualization=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add collision shapes representing a box container of specified dimensions to the given body. More...
 
std::shared_ptr< ChBodyCreateBoxContainer (ChSystem *system, ChContactMaterialSharedPtr mat, const ChVector3d &size, double thickness, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool collide=true, bool overlap=true, bool closed=false)
 Create a fixed body with collision and visualization geometry representing a box volume. More...
 
std::shared_ptr< ChBodyCreateCylindricalContainerFromBoxes (ChSystem *system, ChContactMaterialSharedPtr mat, double radius, double height, double thickness, int numBoxes, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool collide=true, bool overlap=true, bool closed=false, bool isBoxBase=true, bool partialVisualization=true)
 Create a fixed body with collision and visualization representing a cylindrical volume. More...
 
bool LoadConvexMesh (const std::string &file_name, ChTriangleMeshConnected &convex_mesh, ChConvexDecompositionHACDv2 &convex_shape, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), int hacd_maxhullcount=1024, int hacd_maxhullmerge=256, int hacd_maxhullvertexes=64, float hacd_concavity=0.01f, float hacd_smallclusterthreshold=0.0f, float hacd_fusetolerance=1e-6f)
 Load an object from a Wavefront OBJ file and generate its convex decomposition.
 
bool LoadConvexHulls (const std::string &file_name, ChTriangleMeshConnected &convex_mesh, std::vector< std::vector< ChVector3d >> &convex_hulls)
 Given a path to an obj file, loads the obj assuming that the individual objects in the obj are convex hulls, useful when loading a precomputed set of convex hulls. More...
 
void AddConvexCollisionModel (std::shared_ptr< ChBody > body, ChContactMaterialSharedPtr material, std::shared_ptr< ChTriangleMeshConnected > convex_mesh, ChConvexDecompositionHACDv2 &convex_shape, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), bool use_original_asset=true, ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Given a convex mesh and its decomposition add it to a ChBody use_original_asset can be used to specify if the mesh or the convex decomp should be used for visualization.
 
void AddConvexCollisionModel (std::shared_ptr< ChBody > body, ChContactMaterialSharedPtr material, std::shared_ptr< ChTriangleMeshConnected > convex_mesh, std::vector< std::vector< ChVector3d >> &convex_hulls, const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaterniond &rot=ChQuaterniond(1, 0, 0, 0), ChVisualMaterialSharedPtr vis_material=ChVisualMaterial::Default())
 Add a convex mesh to an object based on a set of points. More...
 
bool LineLineIntersect (const ChVector3d &p1, const ChVector3d &p2, const ChVector3d &p3, const ChVector3d &p4, ChVector3d *pa, ChVector3d *pb, double *mua, double *mub)
 Calculate the line segment PaPb that is the shortest route between two lines P1P2 and P3P4. More...
 
double PointLineDistance (const ChVector3d &p, const ChVector3d &dA, const ChVector3d &dB, double &mu, bool &is_insegment)
 Calculate distance between a point p and a line identified with segment dA,dB. More...
 
double PointTriangleDistance (const ChVector3d &B, const ChVector3d &A1, const ChVector3d &A2, const ChVector3d &A3, double &mu, double &mv, bool &is_into, ChVector3d &Bprojected)
 Calculate distance of a point from a triangle surface. More...
 
bool DegenerateTriangle (const ChVector3d &Dx, const ChVector3d &Dy)
 Check if the triangle defined by the two given vectors is degenerate.
 
bool DegenerateTriangle (const ChVector3d &v1, const ChVector3d &v2, const ChVector3d &v3)
 Check if the triangle defined by the three given vertices is degenerate.
 
void WriteBodies (ChSystem *system, const std::string &filename, bool active_only=false, bool dump_vel=false, const std::string &delim=",")
 This function dumps to a CSV file pody position, orientation, and optionally linear and angular velocity. More...
 
bool WriteCheckpoint (ChSystem *system, const std::string &filename)
 Create a CSV file with a checkpoint.
 
void ReadCheckpoint (ChSystem *system, const std::string &filename)
 Read a CSV file with a checkpoint.
 
void WriteCamera (const std::string &filename, const ChVector3d &cam_location, const ChVector3d &cam_target, const ChVector3d &camera_upvec, const std::string &delim=",")
 Write CSV output file with camera information for off-line visualization. More...
 
void WriteVisualizationAssets (ChSystem *system, const std::string &filename, bool body_info=true, const std::string &delim=",")
 Write CSV output file with body and asset information for off-line visualization. More...
 
void WriteVisualizationAssets (ChSystem *system, const std::string &filename, std::function< bool(const ChBody &)> selector, bool body_info=true, const std::string &delim=",")
 Write CSV output file with body and asset information for off-line visualization. More...
 
void WriteMeshPovray (ChTriangleMeshConnected &trimesh, const std::string &mesh_name, const std::string &out_dir, const ChColor &color=ChColor(0.4f, 0.4f, 0.4f), const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0), bool smoothed=false)
 Write the specified mesh as a macro in a PovRay include file. More...
 
bool WriteMeshPovray (const std::string &obj_filename, const std::string &mesh_name, const std::string &out_dir, const ChColor &color=ChColor(0.4f, 0.4f, 0.4f), const ChVector3d &pos=ChVector3d(0, 0, 0), const ChQuaternion<> &rot=ChQuaternion<>(1, 0, 0, 0))
 Write the triangular mesh from the specified OBJ file as a macro in a PovRay include file. More...
 
void WriteCurvePovray (const ChBezierCurve &curve, const std::string &curve_name, const std::string &out_dir, double radius=0.03, const ChColor &col=ChColor(0.8f, 0.8f, 0.2f))
 Write the specified Bezier curve as a macro in a PovRay include file.
 
template<typename T >
ChWriterCSVoperator<< (ChWriterCSV &out, const ChVector3< T > &v)
 
template<typename T >
ChWriterCSVoperator<< (ChWriterCSV &out, const ChQuaternion< T > &q)
 
ChWriterCSVoperator<< (ChWriterCSV &out, const ChColor &c)
 
template<typename T >
ChWriterCSVoperator<< (ChWriterCSV &out, const std::vector< T > &vec)
 
std::default_random_engine & rengine ()
 
template<typename T >
sampleTruncatedDist (std::normal_distribution< T > &distribution, T minVal, T maxVal)
 
template<typename T >
std::vector< ChVector3< T > > ChPDLayerSamplerBox (ChVector3< T > center, ChVector3< T > hdims, T diam, T padding_factor=1.02, bool verbose=false)
 Poisson Disk sampler for sampling a 3D box in layers. More...
 
bool Validate (const std::string &sim_filename, const std::string &ref_filename, ChNormType norm_type, double tolerance, DataVector &norms)
 Compare the data in the two specified files. More...
 
bool Validate (const Data &sim_data, const Data &ref_data, ChNormType norm_type, double tolerance, DataVector &norms)
 Compare the data in the two specified structures The comparison is done using the specified norm type and tolerance. More...
 
bool Validate (const std::string &sim_filename, ChNormType norm_type, double tolerance, DataVector &norms)
 Validation of a constraint violation data file. More...
 
bool Validate (const Data &sim_data, ChNormType norm_type, double tolerance, DataVector &norms)
 Validation of a constraint violation data structure. More...
 
void SetValidationDataPath (const std::string &path)
 Set the path to the reference validation data directory. More...
 
const std::string & GetValidationDataPath ()
 Obtain the current path to the reference validation data directory. More...
 
std::string GetValidationDataFile (const std::string &filename)
 Obtain the complete path to the specified filename. More...
 

Variables

const int MSG_HEADER_LEN = sizeof(uint64_t)
 
const int HOST_NAME_LENGTH = 64
 
const int MAX_RECV_LEN = 8096
 
const int MAX_MSG_LEN = 1024
 
const int PORTNUM = 1200
 
template<class T >
constexpr T Pi = T(3.1415926535897932385L)
 

Function Documentation

◆ GetValidationDataFile()

ChApi std::string chrono::utils::GetValidationDataFile ( const std::string &  filename)

Obtain the complete path to the specified filename.

The given filename is assumed to be relative to the reference validation data directory. (thread safe)

◆ GetValidationDataPath()

const ChApi std::string & chrono::utils::GetValidationDataPath ( )

Obtain the current path to the reference validation data directory.

(thread safe)

◆ SetValidationDataPath()

ChApi void chrono::utils::SetValidationDataPath ( const std::string &  path)

Set the path to the reference validation data directory.

(ATTENTION: not thread safe)

◆ Validate() [1/4]

ChApi bool chrono::utils::Validate ( const Data sim_data,
ChNormType  norm_type,
double  tolerance,
DataVector norms 
)

Validation of a constraint violation data structure.

The validation is done using the specified norm type and tolerance. The function returns true if the norms of all columns, excluding the first one, are below the given tolerance and false otherwise.

◆ Validate() [2/4]

ChApi bool chrono::utils::Validate ( const Data sim_data,
const Data ref_data,
ChNormType  norm_type,
double  tolerance,
DataVector norms 
)

Compare the data in the two specified structures The comparison is done using the specified norm type and tolerance.

The function returns true if the norms of all column differences are below the given tolerance and false otherwise.

◆ Validate() [3/4]

ChApi bool chrono::utils::Validate ( const std::string &  sim_filename,
ChNormType  norm_type,
double  tolerance,
DataVector norms 
)

Validation of a constraint violation data file.

The validation is done using the specified norm type and tolerance. The function returns true if the norms of all columns, excluding the first one, are below the given tolerance and false otherwise. It is assumed that the input file is TAB-delimited.

◆ Validate() [4/4]

ChApi bool chrono::utils::Validate ( const std::string &  sim_filename,
const std::string &  ref_filename,
ChNormType  norm_type,
double  tolerance,
DataVector norms 
)

Compare the data in the two specified files.

The comparison is done using the specified norm type and tolerance. The function returns true if the norms of all column differences are below the given tolerance and false otherwise. It is assumed that the input files are TAB-delimited.

◆ WriteBodies()

ChApi void chrono::utils::WriteBodies ( ChSystem system,
const std::string &  filename,
bool  active_only = false,
bool  dump_vel = false,
const std::string &  delim = "," 
)

This function dumps to a CSV file pody position, orientation, and optionally linear and angular velocity.

Optionally, only active bodies are processed.

◆ WriteCamera()

ChApi void chrono::utils::WriteCamera ( const std::string &  filename,
const ChVector3d cam_location,
const ChVector3d cam_target,
const ChVector3d camera_upvec,
const std::string &  delim = "," 
)

Write CSV output file with camera information for off-line visualization.

The output file includes three vectors, one per line, for camera position, camera target (look-at point), and camera up vector, respectively.

◆ WriteMeshPovray() [1/2]

ChApi void chrono::utils::WriteMeshPovray ( ChTriangleMeshConnected trimesh,
const std::string &  mesh_name,
const std::string &  out_dir,
const ChColor color = ChColor(0.4f, 0.4f, 0.4f),
const ChVector3d pos = ChVector3d(0, 0, 0),
const ChQuaternion<> &  rot = ChQuaternion<>(1, 0, 0, 0),
bool  smoothed = false 
)

Write the specified mesh as a macro in a PovRay include file.

The output file will be "[out_dir]/[mesh_name].inc". The mesh vertices will be transformed to the frame with specified offset and orientation.

◆ WriteMeshPovray() [2/2]

ChApi bool chrono::utils::WriteMeshPovray ( const std::string &  obj_filename,
const std::string &  mesh_name,
const std::string &  out_dir,
const ChColor color = ChColor(0.4f, 0.4f, 0.4f),
const ChVector3d pos = ChVector3d(0, 0, 0),
const ChQuaternion<> &  rot = ChQuaternion<>(1, 0, 0, 0) 
)

Write the triangular mesh from the specified OBJ file as a macro in a PovRay include file.

The output file will be "[out_dir]/[mesh_name].inc". The mesh vertices will be transformed to the frame with specified offset and orientation.

◆ WriteVisualizationAssets() [1/2]

ChApi void chrono::utils::WriteVisualizationAssets ( ChSystem system,
const std::string &  filename,
bool  body_info = true,
const std::string &  delim = "," 
)

Write CSV output file with body and asset information for off-line visualization.

(1) The first line of the output file contains:

  • the number of bodies (0 if no body information is included below)
  • the number of visual assets
  • the number of links
  • the number of TSDA spring-dampers (2) If the number of bodies is not zero, the next block of lines includes information about the rigid bodies. Each line contains 9 values:
  • the body identifier
  • a flag (1 or 0) indicating whether the body is active or not
  • the body position expressed in global frame
  • the body orientation (as a quaternion, expressed in global frame) (3) The next block of lines includes information about the visual assets. Each line contains:
  • the identifier of the associated body
  • a flag (1 or 0) indicating whether the body is active or not
  • the asset position expresssed in global frame
  • the asset orientation (as a quaternion, expressed in global frame)
  • the visualization asset type (an enum value)
  • geometry information depending on the type above (4) The next block of lines includes information about the joints. Each line contains:
  • the joint type (an enum value)
  • joint position and orientation information depending on the type above (5) The next block of lines includes information about TSDA elements. Each line contains:
  • the type of visual asset (0 for segment or 1 for coil)
  • start point position
  • end point position
Parameters
systemcontaing system
filenameoutput file name
body_infoinclude body state information
delimCSV delimitator

◆ WriteVisualizationAssets() [2/2]

ChApi void chrono::utils::WriteVisualizationAssets ( ChSystem system,
const std::string &  filename,
std::function< bool(const ChBody &)>  selector,
bool  body_info = true,
const std::string &  delim = "," 
)

Write CSV output file with body and asset information for off-line visualization.

This version uses a discriminator function to select which bodies and assets are included in the output. The function selector receives as argument a body reference and must return 'true' if the body and its assets should be included in the output file and 'false' otherwise.

Parameters
systemcontaing system
filenameoutput file name
selectorselect bodies
body_infoinclude body state information
delimCSV delimitator