Skip to content

Commit

Permalink
4.0 Resolve cppcheck errors
Browse files Browse the repository at this point in the history
  • Loading branch information
aswathselvam committed Dec 13, 2021
1 parent 43c5d12 commit b2e1897
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 18 deletions.
50 changes: 37 additions & 13 deletions Results/cppcheckoutput.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,51 @@
Checking include/swarm_robots/agent.hpp ...
1/25 files checked 4% done
Checking include/swarm_robots/agent_node.hpp ...
2/25 files checked 11% done
Checking include/swarm_robots/arena.hpp ...
3/25 files checked 14% done
Checking include/swarm_robots/forward_kinematics.hpp ...
4/25 files checked 18% done
Checking include/swarm_robots/inverse_kinematics.hpp ...
5/25 files checked 22% done
Checking include/swarm_robots/obstacle.hpp ...
6/25 files checked 25% done
Checking include/swarm_robots/path_planner.hpp ...
7/25 files checked 31% done
Checking include/swarm_robots/safety_check.hpp ...
8/25 files checked 35% done
Checking include/swarm_robots/state.hpp ...
9/25 files checked 38% done
Checking include/swarm_robots/swarm_master.hpp ...
10/25 files checked 40% done
Checking src/action_client.cpp ...
11/25 files checked 41% done
Checking src/action_server.cpp ...
12/25 files checked 43% done
Checking src/agent.cpp ...
1/13 files checked 8% done
13/25 files checked 47% done
Checking src/agent_node.cpp ...
2/13 files checked 21% done
14/25 files checked 54% done
Checking src/arena.cpp ...
3/13 files checked 24% done
15/25 files checked 56% done
Checking src/forward_kinematics.cpp ...
4/13 files checked 31% done
16/25 files checked 59% done
Checking src/inverse_kinematics.cpp ...
5/13 files checked 39% done
17/25 files checked 64% done
Checking src/main.cpp ...
6/13 files checked 40% done
18/25 files checked 65% done
Checking src/obstacle.cpp ...
7/13 files checked 42% done
19/25 files checked 66% done
Checking src/path_planner.cpp ...
Checking src/path_planner.cpp: DEBUG...
8/13 files checked 80% done
20/25 files checked 85% done
Checking src/safety_check.cpp ...
9/13 files checked 87% done
21/25 files checked 88% done
Checking src/state.cpp ...
10/13 files checked 90% done
22/25 files checked 90% done
Checking src/swarm_master.cpp ...
11/13 files checked 94% done
23/25 files checked 92% done
Checking test/main.cpp ...
12/13 files checked 96% done
24/25 files checked 93% done
Checking test/testswarm.cpp ...
13/13 files checked 100% done
25/25 files checked 100% done
3 changes: 3 additions & 0 deletions Results/cpplintoutput.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Done processing ./include/swarm_robots/path_planner.hpp
Done processing ./include/swarm_robots/safety_check.hpp
Done processing ./include/swarm_robots/state.hpp
Done processing ./include/swarm_robots/swarm_master.hpp
Done processing ./src/action_client.cpp
Done processing ./src/action_server.cpp
Done processing ./src/agent.cpp
Done processing ./src/agent_node.cpp
Done processing ./src/arena.cpp
Expand All @@ -21,3 +23,4 @@ Done processing ./src/state.cpp
Done processing ./src/swarm_master.cpp
Done processing ./test/main.cpp
Done processing ./test/testswarm.cpp
Total errors found: 55
2 changes: 2 additions & 0 deletions src/agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ Agent::Agent(string agent_id) {
this->velocity_.y_ = 0;
this->velocity_.yaw_ = 0;
this->heading_angle_ = 180;
this->forward_kinematics_= NULL;
this->inverse_kinematics_ = NULL;
}

void Agent::PlanPath() {
Expand Down
2 changes: 1 addition & 1 deletion src/inverse_kinematics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void InverseKinematics::execute(const swarm_robots::swarmACTGoalConstPtr& goal,
}


State InverseKinematics::PerformIK(State start, State goal) {
State InverseKinematics::PerformIK(const State& start, const State& goal) {
this->current_location_ = start;
this->goal_location_ = goal;
State vel = PerformModelIK();
Expand Down
8 changes: 5 additions & 3 deletions src/path_planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,18 @@ using std::string;
} while (false)
#endif

PathPlanner::PathPlanner(std::string ns, ros::NodeHandlePtr nh) {
PathPlanner::PathPlanner(const std::string ns, ros::NodeHandlePtr nh) {
this->ns = "_jackal_" + ns;
this->fixed_frame = "map";
this->nh_ = nh;
this->success_ = false;
this->oct_tree_ = NULL;
// ros::Subscriber octree_sub =
// n.subscribe("/octomap_binary", 1, octomapCallback);
this->vis_pub_ =
nh_->advertise<visualization_msgs::Marker>("visualization_marker" + this->ns, 0); // NOLINT
DEBUG_MSG("OMPL version: " << OMPL_VERSION << std::endl);

CreateEmptyMap();
// space = ob::StateSpacePtr(new ob::SE2StateSpace());
}

Expand All @@ -86,7 +88,7 @@ bool PathPlanner::IsStateValid(const ob::State *state) {
}
}

bool PathPlanner::Plan(State start, State goal) {
bool PathPlanner::Plan(const State &start, State &goal) {
/*
// construct the state space we are planning in
Expand Down
2 changes: 1 addition & 1 deletion src/swarm_master.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ int main(int argc, char** argv) {
ros::init(argc, argv, "swarm_master");
ROS_INFO_STREAM("Initialized node swarm_master.");
vector<AgentNode*> agent_nodes;
int n = 20;
try {
int n = 20;
for (int i = 0; i < n; i++) {
AgentNode* agent_node = new AgentNode(std::to_string(i));
agent_nodes.push_back(agent_node);
Expand Down

0 comments on commit b2e1897

Please sign in to comment.