Remove const qualifier from mjData in mj_geomDistance. The function mj_geomDistance will require data stack space as nativeccd memory is determined from opt.ccd_iterations.
PiperOrigin-RevId: 881946592 Change-Id: I524b9fa41018a581e58647d44de6ca3db4c6608b
This commit is contained in:
committed by
Copybara-Service
parent
64ee2d041f
commit
acf7f030a6
@@ -3293,8 +3293,8 @@ void mj_objectVelocity(const mjModel* m, const mjData* d,
|
|||||||
int objtype, int objid, mjtNum res[6], int flg_local);
|
int objtype, int objid, mjtNum res[6], int flg_local);
|
||||||
void mj_objectAcceleration(const mjModel* m, const mjData* d,
|
void mj_objectAcceleration(const mjModel* m, const mjData* d,
|
||||||
int objtype, int objid, mjtNum res[6], int flg_local);
|
int objtype, int objid, mjtNum res[6], int flg_local);
|
||||||
mjtNum mj_geomDistance(const mjModel* m, const mjData* d, int geom1, int geom2,
|
mjtNum mj_geomDistance(const mjModel* m, mjData* d, int geom1, int geom2, mjtNum distmax,
|
||||||
mjtNum distmax, mjtNum fromto[6]);
|
mjtNum fromto[6]);
|
||||||
void mj_contactForce(const mjModel* m, const mjData* d, int id, mjtNum result[6]);
|
void mj_contactForce(const mjModel* m, const mjData* d, int id, mjtNum result[6]);
|
||||||
void mj_differentiatePos(const mjModel* m, mjtNum* qvel, mjtNum dt,
|
void mj_differentiatePos(const mjModel* m, mjtNum* qvel, mjtNum dt,
|
||||||
const mjtNum* qpos1, const mjtNum* qpos2);
|
const mjtNum* qpos1, const mjtNum* qpos2);
|
||||||
|
|||||||
@@ -609,8 +609,8 @@ MJAPI void mj_objectAcceleration(const mjModel* m, const mjData* d,
|
|||||||
|
|
||||||
// Return smallest signed distance between two geoms and optionally segment from geom1 to geom2.
|
// Return smallest signed distance between two geoms and optionally segment from geom1 to geom2.
|
||||||
// Nullable: fromto
|
// Nullable: fromto
|
||||||
MJAPI mjtNum mj_geomDistance(const mjModel* m, const mjData* d, int geom1, int geom2,
|
MJAPI mjtNum mj_geomDistance(const mjModel* m, mjData* d, int geom1, int geom2, mjtNum distmax,
|
||||||
mjtNum distmax, mjtNum fromto[6]);
|
mjtNum fromto[6]);
|
||||||
|
|
||||||
// Extract 6D force:torque given contact id, in the contact frame.
|
// Extract 6D force:torque given contact id, in the contact frame.
|
||||||
MJAPI void mj_contactForce(const mjModel* m, const mjData* d, int id, mjtNum result[6]);
|
MJAPI void mj_contactForce(const mjModel* m, const mjData* d, int id, mjtNum result[6]);
|
||||||
|
|||||||
@@ -663,7 +663,7 @@ PYBIND11_MODULE(_functions, pymodule) {
|
|||||||
Def<traits::mj_contactForce>(pymodule);
|
Def<traits::mj_contactForce>(pymodule);
|
||||||
Def<traits::mj_geomDistance>(
|
Def<traits::mj_geomDistance>(
|
||||||
pymodule,
|
pymodule,
|
||||||
[](const raw::MjModel* m, const raw::MjData* d,
|
[](const raw::MjModel* m, raw::MjData* d,
|
||||||
int geom1, int geom2, mjtNum distmax,
|
int geom1, int geom2, mjtNum distmax,
|
||||||
std::optional<Eigen::Ref<EigenArrayXX>> fromto) {
|
std::optional<Eigen::Ref<EigenArrayXX>> fromto) {
|
||||||
if (fromto.has_value() && fromto->size() != 6) {
|
if (fromto.has_value() && fromto->size() != 6) {
|
||||||
|
|||||||
@@ -3626,7 +3626,7 @@ FUNCTIONS: Mapping[str, FunctionDecl] = dict([
|
|||||||
FunctionParameterDecl(
|
FunctionParameterDecl(
|
||||||
name='d',
|
name='d',
|
||||||
type=PointerType(
|
type=PointerType(
|
||||||
inner_type=ValueType(name='mjData', is_const=True),
|
inner_type=ValueType(name='mjData'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
FunctionParameterDecl(
|
FunctionParameterDecl(
|
||||||
|
|||||||
@@ -524,7 +524,7 @@ void mj_xfrcAccumulate(const mjModel* m, mjData* d, mjtNum* qfrc) {
|
|||||||
//-------------------------- miscellaneous ---------------------------------------------------------
|
//-------------------------- miscellaneous ---------------------------------------------------------
|
||||||
|
|
||||||
// returns the smallest distance between two geoms (using nativeccd)
|
// returns the smallest distance between two geoms (using nativeccd)
|
||||||
static mjtNum mj_geomDistanceCCD(const mjModel* m, const mjData* d, int g1, int g2,
|
static mjtNum mj_geomDistanceCCD(const mjModel* m, mjData* d, int g1, int g2,
|
||||||
mjtNum distmax, mjtNum fromto[6]) {
|
mjtNum distmax, mjtNum fromto[6]) {
|
||||||
mjCCDConfig config;
|
mjCCDConfig config;
|
||||||
mjCCDStatus status;
|
mjCCDStatus status;
|
||||||
@@ -553,7 +553,7 @@ static mjtNum mj_geomDistanceCCD(const mjModel* m, const mjData* d, int g1, int
|
|||||||
|
|
||||||
|
|
||||||
// returns the smallest distance between two geoms
|
// returns the smallest distance between two geoms
|
||||||
mjtNum mj_geomDistance(const mjModel* m, const mjData* d, int geom1, int geom2, mjtNum distmax,
|
mjtNum mj_geomDistance(const mjModel* m, mjData* d, int geom1, int geom2, mjtNum distmax,
|
||||||
mjtNum fromto[6]) {
|
mjtNum fromto[6]) {
|
||||||
mjContact con[mjMAXCONPAIR];
|
mjContact con[mjMAXCONPAIR];
|
||||||
mjtNum dist = distmax;
|
mjtNum dist = distmax;
|
||||||
|
|||||||
@@ -86,8 +86,8 @@ void mj_xfrcAccumulate(const mjModel* m, mjData* d, mjtNum* qfrc);
|
|||||||
//-------------------------- miscellaneous ---------------------------------------------------------
|
//-------------------------- miscellaneous ---------------------------------------------------------
|
||||||
|
|
||||||
// returns the smallest distance between two geoms
|
// returns the smallest distance between two geoms
|
||||||
MJAPI mjtNum mj_geomDistance(const mjModel* m, const mjData* d, int geom1, int geom2,
|
MJAPI mjtNum mj_geomDistance(const mjModel* m, mjData* d, int geom1, int geom2, mjtNum distmax,
|
||||||
mjtNum distmax, mjtNum fromto[6]);
|
mjtNum fromto[6]);
|
||||||
|
|
||||||
// compute velocity by finite-differencing two positions
|
// compute velocity by finite-differencing two positions
|
||||||
MJAPI void mj_differentiatePos(const mjModel* m, mjtNum* qvel, mjtNum dt,
|
MJAPI void mj_differentiatePos(const mjModel* m, mjtNum* qvel, mjtNum dt,
|
||||||
|
|||||||
@@ -8599,7 +8599,7 @@ void mj_fwdVelocity_wrapper(const MjModel& m, MjData& d) {
|
|||||||
mj_fwdVelocity(m.get(), d.get());
|
mj_fwdVelocity(m.get(), d.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
mjtNum mj_geomDistance_wrapper(const MjModel& m, const MjData& d, int geom1, int geom2, mjtNum distmax, const val& fromto) {
|
mjtNum mj_geomDistance_wrapper(const MjModel& m, MjData& d, int geom1, int geom2, mjtNum distmax, const val& fromto) {
|
||||||
UNPACK_NULLABLE_VALUE(mjtNum, fromto);
|
UNPACK_NULLABLE_VALUE(mjtNum, fromto);
|
||||||
CHECK_SIZE(fromto, 6);
|
CHECK_SIZE(fromto, 6);
|
||||||
return mj_geomDistance(m.get(), d.get(), geom1, geom2, distmax, fromto_.data());
|
return mj_geomDistance(m.get(), d.get(), geom1, geom2, distmax, fromto_.data());
|
||||||
|
|||||||
Reference in New Issue
Block a user