Thanks alot! It makes perfect sense! Thing is that the other interfaces 
were like this so I didn't really think about this!

Mihai

Nate Koenig wrote:
> Hello,
>
> I finally figured out the problem. All of the interfaces were
> calculating an incorrect size. To fix your code change:
>
> public: ActarrayIface():Iface("actarray", sizeof(ActarrayIface)) {}
>
> to
>
> public: ActarrayIface():Iface("actarray",
> sizeof(ActarrayIface)+sizeof(gzActarrayData)) {}
>
> That should make everything work smoothly.
>
> -nate
>
> On 5/18/07, Mihai Emanuel Dolha <[EMAIL PROTECTED]> wrote:
>   
>> Hi!
>> Here is the code I added in gazebo.h
>>
>>     
>> /***************************************************************************/
>>     //                      ACTARRAY
>>     INTERFACE                                 //
>>
>>     //maximum number of actuators
>>     #define GAZEBO_ACTARRAY_MAX_NUM_ACTUATORS 16
>>
>>
>>     // @brief Actuator geometry
>>     class gzActarrayActuatorGeom
>>     {
>>       //The type of the actuator - linear or rotary.
>>       uint8_t type;
>>       // The range of motion of the actuator, in m or rad depending on
>>     the type.
>>       float min;
>>       // The range of motion of the actuator, in m or rad depending on
>>     the type.
>>       float centre;
>>       // The range of motion of the actuator, in m or rad depending on
>>     the type.
>>       float max;
>>       // The range of motion of the actuator, in m or rad depending on
>>     the type.
>>       float home;
>>       // The configured speed setting of the actuator - different from
>>     current speed.
>>       float config_speed;
>>       // The maximum achievable speed of the actuator.
>>       float max_speed;
>>       // If the actuator has brakes or not.
>>       uint8_t hasbrakes;
>>     };
>>
>>     // @brief Structure containing a single actuator's information
>>     class gzActarrayActuator
>>     {
>>       // The position of the actuator in m or rad depending on the type.
>>       public: float position;
>>       // The speed of the actuator in m/s or rad/s depending on the type.
>>       public: float speed;
>>       // The current state of the actuator.
>>       public: uint8_t state;
>>
>>     };
>>
>>     // The actuator array data packet.
>>     class gzActarrayData
>>     {
>>       // The number of actuators in the array.
>>       public: unsigned int actuators_count;
>>
>>       //timestamp
>>       public: double time;
>>
>>       // The actuator data.
>>       public: gzActarrayActuator
>>     actuators[GAZEBO_ACTARRAY_MAX_NUM_ACTUATORS];
>>
>>       // The actuators geoms
>>       public: gzActarrayActuatorGeom
>>     actuator_geoms[GAZEBO_ACTARRAY_MAX_NUM_ACTUATORS];
>>
>>       //position commands
>>       public: float cmd_pos[GAZEBO_ACTARRAY_MAX_NUM_ACTUATORS];
>>
>>       //speed commands
>>       public: float cmd_speed[GAZEBO_ACTARRAY_MAX_NUM_ACTUATORS];
>>
>>       // bad command flag - (speed to high set for the actuators or
>>     position not reachable)
>>       public: int bad_cmd;
>>
>>       //position / speed comand
>>       public: unsigned int joint_mode[GAZEBO_ACTARRAY_MAX_NUM_ACTUATORS];
>>
>>     };
>>
>>     //!The Actarray interface
>>     class ActarrayIface : public Iface
>>     {
>>       public: ActarrayIface():Iface("actarray", sizeof(ActarrayIface)) {}
>>       public: virtual ~ActarrayIface() {this->data = NULL;}
>>
>>       public: virtual int Create(Server *server, const char *id)
>>               {
>>                int result = Iface::Create(server,id);
>>                this->data = (gzActarrayData*)this->mMap;
>>                return result;}
>>
>>       public: virtual int Open(Client *client, const char *id)
>>               {int result = Iface::Open(client,id);
>>                this->data = (gzActarrayData*)this->mMap;
>>                return result;}
>>
>>       public: gzActarrayData *data;
>>     };
>>
>>     //                       END ACTARRAY INTERFACE
>>     
>> /***************************************************************************/
>>
>>
>>
>>
>> Nate Koenig wrote:
>>     
>>> Hello,
>>>
>>> Could you post your actarray code, and I'll take a look at it?
>>>
>>> Thanks,
>>> -nate
>>>
>>> On 5/15/07, Mihai Emanuel Dolha <[EMAIL PROTECTED]> wrote:
>>>
>>>       
>>>> Hi!
>>>>
>>>> I implemented the actarray interface in the SVN Gazebo and I'm using it
>>>> to control a robot model I made. Things are working pretty well with one
>>>> exception: sometimes the commands that my client writes on the interface
>>>> are replaced by 0 , and my robot stops. My client is not rewriting the
>>>> interface and I couldn't find who is.
>>>>
>>>> Does anybody who is using or working on this version have a clue?
>>>>
>>>> Thanks,
>>>>
>>>> Mihai
>>>>
>>>> -------------------------------------------------------------------------
>>>> This SF.net email is sponsored by DB2 Express
>>>> Download DB2 Express C - the FREE version of DB2 express and take
>>>> control of your XML. No limits. Just data. Click to get it now.
>>>> http://sourceforge.net/powerbar/db2/
>>>> _______________________________________________
>>>> Playerstage-gazebo mailing list
>>>> [email protected]
>>>> https://lists.sourceforge.net/lists/listinfo/playerstage-gazebo
>>>>
>>>>
>>>>         
>>> -------------------------------------------------------------------------
>>> This SF.net email is sponsored by DB2 Express
>>> Download DB2 Express C - the FREE version of DB2 express and take
>>> control of your XML. No limits. Just data. Click to get it now.
>>> http://sourceforge.net/powerbar/db2/
>>> _______________________________________________
>>> Playerstage-gazebo mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/playerstage-gazebo
>>>
>>>
>>>       
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by DB2 Express
>> Download DB2 Express C - the FREE version of DB2 express and take
>> control of your XML. No limits. Just data. Click to get it now.
>> http://sourceforge.net/powerbar/db2/
>> _______________________________________________
>> Playerstage-gazebo mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/playerstage-gazebo
>>
>>     
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Playerstage-gazebo mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/playerstage-gazebo
>
>   


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Playerstage-gazebo mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-gazebo

Reply via email to