Skip to content

Commit

Permalink
Add some reformat and copyright notices
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Perez <[email protected]>
  • Loading branch information
Blast545 committed Feb 3, 2021
1 parent 9b516dd commit 1b08d5d
Show file tree
Hide file tree
Showing 11 changed files with 214 additions and 60 deletions.
1 change: 0 additions & 1 deletion bullet/src/Base.hh
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ class Base : public Implements3d<FeatureList<Feature>>
public: std::unordered_map<std::size_t, LinkInfoPtr> links;
public: std::unordered_map<std::size_t, CollisionInfoPtr> collisions;
public: std::unordered_map<std::size_t, JointInfoPtr> joints;
public: std::unordered_map<std::size_t, std::size_t> link_to_collision;

public: int internalTicksDivider = 0;

Expand Down
42 changes: 32 additions & 10 deletions bullet/src/EntityManagementFeatures.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Copyright (C) 2020 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

#include <btBulletDynamicsCommon.h>

#include <string>
Expand All @@ -19,27 +36,29 @@ Identity EntityManagementFeatures::ConstructEmptyWorld(

auto solver = new btSequentialImpulseConstraintSolver;
auto world = new btDiscreteDynamicsWorld(
dispatcher, broadphase, solver, collisionConfiguration);
dispatcher, broadphase, solver, collisionConfiguration);

world->getSolverInfo().m_globalCfm = 0;

return this->AddWorld(
{world, _name, collisionConfiguration, dispatcher, broadphase, solver});
{world, _name, collisionConfiguration, dispatcher, broadphase, solver});
}

/////////////////////////////////////////////////
bool EntityManagementFeatures::RemoveModel(const Identity &_modelID)
{
// Check if the model exists
if (this->models.find(_modelID.id) == this->models.end()){
if (this->models.find(_modelID.id) == this->models.end())
{
return false;
}
// Current implementation does not include joints
// Those should be removed here before removing the model
auto model = this->models.at(_modelID);

// Clean up collisions
std::unordered_map<std::size_t, CollisionInfoPtr>::iterator collision_it = this->collisions.begin();
std::unordered_map<std::size_t, CollisionInfoPtr>::iterator collision_it =
this->collisions.begin();
while (collision_it != this->collisions.end())
{
const auto &collisionInfo = collision_it->second;
Expand Down Expand Up @@ -74,25 +93,27 @@ bool EntityManagementFeatures::RemoveModel(const Identity &_modelID)
}

bool EntityManagementFeatures::ModelRemoved(
const Identity &_modelID) const
const Identity &_modelID) const
{
return this->models.find(_modelID) == this->models.end();
}

bool EntityManagementFeatures::RemoveModelByIndex(
const Identity & _worldID, std::size_t _modelIndex)
const Identity & _worldID, std::size_t _modelIndex)
{
// Check if the model exists
if (this->models.find(_modelIndex) == this->models.end() ||
this->models.at(_modelIndex)->world.id != _worldID.id) {
this->models.at(_modelIndex)->world.id != _worldID.id)
{
return false;
}
// Current implementation does not include joints
// Those should be removed here before removing the model

auto model = this->models.at(_modelIndex);
// Clean up collisions
std::unordered_map<std::size_t, CollisionInfoPtr>::iterator collision_it = this->collisions.begin();
std::unordered_map<std::size_t, CollisionInfoPtr>::iterator collision_it =
this->collisions.begin();
while (collision_it != this->collisions.end())
{
const auto &collisionInfo = collision_it->second;
Expand Down Expand Up @@ -127,7 +148,7 @@ bool EntityManagementFeatures::RemoveModelByIndex(
}

bool EntityManagementFeatures::RemoveModelByName(
const Identity & _worldID, const std::string & _modelName )
const Identity & _worldID, const std::string & _modelName )
{

// Check if there is a model with the requested name
Expand All @@ -145,7 +166,8 @@ bool EntityManagementFeatures::RemoveModelByName(
}
}

if (found) {
if (found)
{
// Use a not valid Identity, not used
return this->RemoveModelByIndex(_worldID, index_id);
}
Expand Down
17 changes: 17 additions & 0 deletions bullet/src/EntityManagementFeatures.hh
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Copyright (C) 2020 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

#ifndef IGNITION_PHYSICS_BULLET_SRC_GETENTITIESFEATURE_HH_
#define IGNITION_PHYSICS_BULLET_SRC_GETENTITIESFEATURE_HH_

Expand Down
17 changes: 17 additions & 0 deletions bullet/src/FreeGroupFeatures.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Copyright (C) 2020 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

#include "FreeGroupFeatures.hh"

namespace ignition {
Expand Down
17 changes: 17 additions & 0 deletions bullet/src/FreeGroupFeatures.hh
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Copyright (C) 2020 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

#ifndef IGNITION_PHYSICS_BULLET_SRC_FREEGROUPFEATURES_HH_
#define IGNITION_PHYSICS_BULLET_SRC_FREEGROUPFEATURES_HH_

Expand Down
17 changes: 17 additions & 0 deletions bullet/src/KinematicsFeatures.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Copyright (C) 2020 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

#include <ignition/common/Console.hh>
#include "KinematicsFeatures.hh"

Expand Down
17 changes: 17 additions & 0 deletions bullet/src/KinematicsFeatures.hh
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Copyright (C) 2020 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

#ifndef IGNITION_PHYSICS_BULLET_SRC_KINEMATICSFEATURES_HH_
#define IGNITION_PHYSICS_BULLET_SRC_KINEMATICSFEATURES_HH_

Expand Down
Loading

0 comments on commit 1b08d5d

Please sign in to comment.