modify_2
This commit is contained in:
parent
e993804f58
commit
ada6266e79
|
@ -51,5 +51,85 @@
|
|||
</ode> -->
|
||||
</physics>
|
||||
|
||||
<model name="bebop_0">
|
||||
<pose>0 0 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_1">
|
||||
<pose>0 5 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_2">
|
||||
<pose>0 10 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_3">
|
||||
<pose>0 15 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_4">
|
||||
<pose>0 20 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_5">
|
||||
<pose>0 25 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_6">
|
||||
<pose>0 30 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_7">
|
||||
<pose>0 35 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_8">
|
||||
<pose>0 40 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_9">
|
||||
<pose>0 45 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
</world>
|
||||
</sdf>
|
||||
|
|
|
@ -71,5 +71,245 @@
|
|||
</ode> -->
|
||||
</physics>
|
||||
|
||||
<model name="bebop_0">
|
||||
<pose>0 0 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_1">
|
||||
<pose>0 5 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_2">
|
||||
<pose>0 10 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_3">
|
||||
<pose>0 15 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_4">
|
||||
<pose>0 20 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_5">
|
||||
<pose>0 25 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_6">
|
||||
<pose>0 30 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_7">
|
||||
<pose>0 35 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_8">
|
||||
<pose>0 40 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_9">
|
||||
<pose>0 45 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_10">
|
||||
<pose>5 0 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_11">
|
||||
<pose>5 5 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_12">
|
||||
<pose>5 10 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_13">
|
||||
<pose>5 15 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_14">
|
||||
<pose>5 20 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_15">
|
||||
<pose>5 25 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_16">
|
||||
<pose>5 30 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_17">
|
||||
<pose>5 35 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_18">
|
||||
<pose>5 40 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_19">
|
||||
<pose>5 45 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_20">
|
||||
<pose>10 0 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_21">
|
||||
<pose>10 5 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_22">
|
||||
<pose>10 10 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_23">
|
||||
<pose>10 15 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_24">
|
||||
<pose>10 20 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_25">
|
||||
<pose>10 25 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_26">
|
||||
<pose>10 30 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_27">
|
||||
<pose>10 35 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_28">
|
||||
<pose>10 40 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
<model name="bebop_29">
|
||||
<pose>10 45 0.186 0 0 0</pose>
|
||||
<include>
|
||||
<uri>model://quadrotor</uri>
|
||||
</include>
|
||||
<plugin name="takeoff" filename="/home/zhangshuai/gazebo_plugin_tutorial/takeoff/build/libtakeoff.so"/>
|
||||
</model>
|
||||
|
||||
</world>
|
||||
</sdf>
|
||||
|
|
|
@ -958,11 +958,11 @@ void World::Update()
|
|||
{
|
||||
std::string tmp_model_name = this->distribution->GetGazeboIDPtr(gazeboLocalID)->GetModelName(i);
|
||||
unsigned int j = 0;
|
||||
for (j = 0; j < this->GetModel(tmp_model_name)->GetLink("base_link")->GetName().length(); j++)
|
||||
infor[i].link_name[j] = this->GetModel(tmp_model_name)->GetLink("base_link")->GetName()[j];
|
||||
for (j = 0; j < this->GetModel(tmp_model_name)->GetLink("canonical")->GetName().length(); j++)
|
||||
infor[i].link_name[j] = this->GetModel(tmp_model_name)->GetLink("canonical")->GetName()[j];
|
||||
infor[i].link_name[j] = '\0';
|
||||
infor[i].ID = this->GetModel(tmp_model_name)->GetLink("base_link")->GetId();
|
||||
infor[i].link_pose = this->GetModel(tmp_model_name)->GetLink("base_link")->GetWorldPose();
|
||||
infor[i].ID = this->GetModel(tmp_model_name)->GetLink("canonical")->GetId();
|
||||
infor[i].link_pose = this->GetModel(tmp_model_name)->GetLink("canonical")->GetWorldPose();
|
||||
}
|
||||
|
||||
CommunicationData temp[50];
|
||||
|
@ -1005,7 +1005,7 @@ void World::Update()
|
|||
for (unsigned int i = 0; i < this->distribution->GetGazeboIDPtr(1)->GetModelCount(); i++)
|
||||
{
|
||||
std::string tmp_model_name = this->distribution->GetGazeboIDPtr(1)->GetModelName(i);
|
||||
this->GetModel(tmp_model_name)->GetLink("base_link")->SetWorldPose(temp[i].link_pose);
|
||||
this->GetModel(tmp_model_name)->GetLink("canonical")->SetWorldPose(temp[i].link_pose);
|
||||
}
|
||||
|
||||
// Added by zhangshuai 2019.04.03 for count time ----Begin
|
||||
|
@ -1046,7 +1046,7 @@ void World::Update()
|
|||
for (unsigned int i = 0; i < this->distribution->GetGazeboIDPtr(0)->GetModelCount(); i++)
|
||||
{
|
||||
std::string tmp_model_name = this->distribution->GetGazeboIDPtr(0)->GetModelName(i);
|
||||
this->GetModel(tmp_model_name)->GetLink("base_link")->SetWorldPose(temp[i].link_pose);
|
||||
this->GetModel(tmp_model_name)->GetLink("canonical")->SetWorldPose(temp[i].link_pose);
|
||||
}
|
||||
|
||||
// Added by zhangshuai 2019.04.03 for count time ----Begin
|
||||
|
@ -1862,7 +1862,25 @@ void World::LoadPlugins()
|
|||
{
|
||||
ModelPtr model = boost::static_pointer_cast<Model>(
|
||||
this->dataPtr->rootElement->GetChild(i));
|
||||
model->LoadPlugins();
|
||||
// Modified by zhangshuai 2019.04.02 ----Begin
|
||||
if (this->flag == 1)
|
||||
{
|
||||
// Judge if the model to load is simulated in this gazebo
|
||||
for (unsigned int j = 0; j < this->distribution->GetGazeboIDPtr(gazeboLocalID)->GetModelCount(); j++)
|
||||
{
|
||||
if (model->GetName() == this->distribution->GetGazeboIDPtr(gazeboLocalID)->GetModelName(j))
|
||||
{
|
||||
// Original part
|
||||
model->LoadPlugins();
|
||||
// Original part
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
model->LoadPlugins();
|
||||
}
|
||||
// Modified by zhangshuai 2019.04.02 ----End
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue