Revision: 8734
http://playerstage.svn.sourceforge.net/playerstage/?rev=8734&view=rev
Author: natepak
Date: 2010-05-29 17:53:34 +0000 (Sat, 29 May 2010)
Log Message:
-----------
Added functions to entity
Modified Paths:
--------------
code/gazebo/branches/simpar/plugins/pioneer_spiral.cc
code/gazebo/branches/simpar/server/Entity.cc
code/gazebo/branches/simpar/server/Entity.hh
Modified: code/gazebo/branches/simpar/plugins/pioneer_spiral.cc
===================================================================
--- code/gazebo/branches/simpar/plugins/pioneer_spiral.cc 2010-05-29
17:28:37 UTC (rev 8733)
+++ code/gazebo/branches/simpar/plugins/pioneer_spiral.cc 2010-05-29
17:53:34 UTC (rev 8734)
@@ -13,6 +13,18 @@
{
World::Instance()->DisconnectWorldUpdateStartSignal(
boost::bind(&PioneerSpiral::UpdateCB, this));
+
+ for (unsigned int i=0; i < this->robot->GetChildCount(); i++)
+ {
+ Body *body = dynamic_cast<Body*>(this->robot->GetChild(i));
+ if (body)
+ {
+ body->SetForce(Vector3(0,0,0));
+ body->SetTorque(Vector3(0,0,0));
+ body->SetLinearVel(Vector3(0,0,0));
+ body->SetAngularVel(Vector3(0,0,0));
+ }
+ }
}
void PioneerSpiral::Load()
Modified: code/gazebo/branches/simpar/server/Entity.cc
===================================================================
--- code/gazebo/branches/simpar/server/Entity.cc 2010-05-29 17:28:37 UTC
(rev 8733)
+++ code/gazebo/branches/simpar/server/Entity.cc 2010-05-29 17:53:34 UTC
(rev 8734)
@@ -183,6 +183,23 @@
}
////////////////////////////////////////////////////////////////////////////////
+/// Get the number of children
+unsigned int Entity::GetChildCount() const
+{
+ return this->children.size();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+/// Get a child by index
+Entity *Entity::GetChild(unsigned int i)
+{
+ if (i < this->children.size())
+ return this->children[i];
+
+ return NULL;
+}
+
+////////////////////////////////////////////////////////////////////////////////
/// Get a child by name
Entity *Entity::GetChild(const std::string &name )
{
Modified: code/gazebo/branches/simpar/server/Entity.hh
===================================================================
--- code/gazebo/branches/simpar/server/Entity.hh 2010-05-29 17:28:37 UTC
(rev 8733)
+++ code/gazebo/branches/simpar/server/Entity.hh 2010-05-29 17:53:34 UTC
(rev 8734)
@@ -85,6 +85,12 @@
/// \return Vector of children entities
public: const std::vector< Entity* > &GetChildren() const;
+ /// \brief Get the number of children
+ public: unsigned int GetChildCount() const;
+
+ /// \brief Get a child by index
+ public: Entity *GetChild(unsigned int i);
+
/// \brief Get a child by name
public: Entity *GetChild(const std::string &name );
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit