[ODE] Find dParamSuspensionERP in ODE.NET

Remi Ricard remi.ricard at simlog.com
Fri Sep 14 12:27:50 MST 2007


Hi Dave,
> An enum that depends on the order of the declarations is not robust. 
You are perfectly right.

What I was trying to say is:

If you have :
enum {
LoStop = a,
HiStop,
Vel,
.....
LoStop2 = some_other_value_to_not_overlap
Vel2,                 <== Out of order, BAD.....
HiStop2,
}

But you can have
enum {
LoStop = a,
Vel,
HiStop,
.....
LoStop2 = some_other_value_to_not_overlap
Vel2,          
HiStop2,
}

The initial ordering of (LogStop, HiStop, Vel, ...) in not important but 
the ordering
of the X values must be the same as the value with out X (See code below)

This is why I'm not using the D_ALL_PARAM_NAMES but I'm using the
D_ALL_PARAM_NAMES_X(start,x)  (with x = 1,2,3). Since they are coming
from the same macro I'm sure they will have the same ordering.
For D_ALL_PARAM_NAMES and D_ALL_PARAM_NAMES_X it should but you never know

I added the 1 since ode code does not have it.
this give me
dParamLoStop1 ==  dParamLoStop

Remi


#define D_ALL_PARAM_NAMES(start) \
  /* parameters for limits and motors */ \
  dParamLoStop = start, \
  dParamHiStop, \
  dParamVel, \
  dParamFMax, \
  dParamFudgeFactor, \
  dParamBounce, \
  dParamCFM, \
  dParamStopERP, \
  dParamStopCFM, \
  /* parameters for suspension */ \
  dParamSuspensionERP, \
  dParamSuspensionCFM,

  
//////////////////////////////////////////////////////////////////////////////
  /// \enum  D_ALL_PARAM_NAMES_X
  ///
  /// \var dParamGroup This is the starting value of the different group
  ///                  (i.e. dParamGroup1, dParamGroup2, dParamGroup3)
  ///                  It also helps in the use of parameter
  ///                  (dParamGroup2 | dParamFMax) == dParamFMax2
  
//////////////////////////////////////////////////////////////////////////////
#define D_ALL_PARAM_NAMES_X(start,x) \
  dParamGroup ## x = start, \
  /* parameters for limits and motors */ \
  dParamLoStop ## x = start, \
  dParamHiStop ## x, \
  dParamVel ## x, \
  dParamFMax ## x, \
  dParamFudgeFactor ## x, \
  dParamBounce ## x, \
  dParamCFM ## x, \
  dParamStopERP ## x, \
  dParamStopCFM ## x, \
  /* parameters for suspension */ \
  dParamSuspensionERP ## x, \
  dParamSuspensionCFM ## x,

enum {
  D_ALL_PARAM_NAMES(0)
  dParamsInGroup,     ///< Number of parameter in a group
  D_ALL_PARAM_NAMES_X(0x000,1)
  D_ALL_PARAM_NAMES_X(0x100,2)
  D_ALL_PARAM_NAMES_X(0x200,3)
 /* add a multiple of this constant to the basic parameter numbers to get
   * the parameters for the second, third etc axes.
   */
  dParamGroup=0x100
};






> If you *must* have JointParam.LoStop < JointParam.HiStop, then you 
> should specify values. Doing so makes it clear that the values matter. 
> In general, the values behind enums shouldn't matter.
>
> Dave
>
> ----- Original Message ----- From: "Remi Ricard" <remi.ricard at simlog.com>
> To: "Dave Grundgeiger" <dave.grundgeiger at codenouveau.com>; "ODE 
> Mailing List (E-mail)" <ode at ode.org>
> Sent: Friday, September 14, 2007 12:44 PM
> Subject: Re: [ODE] Find dParamSuspensionERP in ODE.NET
>
>
>> Hi Dave,
>>
>>
>>> Just a personal design preference: I assume from this definition 
>>> that each enumerated constant *must* have a specific underlying 
>>> value (LoStop == 0, HiStop == 1, ..., LoStop2 = 256, HiStop2 == 257, 
>>> etc.) and that the code will break if they don't have these specific 
>>> values. If that is the case, then you should specify all values 
>>> explicitly.
>>>
>> What you really need is to keep the ordering for
>> LoStopX
>> HiStopX
>> .....
>>
>> to be the same( where X is nothing, 2, 3), in C this is achieve with 
>> macro.
>>
>> Remi
>>
>>> ----- Original Message ----- From: "Jason Perkins" <starkos at gmail.com>
>>> To: "Cardinal4" <cardinleejh at gmail.com>
>>> Cc: <ode at ode.org>
>>> Sent: Friday, September 14, 2007 7:03 AM
>>> Subject: Re: [ODE] Find dParamSuspensionERP in ODE.NET
>>>
>>>
>>>
>>>> On 9/13/07, Cardinal4 <cardinleejh at gmail.com> wrote:
>>>>
>>>>> In ODE.NET, I couldn't locate anything called 
>>>>> d.ParamSuspensionERP, or
>>>>> anything similar.
>>>>>
>>>> I've added these as a new JointParam enumeration:
>>>>
>>>> public enum JointParam : int
>>>> {
>>>> LoStop,
>>>> HiStop,
>>>> Vel,
>>>> FMax,
>>>> FudgeFactor,
>>>> Bounce,
>>>> CFM,
>>>> StopERP,
>>>> StopCFM,
>>>> SuspensionERP,
>>>> SuspensionCFM,
>>>> LoStop2 = 256,
>>>> HiStop2,
>>>> Vel2,
>>>> FMax2,
>>>> FudgeFactor2,
>>>> Bounce2,
>>>> CFM2,
>>>> StopERP2,
>>>> StopCFM2,
>>>> SuspensionERP2,
>>>> SuspensionCFM2,
>>>> LoStop3 = 512,
>>>> HiStop3,
>>>> Vel3,
>>>> FMax3,
>>>> FudgeFactor3,
>>>> Bounce3,
>>>> CFM3,
>>>> StopERP3,
>>>> StopCFM3,
>>>> SuspensionERP3,
>>>> SuspensionCFM3
>>>> }
>>>>
>>>> Comments and suggestions welcome.
>>>>
>>>> Jason
>>>> _______________________________________________
>>>> ODE mailing list
>>>> ODE at ode.org
>>>> http://ode.org/mailman/listinfo/ode
>>>>
>>>>
>>>
>>> _______________________________________________
>>> ODE mailing list
>>> ODE at ode.org
>>> http://ode.org/mailman/listinfo/ode
>>>
>>>
>>
>>
>
>



More information about the ODE mailing list