Panda3D
odeAMotorJoint.I
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file odeAMotorJoint.I
10  * @author joswilso
11  * @date 2006-12-27
12  */
13 
14 INLINE void OdeAMotorJoint::
15 set_num_axes(int num) {
16  dJointSetAMotorNumAxes(_id, num);
17 }
18 
19 INLINE void OdeAMotorJoint::
20 set_axis(int anum, int rel, dReal x, dReal y, dReal z) {
21  dJointSetAMotorAxis(_id, anum, rel, x, y, z);
22 }
23 
24 INLINE void OdeAMotorJoint::
25 set_axis(int anum, int rel, const LVecBase3f &axis) {
26  dJointSetAMotorAxis(_id, anum, rel, axis[0], axis[1], axis[2]);
27 }
28 
29 INLINE void OdeAMotorJoint::
30 set_angle(int anum, dReal angle) {
31  dJointSetAMotorAngle(_id, anum, angle);
32 }
33 
34 INLINE void OdeAMotorJoint::
35 set_mode(int mode) {
36  dJointSetAMotorMode(_id, mode);
37 }
38 
39 INLINE void OdeAMotorJoint::
40 add_torques(dReal torque1, dReal torque2, dReal torque3) {
41  dJointAddAMotorTorques(_id, torque1, torque2, torque3);
42 }
43 
44 INLINE int OdeAMotorJoint::
45 get_num_axes() const {
46  return dJointGetAMotorNumAxes(_id);
47 }
48 
49 INLINE LVecBase3f OdeAMotorJoint::
50 get_axis(int anum) const {
51  dVector3 result;
52  dJointGetAMotorAxis(_id, anum, result);
53  return LVecBase3f(result[0], result[1], result[2]);
54 }
55 
56 INLINE int OdeAMotorJoint::
57 get_axis_rel(int anum) const {
58  return dJointGetAMotorAxisRel(_id, anum);
59 }
60 
61 INLINE dReal OdeAMotorJoint::
62 get_angle(int anum) const {
63  return dJointGetAMotorAngle(_id, anum);
64 }
65 
66 INLINE dReal OdeAMotorJoint::
67 get_angle_rate(int anum) const {
68  return dJointGetAMotorAngleRate(_id, anum);
69 }
70 
71 INLINE int OdeAMotorJoint::
72 get_mode() const {
73  return dJointGetAMotorMode(_id);
74 }
75 
76 INLINE void OdeAMotorJoint::
77 set_param_lo_stop(int axis, dReal val) {
78  nassertv( _id != 0 );
79  nassertv( 0 <= axis && axis <= 2 );
80  if ( axis == 0 ) {
81  dJointSetAMotorParam(_id, dParamLoStop, val);
82  } else if ( axis == 1 ) {
83  dJointSetAMotorParam(_id, dParamLoStop, val);
84  } else if ( axis == 2 ) {
85  dJointSetAMotorParam(_id, dParamLoStop, val);
86  }
87 }
88 
89 INLINE void OdeAMotorJoint::
90 set_param_hi_stop(int axis, dReal val) {
91  nassertv( _id != 0 );
92  nassertv( 0 <= axis && axis <= 2 );
93  if ( axis == 0 ) {
94  dJointSetAMotorParam(_id, dParamHiStop, val);
95  } else if ( axis == 1 ) {
96  dJointSetAMotorParam(_id, dParamHiStop, val);
97  } else if ( axis == 2 ) {
98  dJointSetAMotorParam(_id, dParamHiStop, val);
99  }
100 }
101 
102 INLINE void OdeAMotorJoint::
103 set_param_vel(int axis, dReal val) {
104  nassertv( _id != 0 );
105  nassertv( 0 <= axis && axis <= 2 );
106  if ( axis == 0 ) {
107  dJointSetAMotorParam(_id, dParamVel, val);
108  } else if ( axis == 1 ) {
109  dJointSetAMotorParam(_id, dParamVel, val);
110  } else if ( axis == 2 ) {
111  dJointSetAMotorParam(_id, dParamVel, val);
112  }
113 }
114 
115 INLINE void OdeAMotorJoint::
116 set_param_f_max(int axis, dReal val) {
117  nassertv( _id != 0 );
118  nassertv( 0 <= axis && axis <= 2 );
119  if ( axis == 0 ) {
120  dJointSetAMotorParam(_id, dParamFMax, val);
121  } else if ( axis == 1 ) {
122  dJointSetAMotorParam(_id, dParamFMax, val);
123  } else if ( axis == 2 ) {
124  dJointSetAMotorParam(_id, dParamFMax, val);
125  }
126 }
127 
128 INLINE void OdeAMotorJoint::
129 set_param_fudge_factor(int axis, dReal val) {
130  nassertv( _id != 0 );
131  nassertv( 0 <= axis && axis <= 2 );
132  if ( axis == 0 ) {
133  dJointSetAMotorParam(_id, dParamFudgeFactor, val);
134  } else if ( axis == 1 ) {
135  dJointSetAMotorParam(_id, dParamFudgeFactor, val);
136  } else if ( axis == 2 ) {
137  dJointSetAMotorParam(_id, dParamFudgeFactor, val);
138  }
139 }
140 
141 INLINE void OdeAMotorJoint::
142 set_param_bounce(int axis, dReal val) {
143  nassertv( _id != 0 );
144  nassertv( 0 <= axis && axis <= 2 );
145  if ( axis == 0 ) {
146  dJointSetAMotorParam(_id, dParamBounce, val);
147  } else if ( axis == 1 ) {
148  dJointSetAMotorParam(_id, dParamBounce, val);
149  } else if ( axis == 2 ) {
150  dJointSetAMotorParam(_id, dParamBounce, val);
151  }
152 }
153 
154 INLINE void OdeAMotorJoint::
155 set_param_CFM(int axis, dReal val) {
156  nassertv( _id != 0 );
157  nassertv( 0 <= axis && axis <= 2 );
158  if ( axis == 0 ) {
159  dJointSetAMotorParam(_id, dParamCFM, val);
160  } else if ( axis == 1 ) {
161  dJointSetAMotorParam(_id, dParamCFM, val);
162  } else if ( axis == 2 ) {
163  dJointSetAMotorParam(_id, dParamCFM, val);
164  }
165 }
166 
167 INLINE void OdeAMotorJoint::
168 set_param_stop_ERP(int axis, dReal val) {
169  nassertv( _id != 0 );
170  nassertv( 0 <= axis && axis <= 2 );
171  if ( axis == 0 ) {
172  dJointSetAMotorParam(_id, dParamStopERP, val);
173  } else if ( axis == 1 ) {
174  dJointSetAMotorParam(_id, dParamStopERP, val);
175  } else if ( axis == 2 ) {
176  dJointSetAMotorParam(_id, dParamStopERP, val);
177  }
178 }
179 
180 INLINE void OdeAMotorJoint::
181 set_param_stop_CFM(int axis, dReal val) {
182  nassertv( _id != 0 );
183  nassertv( 0 <= axis && axis <= 2 );
184  if ( axis == 0 ) {
185  dJointSetAMotorParam(_id, dParamStopCFM, val);
186  } else if ( axis == 1 ) {
187  dJointSetAMotorParam(_id, dParamStopCFM, val);
188  } else if ( axis == 2 ) {
189  dJointSetAMotorParam(_id, dParamStopCFM, val);
190  }
191 }
192 
193 INLINE dReal OdeAMotorJoint::
194 get_param_lo_stop(int axis) const {
195  nassertr( _id != 0, 0 );
196  nassertr( 0 <= axis && axis <= 2, 0 );
197  if ( axis == 0 ) {
198  return dJointGetAMotorParam(_id, dParamLoStop);
199  } else if ( axis == 1 ) {
200  return dJointGetAMotorParam(_id, dParamLoStop);
201  } else if ( axis == 2 ) {
202  return dJointGetAMotorParam(_id, dParamLoStop);
203  }
204  return 0;
205 }
206 
207 INLINE dReal OdeAMotorJoint::
208 get_param_hi_stop(int axis) const {
209  nassertr( _id != 0, 0 );
210  nassertr( 0 <= axis && axis <= 2, 0 );
211  if ( axis == 0 ) {
212  return dJointGetAMotorParam(_id, dParamHiStop);
213  } else if ( axis == 1 ) {
214  return dJointGetAMotorParam(_id, dParamHiStop);
215  } else if ( axis == 2 ) {
216  return dJointGetAMotorParam(_id, dParamHiStop);
217  }
218  return 0;
219 }
220 
221 INLINE dReal OdeAMotorJoint::
222 get_param_vel(int axis) const {
223  nassertr( _id != 0, 0 );
224  nassertr( 0 <= axis && axis <= 2, 0 );
225  if ( axis == 0 ) {
226  return dJointGetAMotorParam(_id, dParamVel);
227  } else if ( axis == 1 ) {
228  return dJointGetAMotorParam(_id, dParamVel);
229  } else if ( axis == 2 ) {
230  return dJointGetAMotorParam(_id, dParamVel);
231  }
232  return 0;
233 }
234 
235 INLINE dReal OdeAMotorJoint::
236 get_param_f_max(int axis) const {
237  nassertr( _id != 0, 0 );
238  nassertr( 0 <= axis && axis <= 2, 0 );
239  if ( axis == 0 ) {
240  return dJointGetAMotorParam(_id, dParamFMax);
241  } else if ( axis == 1 ) {
242  return dJointGetAMotorParam(_id, dParamFMax);
243  } else if ( axis == 2 ) {
244  return dJointGetAMotorParam(_id, dParamFMax);
245  }
246  return 0;
247 }
248 
249 INLINE dReal OdeAMotorJoint::
250 get_param_fudge_factor(int axis) const {
251  nassertr( _id != 0, 0 );
252  nassertr( 0 <= axis && axis <= 2, 0 );
253  if ( axis == 0 ) {
254  return dJointGetAMotorParam(_id, dParamFudgeFactor);
255  } else if ( axis == 1 ) {
256  return dJointGetAMotorParam(_id, dParamFudgeFactor);
257  } else if ( axis == 2 ) {
258  return dJointGetAMotorParam(_id, dParamFudgeFactor);
259  }
260  return 0;
261 }
262 
263 INLINE dReal OdeAMotorJoint::
264 get_param_bounce(int axis) const {
265  nassertr( _id != 0, 0 );
266  nassertr( 0 <= axis && axis <= 2, 0 );
267  if ( axis == 0 ) {
268  return dJointGetAMotorParam(_id, dParamBounce);
269  } else if ( axis == 1 ) {
270  return dJointGetAMotorParam(_id, dParamBounce);
271  } else if ( axis == 2 ) {
272  return dJointGetAMotorParam(_id, dParamBounce);
273  }
274  return 0;
275 }
276 
277 INLINE dReal OdeAMotorJoint::
278 get_param_CFM(int axis) const {
279  nassertr( _id != 0, 0 );
280  nassertr( 0 <= axis && axis <= 2, 0 );
281  if ( axis == 0 ) {
282  return dJointGetAMotorParam(_id, dParamCFM);
283  } else if ( axis == 1 ) {
284  return dJointGetAMotorParam(_id, dParamCFM);
285  } else if ( axis == 2 ) {
286  return dJointGetAMotorParam(_id, dParamCFM);
287  }
288  return 0;
289 }
290 
291 INLINE dReal OdeAMotorJoint::
292 get_param_stop_ERP(int axis) const {
293  nassertr( _id != 0, 0 );
294  nassertr( 0 <= axis && axis <= 2, 0 );
295  if ( axis == 0 ) {
296  return dJointGetAMotorParam(_id, dParamStopERP);
297  } else if ( axis == 1 ) {
298  return dJointGetAMotorParam(_id, dParamStopERP);
299  } else if ( axis == 2 ) {
300  return dJointGetAMotorParam(_id, dParamStopERP);
301  }
302  return 0;
303 }
304 
305 INLINE dReal OdeAMotorJoint::
306 get_param_stop_CFM(int axis) const {
307  nassertr( _id != 0, 0 );
308  nassertr( 0 <= axis && axis <= 2, 0 );
309  if ( axis == 0 ) {
310  return dJointGetAMotorParam(_id, dParamStopCFM);
311  } else if ( axis == 1 ) {
312  return dJointGetAMotorParam(_id, dParamStopCFM);
313  } else if ( axis == 2 ) {
314  return dJointGetAMotorParam(_id, dParamStopCFM);
315  }
316  return 0;
317 }