Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Travis: Update to Noetic and fix various warnings #79

Merged
merged 7 commits into from
Oct 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 43 additions & 34 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,66 +1,75 @@
---
BasedOnStyle: Google
ColumnLimit: 120
MaxEmptyLinesToKeep: 1
SortIncludes: false

Standard: Auto
IndentWidth: 2
TabWidth: 2
UseTab: Never
AccessModifierOffset: -2
ConstructorInitializerIndentWidth: 2
NamespaceIndentation: None
ContinuationIndentWidth: 4
IndentCaseLabels: true
IndentFunctionDeclarationAfterType: false

AlignEscapedNewlinesLeft: false
AlignTrailingComments: true

AllowAllParametersOfDeclarationOnNextLine: false
ExperimentalAutoDetectBinPacking: false
ObjCSpaceBeforeProtocolList: true
Cpp11BracedListStyle: false

AllowShortBlocksOnASingleLine: true
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortLoopsOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false

AlwaysBreakTemplateDeclarations: true
AlwaysBreakBeforeMultilineStrings: false
BreakBeforeBinaryOperators: false
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: true

BinPackParameters: true
ColumnLimit: 120
ConstructorInitializerAllOnOneLineOrOnePerLine: true
DerivePointerBinding: false
PointerBindsToType: true
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: true
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 60
PenaltyBreakString: 1
PenaltyBreakFirstLessLess: 1000
PenaltyExcessCharacter: 1000
PenaltyReturnTypeOnItsOwnLine: 90

PenaltyExcessCharacter: 50
PenaltyBreakBeforeFirstCallParameter: 30
PenaltyBreakComment: 1000
PenaltyBreakFirstLessLess: 10
PenaltyBreakString: 100
PenaltyReturnTypeOnItsOwnLine: 50

SpacesBeforeTrailingComments: 2
Cpp11BracedListStyle: false
Standard: Auto
IndentWidth: 2
TabWidth: 2
UseTab: Never
IndentFunctionDeclarationAfterType: false
SpacesInParentheses: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpaceAfterCStyleCast: false
SpaceAfterControlStatementKeyword: true
SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 4
SortIncludes: false
SpaceAfterCStyleCast: false

# Configure each individual brace in BraceWrapping
BreakBeforeBraces: Custom

# Control of individual brace wrapping cases
BraceWrapping: {
AfterClass: 'true'
AfterControlStatement: 'true'
AfterEnum : 'true'
AfterFunction : 'true'
AfterNamespace : 'true'
AfterStruct : 'true'
AfterUnion : 'true'
BeforeCatch : 'true'
BeforeElse : 'true'
IndentBraces : 'false'
}
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
...
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ cache: ccache

env:
global:
- DOCKER_IMAGE=moveit/moveit:master-source
- CXXFLAGS="-Wall -Wextra -Wwrite-strings -Wunreachable-code -Wpointer-arith -Wredundant-decls -Wno-unused-parameter -Wno-unused-function"
- ROS_DISTRO=noetic
- ROS_REPO=ros-testing
- CXXFLAGS="-Wall -Wextra -Wwrite-strings -Wunreachable-code -Wpointer-arith -Wredundant-decls"
- WARNINGS_OK=false
matrix:
- TEST="clang-format catkin_lint"
- TEST=clang-tidy-fix
- DOCKER_IMAGE=moveit/moveit:master-source
- DOCKER_IMAGE=moveit/moveit:master-source ROS_REPO=

before_script:
- git clone -q --depth=1 https://github.com/ros-planning/moveit_ci.git .moveit_ci
Expand Down
7 changes: 2 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,10 @@ catkin_package(
)

## Build
include_directories(include)
include_directories(SYSTEM
${EIGEN3_INCLUDE_DIRS}
)

include_directories(
include
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIRS}
)

# Visualization Tools Library
Expand Down
10 changes: 1 addition & 9 deletions include/moveit_visual_tools/imarker_end_effector.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@

namespace moveit_visual_tools
{
using visualization_msgs::InteractiveMarkerFeedback;
using visualization_msgs::InteractiveMarkerControl;
using visualization_msgs::InteractiveMarkerFeedback;

typedef std::function<void(const visualization_msgs::InteractiveMarkerFeedbackConstPtr&, const Eigen::Isometry3d&)>
IMarkerCallback;
Expand Down Expand Up @@ -177,12 +177,4 @@ typedef std::shared_ptr<IMarkerEndEffector> IMarkerEndEffectorPtr;
typedef std::shared_ptr<const IMarkerEndEffector> IMarkerEndEffectorConstPtr;
} // namespace moveit_visual_tools

namespace
{
/** \brief Collision checking handle for IK solvers */
bool isStateValid(const planning_scene::PlanningScene* planning_scene, bool verbose, bool only_check_self_collision,
const moveit_visual_tools::MoveItVisualToolsPtr& visual_tools_, moveit::core::RobotState* state,
const moveit::core::JointModelGroup* group, const double* ik_solution);
}

#endif // MOVEIT_VISUAL_TOOLS_IMARKER_END_EFFECTOR_H
10 changes: 1 addition & 9 deletions include/moveit_visual_tools/imarker_robot_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@

namespace moveit_visual_tools
{
using visualization_msgs::InteractiveMarkerFeedback;
using visualization_msgs::InteractiveMarkerControl;
using visualization_msgs::InteractiveMarkerFeedback;

typedef std::function<void(const visualization_msgs::InteractiveMarkerFeedbackConstPtr&, const Eigen::Isometry3d&)>
IMarkerCallback;
Expand Down Expand Up @@ -182,12 +182,4 @@ typedef std::shared_ptr<IMarkerRobotState> IMarkerRobotStatePtr;
typedef std::shared_ptr<const IMarkerRobotState> IMarkerRobotStateConstPtr;
} // namespace moveit_visual_tools

namespace
{
/** \brief Collision checking handle for IK solvers */
bool isIKStateValid(const planning_scene::PlanningScene* planning_scene, bool verbose, bool only_check_self_collision,
const moveit_visual_tools::MoveItVisualToolsPtr& visual_tools_, moveit::core::RobotState* state,
const moveit::core::JointModelGroup* group, const double* ik_solution);
}

#endif // MOVEIT_VISUAL_TOOLS_IMARKER_ROBOT_STATE_H
112 changes: 56 additions & 56 deletions src/imarker_end_effector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,61 @@
#include <moveit_visual_tools/imarker_robot_state.h>
#include <moveit_visual_tools/imarker_end_effector.h>

namespace
{
bool isStateValid(const planning_scene::PlanningScene* planning_scene, bool verbose, bool only_check_self_collision,
const moveit_visual_tools::MoveItVisualToolsPtr& visual_tools, moveit::core::RobotState* robot_state,
const moveit::core::JointModelGroup* group, const double* ik_solution)
{
// Apply IK solution to robot state
robot_state->setJointGroupPositions(group, ik_solution);
robot_state->update();

#if 0 // Ensure there are objects in the planning scene
const std::size_t num_collision_objects = planning_scene->getCollisionEnv()->getWorld()->size();
if (num_collision_objects == 0)
{
ROS_ERROR_STREAM_NAMED("cart_path_planner", "No collision objects exist in world, you need at least a table "
"modeled for the controller to work");
ROS_ERROR_STREAM_NAMED("cart_path_planner", "To fix this, relaunch the teleop/head tracking/whatever MoveIt "
"node to publish the collision objects");
return false;
}
#endif

if (!planning_scene)
{
ROS_ERROR_STREAM_NAMED("cart_path_planner", "No planning scene provided");
return false;
}
if (only_check_self_collision)
{
// No easy API exists for only checking self-collision, so we do it here.
// TODO(davetcoleman): move this into planning_scene.cpp
collision_detection::CollisionRequest req;
req.verbose = verbose;
req.group_name = group->getName();
collision_detection::CollisionResult res;
planning_scene->checkSelfCollision(req, res, *robot_state);
if (!res.collision)
return true; // not in collision
}
else if (!planning_scene->isStateColliding(*robot_state, group->getName()))
return true; // not in collision

// Display more info about the collision
if (verbose)
{
visual_tools->publishRobotState(*robot_state, rviz_visual_tools::RED);
planning_scene->isStateColliding(*robot_state, group->getName(), true);
visual_tools->publishContactPoints(*robot_state, planning_scene);
}
ROS_WARN_STREAM_THROTTLE_NAMED(2.0, "cart_path_planner", "Collision");
return false;
}

} // namespace

namespace moveit_visual_tools
{
IMarkerEndEffector::IMarkerEndEffector(IMarkerRobotState* imarker_parent, const std::string& imarker_name,
Expand Down Expand Up @@ -174,7 +229,7 @@ void IMarkerEndEffector::initializeInteractiveMarkers()
make6DofMarker(pose_msg);
}

void IMarkerEndEffector::updateIMarkerPose(const Eigen::Isometry3d& pose)
void IMarkerEndEffector::updateIMarkerPose(const Eigen::Isometry3d& /*pose*/)
{
// Move marker to tip of fingers
// imarker_pose_ = pose * imarker_offset_.inverse();
Expand Down Expand Up @@ -269,58 +324,3 @@ IMarkerEndEffector::makeBoxControl(visualization_msgs::InteractiveMarker& msg)
}

} // namespace moveit_visual_tools

namespace
{
bool isStateValid(const planning_scene::PlanningScene* planning_scene, bool verbose, bool only_check_self_collision,
const moveit_visual_tools::MoveItVisualToolsPtr& visual_tools, moveit::core::RobotState* robot_state,
const moveit::core::JointModelGroup* group, const double* ik_solution)
{
// Apply IK solution to robot state
robot_state->setJointGroupPositions(group, ik_solution);
robot_state->update();

#if 0 // Ensure there are objects in the planning scene
const std::size_t num_collision_objects = planning_scene->getCollisionEnv()->getWorld()->size();
if (num_collision_objects == 0)
{
ROS_ERROR_STREAM_NAMED("cart_path_planner", "No collision objects exist in world, you need at least a table "
"modeled for the controller to work");
ROS_ERROR_STREAM_NAMED("cart_path_planner", "To fix this, relaunch the teleop/head tracking/whatever MoveIt "
"node to publish the collision objects");
return false;
}
#endif

if (!planning_scene)
{
ROS_ERROR_STREAM_NAMED("cart_path_planner", "No planning scene provided");
return false;
}
if (only_check_self_collision)
{
// No easy API exists for only checking self-collision, so we do it here.
// TODO(davetcoleman): move this into planning_scene.cpp
collision_detection::CollisionRequest req;
req.verbose = verbose;
req.group_name = group->getName();
collision_detection::CollisionResult res;
planning_scene->checkSelfCollision(req, res, *robot_state);
if (!res.collision)
return true; // not in collision
}
else if (!planning_scene->isStateColliding(*robot_state, group->getName()))
return true; // not in collision

// Display more info about the collision
if (verbose)
{
visual_tools->publishRobotState(*robot_state, rviz_visual_tools::RED);
planning_scene->isStateColliding(*robot_state, group->getName(), true);
visual_tools->publishContactPoints(*robot_state, planning_scene);
}
ROS_WARN_STREAM_THROTTLE_NAMED(2.0, "cart_path_planner", "Collision");
return false;
}

} // namespace
Loading