issue about nesting models -> nested controllers are not updated

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

issue about nesting models -> nested controllers are not updated

Luigi Freda
Hi,
I'm using gazebo revision number 8676.
I found that when you nest models in the world description
(e.g., in the pioneer2dx_camera.world, the sonyvid30_model is nested inside
the pioneer2dx_model1)
the controllers of the nested models are correctly initialized but NOT
updated.
Hence, nested controllers are not considered at all during the simulation
loop.

I found this problem after updating gazebo. I got crazy trying to make a
sonyvid30_model ptz controller work.
Then, I found that the problem was in the gazebo code.

I found a temporary solution. In the function

void Model::Attach(XMLConfigNode *node)

I replaced these two original lines

if (this->parent->GetType() == Entity::MODEL)
  parentModel = (Model*)this->parent;

with these new ones

  if (this->parent->GetType() == Entity::MODEL)
  {
     parentModel = (Model*)this->parent;
     // Copy the controllers into the parent controller vector
     parentModel->controllers.insert( this->controllers.begin(),
this->controllers.end() );
  }

Everything seems to work now, but there are some remaining issues with this
patch:
- this solves the problem only with controllers nested only one time, that
is with controllers of models which are direct children of level-0 models.
The controller vector of a nested model should be copied in the controller
vector of its root model!
- controllers are intialized twice.

Waiting for your comments.

- Xfly
------------------------------------------------------------------------------

_______________________________________________
Playerstage-gazebo mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/playerstage-gazebo
Reply | Threaded
Open this post in threaded view
|

Re: issue about nesting models -> nested controllers are not updated

Jochen Welle-2
Hi,

i am facing the same problem. I recently switched from 0.10.0 to the svn
version of gazebo. In 0.10.0 all models were added to a list in the
World object and the Update() method of a model was called in world
Update(), which finally results in a call of the controllers
UpdateChild() method. In the current svn version nested models (those
who have a parent model) are not added to the list in the World object
and their Update() method is never called, i think.
My solution is to call the Update() method of a nested model in the
parents model Update() method. This avoids the problems Xfly described
for his solution. See attached patch. I have placed the update calls for
the child models before the IsStatic check, because i think it should be
possible to attach non-static models to static models. Please correct
me, if i am wrong.

regards,
Jochen


On 13/05/10 10:29, xfly wrote:

> Hi,
> I'm using gazebo revision number 8676.
> I found that when you nest models in the world description
> (e.g., in the pioneer2dx_camera.world, the sonyvid30_model is nested inside
> the pioneer2dx_model1)
> the controllers of the nested models are correctly initialized but NOT
> updated.
> Hence, nested controllers are not considered at all during the simulation
> loop.
>
> I found this problem after updating gazebo. I got crazy trying to make a
> sonyvid30_model ptz controller work.
> Then, I found that the problem was in the gazebo code.
>
> I found a temporary solution. In the function
>
> void Model::Attach(XMLConfigNode *node)
>
> I replaced these two original lines
>
> if (this->parent->GetType() == Entity::MODEL)
>    parentModel = (Model*)this->parent;
>
> with these new ones
>
>    if (this->parent->GetType() == Entity::MODEL)
>    {
>       parentModel = (Model*)this->parent;
>       // Copy the controllers into the parent controller vector
>       parentModel->controllers.insert( this->controllers.begin(),
> this->controllers.end() );
>    }
>
> Everything seems to work now, but there are some remaining issues with this
> patch:
> - this solves the problem only with controllers nested only one time, that
> is with controllers of models which are direct children of level-0 models.
> The controller vector of a nested model should be copied in the controller
> vector of its root model!
> - controllers are intialized twice.
>
> Waiting for your comments.
>
> - Xfly
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Playerstage-gazebo mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/playerstage-gazebo

--
Dipl. Inform. Jochen Welle
Unbemannte Systeme

Fraunhofer-Institut für Kommunikation, Informationsverarbeitung und
Ergonomie FKIE
Neuenahrer Straße 20 | 53343 Wachtberg
Telefon +49 (0)228 9435-495 | Fax -16495
mailto:[hidden email]
http://www.fkie.fraunhofer.de


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Playerstage-gazebo mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/playerstage-gazebo