From 0f780ac11e52708adb41c0efacbd8561c88f571f Mon Sep 17 00:00:00 2001 From: Abhay Date: Thu, 29 Mar 2018 18:10:55 +0530 Subject: [PATCH 1/4] Modified wall models --- .../gazeboserver/models/wall1/model.sdf | 122 ++++++++++++++--- .../gazeboserver/models/wall2/model.sdf | 123 +++++++++++++++--- .../gazeboserver/models/wall3/model.sdf | 122 ++++++++++++++--- .../gazeboserver/models/wall4/model.sdf | 122 ++++++++++++++--- 4 files changed, 409 insertions(+), 80 deletions(-) diff --git a/src/drivers/gazeboserver/models/wall1/model.sdf b/src/drivers/gazeboserver/models/wall1/model.sdf index 312f6eaa4..94be7e902 100644 --- a/src/drivers/gazeboserver/models/wall1/model.sdf +++ b/src/drivers/gazeboserver/models/wall1/model.sdf @@ -1,22 +1,104 @@ - - - - - - - model://wall1/meshes/pared1.dae - - - - - - - model://wall1/meshes/pared1.dae - - - - - - + + + + 0 0 2.133 0 0 0 + + 10000 + + 99999999999 + 0 + 0 + 99999999999 + 0 + 99999999999 + + 0 0 0 0 -0 0 + + 0 + 0 + 1 + + + + 2.5 0.150783 4.266 + + + + + 0.3 0.9 0.3 1 + 0.3 0.7 0.3 1 + 0.01 0.1 0.01 1 + 0 0 0 1 + + __default__ + + + 0 0 0 0 -0 0 + 0 + 1 + + + 0 + 10 + 0 0 0 0 -0 0 + + + 2.5 0.150783 4.266 + + + + + + 100 + 100 + 0 0 0 + 0 + 0 + + + 1 + 0 + 0 + 1 + + 0 + + + + + 0 + 1e+06 + + + 0 + 1 + 1 + + 0 + 0.2 + 1e+13 + 1 + 0.01 + 0 + + + 1 + -0.01 + 0 + 0.2 + 1e+13 + 1 + + + + + + 0 + 1 + + diff --git a/src/drivers/gazeboserver/models/wall2/model.sdf b/src/drivers/gazeboserver/models/wall2/model.sdf index 7cadd02bf..a483ec87b 100644 --- a/src/drivers/gazeboserver/models/wall2/model.sdf +++ b/src/drivers/gazeboserver/models/wall2/model.sdf @@ -1,22 +1,105 @@ - - - - - - - model://wall2/meshes/pared2.dae - - - - - - - model://wall2/meshes/pared2.dae - - - - - - + + + + 0 + 0 0 1.2 0 0 0 + + 10000 + + 99999999999 + 0 + 0 + 99999999999 + 0 + 99999999999 + + 0 0 0 0 -0 0 + + 0 + 0 + 1 + + + + 6.266 0.150783 2.4 + + + + + 0.97 0.9 0.23 1 + 0.77 0.7 0.22 1 + 0.1 0.1 0.005 1 + 0 0 0 1 + + __default__ + + + 0 0 0 0 -0 0 + 0 + 1 + + + 0 + 10 + 0 0 0 0 -0 0 + + + 6.266 0.150783 2.4 + + + + + + 100 + 100 + 0 0 0 + 0 + 0 + + + 1 + 0 + 0 + 1 + + 0 + + + + + 0 + 1e+06 + + + 0 + 1 + 1 + + 0 + 0.2 + 1e+13 + 1 + 0.01 + 0 + + + 1 + -0.01 + 0 + 0.2 + 1e+13 + 1 + + + + + + 0 + 1 + + diff --git a/src/drivers/gazeboserver/models/wall3/model.sdf b/src/drivers/gazeboserver/models/wall3/model.sdf index afa2d7bc9..fe789f566 100644 --- a/src/drivers/gazeboserver/models/wall3/model.sdf +++ b/src/drivers/gazeboserver/models/wall3/model.sdf @@ -1,22 +1,104 @@ - - - - - - - model://wall3/meshes/pared3.dae - - - - - - - model://wall3/meshes/pared3.dae - - - - - - + + + + 0 0 2.133 0 0 0 + + 10000 + + 99999999999 + 0 + 0 + 99999999999 + 0 + 99999999999 + + 0 0 0 0 -0 0 + + 0 + 0 + 1 + + + + 2.5 0.150783 4.266 + + + + + 0.9 0.3 0.3 1 + 0.7 0.3 0.3 1 + 0.1 0.01 0.01 1 + 0 0 0 1 + + __default__ + + + 0 0 0 0 -0 0 + 0 + 1 + + + 0 + 10 + 0 0 0 0 -0 0 + + + 2.5 0.150783 4.266 + + + + + + 100 + 100 + 0 0 0 + 0 + 0 + + + 1 + 0 + 0 + 1 + + 0 + + + + + 0 + 1e+06 + + + 0 + 1 + 1 + + 0 + 0.2 + 1e+13 + 1 + 0.01 + 0 + + + 1 + -0.01 + 0 + 0.2 + 1e+13 + 1 + + + + + + 0 + 1 + + diff --git a/src/drivers/gazeboserver/models/wall4/model.sdf b/src/drivers/gazeboserver/models/wall4/model.sdf index 4ce9c80a2..865a5db33 100644 --- a/src/drivers/gazeboserver/models/wall4/model.sdf +++ b/src/drivers/gazeboserver/models/wall4/model.sdf @@ -1,22 +1,104 @@ - - - - - - - model://wall4/meshes/pared4.dae - - - - - - - model://wall4/meshes/pared4.dae - - - - - - + + + + 0 0 2.133 0 0 0 + + 10000 + + 99999999999 + 0 + 0 + 99999999999 + 0 + 99999999999 + + 0 0 0 0 -0 0 + + 0 + 0 + 1 + + + + 2.5 0.150783 4.266 + + + + + 0.9 0.3 0.3 1 + 0.7 0.3 0.3 1 + 0.1 0.01 0.01 1 + 0 0 0 1 + + __default__ + + + 0 0 0 0 -0 0 + 0 + 1 + + + 0 + 10 + 0 0 0 0 -0 0 + + + 2.5 0.150783 4.266 + + + + + + 100 + 100 + 0 0 0 + 0 + 0 + + + 1 + 0 + 0 + 1 + + 0 + + + + + 0 + 1e+06 + + + 0 + 1 + 1 + + 0 + 0.2 + 1e+13 + 1 + 0.01 + 0 + + + 1 + -0.01 + 0 + 0.2 + 1e+13 + 1 + + + + + + 0 + 1 + + From 19379a7618f017ad76d6f380031efa6319447a2e Mon Sep 17 00:00:00 2001 From: Abhay Date: Thu, 29 Mar 2018 18:11:32 +0530 Subject: [PATCH 2/4] Modiified gymkhana world --- .../gazeboserver/worlds/gymkhana.world | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/src/drivers/gazeboserver/worlds/gymkhana.world b/src/drivers/gazeboserver/worlds/gymkhana.world index a242b0c97..e04a3ca33 100644 --- a/src/drivers/gazeboserver/worlds/gymkhana.world +++ b/src/drivers/gazeboserver/worlds/gymkhana.world @@ -4,11 +4,45 @@ model://hangar + 0 -2 0 0 0 0 - + model://sun + + + ardrone-black + model://ArDrone2 + 0 10 0.1 0 0 -1.57 + + + + model://wall1 + 0 4 0 0 0 0 + + + + model://wall1 + 0 8 0 0 0 0 + + + + model://wall2 + 0 0 0 0 0 0 + + + + model://wall3 + 0 -6 0 0 0 0 + + + + model://wall4 + 0 -6 0 0 0 0 + + + From d602f0acecb49b53a45ebc4e95595385fcaaac51 Mon Sep 17 00:00:00 2001 From: Abhay Date: Thu, 29 Mar 2018 18:19:36 +0530 Subject: [PATCH 3/4] Walls move with random velocity --- .../gazeboserver/plugins/gymkhana/wall1.cc | 34 +++--- .../gazeboserver/plugins/gymkhana/wall2.cc | 43 ++++---- .../gazeboserver/plugins/gymkhana/wall3.cc | 36 ++++--- .../gazeboserver/plugins/gymkhana/wall4.cc | 102 +++++++++--------- 4 files changed, 115 insertions(+), 100 deletions(-) diff --git a/src/drivers/gazeboserver/plugins/gymkhana/wall1.cc b/src/drivers/gazeboserver/plugins/gymkhana/wall1.cc index 5d3c868ee..2f9572433 100644 --- a/src/drivers/gazeboserver/plugins/gymkhana/wall1.cc +++ b/src/drivers/gazeboserver/plugins/gymkhana/wall1.cc @@ -7,43 +7,47 @@ namespace gazebo { - class Wall1 : public ModelPlugin { + class Wall1 : public ModelPlugin { private: math::Pose pose; - private: bool flag; + private: bool flag; + private: double vel1; + private: double vel2; - public: void Load(physics::ModelPtr _parent, sdf::ElementPtr ) { - this->model = _parent; + public: void Load(physics::ModelPtr _parent, sdf::ElementPtr ) { + this->model = _parent; flag = true; - this->updateConnection = event::Events::ConnectWorldUpdateBegin( - boost::bind(&Wall1::OnUpdate, this, _1)); + this->updateConnection = event::Events::ConnectWorldUpdateBegin( + boost::bind(&Wall1::OnUpdate, this, _1)); std::cout << "Loading wall 1" << std::endl; + this->vel1 = 0.5 + double(rand())/RAND_MAX*1.5; + this->vel2 = (0.5 + double(rand())/RAND_MAX*1.5)*-1; } - public: void OnUpdate(const common::UpdateInfo & ) { + public: void OnUpdate(const common::UpdateInfo & ) { pose = this->model->GetWorldPose(); if (flag) { - this->model->SetLinearVel(math::Vector3(1, 0, 0)); + this->model->SetLinearVel(math::Vector3(this->vel1, 0, 0)); } if ( pose.pos.x >=4 ) { - pose.pos.x = 4; - this->model->SetWorldPose(pose); + pose.pos.x = 4; + this->model->SetWorldPose(pose); flag = false; } if (!flag) { - this->model->SetLinearVel(math::Vector3(-1, 0, 0)); + this->model->SetLinearVel(math::Vector3(this->vel2, 0, 0)); } if ( pose.pos.x <=-4 ) { - pose.pos.x = -4; - this->model->SetWorldPose(pose); + pose.pos.x = -4; + this->model->SetWorldPose(pose); flag = true; } } private: physics::ModelPtr model; private: event::ConnectionPtr updateConnection; - }; - GZ_REGISTER_MODEL_PLUGIN(Wall1) + }; + GZ_REGISTER_MODEL_PLUGIN(Wall1) } diff --git a/src/drivers/gazeboserver/plugins/gymkhana/wall2.cc b/src/drivers/gazeboserver/plugins/gymkhana/wall2.cc index 33988bcf8..5b036c1a9 100644 --- a/src/drivers/gazeboserver/plugins/gymkhana/wall2.cc +++ b/src/drivers/gazeboserver/plugins/gymkhana/wall2.cc @@ -7,43 +7,46 @@ namespace gazebo { - class Wall2 : public ModelPlugin { + class Wall2 : public ModelPlugin { private: math::Pose pose; - private: bool flag; + private: bool flag; + private: double vel1; + private: double vel2; - public: void Load(physics::ModelPtr _parent, sdf::ElementPtr ) { - this->model = _parent; + public: void Load(physics::ModelPtr _parent, sdf::ElementPtr ) { + this->model = _parent; flag = true; - this->updateConnection = event::Events::ConnectWorldUpdateBegin( - boost::bind(&Wall2::OnUpdate, this, _1)); + this->updateConnection = event::Events::ConnectWorldUpdateBegin( + boost::bind(&Wall2::OnUpdate, this, _1)); std::cout << "Loading wall 2" << std::endl; + this->vel1 = 0.5 + double(rand())/RAND_MAX*1.5; + this->vel2 = (0.5 + double(rand())/RAND_MAX*1.5)*-1; } - public: void OnUpdate(const common::UpdateInfo & ) { + public: void OnUpdate(const common::UpdateInfo & ) { pose = this->model->GetWorldPose(); - - - if (flag) { - this->model->SetLinearVel(math::Vector3(0, 0, 0.5)); + + if (flag) { + this->model->SetLinearVel(math::Vector3(0, 0, this->vel1)); } - if ( pose.pos.z >= 2 ) { - pose.pos.z = 2; - this->model->SetWorldPose(pose); + if ( pose.pos.z >= 2.8 ) { + pose.pos.z = 2.8; + this->model->SetWorldPose(pose); flag = false; } if (!flag) { - this->model->SetLinearVel(math::Vector3(0, 0, -0.5)); + this->model->SetLinearVel(math::Vector3(0, 0, this->vel2)); } - if ( pose.pos.z <=0) { - pose.pos.z = 0; - this->model->SetWorldPose(pose); + if ( pose.pos.z <= 0) { + pose.pos.z = 0; + this->model->SetWorldPose(pose); flag = true; } } private: physics::ModelPtr model; private: event::ConnectionPtr updateConnection; - }; - GZ_REGISTER_MODEL_PLUGIN(Wall2) + }; + GZ_REGISTER_MODEL_PLUGIN(Wall2) } diff --git a/src/drivers/gazeboserver/plugins/gymkhana/wall3.cc b/src/drivers/gazeboserver/plugins/gymkhana/wall3.cc index 35c87ccaa..a58cc9607 100644 --- a/src/drivers/gazeboserver/plugins/gymkhana/wall3.cc +++ b/src/drivers/gazeboserver/plugins/gymkhana/wall3.cc @@ -7,43 +7,47 @@ namespace gazebo { - class Wall3 : public ModelPlugin { + class Wall3 : public ModelPlugin { private: math::Pose pose; - private: bool flag; + private: bool flag; + private: double vel1; + private: double vel2; - public: void Load(physics::ModelPtr _parent, sdf::ElementPtr ) { - this->model = _parent; + public: void Load(physics::ModelPtr _parent, sdf::ElementPtr ) { + this->model = _parent; flag = true; - this->updateConnection = event::Events::ConnectWorldUpdateBegin( - boost::bind(&Wall3::OnUpdate, this, _1)); + this->updateConnection = event::Events::ConnectWorldUpdateBegin( + boost::bind(&Wall3::OnUpdate, this, _1)); std::cout << "Loading wall 3" << std::endl; + this->vel1 = 0.5 + double(rand())/RAND_MAX*1.5; + this->vel2 = (0.5 + double(rand())/RAND_MAX*1.5)*-1; } - public: void OnUpdate(const common::UpdateInfo & ) { + public: void OnUpdate(const common::UpdateInfo & ) { pose = this->model->GetWorldPose(); if (flag) { - this->model->SetLinearVel(math::Vector3(1, 0, 0)); + this->model->SetLinearVel(math::Vector3(this->vel1, 0, 0)); } if ( pose.pos.x >=4 ) { - pose.pos.x = 4; - this->model->SetWorldPose(pose); + pose.pos.x = 4; + this->model->SetWorldPose(pose); flag = false; } if (!flag) { - this->model->SetLinearVel(math::Vector3(-1, 0, 0)); + this->model->SetLinearVel(math::Vector3(this->vel2, 0, 0)); } - if ( pose.pos.x <=0 ) { - pose.pos.x = 0; - this->model->SetWorldPose(pose); + if ( pose.pos.x <= 1.25 ) { + pose.pos.x = 1.25; + this->model->SetWorldPose(pose); flag = true; } } private: physics::ModelPtr model; private: event::ConnectionPtr updateConnection; - }; - GZ_REGISTER_MODEL_PLUGIN(Wall3) + }; + GZ_REGISTER_MODEL_PLUGIN(Wall3) } diff --git a/src/drivers/gazeboserver/plugins/gymkhana/wall4.cc b/src/drivers/gazeboserver/plugins/gymkhana/wall4.cc index 7ca87946a..87f8ce9c5 100644 --- a/src/drivers/gazeboserver/plugins/gymkhana/wall4.cc +++ b/src/drivers/gazeboserver/plugins/gymkhana/wall4.cc @@ -1,49 +1,53 @@ -#include -#include -#include -#include -#include -#include - -namespace gazebo -{ - class Wall4 : public ModelPlugin { - - private: math::Pose pose; - private: bool flag; - - public: void Load(physics::ModelPtr _parent, sdf::ElementPtr ) { - this->model = _parent; - flag = true; - this->updateConnection = event::Events::ConnectWorldUpdateBegin( - boost::bind(&Wall4::OnUpdate, this, _1)); - std::cout << "Loading wall 4" << std::endl; - - } - - public: void OnUpdate(const common::UpdateInfo & ) { - pose = this->model->GetWorldPose(); - - if (flag) { - this->model->SetLinearVel(math::Vector3(-1, 0, 0)); - } - if ( pose.pos.x <=-4 ) { - pose.pos.x = -4; - this->model->SetWorldPose(pose); - flag = false; - } - if (!flag) { - this->model->SetLinearVel(math::Vector3(1, 0, 0)); - } - if ( pose.pos.x >=0 ) { - pose.pos.x = 0; - this->model->SetWorldPose(pose); - flag = true; - } - - } - private: physics::ModelPtr model; - private: event::ConnectionPtr updateConnection; - }; - GZ_REGISTER_MODEL_PLUGIN(Wall4) -} +#include +#include +#include +#include +#include +#include + +namespace gazebo +{ + class Wall4 : public ModelPlugin { + + private: math::Pose pose; + private: bool flag; + private: double vel1; + private: double vel2; + + public: void Load(physics::ModelPtr _parent, sdf::ElementPtr ) { + this->model = _parent; + flag = true; + this->updateConnection = event::Events::ConnectWorldUpdateBegin( + boost::bind(&Wall4::OnUpdate, this, _1)); + std::cout << "Loading wall 4" << std::endl; + this->vel1 = 0.5 + double(rand())/RAND_MAX*1.5; + this->vel2 = (0.5 + double(rand())/RAND_MAX*1.5)*-1; + + } + + public: void OnUpdate(const common::UpdateInfo & ) { + pose = this->model->GetWorldPose(); + + if (flag) { + this->model->SetLinearVel(math::Vector3(this->vel2, 0, 0)); + } + if ( pose.pos.x <=-4 ) { + pose.pos.x = -4; + this->model->SetWorldPose(pose); + flag = false; + } + if (!flag) { + this->model->SetLinearVel(math::Vector3(this->vel1, 0, 0)); + } + if ( pose.pos.x >= -1.25 ) { + pose.pos.x = -1.25; + this->model->SetWorldPose(pose); + flag = true; + } + + } + private: physics::ModelPtr model; + private: event::ConnectionPtr updateConnection; + }; + GZ_REGISTER_MODEL_PLUGIN(Wall4) +} From be77da1c4b9d09cb490e45cfbdff933b8235db51 Mon Sep 17 00:00:00 2001 From: Abhay Date: Thu, 29 Mar 2018 18:20:07 +0530 Subject: [PATCH 4/4] Changed decription --- src/drivers/gazeboserver/models/hangar/model.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/drivers/gazeboserver/models/hangar/model.config b/src/drivers/gazeboserver/models/hangar/model.config index 13add50d4..f883b1f97 100644 --- a/src/drivers/gazeboserver/models/hangar/model.config +++ b/src/drivers/gazeboserver/models/hangar/model.config @@ -11,6 +11,6 @@ - The F1 Monaco track without elevations. + The gymkhana hanger for drone exercises.