mirror of
https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git
synced 2025-09-15 13:08:35 +08:00
remove indent in namespace
This commit is contained in:
parent
554c9b3b29
commit
3013cdcff4
@ -24,70 +24,68 @@
|
||||
|
||||
namespace gazebo
|
||||
{
|
||||
class Obstacle1: public ModelPlugin
|
||||
{
|
||||
class Obstacle1: public ModelPlugin
|
||||
{
|
||||
public:
|
||||
void Load(physics::ModelPtr _parent, sdf::ElementPtr /*_sdf*/)
|
||||
{
|
||||
// Store the pointer to the model
|
||||
this->model = _parent;
|
||||
void Load(physics::ModelPtr _parent, sdf::ElementPtr /*_sdf*/)
|
||||
{
|
||||
// Store the pointer to the model
|
||||
this->model = _parent;
|
||||
|
||||
// create the animation
|
||||
gazebo::common::PoseAnimationPtr anim(
|
||||
// name the animation "move_1",
|
||||
// make it last 260 seconds,
|
||||
// and set it on a repeat loop
|
||||
new gazebo::common::PoseAnimation("move1", 160.0, true));
|
||||
// create the animation
|
||||
gazebo::common::PoseAnimationPtr anim(
|
||||
// name the animation "move_1",
|
||||
// make it last 260 seconds,
|
||||
// and set it on a repeat loop
|
||||
new gazebo::common::PoseAnimation("move1", 160.0, true));
|
||||
|
||||
gazebo::common::PoseKeyFrame * key;
|
||||
gazebo::common::PoseKeyFrame * key;
|
||||
|
||||
// set starting location of the box
|
||||
key = anim->CreateKeyFrame(0);
|
||||
key->Translation(ignition::math::Vector3d(0.0, 0.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
// set starting location of the box
|
||||
key = anim->CreateKeyFrame(0);
|
||||
key->Translation(ignition::math::Vector3d(0.0, 0.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
|
||||
key = anim->CreateKeyFrame(10);
|
||||
key->Translation(ignition::math::Vector3d(-0.5, -1.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
key = anim->CreateKeyFrame(10);
|
||||
key->Translation(ignition::math::Vector3d(-0.5, -1.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
|
||||
key = anim->CreateKeyFrame(50);
|
||||
key->Translation(ignition::math::Vector3d(-3.5, -1.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
key = anim->CreateKeyFrame(50);
|
||||
key->Translation(ignition::math::Vector3d(-3.5, -1.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
|
||||
key = anim->CreateKeyFrame(70);
|
||||
key->Translation(ignition::math::Vector3d(-3.7, -3.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
key = anim->CreateKeyFrame(70);
|
||||
key->Translation(ignition::math::Vector3d(-3.7, -3.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
|
||||
key = anim->CreateKeyFrame(90);
|
||||
key->Translation(ignition::math::Vector3d(-3.5, -1.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
key = anim->CreateKeyFrame(90);
|
||||
key->Translation(ignition::math::Vector3d(-3.5, -1.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
|
||||
key = anim->CreateKeyFrame(130);
|
||||
key->Translation(ignition::math::Vector3d(-0.5, -1.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
key = anim->CreateKeyFrame(130);
|
||||
key->Translation(ignition::math::Vector3d(-0.5, -1.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
|
||||
key = anim->CreateKeyFrame(140);
|
||||
key->Translation(ignition::math::Vector3d(0.0, 0.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
key = anim->CreateKeyFrame(140);
|
||||
key->Translation(ignition::math::Vector3d(0.0, 0.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
|
||||
key = anim->CreateKeyFrame(160);
|
||||
key->Translation(ignition::math::Vector3d(0.0, 0.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
key = anim->CreateKeyFrame(160);
|
||||
key->Translation(ignition::math::Vector3d(0.0, 0.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
|
||||
// set the animation
|
||||
_parent->SetAnimation(anim);
|
||||
}
|
||||
|
||||
// Pointer to the model
|
||||
// set the animation
|
||||
_parent->SetAnimation(anim);
|
||||
}
|
||||
|
||||
// Pointer to the model
|
||||
private:
|
||||
physics::ModelPtr model;
|
||||
physics::ModelPtr model;
|
||||
|
||||
// Pointer to the update event connection
|
||||
|
||||
private:
|
||||
event::ConnectionPtr updateConnection;
|
||||
};
|
||||
// Register this plugin with the simulator
|
||||
GZ_REGISTER_MODEL_PLUGIN(Obstacle1)
|
||||
} // namespace gazebo
|
||||
event::ConnectionPtr updateConnection;
|
||||
};
|
||||
// Register this plugin with the simulator
|
||||
GZ_REGISTER_MODEL_PLUGIN(Obstacle1)
|
||||
}// namespace gazebo
|
||||
|
||||
@ -24,85 +24,84 @@
|
||||
|
||||
namespace gazebo
|
||||
{
|
||||
class Obstacle2: public ModelPlugin
|
||||
{
|
||||
class Obstacle2: public ModelPlugin
|
||||
{
|
||||
public:
|
||||
void Load(physics::ModelPtr _parent, sdf::ElementPtr /*_sdf*/)
|
||||
{
|
||||
// Store the pointer to the model
|
||||
this->model = _parent;
|
||||
void Load(physics::ModelPtr _parent, sdf::ElementPtr /*_sdf*/)
|
||||
{
|
||||
// Store the pointer to the model
|
||||
this->model = _parent;
|
||||
|
||||
// create the animation
|
||||
gazebo::common::PoseAnimationPtr anim(
|
||||
// name the animation "move_2",
|
||||
// make it last 260 seconds,
|
||||
// and set it on a repeat loop
|
||||
new gazebo::common::PoseAnimation("move2", 140.0, true));
|
||||
// create the animation
|
||||
gazebo::common::PoseAnimationPtr anim(
|
||||
// name the animation "move_2",
|
||||
// make it last 260 seconds,
|
||||
// and set it on a repeat loop
|
||||
new gazebo::common::PoseAnimation("move2", 140.0, true));
|
||||
|
||||
gazebo::common::PoseKeyFrame * key;
|
||||
gazebo::common::PoseKeyFrame * key;
|
||||
|
||||
// set starting location of the box
|
||||
key = anim->CreateKeyFrame(0);
|
||||
key->Translation(ignition::math::Vector3d(0.0, 0.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
// set starting location of the box
|
||||
key = anim->CreateKeyFrame(0);
|
||||
key->Translation(ignition::math::Vector3d(0.0, 0.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
|
||||
key = anim->CreateKeyFrame(10);
|
||||
key->Translation(ignition::math::Vector3d(0.7, 0.2, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
key = anim->CreateKeyFrame(10);
|
||||
key->Translation(ignition::math::Vector3d(0.7, 0.2, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
|
||||
key = anim->CreateKeyFrame(40);
|
||||
key->Translation(ignition::math::Vector3d(2.5, 3.5, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
key = anim->CreateKeyFrame(40);
|
||||
key->Translation(ignition::math::Vector3d(2.5, 3.5, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
|
||||
key = anim->CreateKeyFrame(55);
|
||||
key->Translation(ignition::math::Vector3d(0.3, 3.5, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
key = anim->CreateKeyFrame(55);
|
||||
key->Translation(ignition::math::Vector3d(0.3, 3.5, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
|
||||
key = anim->CreateKeyFrame(85);
|
||||
key->Translation(ignition::math::Vector3d(3.5, 1.8, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
key = anim->CreateKeyFrame(85);
|
||||
key->Translation(ignition::math::Vector3d(3.5, 1.8, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
|
||||
key = anim->CreateKeyFrame(100);
|
||||
key->Translation(ignition::math::Vector3d(3.5, 0.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
key = anim->CreateKeyFrame(100);
|
||||
key->Translation(ignition::math::Vector3d(3.5, 0.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
|
||||
key = anim->CreateKeyFrame(110);
|
||||
key->Translation(ignition::math::Vector3d(2.0, 0.5, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
key = anim->CreateKeyFrame(110);
|
||||
key->Translation(ignition::math::Vector3d(2.0, 0.5, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
|
||||
key = anim->CreateKeyFrame(115);
|
||||
key->Translation(ignition::math::Vector3d(1.5, 1.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
key = anim->CreateKeyFrame(115);
|
||||
key->Translation(ignition::math::Vector3d(1.5, 1.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
|
||||
key = anim->CreateKeyFrame(120);
|
||||
key->Translation(ignition::math::Vector3d(1.0, 0.5, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
key = anim->CreateKeyFrame(120);
|
||||
key->Translation(ignition::math::Vector3d(1.0, 0.5, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
|
||||
key = anim->CreateKeyFrame(125);
|
||||
key->Translation(ignition::math::Vector3d(0.5, 0.1, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
key = anim->CreateKeyFrame(125);
|
||||
key->Translation(ignition::math::Vector3d(0.5, 0.1, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
|
||||
key = anim->CreateKeyFrame(130);
|
||||
key->Translation(ignition::math::Vector3d(0.0, 0.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
key = anim->CreateKeyFrame(130);
|
||||
key->Translation(ignition::math::Vector3d(0.0, 0.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
|
||||
key = anim->CreateKeyFrame(140);
|
||||
key->Translation(ignition::math::Vector3d(0.0, 0.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
key = anim->CreateKeyFrame(140);
|
||||
key->Translation(ignition::math::Vector3d(0.0, 0.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
|
||||
// set the animation
|
||||
_parent->SetAnimation(anim);
|
||||
}
|
||||
|
||||
// Pointer to the model
|
||||
// set the animation
|
||||
_parent->SetAnimation(anim);
|
||||
}
|
||||
|
||||
// Pointer to the model
|
||||
private:
|
||||
physics::ModelPtr model;
|
||||
// Pointer to the update event connection
|
||||
physics::ModelPtr model;
|
||||
|
||||
// Pointer to the update event connection
|
||||
private:
|
||||
event::ConnectionPtr updateConnection;
|
||||
};
|
||||
// Register this plugin with the simulator
|
||||
GZ_REGISTER_MODEL_PLUGIN(Obstacle2)
|
||||
} // namespace gazebo
|
||||
event::ConnectionPtr updateConnection;
|
||||
};
|
||||
// Register this plugin with the simulator
|
||||
GZ_REGISTER_MODEL_PLUGIN(Obstacle2)
|
||||
}// namespace gazebo
|
||||
|
||||
@ -26,49 +26,48 @@
|
||||
|
||||
namespace gazebo
|
||||
{
|
||||
class Obstacles: public ModelPlugin
|
||||
{
|
||||
class Obstacles: public ModelPlugin
|
||||
{
|
||||
public:
|
||||
void Load(physics::ModelPtr _parent, sdf::ElementPtr /*_sdf*/)
|
||||
{
|
||||
// Store the pointer to the model
|
||||
this->model = _parent;
|
||||
void Load(physics::ModelPtr _parent, sdf::ElementPtr /*_sdf*/)
|
||||
{
|
||||
// Store the pointer to the model
|
||||
this->model = _parent;
|
||||
|
||||
// create the animation
|
||||
gazebo::common::PoseAnimationPtr anim(
|
||||
// name the animation "move",
|
||||
// make it last 40 seconds,
|
||||
// and set it on a repeat loop
|
||||
new gazebo::common::PoseAnimation("move", 40.0, true));
|
||||
// create the animation
|
||||
gazebo::common::PoseAnimationPtr anim(
|
||||
// name the animation "move",
|
||||
// make it last 40 seconds,
|
||||
// and set it on a repeat loop
|
||||
new gazebo::common::PoseAnimation("move", 40.0, true));
|
||||
|
||||
gazebo::common::PoseKeyFrame * key;
|
||||
gazebo::common::PoseKeyFrame * key;
|
||||
|
||||
// set starting location of the box
|
||||
key = anim->CreateKeyFrame(0);
|
||||
key->Translation(ignition::math::Vector3d(0.0, 0.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
// set starting location of the box
|
||||
key = anim->CreateKeyFrame(0);
|
||||
key->Translation(ignition::math::Vector3d(0.0, 0.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 0));
|
||||
|
||||
key = anim->CreateKeyFrame(20);
|
||||
key->Translation(ignition::math::Vector3d(0.0, 0.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, PI));
|
||||
key = anim->CreateKeyFrame(20);
|
||||
key->Translation(ignition::math::Vector3d(0.0, 0.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, PI));
|
||||
|
||||
key = anim->CreateKeyFrame(40);
|
||||
key->Translation(ignition::math::Vector3d(0.0, 0.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 2 * PI));
|
||||
key = anim->CreateKeyFrame(40);
|
||||
key->Translation(ignition::math::Vector3d(0.0, 0.0, 0.0));
|
||||
key->Rotation(ignition::math::Quaterniond(0, 0, 2 * PI));
|
||||
|
||||
// set the animation
|
||||
_parent->SetAnimation(anim);
|
||||
}
|
||||
|
||||
// Pointer to the model
|
||||
// set the animation
|
||||
_parent->SetAnimation(anim);
|
||||
}
|
||||
|
||||
// Pointer to the model
|
||||
private:
|
||||
physics::ModelPtr model;
|
||||
// Pointer to the update event connection
|
||||
physics::ModelPtr model;
|
||||
|
||||
// Pointer to the update event connection
|
||||
private:
|
||||
event::ConnectionPtr updateConnection;
|
||||
};
|
||||
event::ConnectionPtr updateConnection;
|
||||
};
|
||||
// Register this plugin with the simulator
|
||||
GZ_REGISTER_MODEL_PLUGIN(Obstacles)
|
||||
} // namespace gazebo
|
||||
GZ_REGISTER_MODEL_PLUGIN(Obstacles)
|
||||
}// namespace gazebo
|
||||
|
||||
Loading…
Reference in New Issue
Block a user