Fix function definition formatting.
PiperOrigin-RevId: 691782530 Change-Id: Ib1611285e77e274b17074d5f09ede00cdc0c6f0f
This commit is contained in:
committed by
Copybara-Service
parent
94bbf297fc
commit
18682aac6a
@@ -63,8 +63,7 @@ static void mjd_cross(const mjtNum a[3], const mjtNum b[3],
|
|||||||
|
|
||||||
|
|
||||||
// derivative of mju_crossMotion w.r.t velocity
|
// derivative of mju_crossMotion w.r.t velocity
|
||||||
static void mjd_crossMotion_vel(mjtNum D[36], const mjtNum v[6])
|
static void mjd_crossMotion_vel(mjtNum D[36], const mjtNum v[6]) {
|
||||||
{
|
|
||||||
mju_zero(D, 36);
|
mju_zero(D, 36);
|
||||||
|
|
||||||
// res[0] = -vel[2]*v[1] + vel[1]*v[2]
|
// res[0] = -vel[2]*v[1] + vel[1]*v[2]
|
||||||
@@ -101,8 +100,7 @@ static void mjd_crossMotion_vel(mjtNum D[36], const mjtNum v[6])
|
|||||||
|
|
||||||
|
|
||||||
// derivative of mju_crossForce w.r.t. velocity
|
// derivative of mju_crossForce w.r.t. velocity
|
||||||
static void mjd_crossForce_vel(mjtNum D[36], const mjtNum f[6])
|
static void mjd_crossForce_vel(mjtNum D[36], const mjtNum f[6]) {
|
||||||
{
|
|
||||||
mju_zero(D, 36);
|
mju_zero(D, 36);
|
||||||
|
|
||||||
// res[0] = -vel[2]*f[1] + vel[1]*f[2] - vel[5]*f[4] + vel[4]*f[5]
|
// res[0] = -vel[2]*f[1] + vel[1]*f[2] - vel[5]*f[4] + vel[4]*f[5]
|
||||||
@@ -139,8 +137,7 @@ static void mjd_crossForce_vel(mjtNum D[36], const mjtNum f[6])
|
|||||||
|
|
||||||
|
|
||||||
// derivative of mju_crossForce w.r.t. force
|
// derivative of mju_crossForce w.r.t. force
|
||||||
static void mjd_crossForce_frc(mjtNum D[36], const mjtNum vel[6])
|
static void mjd_crossForce_frc(mjtNum D[36], const mjtNum vel[6]) {
|
||||||
{
|
|
||||||
mju_zero(D, 36);
|
mju_zero(D, 36);
|
||||||
|
|
||||||
// res[0] = -vel[2]*f[1] + vel[1]*f[2] - vel[5]*f[4] + vel[4]*f[5]
|
// res[0] = -vel[2]*f[1] + vel[1]*f[2] - vel[5]*f[4] + vel[4]*f[5]
|
||||||
@@ -177,8 +174,7 @@ static void mjd_crossForce_frc(mjtNum D[36], const mjtNum vel[6])
|
|||||||
|
|
||||||
|
|
||||||
// derivative of mju_mulInertVec w.r.t vel
|
// derivative of mju_mulInertVec w.r.t vel
|
||||||
static void mjd_mulInertVec_vel(mjtNum D[36], const mjtNum i[10])
|
static void mjd_mulInertVec_vel(mjtNum D[36], const mjtNum i[10]) {
|
||||||
{
|
|
||||||
mju_zero(D, 36);
|
mju_zero(D, 36);
|
||||||
|
|
||||||
// res[0] = i[0]*v[0] + i[3]*v[1] + i[4]*v[2] - i[8]*v[4] + i[7]*v[5]
|
// res[0] = i[0]*v[0] + i[3]*v[1] + i[4]*v[2] - i[8]*v[4] + i[7]*v[5]
|
||||||
@@ -221,8 +217,7 @@ static void mjd_mulInertVec_vel(mjtNum D[36], const mjtNum i[10])
|
|||||||
|
|
||||||
|
|
||||||
// derivative of mju_subQuat w.r.t inputs
|
// derivative of mju_subQuat w.r.t inputs
|
||||||
void mjd_subQuat(const mjtNum qa[4], const mjtNum qb[4], mjtNum Da[9], mjtNum Db[9])
|
void mjd_subQuat(const mjtNum qa[4], const mjtNum qb[4], mjtNum Da[9], mjtNum Db[9]) {
|
||||||
{
|
|
||||||
// no outputs, quick return
|
// no outputs, quick return
|
||||||
if (!Da && !Db) {
|
if (!Da && !Db) {
|
||||||
return;
|
return;
|
||||||
@@ -330,8 +325,7 @@ void mjd_quatIntegrate(const mjtNum vel[3], mjtNum scale,
|
|||||||
// no longer used, except in tests
|
// no longer used, except in tests
|
||||||
|
|
||||||
// derivative of cvel, cdof_dot w.r.t qvel (dense version)
|
// derivative of cvel, cdof_dot w.r.t qvel (dense version)
|
||||||
static void mjd_comVel_vel_dense(const mjModel* m, mjData* d, mjtNum* Dcvel, mjtNum* Dcdofdot)
|
static void mjd_comVel_vel_dense(const mjModel* m, mjData* d, mjtNum* Dcvel, mjtNum* Dcdofdot) {
|
||||||
{
|
|
||||||
int nv = m->nv, nbody = m->nbody;
|
int nv = m->nv, nbody = m->nbody;
|
||||||
mjtNum mat[36];
|
mjtNum mat[36];
|
||||||
|
|
||||||
@@ -969,8 +963,7 @@ static void mjd_addedMassForces(
|
|||||||
static inline void mjd_viscous_torque(
|
static inline void mjd_viscous_torque(
|
||||||
mjtNum* restrict D, const mjtNum lvel[6], const mjtNum fluid_density,
|
mjtNum* restrict D, const mjtNum lvel[6], const mjtNum fluid_density,
|
||||||
const mjtNum fluid_viscosity, const mjtNum size[3],
|
const mjtNum fluid_viscosity, const mjtNum size[3],
|
||||||
const mjtNum slender_drag_coef, const mjtNum ang_drag_coef)
|
const mjtNum slender_drag_coef, const mjtNum ang_drag_coef) {
|
||||||
{
|
|
||||||
const mjtNum d_max = mju_max(mju_max(size[0], size[1]), size[2]);
|
const mjtNum d_max = mju_max(mju_max(size[0], size[1]), size[2]);
|
||||||
const mjtNum d_min = mju_min(mju_min(size[0], size[1]), size[2]);
|
const mjtNum d_min = mju_min(mju_min(size[0], size[1]), size[2]);
|
||||||
const mjtNum d_mid = size[0] + size[1] + size[2] - d_max - d_min;
|
const mjtNum d_mid = size[0] + size[1] + size[2] - d_max - d_min;
|
||||||
@@ -1280,8 +1273,7 @@ void mjd_ellipsoidFluid(const mjModel* m, mjData* d, int bodyid) {
|
|||||||
|
|
||||||
|
|
||||||
// fluid forces based on inertia-box approximation
|
// fluid forces based on inertia-box approximation
|
||||||
void mjd_inertiaBoxFluid(const mjModel* m, mjData* d, int i)
|
void mjd_inertiaBoxFluid(const mjModel* m, mjData* d, int i) {
|
||||||
{
|
|
||||||
mj_markStack(d);
|
mj_markStack(d);
|
||||||
|
|
||||||
int nv = m->nv;
|
int nv = m->nv;
|
||||||
|
|||||||
@@ -1046,10 +1046,9 @@ int mju_QCQP(mjtNum* res, const mjtNum* Ain, const mjtNum* bin,
|
|||||||
// R must have allocatd size n*(n+7), but only nfree*nfree values are used in output
|
// R must have allocatd size n*(n+7), but only nfree*nfree values are used in output
|
||||||
// index (if given) must have allocated size n, but only nfree values are used in output
|
// index (if given) must have allocated size n, but only nfree values are used in output
|
||||||
// only lower triangles of H and R and read from and written to, respectively
|
// only lower triangles of H and R and read from and written to, respectively
|
||||||
int mju_boxQP(mjtNum* res, mjtNum* R, int* index, // outputs
|
int mju_boxQP(mjtNum* res, mjtNum* R, int* index,
|
||||||
const mjtNum* H, const mjtNum* g, int n, // QP definition
|
const mjtNum* H, const mjtNum* g, int n,
|
||||||
const mjtNum* lower, const mjtNum* upper) // bounds
|
const mjtNum* lower, const mjtNum* upper) {
|
||||||
{
|
|
||||||
// algorithm options
|
// algorithm options
|
||||||
int maxiter = 100; // maximum number of iterations
|
int maxiter = 100; // maximum number of iterations
|
||||||
mjtNum mingrad = 1E-16; // minimum squared norm of (unclamped) gradient
|
mjtNum mingrad = 1E-16; // minimum squared norm of (unclamped) gradient
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ mjtNum mjv_frustumHeight(const mjvScene* scn) {
|
|||||||
|
|
||||||
|
|
||||||
// rotate 3D vec in horizontal plane by angle between (0,1) and (forward_x,forward_y)
|
// rotate 3D vec in horizontal plane by angle between (0,1) and (forward_x,forward_y)
|
||||||
MJAPI void mjv_alignToCamera(mjtNum* res, const mjtNum* vec, const mjtNum* forward) {
|
void mjv_alignToCamera(mjtNum* res, const mjtNum* vec, const mjtNum* forward) {
|
||||||
mjtNum xaxis[2], yaxis[2];
|
mjtNum xaxis[2], yaxis[2];
|
||||||
|
|
||||||
// forward-aligned y-axis
|
// forward-aligned y-axis
|
||||||
|
|||||||
@@ -394,9 +394,9 @@ void mjv_updateSceneState(const mjModel* m, mjData* d, const mjvOption* opt,
|
|||||||
|
|
||||||
|
|
||||||
// move camera with mouse given a scene state; action is mjtMouse
|
// move camera with mouse given a scene state; action is mjtMouse
|
||||||
MJAPI void mjv_moveCameraFromState(const mjvSceneState* scnstate, int action,
|
void mjv_moveCameraFromState(const mjvSceneState* scnstate, int action,
|
||||||
mjtNum reldx, mjtNum reldy,
|
mjtNum reldx, mjtNum reldy,
|
||||||
const mjvScene* scn, mjvCamera* cam) {
|
const mjvScene* scn, mjvCamera* cam) {
|
||||||
mjModel m;
|
mjModel m;
|
||||||
mjv_assignFromSceneState(scnstate, &m, NULL);
|
mjv_assignFromSceneState(scnstate, &m, NULL);
|
||||||
mjv_moveCamera(&m, action, reldx, reldy, scn, cam);
|
mjv_moveCamera(&m, action, reldx, reldy, scn, cam);
|
||||||
@@ -405,9 +405,9 @@ MJAPI void mjv_moveCameraFromState(const mjvSceneState* scnstate, int action,
|
|||||||
|
|
||||||
|
|
||||||
// move perturb object with mouse given a scene state; action is mjtMouse
|
// move perturb object with mouse given a scene state; action is mjtMouse
|
||||||
MJAPI void mjv_movePerturbFromState(const mjvSceneState* scnstate, int action,
|
void mjv_movePerturbFromState(const mjvSceneState* scnstate, int action,
|
||||||
mjtNum reldx, mjtNum reldy,
|
mjtNum reldx, mjtNum reldy,
|
||||||
const mjvScene* scn, mjvPerturb* pert) {
|
const mjvScene* scn, mjvPerturb* pert) {
|
||||||
mjModel m;
|
mjModel m;
|
||||||
mjData d;
|
mjData d;
|
||||||
mjv_assignFromSceneState(scnstate, &m, &d);
|
mjv_assignFromSceneState(scnstate, &m, &d);
|
||||||
|
|||||||
@@ -440,7 +440,7 @@ mjsTendon* mjs_addTendon(mjSpec* s, mjsDefault* defspec) {
|
|||||||
|
|
||||||
|
|
||||||
// wrap site using tendon
|
// wrap site using tendon
|
||||||
MJAPI mjsWrap* mjs_wrapSite(mjsTendon* tendonspec, const char* name) {
|
mjsWrap* mjs_wrapSite(mjsTendon* tendonspec, const char* name) {
|
||||||
mjCTendon* tendon = static_cast<mjCTendon*>(tendonspec->element);
|
mjCTendon* tendon = static_cast<mjCTendon*>(tendonspec->element);
|
||||||
tendon->WrapSite(name);
|
tendon->WrapSite(name);
|
||||||
return &tendon->path.back()->spec;
|
return &tendon->path.back()->spec;
|
||||||
|
|||||||
Reference in New Issue
Block a user