1 /*************************************************************************
3 * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
4 * All rights reserved. Email: russ@q12.org Web: www.q12.org *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of EITHER: *
8 * (1) The GNU Lesser General Public License as published by the Free *
9 * Software Foundation; either version 2.1 of the License, or (at *
10 * your option) any later version. The text of the GNU Lesser *
11 * General Public License is included with this library in the *
13 * (2) The BSD-style license that is included with this library in *
14 * the file LICENSE-BSD.TXT. *
16 * This library is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
19 * LICENSE.TXT and LICENSE-BSD.TXT for more details. *
21 *************************************************************************/
23 #ifndef _ODE_OBJECTS_H_
24 #define _ODE_OBJECTS_H_
26 #include <ode/common.h>
28 #include <ode/contact.h>
29 #include <ode/threading.h>
36 * @defgroup world World
38 * The world object is a container for rigid bodies and joints. Objects in
39 * different worlds can not interact, for example rigid bodies from two
40 * different worlds can not collide.
42 * All the objects in a world exist at the same point in time, thus one
43 * reason to use separate worlds is to simulate systems at different rates.
44 * Most applications will only need one world.
48 * @brief Create a new, empty world and return its ID number.
49 * @return an identifier
52 ODE_API dWorldID
dWorldCreate(void);
56 * @brief Destroy a world and everything in it.
58 * This includes all bodies, and all joints that are not part of a joint
59 * group. Joints that are part of a joint group will be deactivated, and
60 * can be destroyed by calling, for example, dJointGroupEmpty().
62 * @param world the identifier for the world the be destroyed.
64 ODE_API
void dWorldDestroy (dWorldID world
);
68 * @brief Set the user-data pointer
69 * @param world the world to set the data on
73 ODE_API
void dWorldSetData (dWorldID world
, void* data
);
77 * @brief Get the user-data pointer
78 * @param world the world to set the data on
82 ODE_API
void* dWorldGetData (dWorldID world
);
86 * @brief Set the world's global gravity vector.
88 * The units are m/s^2, so Earth's gravity vector would be (0,0,-9.81),
89 * assuming that +z is up. The default is no gravity, i.e. (0,0,0).
93 ODE_API
void dWorldSetGravity (dWorldID
, dReal x
, dReal y
, dReal z
);
97 * @brief Get the gravity vector for a given world.
100 ODE_API
void dWorldGetGravity (dWorldID
, dVector3 gravity
);
104 * @brief Set the global ERP value, that controls how much error
105 * correction is performed in each time step.
107 * @param dWorldID the identifier of the world.
108 * @param erp Typical values are in the range 0.1--0.8. The default is 0.2.
110 ODE_API
void dWorldSetERP (dWorldID
, dReal erp
);
113 * @brief Get the error reduction parameter.
117 ODE_API dReal
dWorldGetERP (dWorldID
);
121 * @brief Set the global CFM (constraint force mixing) value.
123 * @param cfm Typical values are in the range @m{10^{-9}} -- 1.
124 * The default is 10^-5 if single precision is being used, or 10^-10
125 * if double precision is being used.
127 ODE_API
void dWorldSetCFM (dWorldID
, dReal cfm
);
130 * @brief Get the constraint force mixing value.
134 ODE_API dReal
dWorldGetCFM (dWorldID
);
137 #define dWORLDSTEP_THREADCOUNT_UNLIMITED dTHREADING_THREAD_COUNT_UNLIMITED
140 * @brief Set maximum threads to be used for island stepping
142 * The actual number of threads that is going to be used will be the minimum
143 * of this limit and number of threads in the threading pool. By default
144 * there is no limit (@c dWORLDSTEP_THREADCOUNT_UNLIMITED).
147 * WARNING! Running island stepping in multiple threads requires allocating
148 * individual stepping memory buffer for each of those threads. The size of buffers
149 * allocated is the size needed to handle the largest island in the world.
151 * Note: Setting a limit for island stepping does not affect threading at lower
152 * levels in stepper functions. The sub-calls scheduled from them can be executed
153 * in as many threads as there are available in the pool.
155 * @param w The world affected
156 * @param count Thread count limit value for island stepping
158 * @see dWorldGetStepIslandsProcessingMaxThreadCount
160 ODE_API
void dWorldSetStepIslandsProcessingMaxThreadCount(dWorldID w
, unsigned count
);
162 * @brief Get maximum threads that are allowed to be used for island stepping.
164 * Please read commentaries to @c dWorldSetStepIslandsProcessingMaxThreadCount for
165 * important information regarding the value returned.
167 * @param w The world queried
168 * @returns Current thread count limit value for island stepping
170 * @see dWorldSetStepIslandsProcessingMaxThreadCount
172 ODE_API
unsigned dWorldGetStepIslandsProcessingMaxThreadCount(dWorldID w
);
175 * @brief Set the world to use shared working memory along with another world.
177 * The worlds allocate working memory internally for simulation stepping. This
178 * memory is cached among the calls to @c dWordStep and @c dWorldQuickStep.
179 * Similarly, several worlds can be set up to share this memory caches thus
180 * reducing overall memory usage by cost of making worlds inappropriate for
181 * simultaneous simulation in multiple threads.
183 * If null value is passed for @a from_world parameter the world is detached from
184 * sharing and returns to defaults for working memory, reservation policy and
185 * memory manager as if just created. This can also be used to enable use of shared
186 * memory for a world that has already had working memory allocated privately.
187 * Normally using shared memory after a world has its private working memory allocated
190 * Allocation policy used can only increase world's internal reserved memory size
191 * and never decreases it. @c dWorldCleanupWorkingMemory can be used to release
192 * working memory for a world in case if number of objects/joint decreases
193 * significantly in it.
195 * With sharing working memory worlds also automatically share memory reservation
196 * policy and memory manager. Thus, these parameters need to be customized for
197 * initial world to be used as sharing source only.
199 * If worlds share working memory they must also use compatible threading implementations
200 * (i.e. it is illegal for one world to perform stepping with self-threaded implementation
201 * when the other world is assigned a multi-threaded implementation).
202 * For more information read section about threading approaches in ODE.
204 * Failure result status means a memory allocation failure.
206 * @param w The world to use the shared memory with.
207 * @param from_world Null or the world the shared memory is to be used from.
208 * @returns 1 for success and 0 for failure.
211 * @see dWorldCleanupWorkingMemory
212 * @see dWorldSetStepMemoryReservationPolicy
213 * @see dWorldSetStepMemoryManager
215 ODE_API
int dWorldUseSharedWorkingMemory(dWorldID w
, dWorldID from_world
/*=NULL*/);
218 * @brief Release internal working memory allocated for world
220 * The worlds allocate working memory internally for simulation stepping. This
221 * function can be used to free world's internal memory cache in case if number of
222 * objects/joints in the world decreases significantly. By default, internal
223 * allocation policy is used to only increase cache size as necessary and never
226 * If a world shares its working memory with other worlds the cache deletion
227 * affects all the linked worlds. However the shared status itself remains intact.
229 * The function call does affect neither memory reservation policy nor memory manager.
231 * @param w The world to release working memory for.
234 * @see dWorldUseSharedWorkingMemory
235 * @see dWorldSetStepMemoryReservationPolicy
236 * @see dWorldSetStepMemoryManager
238 ODE_API
void dWorldCleanupWorkingMemory(dWorldID w
);
241 #define dWORLDSTEP_RESERVEFACTOR_DEFAULT 1.2f
242 #define dWORLDSTEP_RESERVESIZE_DEFAULT 65536U
245 * @struct dWorldStepReserveInfo
246 * @brief Memory reservation policy descriptor structure for world stepping functions.
248 * @c struct_size should be assigned the size of the structure.
250 * @c reserve_factor is a quotient that is multiplied by required memory size
251 * to allocate extra reserve whenever reallocation is needed.
253 * @c reserve_minimum is a minimum size that is checked against whenever reallocation
254 * is needed to allocate expected working memory minimum at once without extra
255 * reallocations as number of bodies/joints grows.
258 * @see dWorldSetStepMemoryReservationPolicy
262 unsigned struct_size
;
263 float reserve_factor
; /* Use float as precision does not matter here*/
264 unsigned reserve_minimum
;
266 } dWorldStepReserveInfo
;
269 * @brief Set memory reservation policy for world to be used with simulation stepping functions
271 * The function allows to customize reservation policy to be used for internal
272 * memory which is allocated to aid simulation for a world. By default, values
273 * of @c dWORLDSTEP_RESERVEFACTOR_DEFAULT and @c dWORLDSTEP_RESERVESIZE_DEFAULT
276 * Passing @a policyinfo argument as NULL results in reservation policy being
277 * reset to defaults as if the world has been just created. The content of
278 * @a policyinfo structure is copied internally and does not need to remain valid
279 * after the call returns.
281 * If the world uses working memory sharing, changing memory reservation policy
282 * affects all the worlds linked together.
284 * Failure result status means a memory allocation failure.
286 * @param w The world to change memory reservation policy for.
287 * @param policyinfo Null or a pointer to policy descriptor structure.
288 * @returns 1 for success and 0 for failure.
291 * @see dWorldUseSharedWorkingMemory
293 ODE_API
int dWorldSetStepMemoryReservationPolicy(dWorldID w
, const dWorldStepReserveInfo
*policyinfo
/*=NULL*/);
296 * @struct dWorldStepMemoryFunctionsInfo
297 * @brief World stepping memory manager descriptor structure
299 * This structure is intended to define the functions of memory manager to be used
300 * with world stepping functions.
302 * @c struct_size should be assigned the size of the structure
304 * @c alloc_block is a function to allocate memory block of given size.
306 * @c shrink_block is a function to shrink existing memory block to a smaller size.
307 * It must preserve the contents of block head while shrinking. The new block size
308 * is guaranteed to be always less than the existing one.
310 * @c free_block is a function to delete existing memory block.
313 * @see dWorldSetStepMemoryManager
317 unsigned struct_size
;
318 void *(*alloc_block
)(dsizeint block_size
);
319 void *(*shrink_block
)(void *block_pointer
, dsizeint block_current_size
, dsizeint block_smaller_size
);
320 void (*free_block
)(void *block_pointer
, dsizeint block_current_size
);
322 } dWorldStepMemoryFunctionsInfo
;
325 * @brief Set memory manager for world to be used with simulation stepping functions
327 * The function allows to customize memory manager to be used for internal
328 * memory allocation during simulation for a world. By default, @c dAlloc/@c dRealloc/@c dFree
329 * based memory manager is used.
331 * Passing @a memfuncs argument as NULL results in memory manager being
332 * reset to default one as if the world has been just created. The content of
333 * @a memfuncs structure is copied internally and does not need to remain valid
334 * after the call returns.
336 * If the world uses working memory sharing, changing memory manager
337 * affects all the worlds linked together.
339 * Failure result status means a memory allocation failure.
341 * @param w The world to change memory reservation policy for.
342 * @param memfuncs Null or a pointer to memory manager descriptor structure.
343 * @returns 1 for success and 0 for failure.
346 * @see dWorldUseSharedWorkingMemory
348 ODE_API
int dWorldSetStepMemoryManager(dWorldID w
, const dWorldStepMemoryFunctionsInfo
*memfuncs
);
351 * @brief Assign threading implementation to be used for [quick]stepping the world.
353 * @warning It is not recommended to assign the same threading implementation to
354 * different worlds if they are going to be called in parallel. In particular this
355 * makes resources preallocation for threaded calls to lose its sense.
356 * Built-in threading implementation is likely to crash if misused this way.
358 * @param w The world to change threading implementation for.
359 * @param functions_info Pointer to threading functions structure
360 * @param threading_impl ID of threading implementation object
364 ODE_API
void dWorldSetStepThreadingImplementation(dWorldID w
, const dThreadingFunctionsInfo
*functions_info
, dThreadingImplementationID threading_impl
);
367 * @brief Step the world.
369 * This uses a "big matrix" method that takes time on the order of m^3
370 * and memory on the order of m^2, where m is the total number of constraint
371 * rows. For large systems this will use a lot of memory and can be very slow,
372 * but this is currently the most accurate method.
374 * Failure result status means that the memory allocation has failed for operation.
375 * In such a case all the objects remain in unchanged state and simulation can be
376 * retried as soon as more memory is available.
378 * @param w The world to be stepped
379 * @param stepsize The number of seconds that the simulation has to advance.
380 * @returns 1 for success and 0 for failure
384 ODE_API
int dWorldStep (dWorldID w
, dReal stepsize
);
387 * @brief Quick-step the world.
389 * This uses an iterative method that takes time on the order of m*N
390 * and memory on the order of m, where m is the total number of constraint
391 * rows N is the number of iterations.
392 * For large systems this is a lot faster than dWorldStep(),
393 * but it is less accurate.
395 * QuickStep is great for stacks of objects especially when the
396 * auto-disable feature is used as well.
397 * However, it has poor accuracy for near-singular systems.
398 * Near-singular systems can occur when using high-friction contacts, motors,
399 * or certain articulated structures. For example, a robot with multiple legs
400 * sitting on the ground may be near-singular.
402 * There are ways to help overcome QuickStep's inaccuracy problems:
405 * \li Reduce the number of contacts in your system (e.g. use the minimum
406 * number of contacts for the feet of a robot or creature).
407 * \li Don't use excessive friction in the contacts.
408 * \li Use contact slip if appropriate
409 * \li Avoid kinematic loops (however, kinematic loops are inevitable in
411 * \li Don't use excessive motor strength.
412 * \liUse force-based motors instead of velocity-based motors.
414 * Increasing the number of QuickStep iterations may help a little bit, but
415 * it is not going to help much if your system is really near singular.
417 * Failure result status means that the memory allocation has failed for operation.
418 * In such a case all the objects remain in unchanged state and simulation can be
419 * retried as soon as more memory is available.
421 * @param w The world to be stepped
422 * @param stepsize The number of seconds that the simulation has to advance.
423 * @returns 1 for success and 0 for failure
427 ODE_API
int dWorldQuickStep (dWorldID w
, dReal stepsize
);
431 * @brief Converts an impulse to a force.
434 * If you want to apply a linear or angular impulse to a rigid body,
435 * instead of a force or a torque, then you can use this function to convert
436 * the desired impulse into a force/torque vector before calling the
437 * BodyAdd... function.
438 * The current algorithm simply scales the impulse by 1/stepsize,
439 * where stepsize is the step size for the next step that will be taken.
440 * This function is given a dWorldID because, in the future, the force
441 * computation may depend on integrator parameters that are set as
442 * properties of the world.
444 ODE_API
void dWorldImpulseToForce
446 dWorldID
, dReal stepsize
,
447 dReal ix
, dReal iy
, dReal iz
, dVector3 force
451 #define dWORLDQUICKSTEP_ITERATION_COUNT_DEFAULT 20U
454 * @brief Set the number of iterations that the QuickStep method performs per
458 * More iterations will give a more accurate solution, but will take
460 * @param num The default is dWORLDQUICKSTEP_ITERATION_COUNT_DEFAULT iterations.
462 ODE_API
void dWorldSetQuickStepNumIterations (dWorldID w
, int num
);
465 * @brief Get the number of iterations that the QuickStep method performs per
468 * @return nr of iterations
470 ODE_API
int dWorldGetQuickStepNumIterations (dWorldID
);
473 #define dWORLDQUICKSTEP_ITERATION_PREMATURE_EXIT_DELTA_DEFAULT 1e-8f
474 #define dWORLDQUICKSTEP_MAXIMAL_EXTRA_ITERATION_COUNT_FACTOR_DEFAULT 1.0f
475 #define dWORLDQUICKSTEP_EXTRA_ITERATION_REQUIREMENT_DELTA_DEFAULT 1e-2f
478 * @brief Configure QuickStep method dynamic iteration count adjustment.
481 * The function controls dynamic iteration count adjustment basing on maximal contact force change
482 * per iteration in matrix.
484 * If Premature Exit Delta is configured with @p ptr_iteration_premature_exit_delta
485 * and the maximal contact force adjustment does not exceed the value the iterations are abandoned
486 * prematurely and computations complete in fewer steps than it would take normally.
487 * Passing zero in @p ptr_iteration_premature_exit_delta will disable the premature exit and enforce
488 * unconditional execution of iteration count set by @fn dWorldSetQuickStepNumIterations.
490 * If extra iterations are enabled by passing a positive fraction in @p ptr_max_num_extra_factor
491 * and, after the normal number of iterations is executed, the maximal contact force adjustment is still
492 * larger than the limit set with the @ptr_extra_iteration_requirement_delta, up to that fraction of
493 * normal iteration count is executed extra until the maximal contact force change falls below the margin.
495 * At least one parameter must be not NULL for the call.
496 * If NULL is passed for any of the parameters the corresponding parameter will retain its previous value.
497 * If the standard number of iterations is changed with @fn dWorldSetQuickStepNumIterations call and
498 * an extra iteration count was configured with @p ptr_max_num_extra_factor the extra absolute value will be
499 * adjusted accordingly.
501 * @param ptr_iteration_premature_exit_delta A margin value such that, if contact force adjustment value maximum in an iteration
502 * becomes less, the method is allowed to terminate prematurely.
503 * @param ptr_max_num_extra_factor A non-negative coefficient that defines fraction of the standard iteration count to be executed extra
504 * if contact force still significantly changes after the standard iterations complete.
505 * @param ptr_extra_iteration_requirement_delta A margin that defines when the extra iterations are not needed or can be abandoned after
507 * @see dWorldGetQuickStepDynamicIterationParameters
509 ODE_API
void dWorldSetQuickStepDynamicIterationParameters(dWorldID w
, const dReal
*ptr_iteration_premature_exit_delta
/*=NULL*/,
510 const dReal
*ptr_max_num_extra_factor
/*=NULL*/, const dReal
*ptr_extra_iteration_requirement_delta
/*=NULL*/);
513 * @brief Retrieve QuickStep method dynamic iteration count adjustment parameters.
516 * The function retrieves dynamic iteration count adjustment parameters.
518 * See @fn dWorldSetQuickStepDynamicIterationParameters for the parameters description.
520 * At least one parameter must be not NULL for the call.
522 * @param out_iteration_premature_exit_delta Premature Exit Delta value (can be NULL if the value is not needed).
523 * @param out_max_num_extra_factor Maximum Extra Iteration Number Factor value (can be NULL if the value is not needed).
524 * @param out_extra_iteration_requirement_delta Extra Iteration Requirement Delta value (can be NULL if the value is not needed).
525 * @see dWorldSetQuickStepDynamicIterationParameters
527 ODE_API
void dWorldGetQuickStepDynamicIterationParameters(dWorldID w
, dReal
*out_iteration_premature_exit_delta
/*=NULL*/,
528 dReal
*out_max_num_extra_factor
/*=NULL*/, dReal
*out_extra_iteration_requirement_delta
/*=NULL*/);
532 * @brief Statistics structure to accumulate QuickStep iteration couunt dynamic adjustment data.
535 * @see @fn dWorldAttachQuickStepDynamicIterationStatisticsSink
540 unsigned struct_size
; /*< to be initialized with the structure size */
542 duint32 iteration_count
; /*< number of iterations executed */
544 duint32 premature_exits
; /*< number of times solution took fewer than the regular iteration count */
545 duint32 prolonged_execs
; /*< number of times solution took more than the regular iteration count */
546 duint32 full_extra_execs
; /*< number of times the assigned exit criteria were not achieved even after all extra iterations allowed */
548 } dWorldQuickStepIterationCount_DynamicAdjustmentStatistics
;
551 void dWorldInitializeQuickStepIterationCount_DynamicAdjustmentStatistics(dWorldQuickStepIterationCount_DynamicAdjustmentStatistics
*ptr_stat
)
553 memset(ptr_stat
, 0, sizeof(*ptr_stat
));
554 ptr_stat
->struct_size
= sizeof(*ptr_stat
);
559 * @brief Attach or remove a structure to collect QuickStep iteration count dynamic adjustment statistics.
562 * The function can be used to attach or remove a structure instance that will be updated with iteration count dynamic adjustment statistics
563 * of QuickStep. To break the attachment, the function must be called with NULL for the @p var_stats.
565 * See @fn dWorldSetQuickStepDynamicIterationParameters for information on the iteration count dynamic adjustment options.
567 * The caller is responsible for initializing the structure before assignment. The structure must persist in memory until unattached or
568 * the host world object is destroyed. The same structure instance may be shared among multiple worlds if that makes sense.
570 * The assignment may fail if the feature is not configured within the library, or if the structure was not initialized properly.
572 * @param var_stats A pointer to structure instance to assigned or NULL to break the previous attachment for the world.
573 * @return Boolean status indicating whether the function succeeded
574 * @see dWorldQuickStepIterationCount_DynamicAdjustmentStatistics
576 ODE_API
int dWorldAttachQuickStepDynamicIterationStatisticsSink(dWorldID w
, dWorldQuickStepIterationCount_DynamicAdjustmentStatistics
*var_stats
/*=NULL*/);
580 * @brief Set the SOR over-relaxation parameter
582 * @param over_relaxation value to use by SOR
584 ODE_API
void dWorldSetQuickStepW (dWorldID
, dReal over_relaxation
);
587 * @brief Get the SOR over-relaxation parameter
589 * @returns the over-relaxation setting
591 ODE_API dReal
dWorldGetQuickStepW (dWorldID
);
593 /* World contact parameter functions */
596 * @brief Set the maximum correcting velocity that contacts are allowed
599 * @param vel The default value is infinity (i.e. no limit).
601 * Reducing this value can help prevent "popping" of deeply embedded objects.
603 ODE_API
void dWorldSetContactMaxCorrectingVel (dWorldID
, dReal vel
);
606 * @brief Get the maximum correcting velocity that contacts are allowed
610 ODE_API dReal
dWorldGetContactMaxCorrectingVel (dWorldID
);
613 * @brief Set the depth of the surface layer around all geometry objects.
616 * Contacts are allowed to sink into the surface layer up to the given
617 * depth before coming to rest.
618 * @param depth The default value is zero.
620 * Increasing this to some small value (e.g. 0.001) can help prevent
621 * jittering problems due to contacts being repeatedly made and broken.
623 ODE_API
void dWorldSetContactSurfaceLayer (dWorldID
, dReal depth
);
626 * @brief Get the depth of the surface layer around all geometry objects.
630 ODE_API dReal
dWorldGetContactSurfaceLayer (dWorldID
);
634 * @defgroup disable Automatic Enabling and Disabling
635 * @ingroup world bodies
637 * Every body can be enabled or disabled. Enabled bodies participate in the
638 * simulation, while disabled bodies are turned off and do not get updated
639 * during a simulation step. New bodies are always created in the enabled state.
641 * A disabled body that is connected through a joint to an enabled body will be
642 * automatically re-enabled at the next simulation step.
644 * Disabled bodies do not consume CPU time, therefore to speed up the simulation
645 * bodies should be disabled when they come to rest. This can be done automatically
646 * with the auto-disable feature.
648 * If a body has its auto-disable flag turned on, it will automatically disable
650 * @li It has been idle for a given number of simulation steps.
651 * @li It has also been idle for a given amount of simulation time.
653 * A body is considered to be idle when the magnitudes of both its
654 * linear average velocity and angular average velocity are below given thresholds.
655 * The sample size for the average defaults to one and can be disabled by setting
658 * Thus, every body has six auto-disable parameters: an enabled flag, a idle step
659 * count, an idle time, linear/angular average velocity thresholds, and the
660 * average samples count.
662 * Newly created bodies get these parameters from world.
666 * @brief Get auto disable linear average threshold for newly created bodies.
668 * @return the threshold
670 ODE_API dReal
dWorldGetAutoDisableLinearThreshold (dWorldID
);
673 * @brief Set auto disable linear average threshold for newly created bodies.
674 * @param linear_average_threshold default is 0.01
677 ODE_API
void dWorldSetAutoDisableLinearThreshold (dWorldID
, dReal linear_average_threshold
);
680 * @brief Get auto disable angular average threshold for newly created bodies.
682 * @return the threshold
684 ODE_API dReal
dWorldGetAutoDisableAngularThreshold (dWorldID
);
687 * @brief Set auto disable angular average threshold for newly created bodies.
688 * @param linear_average_threshold default is 0.01
691 ODE_API
void dWorldSetAutoDisableAngularThreshold (dWorldID
, dReal angular_average_threshold
);
694 * @brief Get auto disable sample count for newly created bodies.
696 * @return number of samples used
698 ODE_API
int dWorldGetAutoDisableAverageSamplesCount (dWorldID
);
701 * @brief Set auto disable average sample count for newly created bodies.
703 * @param average_samples_count Default is 1, meaning only instantaneous velocity is used.
704 * Set to zero to disable sampling and thus prevent any body from auto-disabling.
706 ODE_API
void dWorldSetAutoDisableAverageSamplesCount (dWorldID
, unsigned int average_samples_count
);
709 * @brief Get auto disable steps for newly created bodies.
711 * @return nr of steps
713 ODE_API
int dWorldGetAutoDisableSteps (dWorldID
);
716 * @brief Set auto disable steps for newly created bodies.
718 * @param steps default is 10
720 ODE_API
void dWorldSetAutoDisableSteps (dWorldID
, int steps
);
723 * @brief Get auto disable time for newly created bodies.
725 * @return nr of seconds
727 ODE_API dReal
dWorldGetAutoDisableTime (dWorldID
);
730 * @brief Set auto disable time for newly created bodies.
732 * @param time default is 0 seconds
734 ODE_API
void dWorldSetAutoDisableTime (dWorldID
, dReal time
);
737 * @brief Get auto disable flag for newly created bodies.
741 ODE_API
int dWorldGetAutoDisableFlag (dWorldID
);
744 * @brief Set auto disable flag for newly created bodies.
746 * @param do_auto_disable default is false.
748 ODE_API
void dWorldSetAutoDisableFlag (dWorldID
, int do_auto_disable
);
752 * @defgroup damping Damping
753 * @ingroup bodies world
755 * Damping serves two purposes: reduce simulation instability, and to allow
756 * the bodies to come to rest (and possibly auto-disabling them).
758 * Bodies are constructed using the world's current damping parameters. Setting
759 * the scales to 0 disables the damping.
761 * Here is how it is done: after every time step linear and angular
762 * velocities are tested against the corresponding thresholds. If they
763 * are above, they are multiplied by (1 - scale). So a negative scale value
764 * will actually increase the speed, and values greater than one will
765 * make the object oscillate every step; both can make the simulation unstable.
767 * To disable damping just set the damping scale to zero.
769 * You can also limit the maximum angular velocity. In contrast to the damping
770 * functions, the angular velocity is affected before the body is moved.
771 * This means that it will introduce errors in joints that are forcing the body
772 * to rotate too fast. Some bodies have naturally high angular velocities
773 * (like cars' wheels), so you may want to give them a very high (like the default,
776 * @note The velocities are damped after the stepper function has moved the
777 * object. Otherwise the damping could introduce errors in joints. First the
778 * joint constraints are processed by the stepper (moving the body), then
779 * the damping is applied.
781 * @note The damping happens right after the moved callback is called; this way
782 * it still possible use the exact velocities the body has acquired during the
783 * step. You can even use the callback to create your own customized damping.
787 * @brief Get the world's linear damping threshold.
790 ODE_API dReal
dWorldGetLinearDampingThreshold (dWorldID w
);
793 * @brief Set the world's linear damping threshold.
794 * @param threshold The damping won't be applied if the linear speed is
795 * below this threshold. Default is 0.01.
798 ODE_API
void dWorldSetLinearDampingThreshold(dWorldID w
, dReal threshold
);
801 * @brief Get the world's angular damping threshold.
804 ODE_API dReal
dWorldGetAngularDampingThreshold (dWorldID w
);
807 * @brief Set the world's angular damping threshold.
808 * @param threshold The damping won't be applied if the angular speed is
809 * below this threshold. Default is 0.01.
812 ODE_API
void dWorldSetAngularDampingThreshold(dWorldID w
, dReal threshold
);
815 * @brief Get the world's linear damping scale.
818 ODE_API dReal
dWorldGetLinearDamping (dWorldID w
);
821 * @brief Set the world's linear damping scale.
822 * @param scale The linear damping scale that is to be applied to bodies.
823 * Default is 0 (no damping). Should be in the interval [0, 1].
826 ODE_API
void dWorldSetLinearDamping (dWorldID w
, dReal scale
);
829 * @brief Get the world's angular damping scale.
832 ODE_API dReal
dWorldGetAngularDamping (dWorldID w
);
835 * @brief Set the world's angular damping scale.
836 * @param scale The angular damping scale that is to be applied to bodies.
837 * Default is 0 (no damping). Should be in the interval [0, 1].
840 ODE_API
void dWorldSetAngularDamping(dWorldID w
, dReal scale
);
843 * @brief Convenience function to set body linear and angular scales.
844 * @param linear_scale The linear damping scale that is to be applied to bodies.
845 * @param angular_scale The angular damping scale that is to be applied to bodies.
848 ODE_API
void dWorldSetDamping(dWorldID w
,
850 dReal angular_scale
);
853 * @brief Get the default maximum angular speed.
855 * @sa dBodyGetMaxAngularSpeed()
857 ODE_API dReal
dWorldGetMaxAngularSpeed (dWorldID w
);
861 * @brief Set the default maximum angular speed for new bodies.
863 * @sa dBodySetMaxAngularSpeed()
865 ODE_API
void dWorldSetMaxAngularSpeed (dWorldID w
, dReal max_speed
);
870 * @defgroup bodies Rigid Bodies
872 * A rigid body has various properties from the point of view of the
873 * simulation. Some properties change over time:
875 * @li Position vector (x,y,z) of the body's point of reference.
876 * Currently the point of reference must correspond to the body's center of mass.
877 * @li Linear velocity of the point of reference, a vector (vx,vy,vz).
878 * @li Orientation of a body, represented by a quaternion (qs,qx,qy,qz) or
879 * a 3x3 rotation matrix.
880 * @li Angular velocity vector (wx,wy,wz) which describes how the orientation
883 * Other body properties are usually constant over time:
885 * @li Mass of the body.
886 * @li Position of the center of mass with respect to the point of reference.
887 * In the current implementation the center of mass and the point of
888 * reference must coincide.
889 * @li Inertia matrix. This is a 3x3 matrix that describes how the body's mass
890 * is distributed around the center of mass. Conceptually each body has an
891 * x-y-z coordinate frame embedded in it that moves and rotates with the body.
893 * The origin of this coordinate frame is the body's point of reference. Some values
894 * in ODE (vectors, matrices etc) are relative to the body coordinate frame, and others
895 * are relative to the global coordinate frame.
897 * Note that the shape of a rigid body is not a dynamical property (except insofar as
898 * it influences the various mass properties). It is only collision detection that cares
899 * about the detailed shape of the body.
904 * @brief Get auto disable linear average threshold.
905 * @ingroup bodies disable
906 * @return the threshold
908 ODE_API dReal
dBodyGetAutoDisableLinearThreshold (dBodyID
);
911 * @brief Set auto disable linear average threshold.
912 * @ingroup bodies disable
913 * @return the threshold
915 ODE_API
void dBodySetAutoDisableLinearThreshold (dBodyID
, dReal linear_average_threshold
);
918 * @brief Get auto disable angular average threshold.
919 * @ingroup bodies disable
920 * @return the threshold
922 ODE_API dReal
dBodyGetAutoDisableAngularThreshold (dBodyID
);
925 * @brief Set auto disable angular average threshold.
926 * @ingroup bodies disable
927 * @return the threshold
929 ODE_API
void dBodySetAutoDisableAngularThreshold (dBodyID
, dReal angular_average_threshold
);
932 * @brief Get auto disable average size (samples count).
933 * @ingroup bodies disable
934 * @return the nr of steps/size.
936 ODE_API
int dBodyGetAutoDisableAverageSamplesCount (dBodyID
);
939 * @brief Set auto disable average buffer size (average steps).
940 * @ingroup bodies disable
941 * @param average_samples_count the nr of samples to review.
943 ODE_API
void dBodySetAutoDisableAverageSamplesCount (dBodyID
, unsigned int average_samples_count
);
947 * @brief Get auto steps a body must be thought of as idle to disable
948 * @ingroup bodies disable
949 * @return the nr of steps
951 ODE_API
int dBodyGetAutoDisableSteps (dBodyID
);
954 * @brief Set auto disable steps.
955 * @ingroup bodies disable
956 * @param steps the nr of steps.
958 ODE_API
void dBodySetAutoDisableSteps (dBodyID
, int steps
);
961 * @brief Get auto disable time.
962 * @ingroup bodies disable
963 * @return nr of seconds
965 ODE_API dReal
dBodyGetAutoDisableTime (dBodyID
);
968 * @brief Set auto disable time.
969 * @ingroup bodies disable
970 * @param time nr of seconds.
972 ODE_API
void dBodySetAutoDisableTime (dBodyID
, dReal time
);
975 * @brief Get auto disable flag.
976 * @ingroup bodies disable
979 ODE_API
int dBodyGetAutoDisableFlag (dBodyID
);
982 * @brief Set auto disable flag.
983 * @ingroup bodies disable
984 * @param do_auto_disable 0 or 1
986 ODE_API
void dBodySetAutoDisableFlag (dBodyID
, int do_auto_disable
);
989 * @brief Set auto disable defaults.
991 * Set the values for the body to those set as default for the world.
992 * @ingroup bodies disable
994 ODE_API
void dBodySetAutoDisableDefaults (dBodyID
);
998 * @brief Retrieves the world attached to te given body.
1003 ODE_API dWorldID
dBodyGetWorld (dBodyID
);
1006 * @brief Create a body in given world.
1008 * Default mass parameters are at position (0,0,0).
1011 ODE_API dBodyID
dBodyCreate (dWorldID
);
1014 * @brief Destroy a body.
1016 * All joints that are attached to this body will be put into limbo:
1017 * i.e. unattached and not affecting the simulation, but they will NOT be
1021 ODE_API
void dBodyDestroy (dBodyID
);
1024 * @brief Set the body's user-data pointer.
1026 * @param data arbitraty pointer
1028 ODE_API
void dBodySetData (dBodyID
, void *data
);
1031 * @brief Get the body's user-data pointer.
1033 * @return a pointer to the user's data.
1035 ODE_API
void *dBodyGetData (dBodyID
);
1038 * @brief Set position of a body.
1040 * After setting, the outcome of the simulation is undefined
1041 * if the new configuration is inconsistent with the joints/constraints
1045 ODE_API
void dBodySetPosition (dBodyID
, dReal x
, dReal y
, dReal z
);
1048 * @brief Set the orientation of a body.
1051 * After setting, the outcome of the simulation is undefined
1052 * if the new configuration is inconsistent with the joints/constraints
1055 ODE_API
void dBodySetRotation (dBodyID
, const dMatrix3 R
);
1058 * @brief Set the orientation of a body.
1061 * After setting, the outcome of the simulation is undefined
1062 * if the new configuration is inconsistent with the joints/constraints
1065 ODE_API
void dBodySetQuaternion (dBodyID
, const dQuaternion q
);
1068 * @brief Set the linear velocity of a body.
1071 ODE_API
void dBodySetLinearVel (dBodyID
, dReal x
, dReal y
, dReal z
);
1074 * @brief Set the angular velocity of a body.
1077 ODE_API
void dBodySetAngularVel (dBodyID
, dReal x
, dReal y
, dReal z
);
1080 * @brief Get the position of a body.
1083 * When getting, the returned values are pointers to internal data structures,
1084 * so the vectors are valid until any changes are made to the rigid body
1086 * @sa dBodyCopyPosition
1088 ODE_API
const dReal
* dBodyGetPosition (dBodyID
);
1092 * @brief Copy the position of a body into a vector.
1094 * @param body the body to query
1095 * @param pos a copy of the body position
1096 * @sa dBodyGetPosition
1098 ODE_API
void dBodyCopyPosition (dBodyID body
, dVector3 pos
);
1102 * @brief Get the rotation of a body.
1104 * @return pointer to a 4x3 rotation matrix.
1106 ODE_API
const dReal
* dBodyGetRotation (dBodyID
);
1110 * @brief Copy the rotation of a body.
1112 * @param body the body to query
1113 * @param R a copy of the rotation matrix
1114 * @sa dBodyGetRotation
1116 ODE_API
void dBodyCopyRotation (dBodyID
, dMatrix3 R
);
1120 * @brief Get the rotation of a body.
1122 * @return pointer to 4 scalars that represent the quaternion.
1124 ODE_API
const dReal
* dBodyGetQuaternion (dBodyID
);
1128 * @brief Copy the orientation of a body into a quaternion.
1130 * @param body the body to query
1131 * @param quat a copy of the orientation quaternion
1132 * @sa dBodyGetQuaternion
1134 ODE_API
void dBodyCopyQuaternion(dBodyID body
, dQuaternion quat
);
1138 * @brief Get the linear velocity of a body.
1141 ODE_API
const dReal
* dBodyGetLinearVel (dBodyID
);
1144 * @brief Get the angular velocity of a body.
1147 ODE_API
const dReal
* dBodyGetAngularVel (dBodyID
);
1150 * @brief Set the mass of a body.
1153 ODE_API
void dBodySetMass (dBodyID
, const dMass
*mass
);
1156 * @brief Get the mass of a body.
1159 ODE_API
void dBodyGetMass (dBodyID
, dMass
*mass
);
1162 * @brief Add force at centre of mass of body in absolute coordinates.
1165 ODE_API
void dBodyAddForce (dBodyID
, dReal fx
, dReal fy
, dReal fz
);
1168 * @brief Add torque at centre of mass of body in absolute coordinates.
1171 ODE_API
void dBodyAddTorque (dBodyID
, dReal fx
, dReal fy
, dReal fz
);
1174 * @brief Add force at centre of mass of body in coordinates relative to body.
1177 ODE_API
void dBodyAddRelForce (dBodyID
, dReal fx
, dReal fy
, dReal fz
);
1180 * @brief Add torque at centre of mass of body in coordinates relative to body.
1183 ODE_API
void dBodyAddRelTorque (dBodyID
, dReal fx
, dReal fy
, dReal fz
);
1186 * @brief Add force at specified point in body in global coordinates.
1189 ODE_API
void dBodyAddForceAtPos (dBodyID
, dReal fx
, dReal fy
, dReal fz
,
1190 dReal px
, dReal py
, dReal pz
);
1192 * @brief Add force at specified point in body in local coordinates.
1195 ODE_API
void dBodyAddForceAtRelPos (dBodyID
, dReal fx
, dReal fy
, dReal fz
,
1196 dReal px
, dReal py
, dReal pz
);
1198 * @brief Add force at specified point in body in global coordinates.
1201 ODE_API
void dBodyAddRelForceAtPos (dBodyID
, dReal fx
, dReal fy
, dReal fz
,
1202 dReal px
, dReal py
, dReal pz
);
1204 * @brief Add force at specified point in body in local coordinates.
1207 ODE_API
void dBodyAddRelForceAtRelPos (dBodyID
, dReal fx
, dReal fy
, dReal fz
,
1208 dReal px
, dReal py
, dReal pz
);
1211 * @brief Return the current accumulated force vector.
1212 * @return points to an array of 3 reals.
1214 * The returned values are pointers to internal data structures, so
1215 * the vectors are only valid until any changes are made to the rigid
1219 ODE_API
const dReal
* dBodyGetForce (dBodyID
);
1222 * @brief Return the current accumulated torque vector.
1223 * @return points to an array of 3 reals.
1225 * The returned values are pointers to internal data structures, so
1226 * the vectors are only valid until any changes are made to the rigid
1230 ODE_API
const dReal
* dBodyGetTorque (dBodyID
);
1233 * @brief Set the body force accumulation vector.
1235 * This is mostly useful to zero the force and torque for deactivated bodies
1236 * before they are reactivated, in the case where the force-adding functions
1237 * were called on them while they were deactivated.
1240 ODE_API
void dBodySetForce (dBodyID b
, dReal x
, dReal y
, dReal z
);
1243 * @brief Set the body torque accumulation vector.
1245 * This is mostly useful to zero the force and torque for deactivated bodies
1246 * before they are reactivated, in the case where the force-adding functions
1247 * were called on them while they were deactivated.
1250 ODE_API
void dBodySetTorque (dBodyID b
, dReal x
, dReal y
, dReal z
);
1253 * @brief Get world position of a relative point on body.
1255 * @param result will contain the result.
1257 ODE_API
void dBodyGetRelPointPos
1259 dBodyID
, dReal px
, dReal py
, dReal pz
,
1264 * @brief Get velocity vector in global coords of a relative point on body.
1266 * @param result will contain the result.
1268 ODE_API
void dBodyGetRelPointVel
1270 dBodyID
, dReal px
, dReal py
, dReal pz
,
1275 * @brief Get velocity vector in global coords of a globally
1276 * specified point on a body.
1278 * @param result will contain the result.
1280 ODE_API
void dBodyGetPointVel
1282 dBodyID
, dReal px
, dReal py
, dReal pz
,
1287 * @brief takes a point in global coordinates and returns
1288 * the point's position in body-relative coordinates.
1290 * This is the inverse of dBodyGetRelPointPos()
1292 * @param result will contain the result.
1294 ODE_API
void dBodyGetPosRelPoint
1296 dBodyID
, dReal px
, dReal py
, dReal pz
,
1301 * @brief Convert from local to world coordinates.
1303 * @param result will contain the result.
1305 ODE_API
void dBodyVectorToWorld
1307 dBodyID
, dReal px
, dReal py
, dReal pz
,
1312 * @brief Convert from world to local coordinates.
1314 * @param result will contain the result.
1316 ODE_API
void dBodyVectorFromWorld
1318 dBodyID
, dReal px
, dReal py
, dReal pz
,
1323 * @brief controls the way a body's orientation is updated at each timestep.
1325 * @param mode can be 0 or 1:
1326 * \li 0: An ``infinitesimal'' orientation update is used.
1327 * This is fast to compute, but it can occasionally cause inaccuracies
1328 * for bodies that are rotating at high speed, especially when those
1329 * bodies are joined to other bodies.
1330 * This is the default for every new body that is created.
1331 * \li 1: A ``finite'' orientation update is used.
1332 * This is more costly to compute, but will be more accurate for high
1335 * Note however that high speed rotations can result in many types of
1336 * error in a simulation, and the finite mode will only fix one of those
1339 ODE_API
void dBodySetFiniteRotationMode (dBodyID
, int mode
);
1342 * @brief sets the finite rotation axis for a body.
1345 * This is axis only has meaning when the finite rotation mode is set
1346 * If this axis is zero (0,0,0), full finite rotations are performed on
1348 * If this axis is nonzero, the body is rotated by performing a partial finite
1349 * rotation along the axis direction followed by an infinitesimal rotation
1350 * along an orthogonal direction.
1352 * This can be useful to alleviate certain sources of error caused by quickly
1353 * spinning bodies. For example, if a car wheel is rotating at high speed
1354 * you can call this function with the wheel's hinge axis as the argument to
1355 * try and improve its behavior.
1357 ODE_API
void dBodySetFiniteRotationAxis (dBodyID
, dReal x
, dReal y
, dReal z
);
1360 * @brief Get the way a body's orientation is updated each timestep.
1362 * @return the mode 0 (infitesimal) or 1 (finite).
1364 ODE_API
int dBodyGetFiniteRotationMode (dBodyID
);
1367 * @brief Get the finite rotation axis.
1368 * @param result will contain the axis.
1371 ODE_API
void dBodyGetFiniteRotationAxis (dBodyID
, dVector3 result
);
1374 * @brief Get the number of joints that are attached to this body.
1376 * @return nr of joints
1378 ODE_API
int dBodyGetNumJoints (dBodyID b
);
1381 * @brief Return a joint attached to this body, given by index.
1383 * @param index valid range is 0 to n-1 where n is the value returned by
1384 * dBodyGetNumJoints().
1386 ODE_API dJointID
dBodyGetJoint (dBodyID
, int index
);
1392 * @brief Set rigid body to dynamic state (default).
1393 * @param dBodyID identification of body.
1396 ODE_API
void dBodySetDynamic (dBodyID
);
1399 * @brief Set rigid body to kinematic state.
1400 * When in kinematic state the body isn't simulated as a dynamic
1401 * body (it's "unstoppable", doesn't respond to forces),
1402 * but can still affect dynamic bodies (e.g. in joints).
1403 * Kinematic bodies can be controlled by position and velocity.
1404 * @note A kinematic body has infinite mass. If you set its mass
1405 * to something else, it loses the kinematic state and behaves
1406 * as a normal dynamic body.
1407 * @param dBodyID identification of body.
1410 ODE_API
void dBodySetKinematic (dBodyID
);
1413 * @brief Check wether a body is in kinematic state.
1415 * @return 1 if a body is kinematic or 0 if it is dynamic.
1417 ODE_API
int dBodyIsKinematic (dBodyID
);
1420 * @brief Manually enable a body.
1421 * @param dBodyID identification of body.
1424 ODE_API
void dBodyEnable (dBodyID
);
1427 * @brief Manually disable a body.
1430 * A disabled body that is connected through a joint to an enabled body will
1431 * be automatically re-enabled at the next simulation step.
1433 ODE_API
void dBodyDisable (dBodyID
);
1436 * @brief Check wether a body is enabled.
1438 * @return 1 if a body is currently enabled or 0 if it is disabled.
1440 ODE_API
int dBodyIsEnabled (dBodyID
);
1443 * @brief Set whether the body is influenced by the world's gravity or not.
1445 * @param mode when nonzero gravity affects this body.
1447 * Newly created bodies are always influenced by the world's gravity.
1449 ODE_API
void dBodySetGravityMode (dBodyID b
, int mode
);
1452 * @brief Get whether the body is influenced by the world's gravity or not.
1454 * @return nonzero means gravity affects this body.
1456 ODE_API
int dBodyGetGravityMode (dBodyID b
);
1459 * @brief Set the 'moved' callback of a body.
1461 * Whenever a body has its position or rotation changed during the
1462 * timestep, the callback will be called (with body as the argument).
1463 * Use it to know which body may need an update in an external
1464 * structure (like a 3D engine).
1466 * @param b the body that needs to be watched.
1467 * @param callback the callback to be invoked when the body moves. Set to zero
1471 ODE_API
void dBodySetMovedCallback(dBodyID b
, void (*callback
)(dBodyID
));
1475 * @brief Return the first geom associated with the body.
1477 * You can traverse through the geoms by repeatedly calling
1478 * dBodyGetNextGeom().
1480 * @return the first geom attached to this body, or 0.
1483 ODE_API dGeomID
dBodyGetFirstGeom (dBodyID b
);
1487 * @brief returns the next geom associated with the same body.
1488 * @param g a geom attached to some body.
1489 * @return the next geom attached to the same body, or 0.
1490 * @sa dBodyGetFirstGeom
1493 ODE_API dGeomID
dBodyGetNextGeom (dGeomID g
);
1497 * @brief Resets the damping settings to the current world's settings.
1498 * @ingroup bodies damping
1500 ODE_API
void dBodySetDampingDefaults(dBodyID b
);
1503 * @brief Get the body's linear damping scale.
1504 * @ingroup bodies damping
1506 ODE_API dReal
dBodyGetLinearDamping (dBodyID b
);
1509 * @brief Set the body's linear damping scale.
1510 * @param scale The linear damping scale. Should be in the interval [0, 1].
1511 * @ingroup bodies damping
1512 * @remarks From now on the body will not use the world's linear damping
1513 * scale until dBodySetDampingDefaults() is called.
1514 * @sa dBodySetDampingDefaults()
1516 ODE_API
void dBodySetLinearDamping(dBodyID b
, dReal scale
);
1519 * @brief Get the body's angular damping scale.
1520 * @ingroup bodies damping
1521 * @remarks If the body's angular damping scale was not set, this function
1522 * returns the world's angular damping scale.
1524 ODE_API dReal
dBodyGetAngularDamping (dBodyID b
);
1527 * @brief Set the body's angular damping scale.
1528 * @param scale The angular damping scale. Should be in the interval [0, 1].
1529 * @ingroup bodies damping
1530 * @remarks From now on the body will not use the world's angular damping
1531 * scale until dBodyResetAngularDamping() is called.
1532 * @sa dBodyResetAngularDamping()
1534 ODE_API
void dBodySetAngularDamping(dBodyID b
, dReal scale
);
1537 * @brief Convenience function to set linear and angular scales at once.
1538 * @param linear_scale The linear damping scale. Should be in the interval [0, 1].
1539 * @param angular_scale The angular damping scale. Should be in the interval [0, 1].
1540 * @ingroup bodies damping
1541 * @sa dBodySetLinearDamping() dBodySetAngularDamping()
1543 ODE_API
void dBodySetDamping(dBodyID b
, dReal linear_scale
, dReal angular_scale
);
1546 * @brief Get the body's linear damping threshold.
1547 * @ingroup bodies damping
1549 ODE_API dReal
dBodyGetLinearDampingThreshold (dBodyID b
);
1552 * @brief Set the body's linear damping threshold.
1553 * @param threshold The linear threshold to be used. Damping
1554 * is only applied if the linear speed is above this limit.
1555 * @ingroup bodies damping
1557 ODE_API
void dBodySetLinearDampingThreshold(dBodyID b
, dReal threshold
);
1560 * @brief Get the body's angular damping threshold.
1561 * @ingroup bodies damping
1563 ODE_API dReal
dBodyGetAngularDampingThreshold (dBodyID b
);
1566 * @brief Set the body's angular damping threshold.
1567 * @param threshold The angular threshold to be used. Damping is
1568 * only used if the angular speed is above this limit.
1569 * @ingroup bodies damping
1571 ODE_API
void dBodySetAngularDampingThreshold(dBodyID b
, dReal threshold
);
1574 * @brief Get the body's maximum angular speed.
1575 * @ingroup damping bodies
1576 * @sa dWorldGetMaxAngularSpeed()
1578 ODE_API dReal
dBodyGetMaxAngularSpeed (dBodyID b
);
1581 * @brief Set the body's maximum angular speed.
1582 * @ingroup damping bodies
1583 * @sa dWorldSetMaxAngularSpeed() dBodyResetMaxAngularSpeed()
1584 * The default value is dInfinity, but it's a good idea to limit
1585 * it at less than 500 if the body has the gyroscopic term
1588 ODE_API
void dBodySetMaxAngularSpeed(dBodyID b
, dReal max_speed
);
1593 * @brief Get the body's gyroscopic state.
1595 * @return nonzero if gyroscopic term computation is enabled (default),
1599 ODE_API
int dBodyGetGyroscopicMode(dBodyID b
);
1603 * @brief Enable/disable the body's gyroscopic term.
1605 * Disabling the gyroscopic term of a body usually improves
1606 * stability. It also helps turning spining objects, like cars'
1609 * @param enabled nonzero (default) to enable gyroscopic term, 0
1613 ODE_API
void dBodySetGyroscopicMode(dBodyID b
, int enabled
);
1619 * @defgroup joints Joints
1621 * In real life a joint is something like a hinge, that is used to connect two
1623 * In ODE a joint is very similar: It is a relationship that is enforced between
1624 * two bodies so that they can only have certain positions and orientations
1625 * relative to each other.
1626 * This relationship is called a constraint -- the words joint and
1627 * constraint are often used interchangeably.
1629 * A joint has a set of parameters that can be set. These include:
1632 * \li dParamLoStop Low stop angle or position. Setting this to
1633 * -dInfinity (the default value) turns off the low stop.
1634 * For rotational joints, this stop must be greater than -pi to be
1636 * \li dParamHiStop High stop angle or position. Setting this to
1637 * dInfinity (the default value) turns off the high stop.
1638 * For rotational joints, this stop must be less than pi to be
1640 * If the high stop is less than the low stop then both stops will
1642 * \li dParamVel Desired motor velocity (this will be an angular or
1644 * \li dParamFMax The maximum force or torque that the motor will use to
1645 * achieve the desired velocity.
1646 * This must always be greater than or equal to zero.
1647 * Setting this to zero (the default value) turns off the motor.
1648 * \li dParamFudgeFactor The current joint stop/motor implementation has
1650 * when the joint is at one stop and the motor is set to move it away
1651 * from the stop, too much force may be applied for one time step,
1652 * causing a ``jumping'' motion.
1653 * This fudge factor is used to scale this excess force.
1654 * It should have a value between zero and one (the default value).
1655 * If the jumping motion is too visible in a joint, the value can be
1657 * Making this value too small can prevent the motor from being able to
1658 * move the joint away from a stop.
1659 * \li dParamBounce The bouncyness of the stops.
1660 * This is a restitution parameter in the range 0..1.
1661 * 0 means the stops are not bouncy at all, 1 means maximum bouncyness.
1662 * \li dParamCFM The constraint force mixing (CFM) value used when not
1664 * \li dParamStopERP The error reduction parameter (ERP) used by the
1666 * \li dParamStopCFM The constraint force mixing (CFM) value used by the
1667 * stops. Together with the ERP value this can be used to get spongy or
1669 * Note that this is intended for unpowered joints, it does not really
1670 * work as expected when a powered joint reaches its limit.
1671 * \li dParamSuspensionERP Suspension error reduction parameter (ERP).
1672 * Currently this is only implemented on the hinge-2 joint.
1673 * \li dParamSuspensionCFM Suspension constraint force mixing (CFM) value.
1674 * Currently this is only implemented on the hinge-2 joint.
1676 * If a particular parameter is not implemented by a given joint, setting it
1677 * will have no effect.
1678 * These parameter names can be optionally followed by a digit (2 or 3)
1679 * to indicate the second or third set of parameters, e.g. for the second axis
1680 * in a hinge-2 joint, or the third axis in an AMotor joint.
1685 * @brief Create a new joint of the ball type.
1688 * The joint is initially in "limbo" (i.e. it has no effect on the simulation)
1689 * because it does not connect to any bodies.
1690 * @param dJointGroupID set to 0 to allocate the joint normally.
1691 * If it is nonzero the joint is allocated in the given joint group.
1693 ODE_API dJointID
dJointCreateBall (dWorldID
, dJointGroupID
);
1696 * @brief Create a new joint of the hinge type.
1698 * @param dJointGroupID set to 0 to allocate the joint normally.
1699 * If it is nonzero the joint is allocated in the given joint group.
1701 ODE_API dJointID
dJointCreateHinge (dWorldID
, dJointGroupID
);
1704 * @brief Create a new joint of the slider type.
1706 * @param dJointGroupID set to 0 to allocate the joint normally.
1707 * If it is nonzero the joint is allocated in the given joint group.
1709 ODE_API dJointID
dJointCreateSlider (dWorldID
, dJointGroupID
);
1712 * @brief Create a new joint of the contact type.
1714 * @param dJointGroupID set to 0 to allocate the joint normally.
1715 * If it is nonzero the joint is allocated in the given joint group.
1717 ODE_API dJointID
dJointCreateContact (dWorldID
, dJointGroupID
, const dContact
*);
1720 * @brief Create a new joint of the hinge2 type.
1722 * @param dJointGroupID set to 0 to allocate the joint normally.
1723 * If it is nonzero the joint is allocated in the given joint group.
1725 ODE_API dJointID
dJointCreateHinge2 (dWorldID
, dJointGroupID
);
1728 * @brief Create a new joint of the universal type.
1730 * @param dJointGroupID set to 0 to allocate the joint normally.
1731 * If it is nonzero the joint is allocated in the given joint group.
1733 ODE_API dJointID
dJointCreateUniversal (dWorldID
, dJointGroupID
);
1736 * @brief Create a new joint of the PR (Prismatic and Rotoide) type.
1738 * @param dJointGroupID set to 0 to allocate the joint normally.
1739 * If it is nonzero the joint is allocated in the given joint group.
1741 ODE_API dJointID
dJointCreatePR (dWorldID
, dJointGroupID
);
1744 * @brief Create a new joint of the PU (Prismatic and Universal) type.
1746 * @param dJointGroupID set to 0 to allocate the joint normally.
1747 * If it is nonzero the joint is allocated in the given joint group.
1749 ODE_API dJointID
dJointCreatePU (dWorldID
, dJointGroupID
);
1752 * @brief Create a new joint of the Piston type.
1754 * @param dJointGroupID set to 0 to allocate the joint normally.
1755 * If it is nonzero the joint is allocated in the given
1758 ODE_API dJointID
dJointCreatePiston (dWorldID
, dJointGroupID
);
1761 * @brief Create a new joint of the fixed type.
1763 * @param dJointGroupID set to 0 to allocate the joint normally.
1764 * If it is nonzero the joint is allocated in the given joint group.
1766 ODE_API dJointID
dJointCreateFixed (dWorldID
, dJointGroupID
);
1768 ODE_API dJointID
dJointCreateNull (dWorldID
, dJointGroupID
);
1771 * @brief Create a new joint of the A-motor type.
1773 * @param dJointGroupID set to 0 to allocate the joint normally.
1774 * If it is nonzero the joint is allocated in the given joint group.
1776 ODE_API dJointID
dJointCreateAMotor (dWorldID
, dJointGroupID
);
1779 * @brief Create a new joint of the L-motor type.
1781 * @param dJointGroupID set to 0 to allocate the joint normally.
1782 * If it is nonzero the joint is allocated in the given joint group.
1784 ODE_API dJointID
dJointCreateLMotor (dWorldID
, dJointGroupID
);
1787 * @brief Create a new joint of the plane-2d type.
1789 * @param dJointGroupID set to 0 to allocate the joint normally.
1790 * If it is nonzero the joint is allocated in the given joint group.
1792 ODE_API dJointID
dJointCreatePlane2D (dWorldID
, dJointGroupID
);
1795 * @brief Create a new joint of the double ball type.
1797 * @param dJointGroupID set to 0 to allocate the joint normally.
1798 * If it is nonzero the joint is allocated in the given joint group.
1800 ODE_API dJointID
dJointCreateDBall (dWorldID
, dJointGroupID
);
1803 * @brief Create a new joint of the double hinge type.
1805 * @param dJointGroupID set to 0 to allocate the joint normally.
1806 * If it is nonzero the joint is allocated in the given joint group.
1808 ODE_API dJointID
dJointCreateDHinge (dWorldID
, dJointGroupID
);
1811 * @brief Create a new joint of the Transmission type.
1813 * @param dJointGroupID set to 0 to allocate the joint normally.
1814 * If it is nonzero the joint is allocated in the given joint group.
1816 ODE_API dJointID
dJointCreateTransmission (dWorldID
, dJointGroupID
);
1820 * @brief Destroy a joint.
1823 * disconnects it from its attached bodies and removing it from the world.
1824 * However, if the joint is a member of a group then this function has no
1825 * effect - to destroy that joint the group must be emptied or destroyed.
1827 ODE_API
void dJointDestroy (dJointID
);
1831 * @brief Create a joint group
1833 * @param max_size deprecated. Set to 0.
1835 ODE_API dJointGroupID
dJointGroupCreate (int max_size
);
1838 * @brief Destroy a joint group.
1841 * All joints in the joint group will be destroyed.
1843 ODE_API
void dJointGroupDestroy (dJointGroupID
);
1846 * @brief Empty a joint group.
1849 * All joints in the joint group will be destroyed,
1850 * but the joint group itself will not be destroyed.
1852 ODE_API
void dJointGroupEmpty (dJointGroupID
);
1855 * @brief Return the number of bodies attached to the joint
1858 ODE_API
int dJointGetNumBodies(dJointID
);
1861 * @brief Attach the joint to some new bodies.
1864 * If the joint is already attached, it will be detached from the old bodies
1866 * To attach this joint to only one body, set body1 or body2 to zero - a zero
1867 * body refers to the static environment.
1868 * Setting both bodies to zero puts the joint into "limbo", i.e. it will
1869 * have no effect on the simulation.
1871 * Some joints, like hinge-2 need to be attached to two bodies to work.
1873 ODE_API
void dJointAttach (dJointID
, dBodyID body1
, dBodyID body2
);
1876 * @brief Manually enable a joint.
1877 * @param dJointID identification of joint.
1880 ODE_API
void dJointEnable (dJointID
);
1883 * @brief Manually disable a joint.
1886 * A disabled joint will not affect the simulation, but will maintain the anchors and
1887 * axes so it can be enabled later.
1889 ODE_API
void dJointDisable (dJointID
);
1892 * @brief Check wether a joint is enabled.
1894 * @return 1 if a joint is currently enabled or 0 if it is disabled.
1896 ODE_API
int dJointIsEnabled (dJointID
);
1899 * @brief Set the user-data pointer
1902 ODE_API
void dJointSetData (dJointID
, void *data
);
1905 * @brief Get the user-data pointer
1908 ODE_API
void *dJointGetData (dJointID
);
1911 * @brief Get the type of the joint
1913 * @return the type, being one of these:
1914 * \li dJointTypeBall
1915 * \li dJointTypeHinge
1916 * \li dJointTypeSlider
1917 * \li dJointTypeContact
1918 * \li dJointTypeUniversal
1919 * \li dJointTypeHinge2
1920 * \li dJointTypeFixed
1921 * \li dJointTypeNull
1922 * \li dJointTypeAMotor
1923 * \li dJointTypeLMotor
1924 * \li dJointTypePlane2D
1927 * \li dJointTypePiston
1929 ODE_API dJointType
dJointGetType (dJointID
);
1932 * @brief Return the bodies that this joint connects.
1934 * @param index return the first (0) or second (1) body.
1936 * If one of these returned body IDs is zero, the joint connects the other body
1937 * to the static environment.
1938 * If both body IDs are zero, the joint is in ``limbo'' and has no effect on
1941 ODE_API dBodyID
dJointGetBody (dJointID
, int index
);
1944 * @brief Sets the datastructure that is to receive the feedback.
1946 * The feedback can be used by the user, so that it is known how
1947 * much force an individual joint exerts.
1950 ODE_API
void dJointSetFeedback (dJointID
, dJointFeedback
*);
1953 * @brief Gets the datastructure that is to receive the feedback.
1956 ODE_API dJointFeedback
*dJointGetFeedback (dJointID
);
1959 * @brief Set the joint anchor point.
1962 * The joint will try to keep this point on each body
1963 * together. The input is specified in world coordinates.
1965 ODE_API
void dJointSetBallAnchor (dJointID
, dReal x
, dReal y
, dReal z
);
1968 * @brief Set the joint anchor point.
1971 ODE_API
void dJointSetBallAnchor2 (dJointID
, dReal x
, dReal y
, dReal z
);
1974 * @brief Param setting for Ball joints
1977 ODE_API
void dJointSetBallParam (dJointID
, int parameter
, dReal value
);
1980 * @brief Set hinge anchor parameter.
1983 ODE_API
void dJointSetHingeAnchor (dJointID
, dReal x
, dReal y
, dReal z
);
1985 ODE_API
void dJointSetHingeAnchorDelta (dJointID
, dReal x
, dReal y
, dReal z
, dReal ax
, dReal ay
, dReal az
);
1988 * @brief Set hinge axis.
1991 ODE_API
void dJointSetHingeAxis (dJointID
, dReal x
, dReal y
, dReal z
);
1994 * @brief Set the Hinge axis as if the 2 bodies were already at angle appart.
1997 * This function initialize the Axis and the relative orientation of each body
1998 * as if body1 was rotated around the axis by the angle value. \br
2001 * dJointSetHingeAxis(jId, 1, 0, 0);
2002 * // If you request the position you will have: dJointGetHingeAngle(jId) == 0
2003 * dJointSetHingeAxisDelta(jId, 1, 0, 0, 0.23);
2004 * // If you request the position you will have: dJointGetHingeAngle(jId) == 0.23
2007 * @param j The Hinge joint ID for which the axis will be set
2008 * @param x The X component of the axis in world frame
2009 * @param y The Y component of the axis in world frame
2010 * @param z The Z component of the axis in world frame
2011 * @param angle The angle for the offset of the relative orientation.
2012 * As if body1 was rotated by angle when the Axis was set (see below).
2013 * The rotation is around the new Hinge axis.
2015 * @note Usually the function dJointSetHingeAxis set the current position of body1
2016 * and body2 as the zero angle position. This function set the current position
2017 * as the if the 2 bodies where \b angle appart.
2018 * @warning Calling dJointSetHingeAnchor or dJointSetHingeAxis will reset the "zero"
2021 ODE_API
void dJointSetHingeAxisOffset (dJointID j
, dReal x
, dReal y
, dReal z
, dReal angle
);
2024 * @brief set joint parameter
2027 ODE_API
void dJointSetHingeParam (dJointID
, int parameter
, dReal value
);
2030 * @brief Applies the torque about the hinge axis.
2032 * That is, it applies a torque with specified magnitude in the direction
2033 * of the hinge axis, to body 1, and with the same magnitude but in opposite
2034 * direction to body 2. This function is just a wrapper for dBodyAddTorque()}
2037 ODE_API
void dJointAddHingeTorque(dJointID joint
, dReal torque
);
2040 * @brief set the joint axis
2043 ODE_API
void dJointSetSliderAxis (dJointID
, dReal x
, dReal y
, dReal z
);
2048 ODE_API
void dJointSetSliderAxisDelta (dJointID
, dReal x
, dReal y
, dReal z
, dReal ax
, dReal ay
, dReal az
);
2051 * @brief set joint parameter
2054 ODE_API
void dJointSetSliderParam (dJointID
, int parameter
, dReal value
);
2057 * @brief Applies the given force in the slider's direction.
2059 * That is, it applies a force with specified magnitude, in the direction of
2060 * slider's axis, to body1, and with the same magnitude but opposite
2061 * direction to body2. This function is just a wrapper for dBodyAddForce().
2064 ODE_API
void dJointAddSliderForce(dJointID joint
, dReal force
);
2070 ODE_API
void dJointSetHinge2Anchor (dJointID
, dReal x
, dReal y
, dReal z
);
2073 * @brief set both axes (optionally)
2075 * This can change both axes at once avoiding transitions via invalid states
2076 * while changing axes one by one and having the first changed axis coincide
2077 * with the other axis existing direction.
2079 * At least one of the axes must be not NULL. If NULL is passed, the corresponding
2080 * axis retains its existing value.
2084 ODE_API
void dJointSetHinge2Axes (dJointID j
, const dReal
*axis1
/*=[dSA__MAX],=NULL*/, const dReal
*axis2
/*=[dSA__MAX],=NULL*/);
2089 * Deprecated. Use @fn dJointSetHinge2Axes instead.
2092 * @see dJointSetHinge2Axes
2094 ODE_API_DEPRECATED ODE_API
void dJointSetHinge2Axis1 (dJointID j
, dReal x
, dReal y
, dReal z
);
2099 * Deprecated. Use @fn dJointSetHinge2Axes instead.
2102 * @see dJointSetHinge2Axes
2104 ODE_API_DEPRECATED ODE_API
void dJointSetHinge2Axis2 (dJointID j
, dReal x
, dReal y
, dReal z
);
2107 * @brief set joint parameter
2110 ODE_API
void dJointSetHinge2Param (dJointID
, int parameter
, dReal value
);
2113 * @brief Applies torque1 about the hinge2's axis 1, torque2 about the
2115 * @remarks This function is just a wrapper for dBodyAddTorque().
2118 ODE_API
void dJointAddHinge2Torques(dJointID joint
, dReal torque1
, dReal torque2
);
2124 ODE_API
void dJointSetUniversalAnchor (dJointID
, dReal x
, dReal y
, dReal z
);
2130 ODE_API
void dJointSetUniversalAxis1 (dJointID
, dReal x
, dReal y
, dReal z
);
2133 * @brief Set the Universal axis1 as if the 2 bodies were already at
2134 * offset1 and offset2 appart with respect to axis1 and axis2.
2137 * This function initialize the axis1 and the relative orientation of
2138 * each body as if body1 was rotated around the new axis1 by the offset1
2139 * value and as if body2 was rotated around the axis2 by offset2. \br
2142 * dJointSetHuniversalAxis1(jId, 1, 0, 0);
2143 * // If you request the position you will have: dJointGetUniversalAngle1(jId) == 0
2144 * // If you request the position you will have: dJointGetUniversalAngle2(jId) == 0
2145 * dJointSetHuniversalAxis1Offset(jId, 1, 0, 0, 0.2, 0.17);
2146 * // If you request the position you will have: dJointGetUniversalAngle1(jId) == 0.2
2147 * // If you request the position you will have: dJointGetUniversalAngle2(jId) == 0.17
2150 * @param j The Hinge joint ID for which the axis will be set
2151 * @param x The X component of the axis in world frame
2152 * @param y The Y component of the axis in world frame
2153 * @param z The Z component of the axis in world frame
2154 * @param angle The angle for the offset of the relative orientation.
2155 * As if body1 was rotated by angle when the Axis was set (see below).
2156 * The rotation is around the new Hinge axis.
2158 * @note Usually the function dJointSetHingeAxis set the current position of body1
2159 * and body2 as the zero angle position. This function set the current position
2160 * as the if the 2 bodies where \b offsets appart.
2162 * @note Any previous offsets are erased.
2164 * @warning Calling dJointSetUniversalAnchor, dJointSetUnivesalAxis1,
2165 * dJointSetUniversalAxis2, dJointSetUniversalAxis2Offset
2166 * will reset the "zero" angle position.
2168 ODE_API
void dJointSetUniversalAxis1Offset (dJointID
, dReal x
, dReal y
, dReal z
,
2169 dReal offset1
, dReal offset2
);
2175 ODE_API
void dJointSetUniversalAxis2 (dJointID
, dReal x
, dReal y
, dReal z
);
2178 * @brief Set the Universal axis2 as if the 2 bodies were already at
2179 * offset1 and offset2 appart with respect to axis1 and axis2.
2182 * This function initialize the axis2 and the relative orientation of
2183 * each body as if body1 was rotated around the axis1 by the offset1
2184 * value and as if body2 was rotated around the new axis2 by offset2. \br
2187 * dJointSetHuniversalAxis2(jId, 0, 1, 0);
2188 * // If you request the position you will have: dJointGetUniversalAngle1(jId) == 0
2189 * // If you request the position you will have: dJointGetUniversalAngle2(jId) == 0
2190 * dJointSetHuniversalAxis2Offset(jId, 0, 1, 0, 0.2, 0.17);
2191 * // If you request the position you will have: dJointGetUniversalAngle1(jId) == 0.2
2192 * // If you request the position you will have: dJointGetUniversalAngle2(jId) == 0.17
2195 * @param j The Hinge joint ID for which the axis will be set
2196 * @param x The X component of the axis in world frame
2197 * @param y The Y component of the axis in world frame
2198 * @param z The Z component of the axis in world frame
2199 * @param angle The angle for the offset of the relative orientation.
2200 * As if body1 was rotated by angle when the Axis was set (see below).
2201 * The rotation is around the new Hinge axis.
2203 * @note Usually the function dJointSetHingeAxis set the current position of body1
2204 * and body2 as the zero angle position. This function set the current position
2205 * as the if the 2 bodies where \b offsets appart.
2207 * @note Any previous offsets are erased.
2209 * @warning Calling dJointSetUniversalAnchor, dJointSetUnivesalAxis1,
2210 * dJointSetUniversalAxis2, dJointSetUniversalAxis2Offset
2211 * will reset the "zero" angle position.
2215 ODE_API
void dJointSetUniversalAxis2Offset (dJointID
, dReal x
, dReal y
, dReal z
,
2216 dReal offset1
, dReal offset2
);
2219 * @brief set joint parameter
2222 ODE_API
void dJointSetUniversalParam (dJointID
, int parameter
, dReal value
);
2225 * @brief Applies torque1 about the universal's axis 1, torque2 about the
2226 * universal's axis 2.
2227 * @remarks This function is just a wrapper for dBodyAddTorque().
2230 ODE_API
void dJointAddUniversalTorques(dJointID joint
, dReal torque1
, dReal torque2
);
2237 ODE_API
void dJointSetPRAnchor (dJointID
, dReal x
, dReal y
, dReal z
);
2240 * @brief set the axis for the prismatic articulation
2243 ODE_API
void dJointSetPRAxis1 (dJointID
, dReal x
, dReal y
, dReal z
);
2246 * @brief set the axis for the rotoide articulation
2249 ODE_API
void dJointSetPRAxis2 (dJointID
, dReal x
, dReal y
, dReal z
);
2252 * @brief set joint parameter
2255 * @note parameterX where X equal 2 refer to parameter for the rotoide articulation
2257 ODE_API
void dJointSetPRParam (dJointID
, int parameter
, dReal value
);
2260 * @brief Applies the torque about the rotoide axis of the PR joint
2262 * That is, it applies a torque with specified magnitude in the direction
2263 * of the rotoide axis, to body 1, and with the same magnitude but in opposite
2264 * direction to body 2. This function is just a wrapper for dBodyAddTorque()}
2267 ODE_API
void dJointAddPRTorque (dJointID j
, dReal torque
);
2274 ODE_API
void dJointSetPUAnchor (dJointID
, dReal x
, dReal y
, dReal z
);
2280 ODE_API_DEPRECATED ODE_API
void dJointSetPUAnchorDelta (dJointID
, dReal x
, dReal y
, dReal z
,
2281 dReal dx
, dReal dy
, dReal dz
);
2284 * @brief Set the PU anchor as if the 2 bodies were already at [dx, dy, dz] appart.
2287 * This function initialize the anchor and the relative position of each body
2288 * as if the position between body1 and body2 was already the projection of [dx, dy, dz]
2289 * along the Piston axis. (i.e as if the body1 was at its current position - [dx,dy,dy] when the
2295 * dJointGetPUAxis(jId, axis);
2296 * dJointSetPUAnchor(jId, 0, 0, 0);
2297 * // If you request the position you will have: dJointGetPUPosition(jId) == 0
2298 * dJointSetPUAnchorOffset(jId, 0, 0, 0, axis[X]*offset, axis[Y]*offset, axis[Z]*offset);
2299 * // If you request the position you will have: dJointGetPUPosition(jId) == offset
2301 * @param j The PU joint for which the anchor point will be set
2302 * @param x The X position of the anchor point in world frame
2303 * @param y The Y position of the anchor point in world frame
2304 * @param z The Z position of the anchor point in world frame
2305 * @param dx A delta to be substracted to the X position as if the anchor was set
2306 * when body1 was at current_position[X] - dx
2307 * @param dx A delta to be substracted to the Y position as if the anchor was set
2308 * when body1 was at current_position[Y] - dy
2309 * @param dx A delta to be substracted to the Z position as if the anchor was set
2310 * when body1 was at current_position[Z] - dz
2312 ODE_API
void dJointSetPUAnchorOffset (dJointID
, dReal x
, dReal y
, dReal z
,
2313 dReal dx
, dReal dy
, dReal dz
);
2316 * @brief set the axis for the first axis or the universal articulation
2319 ODE_API
void dJointSetPUAxis1 (dJointID
, dReal x
, dReal y
, dReal z
);
2322 * @brief set the axis for the second axis or the universal articulation
2325 ODE_API
void dJointSetPUAxis2 (dJointID
, dReal x
, dReal y
, dReal z
);
2328 * @brief set the axis for the prismatic articulation
2331 ODE_API
void dJointSetPUAxis3 (dJointID
, dReal x
, dReal y
, dReal z
);
2334 * @brief set the axis for the prismatic articulation
2336 * @note This function was added for convenience it is the same as
2339 ODE_API
void dJointSetPUAxisP (dJointID id
, dReal x
, dReal y
, dReal z
);
2344 * @brief set joint parameter
2347 * @note parameterX where X equal 2 refer to parameter for second axis of the
2348 * universal articulation
2349 * @note parameterX where X equal 3 refer to parameter for prismatic
2352 ODE_API
void dJointSetPUParam (dJointID
, int parameter
, dReal value
);
2355 * @brief Applies torques about the rotoide axes of PU joint
2357 * That is, it applies torque1 about the universal axis 1 and torque2 about the
2358 * universal axis 2 to body 1, and with the same magnitude but in opposite
2359 * direction to body 2.
2361 * @remarks This function is just a wrapper for dBodyAddTorque().
2364 ODE_API
void dJointAddPUTorques (dJointID joint
, dReal torque1
, dReal torque2
);
2370 * @brief set the joint anchor
2373 ODE_API
void dJointSetPistonAnchor (dJointID
, dReal x
, dReal y
, dReal z
);
2376 * @brief Set the Piston anchor as if the 2 bodies were already at [dx,dy, dz] appart.
2379 * This function initialize the anchor and the relative position of each body
2380 * as if the position between body1 and body2 was already the projection of [dx, dy, dz]
2381 * along the Piston axis. (i.e as if the body1 was at its current position - [dx,dy,dy] when the
2387 * dJointGetPistonAxis(jId, axis);
2388 * dJointSetPistonAnchor(jId, 0, 0, 0);
2389 * // If you request the position you will have: dJointGetPistonPosition(jId) == 0
2390 * dJointSetPistonAnchorOffset(jId, 0, 0, 0, axis[X]*offset, axis[Y]*offset, axis[Z]*offset);
2391 * // If you request the position you will have: dJointGetPistonPosition(jId) == offset
2393 * @param j The Piston joint for which the anchor point will be set
2394 * @param x The X position of the anchor point in world frame
2395 * @param y The Y position of the anchor point in world frame
2396 * @param z The Z position of the anchor point in world frame
2397 * @param dx A delta to be substracted to the X position as if the anchor was set
2398 * when body1 was at current_position[X] - dx
2399 * @param dx A delta to be substracted to the Y position as if the anchor was set
2400 * when body1 was at current_position[Y] - dy
2401 * @param dx A delta to be substracted to the Z position as if the anchor was set
2402 * when body1 was at current_position[Z] - dz
2404 ODE_API
void dJointSetPistonAnchorOffset(dJointID j
, dReal x
, dReal y
, dReal z
,
2405 dReal dx
, dReal dy
, dReal dz
);
2408 * @brief set the joint axis
2411 ODE_API
void dJointSetPistonAxis (dJointID
, dReal x
, dReal y
, dReal z
);
2414 * This function set prismatic axis of the joint and also set the position
2418 * @param j The joint affected by this function
2419 * @param x The x component of the axis
2420 * @param y The y component of the axis
2421 * @param z The z component of the axis
2422 * @param dx The Initial position of the prismatic join in the x direction
2423 * @param dy The Initial position of the prismatic join in the y direction
2424 * @param dz The Initial position of the prismatic join in the z direction
2426 ODE_API_DEPRECATED ODE_API
void dJointSetPistonAxisDelta (dJointID j
, dReal x
, dReal y
, dReal z
, dReal ax
, dReal ay
, dReal az
);
2429 * @brief set joint parameter
2432 ODE_API
void dJointSetPistonParam (dJointID
, int parameter
, dReal value
);
2435 * @brief Applies the given force in the slider's direction.
2437 * That is, it applies a force with specified magnitude, in the direction of
2438 * prismatic's axis, to body1, and with the same magnitude but opposite
2439 * direction to body2. This function is just a wrapper for dBodyAddForce().
2442 ODE_API
void dJointAddPistonForce (dJointID joint
, dReal force
);
2446 * @brief Call this on the fixed joint after it has been attached to
2447 * remember the current desired relative offset and desired relative
2448 * rotation between the bodies.
2451 ODE_API
void dJointSetFixed (dJointID
);
2454 * @brief Sets joint parameter
2458 ODE_API
void dJointSetFixedParam (dJointID
, int parameter
, dReal value
);
2461 * @brief set the nr of axes
2465 ODE_API
void dJointSetAMotorNumAxes (dJointID
, int num
);
2471 ODE_API
void dJointSetAMotorAxis (dJointID
, int anum
, int rel
,
2472 dReal x
, dReal y
, dReal z
);
2475 * @brief Tell the AMotor what the current angle is along axis anum.
2477 * This function should only be called in dAMotorUser mode, because in this
2478 * mode the AMotor has no other way of knowing the joint angles.
2479 * The angle information is needed if stops have been set along the axis,
2480 * but it is not needed for axis motors.
2483 ODE_API
void dJointSetAMotorAngle (dJointID
, int anum
, dReal angle
);
2486 * @brief set joint parameter
2489 ODE_API
void dJointSetAMotorParam (dJointID
, int parameter
, dReal value
);
2495 ODE_API
void dJointSetAMotorMode (dJointID
, int mode
);
2498 * @brief Applies torque0 about the AMotor's axis 0, torque1 about the
2499 * AMotor's axis 1, and torque2 about the AMotor's axis 2.
2501 * If the motor has fewer than three axes, the higher torques are ignored.
2502 * This function is just a wrapper for dBodyAddTorque().
2505 ODE_API
void dJointAddAMotorTorques (dJointID
, dReal torque1
, dReal torque2
, dReal torque3
);
2508 * @brief Set the number of axes that will be controlled by the LMotor.
2509 * @param num can range from 0 (which effectively deactivates the joint) to 3.
2512 ODE_API
void dJointSetLMotorNumAxes (dJointID
, int num
);
2515 * @brief Set the AMotor axes.
2516 * @param anum selects the axis to change (0,1 or 2).
2517 * @param rel Each axis can have one of three ``relative orientation'' modes
2518 * \li 0: The axis is anchored to the global frame.
2519 * \li 1: The axis is anchored to the first body.
2520 * \li 2: The axis is anchored to the second body.
2521 * @remarks The axis vector is always specified in global coordinates
2522 * regardless of the setting of rel.
2525 ODE_API
void dJointSetLMotorAxis (dJointID
, int anum
, int rel
, dReal x
, dReal y
, dReal z
);
2528 * @brief set joint parameter
2531 ODE_API
void dJointSetLMotorParam (dJointID
, int parameter
, dReal value
);
2536 ODE_API
void dJointSetPlane2DXParam (dJointID
, int parameter
, dReal value
);
2542 ODE_API
void dJointSetPlane2DYParam (dJointID
, int parameter
, dReal value
);
2547 ODE_API
void dJointSetPlane2DAngleParam (dJointID
, int parameter
, dReal value
);
2550 * @brief Get the joint anchor point, in world coordinates.
2552 * This returns the point on body 1. If the joint is perfectly satisfied,
2553 * this will be the same as the point on body 2.
2555 ODE_API
void dJointGetBallAnchor (dJointID
, dVector3 result
);
2558 * @brief Get the joint anchor point, in world coordinates.
2560 * This returns the point on body 2. You can think of a ball and socket
2561 * joint as trying to keep the result of dJointGetBallAnchor() and
2562 * dJointGetBallAnchor2() the same. If the joint is perfectly satisfied,
2563 * this function will return the same value as dJointGetBallAnchor() to
2564 * within roundoff errors. dJointGetBallAnchor2() can be used, along with
2565 * dJointGetBallAnchor(), to see how far the joint has come apart.
2567 ODE_API
void dJointGetBallAnchor2 (dJointID
, dVector3 result
);
2570 * @brief get joint parameter
2573 ODE_API dReal
dJointGetBallParam (dJointID
, int parameter
);
2576 * @brief Get the hinge anchor point, in world coordinates.
2578 * This returns the point on body 1. If the joint is perfectly satisfied,
2579 * this will be the same as the point on body 2.
2582 ODE_API
void dJointGetHingeAnchor (dJointID
, dVector3 result
);
2585 * @brief Get the joint anchor point, in world coordinates.
2586 * @return The point on body 2. If the joint is perfectly satisfied,
2587 * this will return the same value as dJointGetHingeAnchor().
2588 * If not, this value will be slightly different.
2589 * This can be used, for example, to see how far the joint has come apart.
2592 ODE_API
void dJointGetHingeAnchor2 (dJointID
, dVector3 result
);
2598 ODE_API
void dJointGetHingeAxis (dJointID
, dVector3 result
);
2601 * @brief get joint parameter
2604 ODE_API dReal
dJointGetHingeParam (dJointID
, int parameter
);
2607 * @brief Get the hinge angle.
2609 * The angle is measured between the two bodies, or between the body and
2610 * the static environment.
2611 * The angle will be between -pi..pi.
2612 * Give the relative rotation with respect to the Hinge axis of Body 1 with
2613 * respect to Body 2.
2614 * When the hinge anchor or axis is set, the current position of the attached
2615 * bodies is examined and that position will be the zero angle.
2618 ODE_API dReal
dJointGetHingeAngle (dJointID
);
2621 * @brief Get the hinge angle time derivative.
2624 ODE_API dReal
dJointGetHingeAngleRate (dJointID
);
2627 * @brief Get the slider linear position (i.e. the slider's extension)
2629 * When the axis is set, the current position of the attached bodies is
2630 * examined and that position will be the zero position.
2632 * The position is the distance, with respect to the zero position,
2633 * along the slider axis of body 1 with respect to
2634 * body 2. (A NULL body is replaced by the world).
2637 ODE_API dReal
dJointGetSliderPosition (dJointID
);
2640 * @brief Get the slider linear position's time derivative.
2643 ODE_API dReal
dJointGetSliderPositionRate (dJointID
);
2646 * @brief Get the slider axis
2649 ODE_API
void dJointGetSliderAxis (dJointID
, dVector3 result
);
2652 * @brief get joint parameter
2655 ODE_API dReal
dJointGetSliderParam (dJointID
, int parameter
);
2658 * @brief Get the joint anchor point, in world coordinates.
2659 * @return the point on body 1. If the joint is perfectly satisfied,
2660 * this will be the same as the point on body 2.
2663 ODE_API
void dJointGetHinge2Anchor (dJointID
, dVector3 result
);
2666 * @brief Get the joint anchor point, in world coordinates.
2667 * This returns the point on body 2. If the joint is perfectly satisfied,
2668 * this will return the same value as dJointGetHinge2Anchor.
2669 * If not, this value will be slightly different.
2670 * This can be used, for example, to see how far the joint has come apart.
2673 ODE_API
void dJointGetHinge2Anchor2 (dJointID
, dVector3 result
);
2676 * @brief Get joint axis
2679 ODE_API
void dJointGetHinge2Axis1 (dJointID
, dVector3 result
);
2682 * @brief Get joint axis
2685 ODE_API
void dJointGetHinge2Axis2 (dJointID
, dVector3 result
);
2688 * @brief get joint parameter
2691 ODE_API dReal
dJointGetHinge2Param (dJointID
, int parameter
);
2697 ODE_API dReal
dJointGetHinge2Angle1 (dJointID
);
2703 ODE_API dReal
dJointGetHinge2Angle2 (dJointID
);
2706 * @brief Get time derivative of angle
2709 ODE_API dReal
dJointGetHinge2Angle1Rate (dJointID
);
2712 * @brief Get time derivative of angle
2715 ODE_API dReal
dJointGetHinge2Angle2Rate (dJointID
);
2718 * @brief Get the joint anchor point, in world coordinates.
2719 * @return the point on body 1. If the joint is perfectly satisfied,
2720 * this will be the same as the point on body 2.
2723 ODE_API
void dJointGetUniversalAnchor (dJointID
, dVector3 result
);
2726 * @brief Get the joint anchor point, in world coordinates.
2727 * @return This returns the point on body 2.
2729 * You can think of the ball and socket part of a universal joint as
2730 * trying to keep the result of dJointGetBallAnchor() and
2731 * dJointGetBallAnchor2() the same. If the joint is
2732 * perfectly satisfied, this function will return the same value
2733 * as dJointGetUniversalAnchor() to within roundoff errors.
2734 * dJointGetUniversalAnchor2() can be used, along with
2735 * dJointGetUniversalAnchor(), to see how far the joint has come apart.
2738 ODE_API
void dJointGetUniversalAnchor2 (dJointID
, dVector3 result
);
2744 ODE_API
void dJointGetUniversalAxis1 (dJointID
, dVector3 result
);
2750 ODE_API
void dJointGetUniversalAxis2 (dJointID
, dVector3 result
);
2754 * @brief get joint parameter
2757 ODE_API dReal
dJointGetUniversalParam (dJointID
, int parameter
);
2760 * @brief Get both angles at the same time.
2763 * @param joint The universal joint for which we want to calculate the angles
2764 * @param angle1 The angle between the body1 and the axis 1
2765 * @param angle2 The angle between the body2 and the axis 2
2767 * @note This function combine getUniversalAngle1 and getUniversalAngle2 together
2768 * and try to avoid redundant calculation
2770 ODE_API
void dJointGetUniversalAngles (dJointID
, dReal
*angle1
, dReal
*angle2
);
2776 ODE_API dReal
dJointGetUniversalAngle1 (dJointID
);
2782 ODE_API dReal
dJointGetUniversalAngle2 (dJointID
);
2785 * @brief Get time derivative of angle
2788 ODE_API dReal
dJointGetUniversalAngle1Rate (dJointID
);
2791 * @brief Get time derivative of angle
2794 ODE_API dReal
dJointGetUniversalAngle2Rate (dJointID
);
2799 * @brief Get the joint anchor point, in world coordinates.
2800 * @return the point on body 1. If the joint is perfectly satisfied,
2801 * this will be the same as the point on body 2.
2804 ODE_API
void dJointGetPRAnchor (dJointID
, dVector3 result
);
2807 * @brief Get the PR linear position (i.e. the prismatic's extension)
2809 * When the axis is set, the current position of the attached bodies is
2810 * examined and that position will be the zero position.
2812 * The position is the "oriented" length between the
2813 * position = (Prismatic axis) dot_product [(body1 + offset) - (body2 + anchor2)]
2817 ODE_API dReal
dJointGetPRPosition (dJointID
);
2820 * @brief Get the PR linear position's time derivative
2824 ODE_API dReal
dJointGetPRPositionRate (dJointID
);
2828 * @brief Get the PR angular position (i.e. the twist between the 2 bodies)
2830 * When the axis is set, the current position of the attached bodies is
2831 * examined and that position will be the zero position.
2834 ODE_API dReal
dJointGetPRAngle (dJointID
);
2837 * @brief Get the PR angular position's time derivative
2841 ODE_API dReal
dJointGetPRAngleRate (dJointID
);
2845 * @brief Get the prismatic axis
2848 ODE_API
void dJointGetPRAxis1 (dJointID
, dVector3 result
);
2851 * @brief Get the Rotoide axis
2854 ODE_API
void dJointGetPRAxis2 (dJointID
, dVector3 result
);
2857 * @brief get joint parameter
2860 ODE_API dReal
dJointGetPRParam (dJointID
, int parameter
);
2865 * @brief Get the joint anchor point, in world coordinates.
2866 * @return the point on body 1. If the joint is perfectly satisfied,
2867 * this will be the same as the point on body 2.
2870 ODE_API
void dJointGetPUAnchor (dJointID
, dVector3 result
);
2873 * @brief Get the PU linear position (i.e. the prismatic's extension)
2875 * When the axis is set, the current position of the attached bodies is
2876 * examined and that position will be the zero position.
2878 * The position is the "oriented" length between the
2879 * position = (Prismatic axis) dot_product [(body1 + offset) - (body2 + anchor2)]
2883 ODE_API dReal
dJointGetPUPosition (dJointID
);
2886 * @brief Get the PR linear position's time derivative
2890 ODE_API dReal
dJointGetPUPositionRate (dJointID
);
2893 * @brief Get the first axis of the universal component of the joint
2896 ODE_API
void dJointGetPUAxis1 (dJointID
, dVector3 result
);
2899 * @brief Get the second axis of the Universal component of the joint
2902 ODE_API
void dJointGetPUAxis2 (dJointID
, dVector3 result
);
2905 * @brief Get the prismatic axis
2908 ODE_API
void dJointGetPUAxis3 (dJointID
, dVector3 result
);
2911 * @brief Get the prismatic axis
2914 * @note This function was added for convenience it is the same as
2917 ODE_API
void dJointGetPUAxisP (dJointID id
, dVector3 result
);
2923 * @brief Get both angles at the same time.
2926 * @param joint The Prismatic universal joint for which we want to calculate the angles
2927 * @param angle1 The angle between the body1 and the axis 1
2928 * @param angle2 The angle between the body2 and the axis 2
2930 * @note This function combine dJointGetPUAngle1 and dJointGetPUAngle2 together
2931 * and try to avoid redundant calculation
2933 ODE_API
void dJointGetPUAngles (dJointID
, dReal
*angle1
, dReal
*angle2
);
2939 ODE_API dReal
dJointGetPUAngle1 (dJointID
);
2942 * @brief * @brief Get time derivative of angle1
2946 ODE_API dReal
dJointGetPUAngle1Rate (dJointID
);
2953 ODE_API dReal
dJointGetPUAngle2 (dJointID
);
2956 * @brief * @brief Get time derivative of angle2
2960 ODE_API dReal
dJointGetPUAngle2Rate (dJointID
);
2963 * @brief get joint parameter
2966 ODE_API dReal
dJointGetPUParam (dJointID
, int parameter
);
2973 * @brief Get the Piston linear position (i.e. the piston's extension)
2975 * When the axis is set, the current position of the attached bodies is
2976 * examined and that position will be the zero position.
2979 ODE_API dReal
dJointGetPistonPosition (dJointID
);
2982 * @brief Get the piston linear position's time derivative.
2985 ODE_API dReal
dJointGetPistonPositionRate (dJointID
);
2988 * @brief Get the Piston angular position (i.e. the twist between the 2 bodies)
2990 * When the axis is set, the current position of the attached bodies is
2991 * examined and that position will be the zero position.
2994 ODE_API dReal
dJointGetPistonAngle (dJointID
);
2997 * @brief Get the piston angular position's time derivative.
3000 ODE_API dReal
dJointGetPistonAngleRate (dJointID
);
3004 * @brief Get the joint anchor
3006 * This returns the point on body 1. If the joint is perfectly satisfied,
3007 * this will be the same as the point on body 2 in direction perpendicular
3008 * to the prismatic axis.
3012 ODE_API
void dJointGetPistonAnchor (dJointID
, dVector3 result
);
3015 * @brief Get the joint anchor w.r.t. body 2
3017 * This returns the point on body 2. You can think of a Piston
3018 * joint as trying to keep the result of dJointGetPistonAnchor() and
3019 * dJointGetPistonAnchor2() the same in the direction perpendicular to the
3020 * pirsmatic axis. If the joint is perfectly satisfied,
3021 * this function will return the same value as dJointGetPistonAnchor() to
3022 * within roundoff errors. dJointGetPistonAnchor2() can be used, along with
3023 * dJointGetPistonAnchor(), to see how far the joint has come apart.
3027 ODE_API
void dJointGetPistonAnchor2 (dJointID
, dVector3 result
);
3030 * @brief Get the prismatic axis (This is also the rotoide axis.
3033 ODE_API
void dJointGetPistonAxis (dJointID
, dVector3 result
);
3036 * @brief get joint parameter
3039 ODE_API dReal
dJointGetPistonParam (dJointID
, int parameter
);
3043 * @brief Get the number of angular axes that will be controlled by the
3045 * @param num can range from 0 (which effectively deactivates the
3047 * This is automatically set to 3 in dAMotorEuler mode.
3050 ODE_API
int dJointGetAMotorNumAxes (dJointID
);
3053 * @brief Get the AMotor axes.
3054 * @param anum selects the axis to change (0,1 or 2).
3055 * @param rel Each axis can have one of three ``relative orientation'' modes.
3056 * \li 0: The axis is anchored to the global frame.
3057 * \li 1: The axis is anchored to the first body.
3058 * \li 2: The axis is anchored to the second body.
3061 ODE_API
void dJointGetAMotorAxis (dJointID
, int anum
, dVector3 result
);
3066 * The axis vector is always specified in global coordinates regardless
3067 * of the setting of rel.
3068 * There are two GetAMotorAxis functions, one to return the axis and one to
3069 * return the relative mode.
3071 * For dAMotorEuler mode:
3072 * \li Only axes 0 and 2 need to be set. Axis 1 will be determined
3073 automatically at each time step.
3074 * \li Axes 0 and 2 must be perpendicular to each other.
3075 * \li Axis 0 must be anchored to the first body, axis 2 must be anchored
3079 ODE_API
int dJointGetAMotorAxisRel (dJointID
, int anum
);
3082 * @brief Get the current angle for axis.
3084 * In dAMotorUser mode this is simply the value that was set with
3085 * dJointSetAMotorAngle().
3086 * In dAMotorEuler mode this is the corresponding euler angle.
3089 ODE_API dReal
dJointGetAMotorAngle (dJointID
, int anum
);
3092 * @brief Get the current angle rate for axis anum.
3094 * In dAMotorUser mode this is always zero, as not enough information is
3096 * In dAMotorEuler mode this is the corresponding euler angle rate.
3099 ODE_API dReal
dJointGetAMotorAngleRate (dJointID
, int anum
);
3102 * @brief get joint parameter
3105 ODE_API dReal
dJointGetAMotorParam (dJointID
, int parameter
);
3108 * @brief Get the angular motor mode.
3109 * @param mode must be one of the following constants:
3110 * \li dAMotorUser The AMotor axes and joint angle settings are entirely
3111 * controlled by the user. This is the default mode.
3112 * \li dAMotorEuler Euler angles are automatically computed.
3113 * The axis a1 is also automatically computed.
3114 * The AMotor axes must be set correctly when in this mode,
3115 * as described below.
3116 * When this mode is initially set the current relative orientations
3117 * of the bodies will correspond to all euler angles at zero.
3120 ODE_API
int dJointGetAMotorMode (dJointID
);
3123 * @brief Get nr of axes.
3126 ODE_API
int dJointGetLMotorNumAxes (dJointID
);
3132 ODE_API
void dJointGetLMotorAxis (dJointID
, int anum
, dVector3 result
);
3135 * @brief get joint parameter
3138 ODE_API dReal
dJointGetLMotorParam (dJointID
, int parameter
);
3141 * @brief get joint parameter
3144 ODE_API dReal
dJointGetFixedParam (dJointID
, int parameter
);
3148 * @brief get the contact point of the first wheel of the Transmission joint.
3151 ODE_API
void dJointGetTransmissionContactPoint1(dJointID
, dVector3 result
);
3154 * @brief get contact point of the second wheel of the Transmission joint.
3157 ODE_API
void dJointGetTransmissionContactPoint2(dJointID
, dVector3 result
);
3160 * @brief set the first axis for the Transmission joint
3161 * @remarks This is the axis around which the first body is allowed to
3162 * revolve and is attached to it. It is given in global coordinates
3163 * and can only be set explicitly in intersecting-axes mode. For the
3164 * parallel-axes and chain modes which share one common axis of
3165 * revolution for both gears dJointSetTransmissionAxis should be used.
3168 ODE_API
void dJointSetTransmissionAxis1(dJointID
, dReal x
, dReal y
, dReal z
);
3171 * @brief get first axis for the Transmission joint
3172 * @remarks In parallel-axes and chain mode the common axis with
3173 * respect to the first body is returned. If the joint constraint is
3174 * satisfied it should be the same as the axis return with
3175 * dJointGetTransmissionAxis2 or dJointGetTransmissionAxis.
3178 ODE_API
void dJointGetTransmissionAxis1(dJointID
, dVector3 result
);
3181 * @brief set second axis for the Transmission joint
3182 * @remarks This is the axis around which the second body is allowed
3183 * to revolve and is attached to it. It is given in global
3184 * coordinates and can only be set explicitly in intersecting-axes
3185 * mode. For the parallel-axes and chain modes which share one common
3186 * axis of revolution for both gears dJointSetTransmissionAxis should
3190 ODE_API
void dJointSetTransmissionAxis2(dJointID
, dReal x
, dReal y
, dReal z
);
3193 * @brief get second axis for the Transmission joint
3194 * @remarks In parallel-axes and chain mode the common axis with
3195 * respect to the second body is returned. If the joint constraint is
3196 * satisfied it should be the same as the axis return with
3197 * dJointGetTransmissionAxis1 or dJointGetTransmissionAxis.
3200 ODE_API
void dJointGetTransmissionAxis2(dJointID
, dVector3 result
);
3203 * @brief set the first anchor for the Transmission joint
3204 * @remarks This is the point of attachment of the wheel on the
3205 * first body. It is given in global coordinates.
3208 ODE_API
void dJointSetTransmissionAnchor1(dJointID
, dReal x
, dReal y
, dReal z
);
3211 * @brief get the first anchor of the Transmission joint
3214 ODE_API
void dJointGetTransmissionAnchor1(dJointID
, dVector3 result
);
3217 * @brief set the second anchor for the Transmission joint
3218 * @remarks This is the point of attachment of the wheel on the
3219 * second body. It is given in global coordinates.
3222 ODE_API
void dJointSetTransmissionAnchor2(dJointID
, dReal x
, dReal y
, dReal z
);
3225 * @brief get the second anchor for the Transmission joint
3228 ODE_API
void dJointGetTransmissionAnchor2(dJointID
, dVector3 result
);
3231 * @brief set a Transmission joint parameter
3234 ODE_API
void dJointSetTransmissionParam(dJointID
, int parameter
, dReal value
);
3237 * @brief get a Transmission joint parameter
3240 ODE_API dReal
dJointGetTransmissionParam(dJointID
, int parameter
);
3243 * @brief set the Transmission joint mode
3244 * @remarks The mode can be one of dTransmissionParallelAxes,
3245 * dTransmissionIntersectingAxes and dTransmissionChainDrive simulating a
3246 * set of parallel-axes gears, intersecting-axes beveled gears or
3247 * chain and sprockets respectively.
3250 ODE_API
void dJointSetTransmissionMode( dJointID j
, int mode
);
3253 * @brief get the Transmission joint mode
3256 ODE_API
int dJointGetTransmissionMode( dJointID j
);
3259 * @brief set the Transmission ratio
3260 * @remarks This is the ratio of the angular speed of the first gear
3261 * to that of the second gear. It can only be set explicitly in
3262 * parallel-axes mode. In intersecting-axes mode the ratio is defined
3263 * implicitly by the initial configuration of the wheels and in chain
3264 * mode it is defined implicitly be the wheel radii.
3267 ODE_API
void dJointSetTransmissionRatio( dJointID j
, dReal ratio
);
3270 * @brief get the Transmission joint ratio
3273 ODE_API dReal
dJointGetTransmissionRatio( dJointID j
);
3276 * @brief set the common axis for both wheels of the Transmission joint
3277 * @remarks This sets the common axis of revolution for both wheels
3278 * and should only be used in parallel-axes or chain mode. For
3279 * intersecting-axes mode where each wheel axis needs to be specified
3280 * individually dJointSetTransmissionAxis1 and
3281 * dJointSetTransmissionAxis2 should be used. The axis is given in
3282 * global coordinates
3285 ODE_API
void dJointSetTransmissionAxis( dJointID j
, dReal x
, dReal y
, dReal z
);
3288 * @brief get the common axis for both wheels of the Transmission joint
3291 ODE_API
void dJointGetTransmissionAxis( dJointID j
, dVector3 result
);
3294 * @brief get the phase, that is the traversed angle for the first
3295 * wheel of the Transmission joint
3298 ODE_API dReal
dJointGetTransmissionAngle1( dJointID j
);
3301 * @brief get the phase, that is the traversed angle for the second
3302 * wheel of the Transmission joint
3305 ODE_API dReal
dJointGetTransmissionAngle2( dJointID j
);
3308 * @brief get the radius of the first wheel of the Transmission joint
3311 ODE_API dReal
dJointGetTransmissionRadius1( dJointID j
);
3314 * @brief get the radius of the second wheel of the Transmission joint
3317 ODE_API dReal
dJointGetTransmissionRadius2( dJointID j
);
3320 * @brief set the radius of the first wheel of the Transmission joint
3321 * @remarks The wheel radii can only be set explicitly in chain mode.
3322 * In the other modes they're defined implicitly by the initial
3323 * configuration and ratio of the wheels.
3326 ODE_API
void dJointSetTransmissionRadius1( dJointID j
, dReal radius
);
3329 * @brief set the radius of the second wheel of the Transmission joint
3330 * @remarks The wheel radii can only be set explicitly in chain mode.
3331 * In the other modes they're defined implicitly by the initial
3332 * configuration and ratio of the wheels.
3335 ODE_API
void dJointSetTransmissionRadius2( dJointID j
, dReal radius
);
3338 * @brief get the backlash of the Transmission joint
3341 ODE_API dReal
dJointGetTransmissionBacklash( dJointID j
);
3344 * @brief set the backlash of the Transmission joint
3345 * @remarks Backlash is the clearance in the mesh of the wheels of the
3346 * transmission and is defined as the maximum distance that the
3347 * geometric contact point can travel without any actual contact or
3348 * transfer of power between the wheels. This can be converted in
3349 * degrees of revolution for each wheel by dividing by the wheel's
3350 * radius. To further illustrate this consider the situation where a
3351 * wheel of radius r_1 is driving another wheel of radius r_2 and
3352 * there is an amount of backlash equal to b in their mesh. If the
3353 * driving wheel were to instantaneously stop there would be no
3354 * contact and hence the driven wheel would continue to turn for
3355 * another b / r_2 radians until all the backlash in the mesh was take
3356 * up and contact restored with the relationship of driving and driven
3357 * wheel reversed. The backlash is therefore given in untis of
3361 ODE_API
void dJointSetTransmissionBacklash( dJointID j
, dReal backlash
);
3364 * @brief set anchor1 for double ball joint
3367 ODE_API
void dJointSetDBallAnchor1(dJointID
, dReal x
, dReal y
, dReal z
);
3370 * @brief set anchor2 for double ball joint
3373 ODE_API
void dJointSetDBallAnchor2(dJointID
, dReal x
, dReal y
, dReal z
);
3376 * @brief get anchor1 from double ball joint
3379 ODE_API
void dJointGetDBallAnchor1(dJointID
, dVector3 result
);
3382 * @brief get anchor2 from double ball joint
3385 ODE_API
void dJointGetDBallAnchor2(dJointID
, dVector3 result
);
3388 * @brief get the target distance from double ball joint
3391 ODE_API dReal
dJointGetDBallDistance(dJointID
);
3394 * @brief set the target distance for the double ball joint
3397 ODE_API
void dJointSetDBallDistance(dJointID
, dReal dist
);
3400 * @brief set double ball joint parameter
3403 ODE_API
void dJointSetDBallParam(dJointID
, int parameter
, dReal value
);
3406 * @brief get double ball joint parameter
3409 ODE_API dReal
dJointGetDBallParam(dJointID
, int parameter
);
3412 * @brief set axis for double hinge joint
3415 ODE_API
void dJointSetDHingeAxis(dJointID
, dReal x
, dReal y
, dReal z
);
3418 * @brief get axis for double hinge joint
3421 ODE_API
void dJointGetDHingeAxis(dJointID
, dVector3 result
);
3424 * @brief set anchor1 for double hinge joint
3427 ODE_API
void dJointSetDHingeAnchor1(dJointID
, dReal x
, dReal y
, dReal z
);
3430 * @brief set anchor2 for double hinge joint
3433 ODE_API
void dJointSetDHingeAnchor2(dJointID
, dReal x
, dReal y
, dReal z
);
3436 * @brief get anchor1 from double hinge joint
3439 ODE_API
void dJointGetDHingeAnchor1(dJointID
, dVector3 result
);
3442 * @brief get anchor2 from double hinge joint
3445 ODE_API
void dJointGetDHingeAnchor2(dJointID
, dVector3 result
);
3448 * @brief get the set distance from double hinge joint
3451 ODE_API dReal
dJointGetDHingeDistance(dJointID
);
3454 * @brief set double hinge joint parameter
3457 ODE_API
void dJointSetDHingeParam(dJointID
, int parameter
, dReal value
);
3460 * @brief get double hinge joint parameter
3463 ODE_API dReal
dJointGetDHingeParam(dJointID
, int parameter
);
3471 ODE_API dJointID
dConnectingJoint (dBodyID
, dBodyID
);
3476 ODE_API
int dConnectingJointList (dBodyID
, dBodyID
, dJointID
*);
3479 * @brief Utility function
3480 * @return 1 if the two bodies are connected together by
3481 * a joint, otherwise return 0.
3484 ODE_API
int dAreConnected (dBodyID
, dBodyID
);
3487 * @brief Utility function
3488 * @return 1 if the two bodies are connected together by
3489 * a joint that does not have type @arg{joint_type}, otherwise return 0.
3490 * @param body1 A body to check.
3491 * @param body2 A body to check.
3492 * @param joint_type is a dJointTypeXXX constant.
3493 * This is useful for deciding whether to add contact joints between two bodies:
3494 * if they are already connected by non-contact joints then it may not be
3495 * appropriate to add contacts, however it is okay to add more contact between-
3496 * bodies that already have contacts.
3499 ODE_API
int dAreConnectedExcluding (dBodyID body1
, dBodyID body2
, int joint_type
);