Fix formatting in documentation code samples.
PiperOrigin-RevId: 652237833 Change-Id: Ia90fadccba39881748a7ead15db3285e00feb08f
This commit is contained in:
committed by
Copybara-Service
parent
22a10fd2ff
commit
3d28a1d8c7
+3
-4
@@ -207,12 +207,10 @@ rendering, is given below.
|
|||||||
mjModel* m;
|
mjModel* m;
|
||||||
mjData* d;
|
mjData* d;
|
||||||
|
|
||||||
int main(void)
|
int main(void) {
|
||||||
{
|
|
||||||
// load model from file and check for errors
|
// load model from file and check for errors
|
||||||
m = mj_loadXML("hello.xml", NULL, error, 1000);
|
m = mj_loadXML("hello.xml", NULL, error, 1000);
|
||||||
if( !m )
|
if (!m) {
|
||||||
{
|
|
||||||
printf("%s\n", error);
|
printf("%s\n", error);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -826,6 +824,7 @@ convention. Suppose we already have ``mjModel* m``. To print the range of a join
|
|||||||
if (jntid >= 0)
|
if (jntid >= 0)
|
||||||
printf("(%f, %f)\n", m->jnt_range[2*jntid], m->jnt_range[2*jntid+1]);
|
printf("(%f, %f)\n", m->jnt_range[2*jntid], m->jnt_range[2*jntid+1]);
|
||||||
|
|
||||||
|
|
||||||
If the name is not found the function returns -1, which is why one should always check for id>=0.
|
If the name is not found the function returns -1, which is why one should always check for id>=0.
|
||||||
|
|
||||||
.. _BodyGeomSite:
|
.. _BodyGeomSite:
|
||||||
|
|||||||
@@ -107,8 +107,7 @@ The default (and recommended) way to control the system is to implement a contro
|
|||||||
.. code-block:: C
|
.. code-block:: C
|
||||||
|
|
||||||
// simple controller applying damping to each dof
|
// simple controller applying damping to each dof
|
||||||
void mycontroller(const mjModel* m, mjData* d)
|
void mycontroller(const mjModel* m, mjData* d) {
|
||||||
{
|
|
||||||
if (m->nu == m->nv)
|
if (m->nu == m->nv)
|
||||||
mju_scl(d->ctrl, d->qvel, -0.1, m->nv);
|
mju_scl(d->ctrl, d->qvel, -0.1, m->nv);
|
||||||
}
|
}
|
||||||
@@ -206,8 +205,7 @@ mj_step2 regardless of the setting of ``mjModel.opt.integrator``.
|
|||||||
|
|
||||||
.. code-block:: C
|
.. code-block:: C
|
||||||
|
|
||||||
void mj_step1(const mjModel* m, mjData* d)
|
void mj_step1(const mjModel* m, mjData* d) {
|
||||||
{
|
|
||||||
mj_checkPos(m, d);
|
mj_checkPos(m, d);
|
||||||
mj_checkVel(m, d);
|
mj_checkVel(m, d);
|
||||||
mj_fwdPosition(m, d);
|
mj_fwdPosition(m, d);
|
||||||
@@ -222,8 +220,7 @@ mj_step2 regardless of the setting of ``mjModel.opt.integrator``.
|
|||||||
mjcb_control(m, d);
|
mjcb_control(m, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mj_step2(const mjModel* m, mjData* d)
|
void mj_step2(const mjModel* m, mjData* d) {
|
||||||
{
|
|
||||||
mj_fwdActuation(m, d);
|
mj_fwdActuation(m, d);
|
||||||
mj_fwdAcceleration(m, d);
|
mj_fwdAcceleration(m, d);
|
||||||
mj_fwdConstraint(m, d);
|
mj_fwdConstraint(m, d);
|
||||||
@@ -372,8 +369,7 @@ skip arguments (mjSTAGE_NONE, 0), where the latter function is implemented as
|
|||||||
|
|
||||||
void mj_forwardSkip(const mjModel* m, mjData* d, int skipstage, int skipsensor) {
|
void mj_forwardSkip(const mjModel* m, mjData* d, int skipstage, int skipsensor) {
|
||||||
// position-dependent
|
// position-dependent
|
||||||
if( skipstage<mjSTAGE_POS )
|
if (skipstage < mjSTAGE_POS) {
|
||||||
{
|
|
||||||
mj_fwdPosition(m, d);
|
mj_fwdPosition(m, d);
|
||||||
if (!skipsensor)
|
if (!skipsensor)
|
||||||
mj_sensorPos(m, d);
|
mj_sensorPos(m, d);
|
||||||
@@ -382,8 +378,7 @@ skip arguments (mjSTAGE_NONE, 0), where the latter function is implemented as
|
|||||||
}
|
}
|
||||||
|
|
||||||
// velocity-dependent
|
// velocity-dependent
|
||||||
if( skipstage<mjSTAGE_VEL )
|
if (skipstage < mjSTAGE_VEL) {
|
||||||
{
|
|
||||||
mj_fwdVelocity(m, d);
|
mj_fwdVelocity(m, d);
|
||||||
if (!skipsensor)
|
if (!skipsensor)
|
||||||
mj_sensorVel(m, d);
|
mj_sensorVel(m, d);
|
||||||
|
|||||||
Reference in New Issue
Block a user