Changeset 952


Ignore:
Timestamp:
06/20/20 01:09:57 (4 years ago)
Author:
Maciej Komosinski
Message:

Added new receptors (Gp:"gyroscope" on a Part, Tp:Touch-proximity and Tc:Touch-contact) and improved existing ones (T, G)

Location:
cpp/frams
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/config/f0-SDK.def

    r945 r952  
    1 CLASS(Model,f0_model,m)
     1CLASS(Model,f0_model,m,Model)
    22GROUP(Properties)
    33GROUP(Visual)
     
    66ENDCLASS
    77
    8 CLASS(Part,f0_part,p)
     8CLASS(Part,f0_part,p,Part)
    99GROUP(Geometry)
    1010GROUP(Other properties)
     
    3939ENDCLASS
    4040
    41 CLASS(Joint,f0_joint,j)
     41CLASS(Joint,f0_joint,j,Joint)
    4242GROUP(Connections)
    4343GROUP(Geometry)
     
    7373ENDCLASS
    7474
    75 CLASS(Joint,f0_nodeltajoint,j,NOXML)
     75CLASS(Joint,f0_nodeltajoint,j,Joint,NOXML)
    7676GROUP(Connections)
    7777GROUP(Geometry)
     
    101101ENDCLASS
    102102
    103 CLASS(Neuro,f0_neuro,n)
     103CLASS(Neuro,f0_neuro,n,Neuro)
    104104GROUP(Connections)
    105105GROUP(Other)
     
    117117ENDCLASS
    118118
    119 CLASS(NeuroConn,f0_neuroconn,c)
     119CLASS(NeuroConn,f0_neuroconn,c,Neuron connection)
    120120GROUP(Connection)
    121121GROUP(Other)
     
    141141ENDNEUROCLASS
    142142
    143 NEUROCLASS(Gyro,G,Gyroscope,`Equilibrium sensor.\n0=the stick is horizontal\n+1/-1=the stick is vertical',0,1,2)
     143NEUROCLASS(Gyro,G,Gyroscope,`Tilt sensor.\nSignal is proportional to sin(angle) = most sensitive in horizontal orientation.\n0=the stick is horizontal\n+1/-1=the stick is vertical',0,1,2)
     144SHAPETYPE(BallAndStickShapeType)
    144145VISUALHINTS(ReceptorClass)
    145146SYMBOL(`8,7,100,50,90,50,90,40,70,40,80,50,70,60,90,60,90,50,12,43,24,48,24,48,19,38,19,38,24,43,24,43,54,48,54,48,64,43,69,38,64,38,54,43,54,5,63,69,58,74,48,79,38,79,28,74,23,69,1,43,79,43,74,1,23,69,26,66,1,63,69,60,66,1,55,76,53,73,1,31,75,33,72')
    146147ENDNEUROCLASS
    147148
    148 NEUROCLASS(Touch,T,Touch,`Touch sensor.\n-1=no contact\n0=just touching\n>0=pressing, value depends on the force applied',0,1,1)
     149NEUROCLASS(GyroP,Gp,Part Gyroscope,`Tilt sensor. Signal is directly proportional to the tilt angle.\n0=the part X axis is horizontal\n+1/-1=the axis is vertical',0,1,1)
     150VISUALHINTS(ReceptorClass)
     151SYMBOL(`8,7,100,50,90,50,90,40,70,40,80,50,70,60,90,60,90,50,12,43,24,48,24,48,19,38,19,38,24,43,24,43,54,48,54,48,64,43,69,38,64,38,54,43,54,5,63,69,58,74,48,79,38,79,28,74,23,69,1,43,79,43,74,1,23,69,26,66,1,63,69,60,66,1,55,76,53,73,1,31,75,33,72')
     152NEUROPROP(ry,1,0,rotation.y,f,-6.282,6.282,0,ry)
     153NEUROPROP(rz,1,0,rotation.z,f,-6.282,6.282,0,rz)
     154ENDNEUROCLASS
     155
     156NEUROCLASS(Touch,T,Touch,`Touch and proximity sensor (Tc+Tp combined)\n-1=no contact\n0=just touching\n>0=pressing, value depends on the force applied (not implemented in ODE mode)',0,1,1)
    149157VISUALHINTS(ReceptorClass)
    150158SYMBOL(`2,7,100,50,90,50,90,40,70,40,80,50,70,60,90,60,90,50,11,75,50,65,50,60,55,55,45,50,55,45,45,40,50,35,50,30,45,25,50,30,55,35,50')
    151159NEUROPROP(r,1,0,Range,f,0.0,1.0,1.0,range)
     160NEUROPROP(ry,1,0,rotation.y,f,-6.282,6.282,0,ry)
     161NEUROPROP(rz,1,0,rotation.z,f,-6.282,6.282,0,rz)
     162ENDNEUROCLASS
     163
     164NEUROCLASS(TouchC,Tc,Touch contact,`Touch sensor.\n-1=no contact\n0=the Part is touching the obstacle\n>0=pressing, value depends on the force applied (not implemented in ODE mode)',0,1,1)
     165VISUALHINTS(ReceptorClass)
     166SYMBOL(`2,7,100,50,90,50,90,40,70,40,80,50,70,60,90,60,90,50,11,75,50,65,50,60,55,55,45,50,55,45,45,40,50,35,50,30,45,25,50,30,55,35,50')
     167ENDNEUROCLASS
     168
     169NEUROCLASS(TouchP,Tp,Touch proximity,`Proximity sensor detecting obstacles along the X axis.\n-1=distance is \'r\' or more\n0=zero distance',0,1,1)
     170VISUALHINTS(ReceptorClass)
     171SYMBOL(`2,7,100,50,90,50,90,40,70,40,80,50,70,60,90,60,90,50,11,75,50,65,50,60,55,55,45,50,55,45,45,40,50,35,50,30,45,25,50,30,55,35,50')
     172NEUROPROP(r,1,0,Range,f,0.0,1.0,1.0,range)
     173NEUROPROP(ry,1,0,rotation.y,f,-6.282,6.282,0,ry)
     174NEUROPROP(rz,1,0,rotation.z,f,-6.282,6.282,0,rz)
    152175ENDNEUROCLASS
    153176
  • cpp/frams/config/f0.def

    r945 r952  
    1 CLASS(Model,f0_model,m)
     1CLASS(Model,f0_model,m,Model)
    22GROUP(Properties)
    33GROUP(Visual)
     
    66ENDCLASS
    77
    8 CLASS(Part,f0_part,p)
     8CLASS(Part,f0_part,p,Part)
    99GROUP(Geometry)
    1010GROUP(Other properties)
     
    3939ENDCLASS
    4040
    41 CLASS(Joint,f0_joint,j)
     41CLASS(Joint,f0_joint,j,Joint)
    4242GROUP(Connections)
    4343GROUP(Geometry)
     
    7373ENDCLASS
    7474
    75 CLASS(Joint,f0_nodeltajoint,j,NOXML)
     75CLASS(Joint,f0_nodeltajoint,j,Joint,NOXML)
    7676GROUP(Connections)
    7777GROUP(Geometry)
     
    101101ENDCLASS
    102102
    103 CLASS(Neuro,f0_neuro,n)
     103CLASS(Neuro,f0_neuro,n,Neuro)
    104104GROUP(Connections)
    105105GROUP(Other)
     
    117117ENDCLASS
    118118
    119 CLASS(NeuroConn,f0_neuroconn,c)
     119CLASS(NeuroConn,f0_neuroconn,c,Neuron connection)
    120120GROUP(Connection)
    121121GROUP(Other)
     
    141141ENDNEUROCLASS
    142142
    143 NEUROCLASS(Gyro,G,Gyroscope,`Equilibrium sensor.\n0=the stick is horizontal\n+1/-1=the stick is vertical',0,1,2)
     143NEUROCLASS(Gyro,G,Gyroscope,`Tilt sensor.\nSignal is proportional to sin(angle) = most sensitive in horizontal orientation.\n0=the stick is horizontal\n+1/-1=the stick is vertical',0,1,2)
     144SHAPETYPE(BallAndStickShapeType)
    144145VISUALHINTS(ReceptorClass)
    145146SYMBOL(`8,7,100,50,90,50,90,40,70,40,80,50,70,60,90,60,90,50,12,43,24,48,24,48,19,38,19,38,24,43,24,43,54,48,54,48,64,43,69,38,64,38,54,43,54,5,63,69,58,74,48,79,38,79,28,74,23,69,1,43,79,43,74,1,23,69,26,66,1,63,69,60,66,1,55,76,53,73,1,31,75,33,72')
    146147ENDNEUROCLASS
    147148
    148 NEUROCLASS(Touch,T,Touch,`Touch sensor.\n-1=no contact\n0=just touching\n>0=pressing, value depends on the force applied',0,1,1)
     149NEUROCLASS(GyroP,Gp,Part Gyroscope,`Tilt sensor. Signal is directly proportional to the tilt angle.\n0=the part X axis is horizontal\n+1/-1=the axis is vertical',0,1,1)
     150VISUALHINTS(ReceptorClass)
     151SYMBOL(`8,7,100,50,90,50,90,40,70,40,80,50,70,60,90,60,90,50,12,43,24,48,24,48,19,38,19,38,24,43,24,43,54,48,54,48,64,43,69,38,64,38,54,43,54,5,63,69,58,74,48,79,38,79,28,74,23,69,1,43,79,43,74,1,23,69,26,66,1,63,69,60,66,1,55,76,53,73,1,31,75,33,72')
     152NEUROPROP(ry,1,0,rotation.y,f,-6.282,6.282,0,ry)
     153NEUROPROP(rz,1,0,rotation.z,f,-6.282,6.282,0,rz)
     154ENDNEUROCLASS
     155
     156NEUROCLASS(Touch,T,Touch,`Touch and proximity sensor (Tc+Tp combined)\n-1=no contact\n0=just touching\n>0=pressing, value depends on the force applied (not implemented in ODE mode)',0,1,1)
    149157VISUALHINTS(ReceptorClass)
    150158SYMBOL(`2,7,100,50,90,50,90,40,70,40,80,50,70,60,90,60,90,50,11,75,50,65,50,60,55,55,45,50,55,45,45,40,50,35,50,30,45,25,50,30,55,35,50')
    151159NEUROPROP(r,1,0,Range,f,0.0,1.0,1.0,range)
     160NEUROPROP(ry,1,0,rotation.y,f,-6.282,6.282,0,ry)
     161NEUROPROP(rz,1,0,rotation.z,f,-6.282,6.282,0,rz)
     162ENDNEUROCLASS
     163
     164NEUROCLASS(TouchC,Tc,Touch contact,`Touch sensor.\n-1=no contact\n0=the Part is touching the obstacle\n>0=pressing, value depends on the force applied (not implemented in ODE mode)',0,1,1)
     165VISUALHINTS(ReceptorClass)
     166SYMBOL(`2,7,100,50,90,50,90,40,70,40,80,50,70,60,90,60,90,50,11,75,50,65,50,60,55,55,45,50,55,45,45,40,50,35,50,30,45,25,50,30,55,35,50')
     167ENDNEUROCLASS
     168
     169NEUROCLASS(TouchP,Tp,Touch proximity,`Proximity sensor detecting obstacles along the X axis.\n-1=distance is \'r\' or more\n0=zero distance',0,1,1)
     170VISUALHINTS(ReceptorClass)
     171SYMBOL(`2,7,100,50,90,50,90,40,70,40,80,50,70,60,90,60,90,50,11,75,50,65,50,60,55,55,45,50,55,45,45,40,50,35,50,30,45,25,50,30,55,35,50')
     172NEUROPROP(r,1,0,Range,f,0.0,1.0,1.0,range)
     173NEUROPROP(ry,1,0,rotation.y,f,-6.282,6.282,0,ry)
     174NEUROPROP(rz,1,0,rotation.z,f,-6.282,6.282,0,rz)
    152175ENDNEUROCLASS
    153176
  • cpp/frams/genetics/preconfigured.h

    r938 r952  
    2828                if (Geno::useValidators(&validators) != NULL)
    2929                        logPrintf("PreconfiguredGenetics", "init", LOG_WARN, "Geno validators already configured");
    30                 static const char* genactive_classes[] = { "N", "G", "T", "S", "*", "|", "@", "M", NULL };
     30                static const char* genactive_classes[] = { "N", "G", "Gp", "T", "S", "*", "|", "@", "M", NULL };
    3131                NeuroClass::resetActive();
    3232                NeuroClass::setGenActive(genactive_classes);
  • cpp/frams/model/defassign-f0-SDK.h

    r945 r952  
    6161
    6262
     63
     64
     65
    6366void Part_MinMaxDef::defassign()
    6467{
    6568volume=4.18879;
    6669}
     70
     71
     72
    6773
    6874
     
    165171
    166172
     173
     174
     175
    167176void Neuro::defassign()
    168177{
     
    172181vis_style="neuro";
    173182}
     183
     184
     185
    174186
    175187
     
    234246
    235247
     248
     249
     250
  • cpp/frams/model/f0-SDK-classes.h

    r945 r952  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2020  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    77ParamEntry f0_model_paramtab[]=
    88{
    9  {"Properties",2,2,"m" },
     9 {"Properties",2,2,"m",NULL,0,NULL,NULL,"Model"},
    1010 {"Visual",},
    1111 {"se",0,1024,"startenergy","f",FIELD(startenergy),},
     
    2424ParamEntry f0_part_paramtab[]=
    2525{
    26  {"Geometry",3,22,"p" },
     26 {"Geometry",3,22,"p",NULL,0,NULL,NULL,"Part"},
    2727 {"Other properties",},
    2828 {"Visual",},
     
    7171ParamEntry f0_part_minmaxdef_paramtab[]=
    7272{
    73  {"Geometry",1,1,"p" },
     73 {"Geometry",1,1,"p"},
    7474 {"f",0,0,"volume","f 0.83776 20.94395 4.18879",FIELD(volume),"Recommended default and min,max range for solid-shape Parts created and modified by genetic operators which are responsible for setting sizex,y,z. Default is the volume of the solid sphere (ball) with default radius=1 (radius is the same as sizex,y,z). Minimum is 5x less, maximum is 5x more.",},
    7575 {0,0,0,}
     
    8686ParamEntry f0_joint_paramtab[]=
    8787{
    88  {"Connections",4,27,"j" },
     88 {"Connections",4,27,"j",NULL,0,NULL,NULL,"Joint"},
    8989 {"Geometry",},
    9090 {"Other properties",},
     
    135135ParamEntry f0_nodeltajoint_paramtab[]=
    136136{
    137  {"Connections",4,21,"j" },
     137 {"Connections",4,21,"j",NULL,0,NULL,NULL,"Joint"},
    138138 {"Geometry",},
    139139 {"Other properties",},
     
    178178ParamEntry f0_neuro_paramtab[]=
    179179{
    180  {"Connections",3,10,"n" },
     180 {"Connections",3,10,"n",NULL,0,NULL,NULL,"Neuro"},
    181181 {"Other",},
    182182 {"Visual",},
     
    204204ParamEntry f0_neuroconn_paramtab[]=
    205205{
    206  {"Connection",2,4,"c" },
     206 {"Connection",2,4,"c",NULL,0,NULL,NULL,"Neuron connection"},
    207207 {"Other",},
    208208 {"n1",0,1024,"this neuro ref#","d -1 999999 -1",FIELD(n1_refno),},
     
    239239
    240240
     241
     242
     243
  • cpp/frams/model/model.cpp

    r934 r952  
    952952                                if ((check != LIVE_CHECK) && (check != CHECKPOINT_CHECK))
    953953                                {
    954                                         if (j->shape != Joint::SHAPE_FIXED)
     954                                        if (j->shape == Joint::SHAPE_BALL_AND_STICK)
    955955                                        {
    956956                                                if (j->d() > getMaxJoint().d.x)
  • cpp/frams/model/modelparts.cpp

    r932 r952  
    2222#include <frams/util/extvalue.h>
    2323#include <frams/param/paramobj.h>
     24#include <frams/neuro/neuroimpl.h>
    2425
    2526#include F0_DEFASSIGN_FILE
     
    756757        {
    757758#define FIELDSTRUCT NeuroExt
    758                 ParamEntry entry = { "class", 2, 0, "neuro class", "s", GETSET(neuroclass) };
     759                ParamEntry entries[] = {
     760                 { "class", 2, 0, "neuro class", "s", GETSET(neuroclass) },
     761                 { "liveNeuro", 2, 1, "live Neuro object", "oNeuro", GETONLY(liveNeuro) }};
    759762#undef FIELDSTRUCT
    760                 add(&entry);
     763                for(auto& e : entries) add(&e);
    761764
    762765#define FIELDSTRUCT Neuro
     
    797800        setClassName(arg->getString()); return PSET_CHANGED;
    798801}
     802
     803void NeuroExt::get_liveNeuro(PARAMGETARGS)
     804{
     805#ifndef SDK_WITHOUT_FRAMS
     806        NeuroNetImpl::getLiveNeuroObject(this,ret);
     807#endif
     808}
  • cpp/frams/model/modelparts.h

    r937 r952  
    519519        PARAMGETDEF(neuroclass);
    520520        PARAMSETDEF(neuroclass);
     521        PARAMGETDEF(liveNeuro);
    521522#undef STATRICKCLASS
    522523        static ParamEntry *getParamTab();
  • cpp/frams/neuro/impl/neuroimpl-body-sdk.h

    r922 r952  
    1616};
    1717
     18extern ParamEntry NI_GyroP_tab[];
     19
     20class NI_GyroP : public NeuroImpl
     21{
     22public:
     23        double ry,rz;
     24        NeuroImpl* makeNew() { return new NI_GyroP(); } // for NeuroFactory
     25        int lateinit() { if (!neuro->part) return 0; simorder = 0; return 1; }
     26        void go() { setState(0); }
     27        NI_GyroP(): ry(0),rz(0) { paramentries = NI_GyroP_tab; }
     28};
     29
    1830extern ParamEntry NI_Touch_tab[];
    1931class NI_Touch : public NeuroImpl
     
    2133public:
    2234        double range;
     35        double ry,rz;
    2336        NeuroImpl* makeNew() { return new NI_Touch(); } // for NeuroFactory
    2437        int lateinit() { if (!neuro->part) return 0; simorder = 0; return 1; }
    2538        void go() { setState(0); }
    26         NI_Touch() :range(1) { paramentries = NI_Touch_tab; }
     39        NI_Touch() :range(1),ry(0),rz(0) { paramentries = NI_Touch_tab; }
    2740};
     41
     42extern ParamEntry NI_TouchP_tab[];
     43class NI_TouchP : public NI_Touch
     44{
     45public:
     46        NeuroImpl* makeNew() { return new NI_TouchP(); } // for NeuroFactory
     47        NI_TouchP() { paramentries = NI_TouchP_tab; }
     48};
     49
     50extern ParamEntry NI_TouchC_tab[];
     51class NI_TouchC : public NI_Touch
     52{
     53public:
     54        NeuroImpl* makeNew() { return new NI_TouchC(); } // for NeuroFactory
     55        NI_TouchC() { paramentries = NI_TouchC_tab; }
     56};
     57
    2858
    2959class NI_Smell : public NeuroImpl
  • cpp/frams/neuro/neurocls-f0-SDK-factory.h

    r946 r952  
    3939#undef FIELDSTRUCT
    4040
     41#define FIELDSTRUCT NI_GyroP
     42ParamEntry NI_GyroP_tab []={
     43{"Part Gyroscope",1, 2 ,"Gp",},
     44{"ry",1,0,"rotation.y","f -6.282 6.282 0",FIELD(ry),},
     45{"rz",1,0,"rotation.z","f -6.282 6.282 0",FIELD(rz),},
     46 {0,0,0,},};
     47#undef FIELDSTRUCT
     48
    4149#define FIELDSTRUCT NI_Touch
    4250ParamEntry NI_Touch_tab []={
    43 {"Touch",1, 1 ,"T",},
     51{"Touch",1, 3 ,"T",},
    4452{"r",1,0,"Range","f 0.0 1.0 1.0",FIELD(range),},
     53{"ry",1,0,"rotation.y","f -6.282 6.282 0",FIELD(ry),},
     54{"rz",1,0,"rotation.z","f -6.282 6.282 0",FIELD(rz),},
     55 {0,0,0,},};
     56#undef FIELDSTRUCT
     57
     58#define FIELDSTRUCT NI_TouchC
     59ParamEntry NI_TouchC_tab []={
     60{"Touch contact",1, 0 ,"Tc",},
     61 {0,0,0,},};
     62#undef FIELDSTRUCT
     63
     64#define FIELDSTRUCT NI_TouchP
     65ParamEntry NI_TouchP_tab []={
     66{"Touch proximity",1, 3 ,"Tp",},
     67{"r",1,0,"Range","f 0.0 1.0 1.0",FIELD(range),},
     68{"ry",1,0,"rotation.y","f -6.282 6.282 0",FIELD(ry),},
     69{"rz",1,0,"rotation.z","f -6.282 6.282 0",FIELD(rz),},
    4570 {0,0,0,},};
    4671#undef FIELDSTRUCT
     
    159184setImplementation("Nu",new NI_StdUNeuron); \
    160185setImplementation("G",new NI_Gyro); \
     186setImplementation("Gp",new NI_GyroP); \
    161187setImplementation("T",new NI_Touch); \
     188setImplementation("Tc",new NI_TouchC); \
     189setImplementation("Tp",new NI_TouchP); \
    162190setImplementation("S",new NI_Smell); \
    163191setImplementation("*",new NI_Const); \
  • cpp/frams/neuro/neurocls-f0-SDK-library.h

    r946 r952  
    4141
    4242
    43  
    44 {0,0,0,},};
    45 addClass(new NeuroClass(NI_Gyro_tab,"Equilibrium sensor.\n0=the stick is horizontal\n+1/-1=the stick is vertical",0,1,2, Gyro_xy,false, 32, 3));
     43
     44 
     45{0,0,0,},};
     46addClass(new NeuroClass(NI_Gyro_tab,"Tilt sensor.\nSignal is proportional to sin(angle) = most sensitive in horizontal orientation.\n0=the stick is horizontal\n+1/-1=the stick is vertical",0,1,2, Gyro_xy,false, 32, 1));
     47
     48      static int GyroP_xy[]={83,8,7,100,50,90,50,90,40,70,40,80,50,70,60,90,60,90,50,12,43,24,48,24,48,19,38,19,38,24,43,24,43,54,48,54,48,64,43,69,38,64,38,54,43,54,5,63,69,58,74,48,79,38,79,28,74,23,69,1,43,79,43,74,1,23,69,26,66,1,63,69,60,66,1,55,76,53,73,1,31,75,33,72};   
     49static ParamEntry NI_GyroP_tab[]={
     50{"Part Gyroscope",1, 2 ,"Gp",},
     51
     52
     53{"ry",1,0,"rotation.y","f -6.282 6.282 0",},
     54{"rz",1,0,"rotation.z","f -6.282 6.282 0",},
     55 
     56{0,0,0,},};
     57addClass(new NeuroClass(NI_GyroP_tab,"Tilt sensor. Signal is directly proportional to the tilt angle.\n0=the part X axis is horizontal\n+1/-1=the axis is vertical",0,1,1, GyroP_xy,false, 32, 3));
    4658
    4759      static int Touch_xy[]={43,2,7,100,50,90,50,90,40,70,40,80,50,70,60,90,60,90,50,11,75,50,65,50,60,55,55,45,50,55,45,45,40,50,35,50,30,45,25,50,30,55,35,50};   
    4860static ParamEntry NI_Touch_tab[]={
    49 {"Touch",1, 1 ,"T",},
     61{"Touch",1, 3 ,"T",},
    5062
    5163
    5264{"r",1,0,"Range","f 0.0 1.0 1.0",},
    53  
    54 {0,0,0,},};
    55 addClass(new NeuroClass(NI_Touch_tab,"Touch sensor.\n-1=no contact\n0=just touching\n>0=pressing, value depends on the force applied",0,1,1, Touch_xy,false, 32, 3));
     65{"ry",1,0,"rotation.y","f -6.282 6.282 0",},
     66{"rz",1,0,"rotation.z","f -6.282 6.282 0",},
     67 
     68{0,0,0,},};
     69addClass(new NeuroClass(NI_Touch_tab,"Touch and proximity sensor (Tc+Tp combined)\n-1=no contact\n0=just touching\n>0=pressing, value depends on the force applied (not implemented in ODE mode)",0,1,1, Touch_xy,false, 32, 3));
     70
     71      static int TouchC_xy[]={43,2,7,100,50,90,50,90,40,70,40,80,50,70,60,90,60,90,50,11,75,50,65,50,60,55,55,45,50,55,45,45,40,50,35,50,30,45,25,50,30,55,35,50};   
     72static ParamEntry NI_TouchC_tab[]={
     73{"Touch contact",1, 0 ,"Tc",},
     74
     75
     76 
     77{0,0,0,},};
     78addClass(new NeuroClass(NI_TouchC_tab,"Touch sensor.\n-1=no contact\n0=the Part is touching the obstacle\n>0=pressing, value depends on the force applied (not implemented in ODE mode)",0,1,1, TouchC_xy,false, 32, 3));
     79
     80      static int TouchP_xy[]={43,2,7,100,50,90,50,90,40,70,40,80,50,70,60,90,60,90,50,11,75,50,65,50,60,55,55,45,50,55,45,45,40,50,35,50,30,45,25,50,30,55,35,50};   
     81static ParamEntry NI_TouchP_tab[]={
     82{"Touch proximity",1, 3 ,"Tp",},
     83
     84
     85{"r",1,0,"Range","f 0.0 1.0 1.0",},
     86{"ry",1,0,"rotation.y","f -6.282 6.282 0",},
     87{"rz",1,0,"rotation.z","f -6.282 6.282 0",},
     88 
     89{0,0,0,},};
     90addClass(new NeuroClass(NI_TouchP_tab,"Proximity sensor detecting obstacles along the X axis.\n-1=distance is \r\' or more\n0=zero distance'",0,1,1, TouchP_xy,false, 32, 3));
    5691
    5792      static int Smell_xy[]={64,5,7,100,50,90,50,90,40,70,40,80,50,70,60,90,60,90,50,3,10,40,15,45,15,55,10,60,5,20,30,25,35,30,45,30,55,25,65,20,70,4,15,35,20,40,22,50,20,60,15,65,5,75,50,50,50,45,45,40,50,45,55,50,50};   
  • cpp/frams/neuro/neuroimpl.cpp

    r932 r952  
    1313#include <frams/simul/simul.h>
    1414#endif
     15#include <frams/vm/classes/3dobject.h>
    1516
    1617const int NeuroImpl::ENDDRAWING = -9999;
     
    153154}
    154155
     156void NeuroNetImpl::getLiveNeuroObject(Neuro *n, ExtValue *ret)
     157{
     158        NeuroImpl *ni = getImpl(n);
     159        if (ni)
     160                ret->setObject(ExtObject(&NeuroImpl::getStaticParam(), ni));
     161        else
     162                ret->setEmpty();
     163}
     164
    155165///////////////////////////////////////////////
    156166
     
    301311ParamEntry neuroimpl_tab[] =
    302312{
    303         { "Neuro", 1, 27 + NEUROIMPL_SIGNAL_PROPS, "Neuro", "Live Neuron object." },
     313        { "Neuro", 1, 29 + NEUROIMPL_SIGNAL_PROPS, "Neuro", "Live Neuron object." },
    304314
    305315        { "getInputState", 0, 0, "Get input signal", "p f(d input)", PROCEDURE(p_get), },
     
    324334        { "position_y", 0, PARAM_READONLY, "Position y", "f", GETONLY(position_y), },
    325335        { "position_z", 0, PARAM_READONLY, "Position z", "f", GETONLY(position_z), },
     336        { "relative_pos", 0, PARAM_READONLY, "Relative position", "oXYZ", GETONLY(relative_pos), },
     337        { "relative_orient", 0, PARAM_READONLY, "Relative orientation", "oOrient", GETONLY(relative_orient), },
    326338        { "creature", 0, PARAM_READONLY, "Gets owner creature", "oCreature", GETONLY(creature), },
    327         { "part", 0, PARAM_READONLY, "The Part object where this neuron is located", "oMechPart", GETONLY(part), },
    328         { "joint", 0, PARAM_READONLY, "The Joint object where this neuron is located", "oMechJoint", GETONLY(joint), },
     339        { "mechpart", 0, PARAM_READONLY, "MechPart object", "oMechPart", GETONLY(part), "The MechPart object where this neuron is located" },
     340        { "mechjoint", 0, PARAM_READONLY, "MechJoint object" , "oMechJoint", GETONLY(joint), "The MechJoint object where this neuron is located" },
    329341        { "neuroproperties", 0, PARAM_READONLY, "Custom neuron fields", "oNeuroProperties", GETONLY(fields),
    330342        "Neurons can have different fields depending on their class. Script neurons have their fields defined using the \"property:\" syntax. If you develop a custom neuron script you should use the NeuroProperties object for accessing your own neuron fields. The Neuro.neuroproperties property is meant for accessing the neuron fields from the outside script.\n"
     
    549561}
    550562
     563void NeuroImpl::get_relative_pos(ExtValue *ret)
     564{
     565        ret->setObject(Pt3D_Ext::makeDynamicObject(getRelativePosition()));
     566}
     567
     568void NeuroImpl::get_relative_orient(ExtValue *ret)
     569{
     570        ret->setObject(Orient_Ext::makeDynamicObject(new Orient_Ext(getRelativeOrientation())));
     571}
    551572
    552573void NeuroImpl::createFieldsObject()
  • cpp/frams/neuro/neuroimpl.h

    r932 r952  
    8888
    8989        static NeuroImpl *getImpl(Neuro* n) { return (NeuroImpl*)n->userdata[mytags_id]; }
     90        static void getLiveNeuroObject(Neuro *n, ExtValue *ret);
    9091};
    9192
     
    271272        Creature* getCreature();
    272273
     274        virtual Pt3D getRelativePosition() { return Pt3D_0; }
     275        virtual Orient getRelativeOrientation() { return Orient_1; }
     276       
    273277#define STATRICKCLASS NeuroImpl
    274278        PARAMGETDEF(count) { arg1->setInt(getInputCount()); }
     
    300304        PARAMGETDEF(position_y);
    301305        PARAMGETDEF(position_z);
     306        PARAMGETDEF(relative_pos);
     307        PARAMGETDEF(relative_orient);
    302308        PARAMGETDEF(fields);
    303309        PARAMGETDEF(neurodef);
Note: See TracChangeset for help on using the changeset viewer.