objects.h 78 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605
  1. /*************************************************************************
  2. * *
  3. * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
  4. * All rights reserved. Email: [email protected] Web: www.q12.org *
  5. * *
  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 *
  12. * file LICENSE.TXT. *
  13. * (2) The BSD-style license that is included with this library in *
  14. * the file LICENSE-BSD.TXT. *
  15. * *
  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. *
  20. * *
  21. *************************************************************************/
  22. #ifndef _ODE_OBJECTS_H_
  23. #define _ODE_OBJECTS_H_
  24. #include <ode/common.h>
  25. #include <ode/mass.h>
  26. #include <ode/contact.h>
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. /**
  31. * @defgroup world World
  32. *
  33. * The world object is a container for rigid bodies and joints. Objects in
  34. * different worlds can not interact, for example rigid bodies from two
  35. * different worlds can not collide.
  36. *
  37. * All the objects in a world exist at the same point in time, thus one
  38. * reason to use separate worlds is to simulate systems at different rates.
  39. * Most applications will only need one world.
  40. */
  41. /**
  42. * @brief Create a new, empty world and return its ID number.
  43. * @return an identifier
  44. * @ingroup world
  45. */
  46. ODE_API dWorldID dWorldCreate(void);
  47. /**
  48. * @brief Destroy a world and everything in it.
  49. *
  50. * This includes all bodies, and all joints that are not part of a joint
  51. * group. Joints that are part of a joint group will be deactivated, and
  52. * can be destroyed by calling, for example, dJointGroupEmpty().
  53. * @ingroup world
  54. * @param world the identifier for the world the be destroyed.
  55. */
  56. ODE_API void dWorldDestroy (dWorldID world);
  57. /**
  58. * @brief Set the world's global gravity vector.
  59. *
  60. * The units are m/s^2, so Earth's gravity vector would be (0,0,-9.81),
  61. * assuming that +z is up. The default is no gravity, i.e. (0,0,0).
  62. *
  63. * @ingroup world
  64. */
  65. ODE_API void dWorldSetGravity (dWorldID, dReal x, dReal y, dReal z);
  66. /**
  67. * @brief Get the gravity vector for a given world.
  68. * @ingroup world
  69. */
  70. ODE_API void dWorldGetGravity (dWorldID, dVector3 gravity);
  71. /**
  72. * @brief Set the global ERP value, that controls how much error
  73. * correction is performed in each time step.
  74. * @ingroup world
  75. * @param dWorldID the identifier of the world.
  76. * @param erp Typical values are in the range 0.1--0.8. The default is 0.2.
  77. */
  78. ODE_API void dWorldSetERP (dWorldID, dReal erp);
  79. /**
  80. * @brief Get the error reduction parameter.
  81. * @ingroup world
  82. * @return ERP value
  83. */
  84. ODE_API dReal dWorldGetERP (dWorldID);
  85. /**
  86. * @brief Set the global CFM (constraint force mixing) value.
  87. * @ingroup world
  88. * @param cfm Typical values are in the range @m{10^{-9}} -- 1.
  89. * The default is 10^-5 if single precision is being used, or 10^-10
  90. * if double precision is being used.
  91. */
  92. ODE_API void dWorldSetCFM (dWorldID, dReal cfm);
  93. /**
  94. * @brief Get the constraint force mixing value.
  95. * @ingroup world
  96. * @return CFM value
  97. */
  98. ODE_API dReal dWorldGetCFM (dWorldID);
  99. /**
  100. * @brief Step the world.
  101. *
  102. * This uses a "big matrix" method that takes time on the order of m^3
  103. * and memory on the order of m^2, where m is the total number of constraint
  104. * rows. For large systems this will use a lot of memory and can be very slow,
  105. * but this is currently the most accurate method.
  106. * @ingroup world
  107. * @param stepsize The number of seconds that the simulation has to advance.
  108. */
  109. ODE_API void dWorldStep (dWorldID, dReal stepsize);
  110. /**
  111. * @brief Converts an impulse to a force.
  112. * @ingroup world
  113. * @remarks
  114. * If you want to apply a linear or angular impulse to a rigid body,
  115. * instead of a force or a torque, then you can use this function to convert
  116. * the desired impulse into a force/torque vector before calling the
  117. * BodyAdd... function.
  118. * The current algorithm simply scales the impulse by 1/stepsize,
  119. * where stepsize is the step size for the next step that will be taken.
  120. * This function is given a dWorldID because, in the future, the force
  121. * computation may depend on integrator parameters that are set as
  122. * properties of the world.
  123. */
  124. ODE_API void dWorldImpulseToForce
  125. (
  126. dWorldID, dReal stepsize,
  127. dReal ix, dReal iy, dReal iz, dVector3 force
  128. );
  129. /**
  130. * @brief Step the world.
  131. * @ingroup world
  132. * @remarks
  133. * This uses an iterative method that takes time on the order of m*N
  134. * and memory on the order of m, where m is the total number of constraint
  135. * rows N is the number of iterations.
  136. * For large systems this is a lot faster than dWorldStep(),
  137. * but it is less accurate.
  138. * @remarks
  139. * QuickStep is great for stacks of objects especially when the
  140. * auto-disable feature is used as well.
  141. * However, it has poor accuracy for near-singular systems.
  142. * Near-singular systems can occur when using high-friction contacts, motors,
  143. * or certain articulated structures. For example, a robot with multiple legs
  144. * sitting on the ground may be near-singular.
  145. * @remarks
  146. * There are ways to help overcome QuickStep's inaccuracy problems:
  147. * \li Increase CFM.
  148. * \li Reduce the number of contacts in your system (e.g. use the minimum
  149. * number of contacts for the feet of a robot or creature).
  150. * \li Don't use excessive friction in the contacts.
  151. * \li Use contact slip if appropriate
  152. * \li Avoid kinematic loops (however, kinematic loops are inevitable in
  153. * legged creatures).
  154. * \li Don't use excessive motor strength.
  155. * \liUse force-based motors instead of velocity-based motors.
  156. *
  157. * Increasing the number of QuickStep iterations may help a little bit, but
  158. * it is not going to help much if your system is really near singular.
  159. */
  160. ODE_API void dWorldQuickStep (dWorldID w, dReal stepsize);
  161. /**
  162. * @brief Set the number of iterations that the QuickStep method performs per
  163. * step.
  164. * @ingroup world
  165. * @remarks
  166. * More iterations will give a more accurate solution, but will take
  167. * longer to compute.
  168. * @param num The default is 20 iterations.
  169. */
  170. ODE_API void dWorldSetQuickStepNumIterations (dWorldID, int num);
  171. /**
  172. * @brief Get the number of iterations that the QuickStep method performs per
  173. * step.
  174. * @ingroup world
  175. * @return nr of iterations
  176. */
  177. ODE_API int dWorldGetQuickStepNumIterations (dWorldID);
  178. /**
  179. * @brief Set the SOR over-relaxation parameter
  180. * @ingroup world
  181. * @param over_relaxation value to use by SOR
  182. */
  183. ODE_API void dWorldSetQuickStepW (dWorldID, dReal over_relaxation);
  184. /**
  185. * @brief Get the SOR over-relaxation parameter
  186. * @ingroup world
  187. * @returns the over-relaxation setting
  188. */
  189. ODE_API dReal dWorldGetQuickStepW (dWorldID);
  190. /* World contact parameter functions */
  191. /**
  192. * @brief Set the maximum correcting velocity that contacts are allowed
  193. * to generate.
  194. * @ingroup world
  195. * @param vel The default value is infinity (i.e. no limit).
  196. * @remarks
  197. * Reducing this value can help prevent "popping" of deeply embedded objects.
  198. */
  199. ODE_API void dWorldSetContactMaxCorrectingVel (dWorldID, dReal vel);
  200. /**
  201. * @brief Get the maximum correcting velocity that contacts are allowed
  202. * to generated.
  203. * @ingroup world
  204. */
  205. ODE_API dReal dWorldGetContactMaxCorrectingVel (dWorldID);
  206. /**
  207. * @brief Set the depth of the surface layer around all geometry objects.
  208. * @ingroup world
  209. * @remarks
  210. * Contacts are allowed to sink into the surface layer up to the given
  211. * depth before coming to rest.
  212. * @param depth The default value is zero.
  213. * @remarks
  214. * Increasing this to some small value (e.g. 0.001) can help prevent
  215. * jittering problems due to contacts being repeatedly made and broken.
  216. */
  217. ODE_API void dWorldSetContactSurfaceLayer (dWorldID, dReal depth);
  218. /**
  219. * @brief Get the depth of the surface layer around all geometry objects.
  220. * @ingroup world
  221. * @returns the depth
  222. */
  223. ODE_API dReal dWorldGetContactSurfaceLayer (dWorldID);
  224. /* StepFast1 functions */
  225. /**
  226. * @brief Step the world using the StepFast1 algorithm.
  227. * @param stepsize the nr of seconds to advance the simulation.
  228. * @param maxiterations The number of iterations to perform.
  229. * @ingroup world
  230. */
  231. ODE_API void dWorldStepFast1(dWorldID, dReal stepsize, int maxiterations);
  232. /**
  233. * @defgroup disable Automatic Enabling and Disabling
  234. * @ingroup world bodies
  235. *
  236. * Every body can be enabled or disabled. Enabled bodies participate in the
  237. * simulation, while disabled bodies are turned off and do not get updated
  238. * during a simulation step. New bodies are always created in the enabled state.
  239. *
  240. * A disabled body that is connected through a joint to an enabled body will be
  241. * automatically re-enabled at the next simulation step.
  242. *
  243. * Disabled bodies do not consume CPU time, therefore to speed up the simulation
  244. * bodies should be disabled when they come to rest. This can be done automatically
  245. * with the auto-disable feature.
  246. *
  247. * If a body has its auto-disable flag turned on, it will automatically disable
  248. * itself when
  249. * @li It has been idle for a given number of simulation steps.
  250. * @li It has also been idle for a given amount of simulation time.
  251. *
  252. * A body is considered to be idle when the magnitudes of both its
  253. * linear average velocity and angular average velocity are below given thresholds.
  254. * The sample size for the average defaults to one and can be disabled by setting
  255. * to zero with
  256. *
  257. * Thus, every body has six auto-disable parameters: an enabled flag, a idle step
  258. * count, an idle time, linear/angular average velocity thresholds, and the
  259. * average samples count.
  260. *
  261. * Newly created bodies get these parameters from world.
  262. */
  263. /**
  264. * @brief Set the AutoEnableDepth parameter used by the StepFast1 algorithm.
  265. * @ingroup disable
  266. */
  267. ODE_API void dWorldSetAutoEnableDepthSF1(dWorldID, int autoEnableDepth);
  268. /**
  269. * @brief Get the AutoEnableDepth parameter used by the StepFast1 algorithm.
  270. * @ingroup disable
  271. */
  272. ODE_API int dWorldGetAutoEnableDepthSF1(dWorldID);
  273. /**
  274. * @brief Get auto disable linear threshold for newly created bodies.
  275. * @ingroup disable
  276. * @return the threshold
  277. */
  278. ODE_API dReal dWorldGetAutoDisableLinearThreshold (dWorldID);
  279. /**
  280. * @brief Set auto disable linear threshold for newly created bodies.
  281. * @param linear_threshold default is 0.01
  282. * @ingroup disable
  283. */
  284. ODE_API void dWorldSetAutoDisableLinearThreshold (dWorldID, dReal linear_threshold);
  285. /**
  286. * @brief Get auto disable angular threshold for newly created bodies.
  287. * @ingroup disable
  288. * @return the threshold
  289. */
  290. ODE_API dReal dWorldGetAutoDisableAngularThreshold (dWorldID);
  291. /**
  292. * @brief Set auto disable angular threshold for newly created bodies.
  293. * @param linear_threshold default is 0.01
  294. * @ingroup disable
  295. */
  296. ODE_API void dWorldSetAutoDisableAngularThreshold (dWorldID, dReal angular_threshold);
  297. /**
  298. * @brief Get auto disable linear average threshold for newly created bodies.
  299. * @ingroup disable
  300. * @return the threshold
  301. */
  302. ODE_API dReal dWorldGetAutoDisableLinearAverageThreshold (dWorldID);
  303. /**
  304. * @brief Set auto disable linear average threshold for newly created bodies.
  305. * @param linear_average_threshold default is 0.01
  306. * @ingroup disable
  307. */
  308. ODE_API void dWorldSetAutoDisableLinearAverageThreshold (dWorldID, dReal linear_average_threshold);
  309. /**
  310. * @brief Get auto disable angular average threshold for newly created bodies.
  311. * @ingroup disable
  312. * @return the threshold
  313. */
  314. ODE_API dReal dWorldGetAutoDisableAngularAverageThreshold (dWorldID);
  315. /**
  316. * @brief Set auto disable angular average threshold for newly created bodies.
  317. * @param linear_average_threshold default is 0.01
  318. * @ingroup disable
  319. */
  320. ODE_API void dWorldSetAutoDisableAngularAverageThreshold (dWorldID, dReal angular_average_threshold);
  321. /**
  322. * @brief Get auto disable sample count for newly created bodies.
  323. * @ingroup disable
  324. * @return number of samples used
  325. */
  326. ODE_API int dWorldGetAutoDisableAverageSamplesCount (dWorldID);
  327. /**
  328. * @brief Set auto disable average sample count for newly created bodies.
  329. * @ingroup disable
  330. * @param average_samples_count Default is 1, meaning only instantaneous velocity is used.
  331. * Set to zero to disable sampling and thus prevent any body from auto-disabling.
  332. */
  333. ODE_API void dWorldSetAutoDisableAverageSamplesCount (dWorldID, unsigned int average_samples_count );
  334. /**
  335. * @brief Get auto disable steps for newly created bodies.
  336. * @ingroup disable
  337. * @return nr of steps
  338. */
  339. ODE_API int dWorldGetAutoDisableSteps (dWorldID);
  340. /**
  341. * @brief Set auto disable steps for newly created bodies.
  342. * @ingroup disable
  343. * @param steps default is 10
  344. */
  345. ODE_API void dWorldSetAutoDisableSteps (dWorldID, int steps);
  346. /**
  347. * @brief Get auto disable time for newly created bodies.
  348. * @ingroup disable
  349. * @return nr of seconds
  350. */
  351. ODE_API dReal dWorldGetAutoDisableTime (dWorldID);
  352. /**
  353. * @brief Set auto disable time for newly created bodies.
  354. * @ingroup disable
  355. * @param time default is 0 seconds
  356. */
  357. ODE_API void dWorldSetAutoDisableTime (dWorldID, dReal time);
  358. /**
  359. * @brief Get auto disable flag for newly created bodies.
  360. * @ingroup disable
  361. * @return 0 or 1
  362. */
  363. ODE_API int dWorldGetAutoDisableFlag (dWorldID);
  364. /**
  365. * @brief Set auto disable flag for newly created bodies.
  366. * @ingroup disable
  367. * @param do_auto_disable default is false.
  368. */
  369. ODE_API void dWorldSetAutoDisableFlag (dWorldID, int do_auto_disable);
  370. /**
  371. * @defgroup damping Damping
  372. * @ingroup bodies world
  373. *
  374. * Damping serves two purposes: reduce simulation instability, and to allow
  375. * the bodies to come to rest (and possibly auto-disabling them).
  376. *
  377. * Bodies are constructed using the world's current damping parameters. Setting
  378. * the scales to 0 disables the damping.
  379. *
  380. * Here is how it is done: after every time step linear and angular
  381. * velocities are tested against the corresponding thresholds. If they
  382. * are above, they are multiplied by (1 - scale). So a negative scale value
  383. * will actually increase the speed, and values greater than one will
  384. * make the object oscillate every step; both can make the simulation unstable.
  385. *
  386. * To disable damping just set the damping scale to zero.
  387. *
  388. * You can also limit the maximum angular velocity. In contrast to the damping
  389. * functions, the angular velocity is affected before the body is moved.
  390. * This means that it will introduce errors in joints that are forcing the body
  391. * to rotate too fast. Some bodies have naturally high angular velocities
  392. * (like cars' wheels), so you may want to give them a very high (like the default,
  393. * dInfinity) limit.
  394. *
  395. * @note The velocities are damped after the stepper function has moved the
  396. * object. Otherwise the damping could introduce errors in joints. First the
  397. * joint constraints are processed by the stepper (moving the body), then
  398. * the damping is applied.
  399. *
  400. * @note The damping happens right after the moved callback is called; this way
  401. * it still possible use the exact velocities the body has acquired during the
  402. * step. You can even use the callback to create your own customized damping.
  403. */
  404. /**
  405. * @brief Get the world's linear damping threshold.
  406. * @ingroup damping
  407. */
  408. ODE_API dReal dWorldGetLinearDampingThreshold (dWorldID w);
  409. /**
  410. * @brief Set the world's linear damping threshold.
  411. * @param threshold The damping won't be applied if the linear speed is
  412. * below this threshold. Default is 0.01.
  413. * @ingroup damping
  414. */
  415. ODE_API void dWorldSetLinearDampingThreshold(dWorldID w, dReal threshold);
  416. /**
  417. * @brief Get the world's angular damping threshold.
  418. * @ingroup damping
  419. */
  420. ODE_API dReal dWorldGetAngularDampingThreshold (dWorldID w);
  421. /**
  422. * @brief Set the world's angular damping threshold.
  423. * @param threshold The damping won't be applied if the angular speed is
  424. * below this threshold. Default is 0.01.
  425. * @ingroup damping
  426. */
  427. ODE_API void dWorldSetAngularDampingThreshold(dWorldID w, dReal threshold);
  428. /**
  429. * @brief Get the world's linear damping scale.
  430. * @ingroup damping
  431. */
  432. ODE_API dReal dWorldGetLinearDamping (dWorldID w);
  433. /**
  434. * @brief Set the world's linear damping scale.
  435. * @param scale The linear damping scale that is to be applied to bodies.
  436. * Default is 0 (no damping). Should be in the interval [0, 1].
  437. * @ingroup damping
  438. */
  439. ODE_API void dWorldSetLinearDamping (dWorldID w, dReal scale);
  440. /**
  441. * @brief Get the world's angular damping scale.
  442. * @ingroup damping
  443. */
  444. ODE_API dReal dWorldGetAngularDamping (dWorldID w);
  445. /**
  446. * @brief Set the world's angular damping scale.
  447. * @param scale The angular damping scale that is to be applied to bodies.
  448. * Default is 0 (no damping). Should be in the interval [0, 1].
  449. * @ingroup damping
  450. */
  451. ODE_API void dWorldSetAngularDamping(dWorldID w, dReal scale);
  452. /**
  453. * @brief Convenience function to set body linear and angular scales.
  454. * @param linear_scale The linear damping scale that is to be applied to bodies.
  455. * @param angular_scale The angular damping scale that is to be applied to bodies.
  456. * @ingroup damping
  457. */
  458. ODE_API void dWorldSetDamping(dWorldID w,
  459. dReal linear_scale,
  460. dReal angular_scale);
  461. /**
  462. * @brief Get the default maximum angular speed.
  463. * @ingroup damping
  464. * @sa dBodyGetMaxAngularSpeed()
  465. */
  466. ODE_API dReal dWorldGetMaxAngularSpeed (dWorldID w);
  467. /**
  468. * @brief Set the default maximum angular speed for new bodies.
  469. * @ingroup damping
  470. * @sa dBodySetMaxAngularSpeed()
  471. */
  472. ODE_API void dWorldSetMaxAngularSpeed (dWorldID w, dReal max_speed);
  473. /**
  474. * @defgroup bodies Rigid Bodies
  475. *
  476. * A rigid body has various properties from the point of view of the
  477. * simulation. Some properties change over time:
  478. *
  479. * @li Position vector (x,y,z) of the body's point of reference.
  480. * Currently the point of reference must correspond to the body's center of mass.
  481. * @li Linear velocity of the point of reference, a vector (vx,vy,vz).
  482. * @li Orientation of a body, represented by a quaternion (qs,qx,qy,qz) or
  483. * a 3x3 rotation matrix.
  484. * @li Angular velocity vector (wx,wy,wz) which describes how the orientation
  485. * changes over time.
  486. *
  487. * Other body properties are usually constant over time:
  488. *
  489. * @li Mass of the body.
  490. * @li Position of the center of mass with respect to the point of reference.
  491. * In the current implementation the center of mass and the point of
  492. * reference must coincide.
  493. * @li Inertia matrix. This is a 3x3 matrix that describes how the body's mass
  494. * is distributed around the center of mass. Conceptually each body has an
  495. * x-y-z coordinate frame embedded in it that moves and rotates with the body.
  496. *
  497. * The origin of this coordinate frame is the body's point of reference. Some values
  498. * in ODE (vectors, matrices etc) are relative to the body coordinate frame, and others
  499. * are relative to the global coordinate frame.
  500. *
  501. * Note that the shape of a rigid body is not a dynamical property (except insofar as
  502. * it influences the various mass properties). It is only collision detection that cares
  503. * about the detailed shape of the body.
  504. */
  505. /**
  506. * @brief Get auto disable linear average threshold.
  507. * @ingroup bodies disable
  508. * @return the threshold
  509. */
  510. ODE_API dReal dBodyGetAutoDisableLinearThreshold (dBodyID);
  511. /**
  512. * @brief Set auto disable linear average threshold.
  513. * @ingroup bodies disable
  514. * @return the threshold
  515. */
  516. ODE_API void dBodySetAutoDisableLinearThreshold (dBodyID, dReal linear_average_threshold);
  517. /**
  518. * @brief Get auto disable angular average threshold.
  519. * @ingroup bodies disable
  520. * @return the threshold
  521. */
  522. ODE_API dReal dBodyGetAutoDisableAngularThreshold (dBodyID);
  523. /**
  524. * @brief Set auto disable angular average threshold.
  525. * @ingroup bodies disable
  526. * @return the threshold
  527. */
  528. ODE_API void dBodySetAutoDisableAngularThreshold (dBodyID, dReal angular_average_threshold);
  529. /**
  530. * @brief Get auto disable average size (samples count).
  531. * @ingroup bodies disable
  532. * @return the nr of steps/size.
  533. */
  534. ODE_API int dBodyGetAutoDisableAverageSamplesCount (dBodyID);
  535. /**
  536. * @brief Set auto disable average buffer size (average steps).
  537. * @ingroup bodies disable
  538. * @param average_samples_count the nr of samples to review.
  539. */
  540. ODE_API void dBodySetAutoDisableAverageSamplesCount (dBodyID, unsigned int average_samples_count);
  541. /**
  542. * @brief Get auto steps a body must be thought of as idle to disable
  543. * @ingroup bodies disable
  544. * @return the nr of steps
  545. */
  546. ODE_API int dBodyGetAutoDisableSteps (dBodyID);
  547. /**
  548. * @brief Set auto disable steps.
  549. * @ingroup bodies disable
  550. * @param steps the nr of steps.
  551. */
  552. ODE_API void dBodySetAutoDisableSteps (dBodyID, int steps);
  553. /**
  554. * @brief Get auto disable time.
  555. * @ingroup bodies disable
  556. * @return nr of seconds
  557. */
  558. ODE_API dReal dBodyGetAutoDisableTime (dBodyID);
  559. /**
  560. * @brief Set auto disable time.
  561. * @ingroup bodies disable
  562. * @param time nr of seconds.
  563. */
  564. ODE_API void dBodySetAutoDisableTime (dBodyID, dReal time);
  565. /**
  566. * @brief Get auto disable flag.
  567. * @ingroup bodies disable
  568. * @return 0 or 1
  569. */
  570. ODE_API int dBodyGetAutoDisableFlag (dBodyID);
  571. /**
  572. * @brief Set auto disable flag.
  573. * @ingroup bodies disable
  574. * @param do_auto_disable 0 or 1
  575. */
  576. ODE_API void dBodySetAutoDisableFlag (dBodyID, int do_auto_disable);
  577. /**
  578. * @brief Set auto disable defaults.
  579. * @remarks
  580. * Set the values for the body to those set as default for the world.
  581. * @ingroup bodies disable
  582. */
  583. ODE_API void dBodySetAutoDisableDefaults (dBodyID);
  584. /**
  585. * @brief Retrieves the world attached to te given body.
  586. * @remarks
  587. *
  588. * @ingroup bodies
  589. */
  590. ODE_API dWorldID dBodyGetWorld (dBodyID);
  591. /**
  592. * @brief Create a body in given world.
  593. * @remarks
  594. * Default mass parameters are at position (0,0,0).
  595. * @ingroup bodies
  596. */
  597. ODE_API dBodyID dBodyCreate (dWorldID);
  598. /**
  599. * @brief Destroy a body.
  600. * @remarks
  601. * All joints that are attached to this body will be put into limbo:
  602. * i.e. unattached and not affecting the simulation, but they will NOT be
  603. * deleted.
  604. * @ingroup bodies
  605. */
  606. ODE_API void dBodyDestroy (dBodyID);
  607. /**
  608. * @brief Set the body's user-data pointer.
  609. * @ingroup bodies
  610. * @param data arbitraty pointer
  611. */
  612. ODE_API void dBodySetData (dBodyID, void *data);
  613. /**
  614. * @brief Get the body's user-data pointer.
  615. * @ingroup bodies
  616. * @return a pointer to the user's data.
  617. */
  618. ODE_API void *dBodyGetData (dBodyID);
  619. /**
  620. * @brief Set position of a body.
  621. * @remarks
  622. * After setting, the outcome of the simulation is undefined
  623. * if the new configuration is inconsistent with the joints/constraints
  624. * that are present.
  625. * @ingroup bodies
  626. */
  627. ODE_API void dBodySetPosition (dBodyID, dReal x, dReal y, dReal z);
  628. /**
  629. * @brief Set the orientation of a body.
  630. * @ingroup bodies
  631. * @remarks
  632. * After setting, the outcome of the simulation is undefined
  633. * if the new configuration is inconsistent with the joints/constraints
  634. * that are present.
  635. */
  636. ODE_API void dBodySetRotation (dBodyID, const dMatrix3 R);
  637. /**
  638. * @brief Set the orientation of a body.
  639. * @ingroup bodies
  640. * @remarks
  641. * After setting, the outcome of the simulation is undefined
  642. * if the new configuration is inconsistent with the joints/constraints
  643. * that are present.
  644. */
  645. ODE_API void dBodySetQuaternion (dBodyID, const dQuaternion q);
  646. /**
  647. * @brief Set the linear velocity of a body.
  648. * @ingroup bodies
  649. */
  650. ODE_API void dBodySetLinearVel (dBodyID, dReal x, dReal y, dReal z);
  651. /**
  652. * @brief Set the angular velocity of a body.
  653. * @ingroup bodies
  654. */
  655. ODE_API void dBodySetAngularVel (dBodyID, dReal x, dReal y, dReal z);
  656. /**
  657. * @brief Get the position of a body.
  658. * @ingroup bodies
  659. * @remarks
  660. * When getting, the returned values are pointers to internal data structures,
  661. * so the vectors are valid until any changes are made to the rigid body
  662. * system structure.
  663. * @sa dBodyCopyPosition
  664. */
  665. ODE_API const dReal * dBodyGetPosition (dBodyID);
  666. /**
  667. * @brief Copy the position of a body into a vector.
  668. * @ingroup bodies
  669. * @param body the body to query
  670. * @param pos a copy of the body position
  671. * @sa dBodyGetPosition
  672. */
  673. ODE_API void dBodyCopyPosition (dBodyID body, dVector3 pos);
  674. /**
  675. * @brief Get the rotation of a body.
  676. * @ingroup bodies
  677. * @return pointer to a 4x3 rotation matrix.
  678. */
  679. ODE_API const dReal * dBodyGetRotation (dBodyID);
  680. /**
  681. * @brief Copy the rotation of a body.
  682. * @ingroup bodies
  683. * @param body the body to query
  684. * @param R a copy of the rotation matrix
  685. * @sa dBodyGetRotation
  686. */
  687. ODE_API void dBodyCopyRotation (dBodyID, dMatrix3 R);
  688. /**
  689. * @brief Get the rotation of a body.
  690. * @ingroup bodies
  691. * @return pointer to 4 scalars that represent the quaternion.
  692. */
  693. ODE_API const dReal * dBodyGetQuaternion (dBodyID);
  694. /**
  695. * @brief Copy the orientation of a body into a quaternion.
  696. * @ingroup bodies
  697. * @param body the body to query
  698. * @param quat a copy of the orientation quaternion
  699. * @sa dBodyGetQuaternion
  700. */
  701. ODE_API void dBodyCopyQuaternion(dBodyID body, dQuaternion quat);
  702. /**
  703. * @brief Get the linear velocity of a body.
  704. * @ingroup bodies
  705. */
  706. ODE_API const dReal * dBodyGetLinearVel (dBodyID);
  707. /**
  708. * @brief Get the angular velocity of a body.
  709. * @ingroup bodies
  710. */
  711. ODE_API const dReal * dBodyGetAngularVel (dBodyID);
  712. /**
  713. * @brief Set the mass of a body.
  714. * @ingroup bodies
  715. */
  716. ODE_API void dBodySetMass (dBodyID, const dMass *mass);
  717. /**
  718. * @brief Get the mass of a body.
  719. * @ingroup bodies
  720. */
  721. ODE_API void dBodyGetMass (dBodyID, dMass *mass);
  722. /**
  723. * @brief Add force at centre of mass of body in absolute coordinates.
  724. * @ingroup bodies
  725. */
  726. ODE_API void dBodyAddForce (dBodyID, dReal fx, dReal fy, dReal fz);
  727. /**
  728. * @brief Add torque at centre of mass of body in absolute coordinates.
  729. * @ingroup bodies
  730. */
  731. ODE_API void dBodyAddTorque (dBodyID, dReal fx, dReal fy, dReal fz);
  732. /**
  733. * @brief Add force at centre of mass of body in coordinates relative to body.
  734. * @ingroup bodies
  735. */
  736. ODE_API void dBodyAddRelForce (dBodyID, dReal fx, dReal fy, dReal fz);
  737. /**
  738. * @brief Add torque at centre of mass of body in coordinates relative to body.
  739. * @ingroup bodies
  740. */
  741. ODE_API void dBodyAddRelTorque (dBodyID, dReal fx, dReal fy, dReal fz);
  742. /**
  743. * @brief Add force at specified point in body in global coordinates.
  744. * @ingroup bodies
  745. */
  746. ODE_API void dBodyAddForceAtPos (dBodyID, dReal fx, dReal fy, dReal fz,
  747. dReal px, dReal py, dReal pz);
  748. /**
  749. * @brief Add force at specified point in body in local coordinates.
  750. * @ingroup bodies
  751. */
  752. ODE_API void dBodyAddForceAtRelPos (dBodyID, dReal fx, dReal fy, dReal fz,
  753. dReal px, dReal py, dReal pz);
  754. /**
  755. * @brief Add force at specified point in body in global coordinates.
  756. * @ingroup bodies
  757. */
  758. ODE_API void dBodyAddRelForceAtPos (dBodyID, dReal fx, dReal fy, dReal fz,
  759. dReal px, dReal py, dReal pz);
  760. /**
  761. * @brief Add force at specified point in body in local coordinates.
  762. * @ingroup bodies
  763. */
  764. ODE_API void dBodyAddRelForceAtRelPos (dBodyID, dReal fx, dReal fy, dReal fz,
  765. dReal px, dReal py, dReal pz);
  766. /**
  767. * @brief Return the current accumulated force vector.
  768. * @return points to an array of 3 reals.
  769. * @remarks
  770. * The returned values are pointers to internal data structures, so
  771. * the vectors are only valid until any changes are made to the rigid
  772. * body system.
  773. * @ingroup bodies
  774. */
  775. ODE_API const dReal * dBodyGetForce (dBodyID);
  776. /**
  777. * @brief Return the current accumulated torque vector.
  778. * @return points to an array of 3 reals.
  779. * @remarks
  780. * The returned values are pointers to internal data structures, so
  781. * the vectors are only valid until any changes are made to the rigid
  782. * body system.
  783. * @ingroup bodies
  784. */
  785. ODE_API const dReal * dBodyGetTorque (dBodyID);
  786. /**
  787. * @brief Set the body force accumulation vector.
  788. * @remarks
  789. * This is mostly useful to zero the force and torque for deactivated bodies
  790. * before they are reactivated, in the case where the force-adding functions
  791. * were called on them while they were deactivated.
  792. * @ingroup bodies
  793. */
  794. ODE_API void dBodySetForce (dBodyID b, dReal x, dReal y, dReal z);
  795. /**
  796. * @brief Set the body torque accumulation vector.
  797. * @remarks
  798. * This is mostly useful to zero the force and torque for deactivated bodies
  799. * before they are reactivated, in the case where the force-adding functions
  800. * were called on them while they were deactivated.
  801. * @ingroup bodies
  802. */
  803. ODE_API void dBodySetTorque (dBodyID b, dReal x, dReal y, dReal z);
  804. /**
  805. * @brief Get world position of a relative point on body.
  806. * @ingroup bodies
  807. * @param result will contain the result.
  808. */
  809. ODE_API void dBodyGetRelPointPos
  810. (
  811. dBodyID, dReal px, dReal py, dReal pz,
  812. dVector3 result
  813. );
  814. /**
  815. * @brief Get velocity vector in global coords of a relative point on body.
  816. * @ingroup bodies
  817. * @param result will contain the result.
  818. */
  819. ODE_API void dBodyGetRelPointVel
  820. (
  821. dBodyID, dReal px, dReal py, dReal pz,
  822. dVector3 result
  823. );
  824. /**
  825. * @brief Get velocity vector in global coords of a globally
  826. * specified point on a body.
  827. * @ingroup bodies
  828. * @param result will contain the result.
  829. */
  830. ODE_API void dBodyGetPointVel
  831. (
  832. dBodyID, dReal px, dReal py, dReal pz,
  833. dVector3 result
  834. );
  835. /**
  836. * @brief takes a point in global coordinates and returns
  837. * the point's position in body-relative coordinates.
  838. * @remarks
  839. * This is the inverse of dBodyGetRelPointPos()
  840. * @ingroup bodies
  841. * @param result will contain the result.
  842. */
  843. ODE_API void dBodyGetPosRelPoint
  844. (
  845. dBodyID, dReal px, dReal py, dReal pz,
  846. dVector3 result
  847. );
  848. /**
  849. * @brief Convert from local to world coordinates.
  850. * @ingroup bodies
  851. * @param result will contain the result.
  852. */
  853. ODE_API void dBodyVectorToWorld
  854. (
  855. dBodyID, dReal px, dReal py, dReal pz,
  856. dVector3 result
  857. );
  858. /**
  859. * @brief Convert from world to local coordinates.
  860. * @ingroup bodies
  861. * @param result will contain the result.
  862. */
  863. ODE_API void dBodyVectorFromWorld
  864. (
  865. dBodyID, dReal px, dReal py, dReal pz,
  866. dVector3 result
  867. );
  868. /**
  869. * @brief controls the way a body's orientation is updated at each timestep.
  870. * @ingroup bodies
  871. * @param mode can be 0 or 1:
  872. * \li 0: An ``infinitesimal'' orientation update is used.
  873. * This is fast to compute, but it can occasionally cause inaccuracies
  874. * for bodies that are rotating at high speed, especially when those
  875. * bodies are joined to other bodies.
  876. * This is the default for every new body that is created.
  877. * \li 1: A ``finite'' orientation update is used.
  878. * This is more costly to compute, but will be more accurate for high
  879. * speed rotations.
  880. * @remarks
  881. * Note however that high speed rotations can result in many types of
  882. * error in a simulation, and the finite mode will only fix one of those
  883. * sources of error.
  884. */
  885. ODE_API void dBodySetFiniteRotationMode (dBodyID, int mode);
  886. /**
  887. * @brief sets the finite rotation axis for a body.
  888. * @ingroup bodies
  889. * @remarks
  890. * This is axis only has meaning when the finite rotation mode is set
  891. * If this axis is zero (0,0,0), full finite rotations are performed on
  892. * the body.
  893. * If this axis is nonzero, the body is rotated by performing a partial finite
  894. * rotation along the axis direction followed by an infinitesimal rotation
  895. * along an orthogonal direction.
  896. * @remarks
  897. * This can be useful to alleviate certain sources of error caused by quickly
  898. * spinning bodies. For example, if a car wheel is rotating at high speed
  899. * you can call this function with the wheel's hinge axis as the argument to
  900. * try and improve its behavior.
  901. */
  902. ODE_API void dBodySetFiniteRotationAxis (dBodyID, dReal x, dReal y, dReal z);
  903. /**
  904. * @brief Get the way a body's orientation is updated each timestep.
  905. * @ingroup bodies
  906. * @return the mode 0 (infitesimal) or 1 (finite).
  907. */
  908. ODE_API int dBodyGetFiniteRotationMode (dBodyID);
  909. /**
  910. * @brief Get the finite rotation axis.
  911. * @param result will contain the axis.
  912. * @ingroup bodies
  913. */
  914. ODE_API void dBodyGetFiniteRotationAxis (dBodyID, dVector3 result);
  915. /**
  916. * @brief Get the number of joints that are attached to this body.
  917. * @ingroup bodies
  918. * @return nr of joints
  919. */
  920. ODE_API int dBodyGetNumJoints (dBodyID b);
  921. /**
  922. * @brief Return a joint attached to this body, given by index.
  923. * @ingroup bodies
  924. * @param index valid range is 0 to n-1 where n is the value returned by
  925. * dBodyGetNumJoints().
  926. */
  927. ODE_API dJointID dBodyGetJoint (dBodyID, int index);
  928. /**
  929. * @brief Manually enable a body.
  930. * @param dBodyID identification of body.
  931. * @ingroup bodies
  932. */
  933. ODE_API void dBodyEnable (dBodyID);
  934. /**
  935. * @brief Manually disable a body.
  936. * @ingroup bodies
  937. * @remarks
  938. * A disabled body that is connected through a joint to an enabled body will
  939. * be automatically re-enabled at the next simulation step.
  940. */
  941. ODE_API void dBodyDisable (dBodyID);
  942. /**
  943. * @brief Check wether a body is enabled.
  944. * @ingroup bodies
  945. * @return 1 if a body is currently enabled or 0 if it is disabled.
  946. */
  947. ODE_API int dBodyIsEnabled (dBodyID);
  948. /**
  949. * @brief Set whether the body is influenced by the world's gravity or not.
  950. * @ingroup bodies
  951. * @param mode when nonzero gravity affects this body.
  952. * @remarks
  953. * Newly created bodies are always influenced by the world's gravity.
  954. */
  955. ODE_API void dBodySetGravityMode (dBodyID b, int mode);
  956. /**
  957. * @brief Get whether the body is influenced by the world's gravity or not.
  958. * @ingroup bodies
  959. * @return nonzero means gravity affects this body.
  960. */
  961. ODE_API int dBodyGetGravityMode (dBodyID b);
  962. /**
  963. * @brief Set the 'moved' callback of a body.
  964. *
  965. * Whenever a body has its position or rotation changed during the
  966. * timestep, the callback will be called (with body as the argument).
  967. * Use it to know which body may need an update in an external
  968. * structure (like a 3D engine).
  969. *
  970. * @param b the body that needs to be watched.
  971. * @param callback the callback to be invoked when the body moves. Set to zero
  972. * to disable.
  973. * @ingroup bodies
  974. */
  975. ODE_API void dBodySetMovedCallback(dBodyID b, void (*callback)(dBodyID));
  976. /**
  977. * @brief Return the first geom associated with the body.
  978. *
  979. * You can traverse through the geoms by repeatedly calling
  980. * dBodyGetNextGeom().
  981. *
  982. * @return the first geom attached to this body, or 0.
  983. * @ingroup bodies
  984. */
  985. ODE_API dGeomID dBodyGetFirstGeom (dBodyID b);
  986. /**
  987. * @brief returns the next geom associated with the same body.
  988. * @param g a geom attached to some body.
  989. * @return the next geom attached to the same body, or 0.
  990. * @sa dBodyGetFirstGeom
  991. * @ingroup bodies
  992. */
  993. ODE_API dGeomID dBodyGetNextGeom (dGeomID g);
  994. /**
  995. * @brief Resets the damping settings to the current world's settings.
  996. * @ingroup bodies damping
  997. */
  998. ODE_API void dBodySetDampingDefaults(dBodyID b);
  999. /**
  1000. * @brief Get the body's linear damping scale.
  1001. * @ingroup bodies damping
  1002. */
  1003. ODE_API dReal dBodyGetLinearDamping (dBodyID b);
  1004. /**
  1005. * @brief Set the body's linear damping scale.
  1006. * @param scale The linear damping scale. Should be in the interval [0, 1].
  1007. * @ingroup bodies damping
  1008. * @remarks From now on the body will not use the world's linear damping
  1009. * scale until dBodySetDampingDefaults() is called.
  1010. * @sa dBodySetDampingDefaults()
  1011. */
  1012. ODE_API void dBodySetLinearDamping(dBodyID b, dReal scale);
  1013. /**
  1014. * @brief Get the body's angular damping scale.
  1015. * @ingroup bodies damping
  1016. * @remarks If the body's angular damping scale was not set, this function
  1017. * returns the world's angular damping scale.
  1018. */
  1019. ODE_API dReal dBodyGetAngularDamping (dBodyID b);
  1020. /**
  1021. * @brief Set the body's angular damping scale.
  1022. * @param scale The angular damping scale. Should be in the interval [0, 1].
  1023. * @ingroup bodies damping
  1024. * @remarks From now on the body will not use the world's angular damping
  1025. * scale until dBodyResetAngularDamping() is called.
  1026. * @sa dBodyResetAngularDamping()
  1027. */
  1028. ODE_API void dBodySetAngularDamping(dBodyID b, dReal scale);
  1029. /**
  1030. * @brief Convenience function to set linear and angular scales at once.
  1031. * @param linear_scale The linear damping scale. Should be in the interval [0, 1].
  1032. * @param angular_scale The angular damping scale. Should be in the interval [0, 1].
  1033. * @ingroup bodies damping
  1034. * @sa dBodySetLinearDamping() dBodySetAngularDamping()
  1035. */
  1036. ODE_API void dBodySetDamping(dBodyID b, dReal linear_scale, dReal angular_scale);
  1037. /**
  1038. * @brief Get the body's linear damping threshold.
  1039. * @ingroup bodies damping
  1040. */
  1041. ODE_API dReal dBodyGetLinearDampingThreshold (dBodyID b);
  1042. /**
  1043. * @brief Set the body's linear damping threshold.
  1044. * @param threshold The linear threshold to be used. Damping
  1045. * is only applied if the linear speed is above this limit.
  1046. * @ingroup bodies damping
  1047. */
  1048. ODE_API void dBodySetLinearDampingThreshold(dBodyID b, dReal threshold);
  1049. /**
  1050. * @brief Get the body's angular damping threshold.
  1051. * @ingroup bodies damping
  1052. */
  1053. ODE_API dReal dBodyGetAngularDampingThreshold (dBodyID b);
  1054. /**
  1055. * @brief Set the body's angular damping threshold.
  1056. * @param threshold The angular threshold to be used. Damping is
  1057. * only used if the angular speed is above this limit.
  1058. * @ingroup bodies damping
  1059. */
  1060. ODE_API void dBodySetAngularDampingThreshold(dBodyID b, dReal threshold);
  1061. /**
  1062. * @brief Get the body's maximum angular speed.
  1063. * @ingroup damping bodies
  1064. * @sa dWorldGetMaxAngularSpeed()
  1065. */
  1066. ODE_API dReal dBodyGetMaxAngularSpeed (dBodyID b);
  1067. /**
  1068. * @brief Set the body's maximum angular speed.
  1069. * @ingroup damping bodies
  1070. * @sa dWorldSetMaxAngularSpeed() dBodyResetMaxAngularSpeed()
  1071. * The default value is dInfinity, but it's a good idea to limit
  1072. * it at less than 500 if you build ODE with the gyroscopic term
  1073. * enabled.
  1074. */
  1075. ODE_API void dBodySetMaxAngularSpeed(dBodyID b, dReal max_speed);
  1076. /**
  1077. * @defgroup joints Joints
  1078. *
  1079. * In real life a joint is something like a hinge, that is used to connect two
  1080. * objects.
  1081. * In ODE a joint is very similar: It is a relationship that is enforced between
  1082. * two bodies so that they can only have certain positions and orientations
  1083. * relative to each other.
  1084. * This relationship is called a constraint -- the words joint and
  1085. * constraint are often used interchangeably.
  1086. *
  1087. * A joint has a set of parameters that can be set. These include:
  1088. *
  1089. *
  1090. * \li dParamLoStop Low stop angle or position. Setting this to
  1091. * -dInfinity (the default value) turns off the low stop.
  1092. * For rotational joints, this stop must be greater than -pi to be
  1093. * effective.
  1094. * \li dParamHiStop High stop angle or position. Setting this to
  1095. * dInfinity (the default value) turns off the high stop.
  1096. * For rotational joints, this stop must be less than pi to be
  1097. * effective.
  1098. * If the high stop is less than the low stop then both stops will
  1099. * be ineffective.
  1100. * \li dParamVel Desired motor velocity (this will be an angular or
  1101. * linear velocity).
  1102. * \li dParamFMax The maximum force or torque that the motor will use to
  1103. * achieve the desired velocity.
  1104. * This must always be greater than or equal to zero.
  1105. * Setting this to zero (the default value) turns off the motor.
  1106. * \li dParamFudgeFactor The current joint stop/motor implementation has
  1107. * a small problem:
  1108. * when the joint is at one stop and the motor is set to move it away
  1109. * from the stop, too much force may be applied for one time step,
  1110. * causing a ``jumping'' motion.
  1111. * This fudge factor is used to scale this excess force.
  1112. * It should have a value between zero and one (the default value).
  1113. * If the jumping motion is too visible in a joint, the value can be
  1114. * reduced.
  1115. * Making this value too small can prevent the motor from being able to
  1116. * move the joint away from a stop.
  1117. * \li dParamBounce The bouncyness of the stops.
  1118. * This is a restitution parameter in the range 0..1.
  1119. * 0 means the stops are not bouncy at all, 1 means maximum bouncyness.
  1120. * \li dParamCFM The constraint force mixing (CFM) value used when not
  1121. * at a stop.
  1122. * \li dParamStopERP The error reduction parameter (ERP) used by the
  1123. * stops.
  1124. * \li dParamStopCFM The constraint force mixing (CFM) value used by the
  1125. * stops. Together with the ERP value this can be used to get spongy or
  1126. * soft stops.
  1127. * Note that this is intended for unpowered joints, it does not really
  1128. * work as expected when a powered joint reaches its limit.
  1129. * \li dParamSuspensionERP Suspension error reduction parameter (ERP).
  1130. * Currently this is only implemented on the hinge-2 joint.
  1131. * \li dParamSuspensionCFM Suspension constraint force mixing (CFM) value.
  1132. * Currently this is only implemented on the hinge-2 joint.
  1133. *
  1134. * If a particular parameter is not implemented by a given joint, setting it
  1135. * will have no effect.
  1136. * These parameter names can be optionally followed by a digit (2 or 3)
  1137. * to indicate the second or third set of parameters, e.g. for the second axis
  1138. * in a hinge-2 joint, or the third axis in an AMotor joint.
  1139. */
  1140. /**
  1141. * @brief Create a new joint of the ball type.
  1142. * @ingroup joints
  1143. * @remarks
  1144. * The joint is initially in "limbo" (i.e. it has no effect on the simulation)
  1145. * because it does not connect to any bodies.
  1146. * @param dJointGroupID set to 0 to allocate the joint normally.
  1147. * If it is nonzero the joint is allocated in the given joint group.
  1148. */
  1149. ODE_API dJointID dJointCreateBall (dWorldID, dJointGroupID);
  1150. /**
  1151. * @brief Create a new joint of the hinge type.
  1152. * @ingroup joints
  1153. * @param dJointGroupID set to 0 to allocate the joint normally.
  1154. * If it is nonzero the joint is allocated in the given joint group.
  1155. */
  1156. ODE_API dJointID dJointCreateHinge (dWorldID, dJointGroupID);
  1157. /**
  1158. * @brief Create a new joint of the slider type.
  1159. * @ingroup joints
  1160. * @param dJointGroupID set to 0 to allocate the joint normally.
  1161. * If it is nonzero the joint is allocated in the given joint group.
  1162. */
  1163. ODE_API dJointID dJointCreateSlider (dWorldID, dJointGroupID);
  1164. /**
  1165. * @brief Create a new joint of the contact type.
  1166. * @ingroup joints
  1167. * @param dJointGroupID set to 0 to allocate the joint normally.
  1168. * If it is nonzero the joint is allocated in the given joint group.
  1169. */
  1170. ODE_API dJointID dJointCreateContact (dWorldID, dJointGroupID, const dContact *);
  1171. /**
  1172. * @brief Create a new joint of the hinge2 type.
  1173. * @ingroup joints
  1174. * @param dJointGroupID set to 0 to allocate the joint normally.
  1175. * If it is nonzero the joint is allocated in the given joint group.
  1176. */
  1177. ODE_API dJointID dJointCreateHinge2 (dWorldID, dJointGroupID);
  1178. /**
  1179. * @brief Create a new joint of the universal type.
  1180. * @ingroup joints
  1181. * @param dJointGroupID set to 0 to allocate the joint normally.
  1182. * If it is nonzero the joint is allocated in the given joint group.
  1183. */
  1184. ODE_API dJointID dJointCreateUniversal (dWorldID, dJointGroupID);
  1185. /**
  1186. * @brief Create a new joint of the PR (Prismatic and Rotoide) type.
  1187. * @ingroup joints
  1188. * @param dJointGroupID set to 0 to allocate the joint normally.
  1189. * If it is nonzero the joint is allocated in the given joint group.
  1190. */
  1191. ODE_API dJointID dJointCreatePR (dWorldID, dJointGroupID);
  1192. /**
  1193. * @brief Create a new joint of the PU (Prismatic and Universal) type.
  1194. * @ingroup joints
  1195. * @param dJointGroupID set to 0 to allocate the joint normally.
  1196. * If it is nonzero the joint is allocated in the given joint group.
  1197. */
  1198. ODE_API dJointID dJointCreatePU (dWorldID, dJointGroupID);
  1199. /**
  1200. * @brief Create a new joint of the Piston type.
  1201. * @ingroup joints
  1202. * @param dJointGroupID set to 0 to allocate the joint normally.
  1203. * If it is nonzero the joint is allocated in the given
  1204. * joint group.
  1205. */
  1206. ODE_API dJointID dJointCreatePiston (dWorldID, dJointGroupID);
  1207. /**
  1208. * @brief Create a new joint of the fixed type.
  1209. * @ingroup joints
  1210. * @param dJointGroupID set to 0 to allocate the joint normally.
  1211. * If it is nonzero the joint is allocated in the given joint group.
  1212. */
  1213. ODE_API dJointID dJointCreateFixed (dWorldID, dJointGroupID);
  1214. ODE_API dJointID dJointCreateNull (dWorldID, dJointGroupID);
  1215. /**
  1216. * @brief Create a new joint of the A-motor type.
  1217. * @ingroup joints
  1218. * @param dJointGroupID set to 0 to allocate the joint normally.
  1219. * If it is nonzero the joint is allocated in the given joint group.
  1220. */
  1221. ODE_API dJointID dJointCreateAMotor (dWorldID, dJointGroupID);
  1222. /**
  1223. * @brief Create a new joint of the L-motor type.
  1224. * @ingroup joints
  1225. * @param dJointGroupID set to 0 to allocate the joint normally.
  1226. * If it is nonzero the joint is allocated in the given joint group.
  1227. */
  1228. ODE_API dJointID dJointCreateLMotor (dWorldID, dJointGroupID);
  1229. /**
  1230. * @brief Create a new joint of the plane-2d type.
  1231. * @ingroup joints
  1232. * @param dJointGroupID set to 0 to allocate the joint normally.
  1233. * If it is nonzero the joint is allocated in the given joint group.
  1234. */
  1235. ODE_API dJointID dJointCreatePlane2D (dWorldID, dJointGroupID);
  1236. /**
  1237. * @brief Destroy a joint.
  1238. * @ingroup joints
  1239. *
  1240. * disconnects it from its attached bodies and removing it from the world.
  1241. * However, if the joint is a member of a group then this function has no
  1242. * effect - to destroy that joint the group must be emptied or destroyed.
  1243. */
  1244. ODE_API void dJointDestroy (dJointID);
  1245. /**
  1246. * @brief Create a joint group
  1247. * @ingroup joints
  1248. * @param max_size deprecated. Set to 0.
  1249. */
  1250. ODE_API dJointGroupID dJointGroupCreate (int max_size);
  1251. /**
  1252. * @brief Destroy a joint group.
  1253. * @ingroup joints
  1254. *
  1255. * All joints in the joint group will be destroyed.
  1256. */
  1257. ODE_API void dJointGroupDestroy (dJointGroupID);
  1258. /**
  1259. * @brief Empty a joint group.
  1260. * @ingroup joints
  1261. *
  1262. * All joints in the joint group will be destroyed,
  1263. * but the joint group itself will not be destroyed.
  1264. */
  1265. ODE_API void dJointGroupEmpty (dJointGroupID);
  1266. /**
  1267. * @brief Return the number of bodies attached to the joint
  1268. * @ingroup joints
  1269. */
  1270. ODE_API int dJointGetNumBodies(dJointID);
  1271. /**
  1272. * @brief Attach the joint to some new bodies.
  1273. * @ingroup joints
  1274. *
  1275. * If the joint is already attached, it will be detached from the old bodies
  1276. * first.
  1277. * To attach this joint to only one body, set body1 or body2 to zero - a zero
  1278. * body refers to the static environment.
  1279. * Setting both bodies to zero puts the joint into "limbo", i.e. it will
  1280. * have no effect on the simulation.
  1281. * @remarks
  1282. * Some joints, like hinge-2 need to be attached to two bodies to work.
  1283. */
  1284. ODE_API void dJointAttach (dJointID, dBodyID body1, dBodyID body2);
  1285. /**
  1286. * @brief Set the user-data pointer
  1287. * @ingroup joints
  1288. */
  1289. ODE_API void dJointSetData (dJointID, void *data);
  1290. /**
  1291. * @brief Get the user-data pointer
  1292. * @ingroup joints
  1293. */
  1294. ODE_API void *dJointGetData (dJointID);
  1295. /**
  1296. * @brief Get the type of the joint
  1297. * @ingroup joints
  1298. * @return the type, being one of these:
  1299. * \li dJointTypeBall
  1300. * \li dJointTypeHinge
  1301. * \li dJointTypeSlider
  1302. * \li dJointTypeContact
  1303. * \li dJointTypeUniversal
  1304. * \li dJointTypeHinge2
  1305. * \li dJointTypeFixed
  1306. * \li dJointTypeNull
  1307. * \li dJointTypeAMotor
  1308. * \li dJointTypeLMotor
  1309. * \li dJointTypePlane2D
  1310. * \li dJointTypePR
  1311. * \li dJointTypePU
  1312. * \li dJointTypePiston
  1313. */
  1314. ODE_API dJointType dJointGetType (dJointID);
  1315. /**
  1316. * @brief Return the bodies that this joint connects.
  1317. * @ingroup joints
  1318. * @param index return the first (0) or second (1) body.
  1319. * @remarks
  1320. * If one of these returned body IDs is zero, the joint connects the other body
  1321. * to the static environment.
  1322. * If both body IDs are zero, the joint is in ``limbo'' and has no effect on
  1323. * the simulation.
  1324. */
  1325. ODE_API dBodyID dJointGetBody (dJointID, int index);
  1326. /**
  1327. * @brief Sets the datastructure that is to receive the feedback.
  1328. *
  1329. * The feedback can be used by the user, so that it is known how
  1330. * much force an individual joint exerts.
  1331. * @ingroup joints
  1332. */
  1333. ODE_API void dJointSetFeedback (dJointID, dJointFeedback *);
  1334. /**
  1335. * @brief Gets the datastructure that is to receive the feedback.
  1336. * @ingroup joints
  1337. */
  1338. ODE_API dJointFeedback *dJointGetFeedback (dJointID);
  1339. /**
  1340. * @brief Set the joint anchor point.
  1341. * @ingroup joints
  1342. *
  1343. * The joint will try to keep this point on each body
  1344. * together. The input is specified in world coordinates.
  1345. */
  1346. ODE_API void dJointSetBallAnchor (dJointID, dReal x, dReal y, dReal z);
  1347. /**
  1348. * @brief Set the joint anchor point.
  1349. * @ingroup joints
  1350. */
  1351. ODE_API void dJointSetBallAnchor2 (dJointID, dReal x, dReal y, dReal z);
  1352. /**
  1353. * @brief Param setting for Ball joints
  1354. * @ingroup joints
  1355. */
  1356. ODE_API void dJointSetBallParam (dJointID, int parameter, dReal value);
  1357. /**
  1358. * @brief Set hinge anchor parameter.
  1359. * @ingroup joints
  1360. */
  1361. ODE_API void dJointSetHingeAnchor (dJointID, dReal x, dReal y, dReal z);
  1362. ODE_API void dJointSetHingeAnchorDelta (dJointID, dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az);
  1363. /**
  1364. * @brief Set hinge axis.
  1365. * @ingroup joints
  1366. */
  1367. ODE_API void dJointSetHingeAxis (dJointID, dReal x, dReal y, dReal z);
  1368. /**
  1369. * @brief Set the Hinge axis as if the 2 bodies were already at angle appart.
  1370. * @ingroup joints
  1371. *
  1372. * This function initialize the Axis and the relative orientation of each body
  1373. * as if body1 was rotated around the axis by the angle value. \br
  1374. * Ex:
  1375. * <PRE>
  1376. * dJointSetHingeAxis(jId, 1, 0, 0);
  1377. * // If you request the position you will have: dJointGetHingeAngle(jId) == 0
  1378. * dJointSetHingeAxisDelta(jId, 1, 0, 0, 0.23);
  1379. * // If you request the position you will have: dJointGetHingeAngle(jId) == 0.23
  1380. * </PRE>
  1381. * @param j The Hinge joint ID for which the axis will be set
  1382. * @param x The X component of the axis in world frame
  1383. * @param y The Y component of the axis in world frame
  1384. * @param z The Z component of the axis in world frame
  1385. * @param angle The angle for the offset of the relative orientation.
  1386. * As if body1 was rotated by angle when the Axis was set (see below).
  1387. * The rotation is around the new Hinge axis.
  1388. *
  1389. * @note Usually the function dJointSetHingeAxis set the current position of body1
  1390. * and body2 as the zero angle position. This function set the current position
  1391. * as the if the 2 bodies where \b angle appart.
  1392. * @warning Calling dJointSetHingeAnchor or dJointSetHingeAxis will reset the "zero"
  1393. * angle position.
  1394. */
  1395. ODE_API void dJointSetHingeAxisOffset (dJointID j, dReal x, dReal y, dReal z, dReal angle);
  1396. /**
  1397. * @brief set joint parameter
  1398. * @ingroup joints
  1399. */
  1400. ODE_API void dJointSetHingeParam (dJointID, int parameter, dReal value);
  1401. /**
  1402. * @brief Applies the torque about the hinge axis.
  1403. *
  1404. * That is, it applies a torque with specified magnitude in the direction
  1405. * of the hinge axis, to body 1, and with the same magnitude but in opposite
  1406. * direction to body 2. This function is just a wrapper for dBodyAddTorque()}
  1407. * @ingroup joints
  1408. */
  1409. ODE_API void dJointAddHingeTorque(dJointID joint, dReal torque);
  1410. /**
  1411. * @brief set the joint axis
  1412. * @ingroup joints
  1413. */
  1414. ODE_API void dJointSetSliderAxis (dJointID, dReal x, dReal y, dReal z);
  1415. /**
  1416. * @ingroup joints
  1417. */
  1418. ODE_API void dJointSetSliderAxisDelta (dJointID, dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az);
  1419. /**
  1420. * @brief set joint parameter
  1421. * @ingroup joints
  1422. */
  1423. ODE_API void dJointSetSliderParam (dJointID, int parameter, dReal value);
  1424. /**
  1425. * @brief Applies the given force in the slider's direction.
  1426. *
  1427. * That is, it applies a force with specified magnitude, in the direction of
  1428. * slider's axis, to body1, and with the same magnitude but opposite
  1429. * direction to body2. This function is just a wrapper for dBodyAddForce().
  1430. * @ingroup joints
  1431. */
  1432. ODE_API void dJointAddSliderForce(dJointID joint, dReal force);
  1433. /**
  1434. * @brief set anchor
  1435. * @ingroup joints
  1436. */
  1437. ODE_API void dJointSetHinge2Anchor (dJointID, dReal x, dReal y, dReal z);
  1438. /**
  1439. * @brief set axis
  1440. * @ingroup joints
  1441. */
  1442. ODE_API void dJointSetHinge2Axis1 (dJointID, dReal x, dReal y, dReal z);
  1443. /**
  1444. * @brief set axis
  1445. * @ingroup joints
  1446. */
  1447. ODE_API void dJointSetHinge2Axis2 (dJointID, dReal x, dReal y, dReal z);
  1448. /**
  1449. * @brief set joint parameter
  1450. * @ingroup joints
  1451. */
  1452. ODE_API void dJointSetHinge2Param (dJointID, int parameter, dReal value);
  1453. /**
  1454. * @brief Applies torque1 about the hinge2's axis 1, torque2 about the
  1455. * hinge2's axis 2.
  1456. * @remarks This function is just a wrapper for dBodyAddTorque().
  1457. * @ingroup joints
  1458. */
  1459. ODE_API void dJointAddHinge2Torques(dJointID joint, dReal torque1, dReal torque2);
  1460. /**
  1461. * @brief set anchor
  1462. * @ingroup joints
  1463. */
  1464. ODE_API void dJointSetUniversalAnchor (dJointID, dReal x, dReal y, dReal z);
  1465. /**
  1466. * @brief set axis
  1467. * @ingroup joints
  1468. */
  1469. ODE_API void dJointSetUniversalAxis1 (dJointID, dReal x, dReal y, dReal z);
  1470. /**
  1471. * @brief set axis
  1472. * @ingroup joints
  1473. */
  1474. ODE_API void dJointSetUniversalAxis2 (dJointID, dReal x, dReal y, dReal z);
  1475. /**
  1476. * @brief set joint parameter
  1477. * @ingroup joints
  1478. */
  1479. ODE_API void dJointSetUniversalParam (dJointID, int parameter, dReal value);
  1480. /**
  1481. * @brief Applies torque1 about the universal's axis 1, torque2 about the
  1482. * universal's axis 2.
  1483. * @remarks This function is just a wrapper for dBodyAddTorque().
  1484. * @ingroup joints
  1485. */
  1486. ODE_API void dJointAddUniversalTorques(dJointID joint, dReal torque1, dReal torque2);
  1487. /**
  1488. * @brief set anchor
  1489. * @ingroup joints
  1490. */
  1491. ODE_API void dJointSetPRAnchor (dJointID, dReal x, dReal y, dReal z);
  1492. /**
  1493. * @brief set the axis for the prismatic articulation
  1494. * @ingroup joints
  1495. */
  1496. ODE_API void dJointSetPRAxis1 (dJointID, dReal x, dReal y, dReal z);
  1497. /**
  1498. * @brief set the axis for the rotoide articulation
  1499. * @ingroup joints
  1500. */
  1501. ODE_API void dJointSetPRAxis2 (dJointID, dReal x, dReal y, dReal z);
  1502. /**
  1503. * @brief set joint parameter
  1504. * @ingroup joints
  1505. *
  1506. * @note parameterX where X equal 2 refer to parameter for the rotoide articulation
  1507. */
  1508. ODE_API void dJointSetPRParam (dJointID, int parameter, dReal value);
  1509. /**
  1510. * @brief Applies the torque about the rotoide axis of the PR joint
  1511. *
  1512. * That is, it applies a torque with specified magnitude in the direction
  1513. * of the rotoide axis, to body 1, and with the same magnitude but in opposite
  1514. * direction to body 2. This function is just a wrapper for dBodyAddTorque()}
  1515. * @ingroup joints
  1516. */
  1517. ODE_API void dJointAddPRTorque (dJointID j, dReal torque);
  1518. /**
  1519. * @brief set anchor
  1520. * @ingroup joints
  1521. */
  1522. ODE_API void dJointSetPUAnchor (dJointID, dReal x, dReal y, dReal z);
  1523. /**
  1524. * @brief set anchor
  1525. * @ingroup joints
  1526. */
  1527. ODE_API void dJointSetPUAnchorDelta (dJointID, dReal x, dReal y, dReal z,
  1528. dReal dx, dReal dy, dReal dz);
  1529. /**
  1530. * @brief set the axis for the first axis or the universal articulation
  1531. * @ingroup joints
  1532. */
  1533. ODE_API void dJointSetPUAxis1 (dJointID, dReal x, dReal y, dReal z);
  1534. /**
  1535. * @brief set the axis for the second axis or the universal articulation
  1536. * @ingroup joints
  1537. */
  1538. ODE_API void dJointSetPUAxis2 (dJointID, dReal x, dReal y, dReal z);
  1539. /**
  1540. * @brief set the axis for the prismatic articulation
  1541. * @ingroup joints
  1542. */
  1543. ODE_API void dJointSetPUAxis3 (dJointID, dReal x, dReal y, dReal z);
  1544. /**
  1545. * @brief set the axis for the prismatic articulation
  1546. * @ingroup joints
  1547. * @note This function was added for convenience it is the same as
  1548. * dJointSetPUAxis3
  1549. */
  1550. ODE_API void dJointSetPUAxisP (dJointID id, dReal x, dReal y, dReal z);
  1551. /**
  1552. * @brief set joint parameter
  1553. * @ingroup joints
  1554. *
  1555. * @note parameterX where X equal 2 refer to parameter for second axis of the
  1556. * universal articulation
  1557. * @note parameterX where X equal 3 refer to parameter for prismatic
  1558. * articulation
  1559. */
  1560. ODE_API void dJointSetPUParam (dJointID, int parameter, dReal value);
  1561. /**
  1562. * @brief Applies the torque about the rotoide axis of the PU joint
  1563. *
  1564. * That is, it applies a torque with specified magnitude in the direction
  1565. * of the rotoide axis, to body 1, and with the same magnitude but in opposite
  1566. * direction to body 2. This function is just a wrapper for dBodyAddTorque()}
  1567. * @ingroup joints
  1568. */
  1569. ODE_API void dJointAddPUTorque (dJointID j, dReal torque);
  1570. /**
  1571. * @brief set the joint anchor
  1572. * @ingroup joints
  1573. */
  1574. ODE_API void dJointSetPistonAnchor (dJointID, dReal x, dReal y, dReal z);
  1575. /**
  1576. * @brief Set the Piston anchor as if the 2 bodies were already at [dx,dy, dz] appart.
  1577. * @ingroup joints
  1578. *
  1579. * This function initialize the anchor and the relative position of each body
  1580. * as if the position between body1 and body2 was already the projection of [dx, dy, dz]
  1581. * along the Piston axis. (i.e as if the body1 was at its current position - [dx,dy,dy] when the
  1582. * axis is set).
  1583. * Ex:
  1584. * <PRE>
  1585. * dReal offset = 3;
  1586. * dVector3 axis;
  1587. * dJointGetPistonAxis(jId, axis);
  1588. * dJointSetPistonAnchor(jId, 0, 0, 0);
  1589. * // If you request the position you will have: dJointGetPistonPosition(jId) == 0
  1590. * dJointSetPistonAnchorOffset(jId, 0, 0, 0, axis[X]*offset, axis[Y]*offset, axis[Z]*offset);
  1591. * // If you request the position you will have: dJointGetPistonPosition(jId) == offset
  1592. * </PRE>
  1593. * @param j The Piston joint for which the anchor point will be set
  1594. * @param x The X position of the anchor point in world frame
  1595. * @param y The Y position of the anchor point in world frame
  1596. * @param z The Z position of the anchor point in world frame
  1597. * @param dx A delta to be substracted to the X position as if the anchor was set
  1598. * when body1 was at current_position[X] - dx
  1599. * @param dx A delta to be substracted to the Y position as if the anchor was set
  1600. * when body1 was at current_position[Y] - dy
  1601. * @param dx A delta to be substracted to the Z position as if the anchor was set
  1602. * when body1 was at current_position[Z] - dz
  1603. */
  1604. ODE_API void dJointSetPistonAnchorOffset(dJointID j, dReal x, dReal y, dReal z,
  1605. dReal dx, dReal dy, dReal dz);
  1606. /**
  1607. * @brief set the joint axis
  1608. * @ingroup joints
  1609. */
  1610. ODE_API void dJointSetPistonAxis (dJointID, dReal x, dReal y, dReal z);
  1611. /**
  1612. * This function set prismatic axis of the joint and also set the position
  1613. * of the joint.
  1614. *
  1615. * @ingroup joints
  1616. * @param j The joint affected by this function
  1617. * @param x The x component of the axis
  1618. * @param y The y component of the axis
  1619. * @param z The z component of the axis
  1620. * @param dx The Initial position of the prismatic join in the x direction
  1621. * @param dy The Initial position of the prismatic join in the y direction
  1622. * @param dz The Initial position of the prismatic join in the z direction
  1623. */
  1624. ODE_API_DEPRECATED ODE_API void dJointSetPistonAxisDelta (dJointID j, dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az);
  1625. /**
  1626. * @brief set joint parameter
  1627. * @ingroup joints
  1628. */
  1629. ODE_API void dJointSetPistonParam (dJointID, int parameter, dReal value);
  1630. /**
  1631. * @brief Applies the given force in the slider's direction.
  1632. *
  1633. * That is, it applies a force with specified magnitude, in the direction of
  1634. * prismatic's axis, to body1, and with the same magnitude but opposite
  1635. * direction to body2. This function is just a wrapper for dBodyAddForce().
  1636. * @ingroup joints
  1637. */
  1638. ODE_API void dJointAddPistonForce (dJointID joint, dReal force);
  1639. /**
  1640. * @brief Call this on the fixed joint after it has been attached to
  1641. * remember the current desired relative offset and desired relative
  1642. * rotation between the bodies.
  1643. * @ingroup joints
  1644. */
  1645. ODE_API void dJointSetFixed (dJointID);
  1646. /*
  1647. * @brief Sets joint parameter
  1648. *
  1649. * @ingroup joints
  1650. */
  1651. ODE_API void dJointSetFixedParam (dJointID, int parameter, dReal value);
  1652. /**
  1653. * @brief set the nr of axes
  1654. * @param num 0..3
  1655. * @ingroup joints
  1656. */
  1657. ODE_API void dJointSetAMotorNumAxes (dJointID, int num);
  1658. /**
  1659. * @brief set axis
  1660. * @ingroup joints
  1661. */
  1662. ODE_API void dJointSetAMotorAxis (dJointID, int anum, int rel,
  1663. dReal x, dReal y, dReal z);
  1664. /**
  1665. * @brief Tell the AMotor what the current angle is along axis anum.
  1666. *
  1667. * This function should only be called in dAMotorUser mode, because in this
  1668. * mode the AMotor has no other way of knowing the joint angles.
  1669. * The angle information is needed if stops have been set along the axis,
  1670. * but it is not needed for axis motors.
  1671. * @ingroup joints
  1672. */
  1673. ODE_API void dJointSetAMotorAngle (dJointID, int anum, dReal angle);
  1674. /**
  1675. * @brief set joint parameter
  1676. * @ingroup joints
  1677. */
  1678. ODE_API void dJointSetAMotorParam (dJointID, int parameter, dReal value);
  1679. /**
  1680. * @brief set mode
  1681. * @ingroup joints
  1682. */
  1683. ODE_API void dJointSetAMotorMode (dJointID, int mode);
  1684. /**
  1685. * @brief Applies torque0 about the AMotor's axis 0, torque1 about the
  1686. * AMotor's axis 1, and torque2 about the AMotor's axis 2.
  1687. * @remarks
  1688. * If the motor has fewer than three axes, the higher torques are ignored.
  1689. * This function is just a wrapper for dBodyAddTorque().
  1690. * @ingroup joints
  1691. */
  1692. ODE_API void dJointAddAMotorTorques (dJointID, dReal torque1, dReal torque2, dReal torque3);
  1693. /**
  1694. * @brief Set the number of axes that will be controlled by the LMotor.
  1695. * @param num can range from 0 (which effectively deactivates the joint) to 3.
  1696. * @ingroup joints
  1697. */
  1698. ODE_API void dJointSetLMotorNumAxes (dJointID, int num);
  1699. /**
  1700. * @brief Set the AMotor axes.
  1701. * @param anum selects the axis to change (0,1 or 2).
  1702. * @param rel Each axis can have one of three ``relative orientation'' modes
  1703. * \li 0: The axis is anchored to the global frame.
  1704. * \li 1: The axis is anchored to the first body.
  1705. * \li 2: The axis is anchored to the second body.
  1706. * @remarks The axis vector is always specified in global coordinates
  1707. * regardless of the setting of rel.
  1708. * @ingroup joints
  1709. */
  1710. ODE_API void dJointSetLMotorAxis (dJointID, int anum, int rel, dReal x, dReal y, dReal z);
  1711. /**
  1712. * @brief set joint parameter
  1713. * @ingroup joints
  1714. */
  1715. ODE_API void dJointSetLMotorParam (dJointID, int parameter, dReal value);
  1716. /**
  1717. * @ingroup joints
  1718. */
  1719. ODE_API void dJointSetPlane2DXParam (dJointID, int parameter, dReal value);
  1720. /**
  1721. * @ingroup joints
  1722. */
  1723. ODE_API void dJointSetPlane2DYParam (dJointID, int parameter, dReal value);
  1724. /**
  1725. * @ingroup joints
  1726. */
  1727. ODE_API void dJointSetPlane2DAngleParam (dJointID, int parameter, dReal value);
  1728. /**
  1729. * @brief Get the joint anchor point, in world coordinates.
  1730. *
  1731. * This returns the point on body 1. If the joint is perfectly satisfied,
  1732. * this will be the same as the point on body 2.
  1733. */
  1734. ODE_API void dJointGetBallAnchor (dJointID, dVector3 result);
  1735. /**
  1736. * @brief Get the joint anchor point, in world coordinates.
  1737. *
  1738. * This returns the point on body 2. You can think of a ball and socket
  1739. * joint as trying to keep the result of dJointGetBallAnchor() and
  1740. * dJointGetBallAnchor2() the same. If the joint is perfectly satisfied,
  1741. * this function will return the same value as dJointGetBallAnchor() to
  1742. * within roundoff errors. dJointGetBallAnchor2() can be used, along with
  1743. * dJointGetBallAnchor(), to see how far the joint has come apart.
  1744. */
  1745. ODE_API void dJointGetBallAnchor2 (dJointID, dVector3 result);
  1746. /**
  1747. * @brief get joint parameter
  1748. * @ingroup joints
  1749. */
  1750. ODE_API dReal dJointGetBallParam (dJointID, int parameter);
  1751. /**
  1752. * @brief Get the hinge anchor point, in world coordinates.
  1753. *
  1754. * This returns the point on body 1. If the joint is perfectly satisfied,
  1755. * this will be the same as the point on body 2.
  1756. * @ingroup joints
  1757. */
  1758. ODE_API void dJointGetHingeAnchor (dJointID, dVector3 result);
  1759. /**
  1760. * @brief Get the joint anchor point, in world coordinates.
  1761. * @return The point on body 2. If the joint is perfectly satisfied,
  1762. * this will return the same value as dJointGetHingeAnchor().
  1763. * If not, this value will be slightly different.
  1764. * This can be used, for example, to see how far the joint has come apart.
  1765. * @ingroup joints
  1766. */
  1767. ODE_API void dJointGetHingeAnchor2 (dJointID, dVector3 result);
  1768. /**
  1769. * @brief get axis
  1770. * @ingroup joints
  1771. */
  1772. ODE_API void dJointGetHingeAxis (dJointID, dVector3 result);
  1773. /**
  1774. * @brief get joint parameter
  1775. * @ingroup joints
  1776. */
  1777. ODE_API dReal dJointGetHingeParam (dJointID, int parameter);
  1778. /**
  1779. * @brief Get the hinge angle.
  1780. *
  1781. * The angle is measured between the two bodies, or between the body and
  1782. * the static environment.
  1783. * The angle will be between -pi..pi.
  1784. * Give the relative rotation with respect to the Hinge axis of Body 1 with
  1785. * respect to Body 2.
  1786. * When the hinge anchor or axis is set, the current position of the attached
  1787. * bodies is examined and that position will be the zero angle.
  1788. * @ingroup joints
  1789. */
  1790. ODE_API dReal dJointGetHingeAngle (dJointID);
  1791. /**
  1792. * @brief Get the hinge angle time derivative.
  1793. * @ingroup joints
  1794. */
  1795. ODE_API dReal dJointGetHingeAngleRate (dJointID);
  1796. /**
  1797. * @brief Get the slider linear position (i.e. the slider's extension)
  1798. *
  1799. * When the axis is set, the current position of the attached bodies is
  1800. * examined and that position will be the zero position.
  1801. * The position is the distance, with respect to the zero position,
  1802. * along the slider axis of body 1 with respect to
  1803. * body 2. (A NULL body is replaced by the world).
  1804. * @ingroup joints
  1805. */
  1806. ODE_API dReal dJointGetSliderPosition (dJointID);
  1807. /**
  1808. * @brief Get the slider linear position's time derivative.
  1809. * @ingroup joints
  1810. */
  1811. ODE_API dReal dJointGetSliderPositionRate (dJointID);
  1812. /**
  1813. * @brief Get the slider axis
  1814. * @ingroup joints
  1815. */
  1816. ODE_API void dJointGetSliderAxis (dJointID, dVector3 result);
  1817. /**
  1818. * @brief get joint parameter
  1819. * @ingroup joints
  1820. */
  1821. ODE_API dReal dJointGetSliderParam (dJointID, int parameter);
  1822. /**
  1823. * @brief Get the joint anchor point, in world coordinates.
  1824. * @return the point on body 1. If the joint is perfectly satisfied,
  1825. * this will be the same as the point on body 2.
  1826. * @ingroup joints
  1827. */
  1828. ODE_API void dJointGetHinge2Anchor (dJointID, dVector3 result);
  1829. /**
  1830. * @brief Get the joint anchor point, in world coordinates.
  1831. * This returns the point on body 2. If the joint is perfectly satisfied,
  1832. * this will return the same value as dJointGetHinge2Anchor.
  1833. * If not, this value will be slightly different.
  1834. * This can be used, for example, to see how far the joint has come apart.
  1835. * @ingroup joints
  1836. */
  1837. ODE_API void dJointGetHinge2Anchor2 (dJointID, dVector3 result);
  1838. /**
  1839. * @brief Get joint axis
  1840. * @ingroup joints
  1841. */
  1842. ODE_API void dJointGetHinge2Axis1 (dJointID, dVector3 result);
  1843. /**
  1844. * @brief Get joint axis
  1845. * @ingroup joints
  1846. */
  1847. ODE_API void dJointGetHinge2Axis2 (dJointID, dVector3 result);
  1848. /**
  1849. * @brief get joint parameter
  1850. * @ingroup joints
  1851. */
  1852. ODE_API dReal dJointGetHinge2Param (dJointID, int parameter);
  1853. /**
  1854. * @brief Get angle
  1855. * @ingroup joints
  1856. */
  1857. ODE_API dReal dJointGetHinge2Angle1 (dJointID);
  1858. /**
  1859. * @brief Get time derivative of angle
  1860. * @ingroup joints
  1861. */
  1862. ODE_API dReal dJointGetHinge2Angle1Rate (dJointID);
  1863. /**
  1864. * @brief Get time derivative of angle
  1865. * @ingroup joints
  1866. */
  1867. ODE_API dReal dJointGetHinge2Angle2Rate (dJointID);
  1868. /**
  1869. * @brief Get the joint anchor point, in world coordinates.
  1870. * @return the point on body 1. If the joint is perfectly satisfied,
  1871. * this will be the same as the point on body 2.
  1872. * @ingroup joints
  1873. */
  1874. ODE_API void dJointGetUniversalAnchor (dJointID, dVector3 result);
  1875. /**
  1876. * @brief Get the joint anchor point, in world coordinates.
  1877. * @return This returns the point on body 2.
  1878. * @remarks
  1879. * You can think of the ball and socket part of a universal joint as
  1880. * trying to keep the result of dJointGetBallAnchor() and
  1881. * dJointGetBallAnchor2() the same. If the joint is
  1882. * perfectly satisfied, this function will return the same value
  1883. * as dJointGetUniversalAnchor() to within roundoff errors.
  1884. * dJointGetUniversalAnchor2() can be used, along with
  1885. * dJointGetUniversalAnchor(), to see how far the joint has come apart.
  1886. * @ingroup joints
  1887. */
  1888. ODE_API void dJointGetUniversalAnchor2 (dJointID, dVector3 result);
  1889. /**
  1890. * @brief Get axis
  1891. * @ingroup joints
  1892. */
  1893. ODE_API void dJointGetUniversalAxis1 (dJointID, dVector3 result);
  1894. /**
  1895. * @brief Get axis
  1896. * @ingroup joints
  1897. */
  1898. ODE_API void dJointGetUniversalAxis2 (dJointID, dVector3 result);
  1899. /**
  1900. * @brief get joint parameter
  1901. * @ingroup joints
  1902. */
  1903. ODE_API dReal dJointGetUniversalParam (dJointID, int parameter);
  1904. /**
  1905. * @brief Get both angles at the same time.
  1906. * @ingroup joints
  1907. *
  1908. * @param joint The universal joint for which we want to calculate the angles
  1909. * @param angle1 The angle between the body1 and the axis 1
  1910. * @param angle2 The angle between the body2 and the axis 2
  1911. *
  1912. * @note This function combine getUniversalAngle1 and getUniversalAngle2 together
  1913. * and try to avoid redundant calculation
  1914. */
  1915. ODE_API void dJointGetUniversalAngles (dJointID, dReal *angle1, dReal *angle2);
  1916. /**
  1917. * @brief Get angle
  1918. * @ingroup joints
  1919. */
  1920. ODE_API dReal dJointGetUniversalAngle1 (dJointID);
  1921. /**
  1922. * @brief Get angle
  1923. * @ingroup joints
  1924. */
  1925. ODE_API dReal dJointGetUniversalAngle2 (dJointID);
  1926. /**
  1927. * @brief Get time derivative of angle
  1928. * @ingroup joints
  1929. */
  1930. ODE_API dReal dJointGetUniversalAngle1Rate (dJointID);
  1931. /**
  1932. * @brief Get time derivative of angle
  1933. * @ingroup joints
  1934. */
  1935. ODE_API dReal dJointGetUniversalAngle2Rate (dJointID);
  1936. /**
  1937. * @brief Get the joint anchor point, in world coordinates.
  1938. * @return the point on body 1. If the joint is perfectly satisfied,
  1939. * this will be the same as the point on body 2.
  1940. * @ingroup joints
  1941. */
  1942. ODE_API void dJointGetPRAnchor (dJointID, dVector3 result);
  1943. /**
  1944. * @brief Get the PR linear position (i.e. the prismatic's extension)
  1945. *
  1946. * When the axis is set, the current position of the attached bodies is
  1947. * examined and that position will be the zero position.
  1948. *
  1949. * The position is the "oriented" length between the
  1950. * position = (Prismatic axis) dot_product [(body1 + offset) - (body2 + anchor2)]
  1951. *
  1952. * @ingroup joints
  1953. */
  1954. ODE_API dReal dJointGetPRPosition (dJointID);
  1955. /**
  1956. * @brief Get the PR linear position's time derivative
  1957. *
  1958. * @ingroup joints
  1959. */
  1960. ODE_API dReal dJointGetPRPositionRate (dJointID);
  1961. /**
  1962. * @brief Get the prismatic axis
  1963. * @ingroup joints
  1964. */
  1965. ODE_API void dJointGetPRAxis1 (dJointID, dVector3 result);
  1966. /**
  1967. * @brief Get the Rotoide axis
  1968. * @ingroup joints
  1969. */
  1970. ODE_API void dJointGetPRAxis2 (dJointID, dVector3 result);
  1971. /**
  1972. * @brief get joint parameter
  1973. * @ingroup joints
  1974. */
  1975. ODE_API dReal dJointGetPRParam (dJointID, int parameter);
  1976. /**
  1977. * @brief Get the joint anchor point, in world coordinates.
  1978. * @return the point on body 1. If the joint is perfectly satisfied,
  1979. * this will be the same as the point on body 2.
  1980. * @ingroup joints
  1981. */
  1982. ODE_API void dJointGetPUAnchor (dJointID, dVector3 result);
  1983. /**
  1984. * @brief Get the PU linear position (i.e. the prismatic's extension)
  1985. *
  1986. * When the axis is set, the current position of the attached bodies is
  1987. * examined and that position will be the zero position.
  1988. *
  1989. * The position is the "oriented" length between the
  1990. * position = (Prismatic axis) dot_product [(body1 + offset) - (body2 + anchor2)]
  1991. *
  1992. * @ingroup joints
  1993. */
  1994. ODE_API dReal dJointGetPUPosition (dJointID);
  1995. /**
  1996. * @brief Get the PR linear position's time derivative
  1997. *
  1998. * @ingroup joints
  1999. */
  2000. ODE_API dReal dJointGetPUPositionRate (dJointID);
  2001. /**
  2002. * @brief Get the first axis of the universal component of the joint
  2003. * @ingroup joints
  2004. */
  2005. ODE_API void dJointGetPUAxis1 (dJointID, dVector3 result);
  2006. /**
  2007. * @brief Get the second axis of the Universal component of the joint
  2008. * @ingroup joints
  2009. */
  2010. ODE_API void dJointGetPUAxis2 (dJointID, dVector3 result);
  2011. /**
  2012. * @brief Get the prismatic axis
  2013. * @ingroup joints
  2014. */
  2015. ODE_API void dJointGetPUAxis3 (dJointID, dVector3 result);
  2016. /**
  2017. * @brief Get the prismatic axis
  2018. * @ingroup joints
  2019. *
  2020. * @note This function was added for convenience it is the same as
  2021. * dJointGetPUAxis3
  2022. */
  2023. ODE_API void dJointGetPUAxisP (dJointID id, dVector3 result);
  2024. /**
  2025. * @brief Get both angles at the same time.
  2026. * @ingroup joints
  2027. *
  2028. * @param joint The Prismatic universal joint for which we want to calculate the angles
  2029. * @param angle1 The angle between the body1 and the axis 1
  2030. * @param angle2 The angle between the body2 and the axis 2
  2031. *
  2032. * @note This function combine dJointGetPUAngle1 and dJointGetPUAngle2 together
  2033. * and try to avoid redundant calculation
  2034. */
  2035. ODE_API void dJointGetPUAngles (dJointID, dReal *angle1, dReal *angle2);
  2036. /**
  2037. * @brief Get angle
  2038. * @ingroup joints
  2039. */
  2040. ODE_API dReal dJointGetPUAngle1 (dJointID);
  2041. /**
  2042. * @brief * @brief Get time derivative of angle1
  2043. *
  2044. * @ingroup joints
  2045. */
  2046. ODE_API dReal dJointGetPUAngle1Rate (dJointID);
  2047. /**
  2048. * @brief Get angle
  2049. * @ingroup joints
  2050. */
  2051. ODE_API dReal dJointGetPUAngle2 (dJointID);
  2052. /**
  2053. * @brief * @brief Get time derivative of angle2
  2054. *
  2055. * @ingroup joints
  2056. */
  2057. ODE_API dReal dJointGetPUAngle2Rate (dJointID);
  2058. /**
  2059. * @brief get joint parameter
  2060. * @ingroup joints
  2061. */
  2062. ODE_API dReal dJointGetPUParam (dJointID, int parameter);
  2063. /**
  2064. * @brief Get the Piston linear position (i.e. the piston's extension)
  2065. *
  2066. * When the axis is set, the current position of the attached bodies is
  2067. * examined and that position will be the zero position.
  2068. * @ingroup joints
  2069. */
  2070. ODE_API dReal dJointGetPistonPosition (dJointID);
  2071. /**
  2072. * @brief Get the piston linear position's time derivative.
  2073. * @ingroup joints
  2074. */
  2075. ODE_API dReal dJointGetPistonPositionRate (dJointID);
  2076. /**
  2077. * @brief Get the Piston angular position (i.e. the twist between the 2 bodies)
  2078. *
  2079. * When the axis is set, the current position of the attached bodies is
  2080. * examined and that position will be the zero position.
  2081. * @ingroup joints
  2082. */
  2083. ODE_API dReal dJointGetPistonAngle (dJointID);
  2084. /**
  2085. * @brief Get the piston angular position's time derivative.
  2086. * @ingroup joints
  2087. */
  2088. ODE_API dReal dJointGetPistonAngleRate (dJointID);
  2089. /**
  2090. * @brief Get the joint anchor
  2091. *
  2092. * This returns the point on body 1. If the joint is perfectly satisfied,
  2093. * this will be the same as the point on body 2 in direction perpendicular
  2094. * to the prismatic axis.
  2095. *
  2096. * @ingroup joints
  2097. */
  2098. ODE_API void dJointGetPistonAnchor (dJointID, dVector3 result);
  2099. /**
  2100. * @brief Get the joint anchor w.r.t. body 2
  2101. *
  2102. * This returns the point on body 2. You can think of a Piston
  2103. * joint as trying to keep the result of dJointGetPistonAnchor() and
  2104. * dJointGetPistonAnchor2() the same in the direction perpendicular to the
  2105. * pirsmatic axis. If the joint is perfectly satisfied,
  2106. * this function will return the same value as dJointGetPistonAnchor() to
  2107. * within roundoff errors. dJointGetPistonAnchor2() can be used, along with
  2108. * dJointGetPistonAnchor(), to see how far the joint has come apart.
  2109. *
  2110. * @ingroup joints
  2111. */
  2112. ODE_API void dJointGetPistonAnchor2 (dJointID, dVector3 result);
  2113. /**
  2114. * @brief Get the prismatic axis (This is also the rotoide axis.
  2115. * @ingroup joints
  2116. */
  2117. ODE_API void dJointGetPistonAxis (dJointID, dVector3 result);
  2118. /**
  2119. * @brief get joint parameter
  2120. * @ingroup joints
  2121. */
  2122. ODE_API dReal dJointGetPistonParam (dJointID, int parameter);
  2123. /**
  2124. * @brief Get the number of angular axes that will be controlled by the
  2125. * AMotor.
  2126. * @param num can range from 0 (which effectively deactivates the
  2127. * joint) to 3.
  2128. * This is automatically set to 3 in dAMotorEuler mode.
  2129. * @ingroup joints
  2130. */
  2131. ODE_API int dJointGetAMotorNumAxes (dJointID);
  2132. /**
  2133. * @brief Get the AMotor axes.
  2134. * @param anum selects the axis to change (0,1 or 2).
  2135. * @param rel Each axis can have one of three ``relative orientation'' modes.
  2136. * \li 0: The axis is anchored to the global frame.
  2137. * \li 1: The axis is anchored to the first body.
  2138. * \li 2: The axis is anchored to the second body.
  2139. * @ingroup joints
  2140. */
  2141. ODE_API void dJointGetAMotorAxis (dJointID, int anum, dVector3 result);
  2142. /**
  2143. * @brief Get axis
  2144. * @remarks
  2145. * The axis vector is always specified in global coordinates regardless
  2146. * of the setting of rel.
  2147. * There are two GetAMotorAxis functions, one to return the axis and one to
  2148. * return the relative mode.
  2149. *
  2150. * For dAMotorEuler mode:
  2151. * \li Only axes 0 and 2 need to be set. Axis 1 will be determined
  2152. automatically at each time step.
  2153. * \li Axes 0 and 2 must be perpendicular to each other.
  2154. * \li Axis 0 must be anchored to the first body, axis 2 must be anchored
  2155. to the second body.
  2156. * @ingroup joints
  2157. */
  2158. ODE_API int dJointGetAMotorAxisRel (dJointID, int anum);
  2159. /**
  2160. * @brief Get the current angle for axis.
  2161. * @remarks
  2162. * In dAMotorUser mode this is simply the value that was set with
  2163. * dJointSetAMotorAngle().
  2164. * In dAMotorEuler mode this is the corresponding euler angle.
  2165. * @ingroup joints
  2166. */
  2167. ODE_API dReal dJointGetAMotorAngle (dJointID, int anum);
  2168. /**
  2169. * @brief Get the current angle rate for axis anum.
  2170. * @remarks
  2171. * In dAMotorUser mode this is always zero, as not enough information is
  2172. * available.
  2173. * In dAMotorEuler mode this is the corresponding euler angle rate.
  2174. * @ingroup joints
  2175. */
  2176. ODE_API dReal dJointGetAMotorAngleRate (dJointID, int anum);
  2177. /**
  2178. * @brief get joint parameter
  2179. * @ingroup joints
  2180. */
  2181. ODE_API dReal dJointGetAMotorParam (dJointID, int parameter);
  2182. /**
  2183. * @brief Get the angular motor mode.
  2184. * @param mode must be one of the following constants:
  2185. * \li dAMotorUser The AMotor axes and joint angle settings are entirely
  2186. * controlled by the user. This is the default mode.
  2187. * \li dAMotorEuler Euler angles are automatically computed.
  2188. * The axis a1 is also automatically computed.
  2189. * The AMotor axes must be set correctly when in this mode,
  2190. * as described below.
  2191. * When this mode is initially set the current relative orientations
  2192. * of the bodies will correspond to all euler angles at zero.
  2193. * @ingroup joints
  2194. */
  2195. ODE_API int dJointGetAMotorMode (dJointID);
  2196. /**
  2197. * @brief Get nr of axes.
  2198. * @ingroup joints
  2199. */
  2200. ODE_API int dJointGetLMotorNumAxes (dJointID);
  2201. /**
  2202. * @brief Get axis.
  2203. * @ingroup joints
  2204. */
  2205. ODE_API void dJointGetLMotorAxis (dJointID, int anum, dVector3 result);
  2206. /**
  2207. * @brief get joint parameter
  2208. * @ingroup joints
  2209. */
  2210. ODE_API dReal dJointGetLMotorParam (dJointID, int parameter);
  2211. /**
  2212. * @brief get joint parameter
  2213. * @ingroup joints
  2214. */
  2215. ODE_API dReal dJointGetFixedParam (dJointID, int parameter);
  2216. /**
  2217. * @ingroup joints
  2218. */
  2219. ODE_API dJointID dConnectingJoint (dBodyID, dBodyID);
  2220. /**
  2221. * @ingroup joints
  2222. */
  2223. ODE_API int dConnectingJointList (dBodyID, dBodyID, dJointID*);
  2224. /**
  2225. * @brief Utility function
  2226. * @return 1 if the two bodies are connected together by
  2227. * a joint, otherwise return 0.
  2228. * @ingroup joints
  2229. */
  2230. ODE_API int dAreConnected (dBodyID, dBodyID);
  2231. /**
  2232. * @brief Utility function
  2233. * @return 1 if the two bodies are connected together by
  2234. * a joint that does not have type @arg{joint_type}, otherwise return 0.
  2235. * @param body1 A body to check.
  2236. * @param body2 A body to check.
  2237. * @param joint_type is a dJointTypeXXX constant.
  2238. * This is useful for deciding whether to add contact joints between two bodies:
  2239. * if they are already connected by non-contact joints then it may not be
  2240. * appropriate to add contacts, however it is okay to add more contact between-
  2241. * bodies that already have contacts.
  2242. * @ingroup joints
  2243. */
  2244. ODE_API int dAreConnectedExcluding (dBodyID body1, dBodyID body2, int joint_type);
  2245. #ifdef __cplusplus
  2246. }
  2247. #endif
  2248. #endif