Skip to content

Commit

Permalink
Merged ros-industrial-attic#63 from main repo. Fixed small warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
sjulier committed Apr 5, 2023
1 parent 42eb88a commit 3cc0081
Show file tree
Hide file tree
Showing 15 changed files with 74 additions and 31 deletions.
31 changes: 23 additions & 8 deletions base_placement_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
cmake_minimum_required(VERSION 2.8.3)

cmake_policy(SET CMP0048 NEW)
project(base_placement_plugin)

# Load catkin and all dependencies required for this package
Expand All @@ -20,16 +21,25 @@ find_package(catkin REQUIRED COMPONENTS
moveit_core
)

find_package(Qt4 COMPONENTS QtCore QtGui REQUIRED)

include(${QT_USE_FILE})

if(rviz_QT_VERSION VERSION_LESS "5")
message(STATUS "Using Qt4 based on the rviz_QT_VERSION: ${rviz_QT_VERSION}")
find_package(Qt4 ${rviz_QT_VERSION} EXACT REQUIRED QtCore QtGui)
## pull in all required include dirs, define QT_LIBRARIES, etc.
include(${QT_USE_FILE})
else()
message(STATUS "Using Qt5 based on the rviz_QT_VERSION: ${rviz_QT_VERSION}")
find_package(Qt5 ${rviz_QT_VERSION} EXACT REQUIRED Core Widgets Concurrent)
## make target_link_libraries(${QT_LIBRARIES}) pull in all required dependencies
set(QT_LIBRARIES Qt5::Widgets Qt5::Concurrent)
endif()
find_package(HDF5 REQUIRED)

add_definitions(-DQT_NO_KEYWORDS)


add_library(create_marker src/create_marker.cpp)
target_link_libraries(create_marker ${catkin_LIBRARIES} )
target_link_libraries(create_marker ${QT_LIBRARIES} ${catkin_LIBRARIES} )

set(base_placement_plugin_SRCS
src/add_way_point.cpp
Expand Down Expand Up @@ -77,12 +87,17 @@ catkin_package(
map_creator
)

qt4_wrap_cpp(base_placement_plugin_MOCS ${base_placement_plugin_HDRS} )
qt4_wrap_ui(base_placement_plugin_UIS_H ${base_placement_plugin_UIS} )
if(rviz_QT_VERSION VERSION_LESS "5")
qt4_wrap_cpp(base_placement_plugin_MOCS ${base_placement_plugin_HDRS} )
qt4_wrap_ui(base_placement_plugin_UIS_H ${base_placement_plugin_UIS} )
else()
qt5_wrap_cpp(base_placement_plugin_MOCS ${base_placement_plugin_HDRS} )
qt5_wrap_ui(base_placement_plugin_UIS_H ${base_placement_plugin_UIS} )
endif()

include_directories(${base_placement_plugin_INCLUDE_DIRECTORIES} ${catkin_INCLUDE_DIRS})
include_directories(${base_placement_plugin_INCLUDE_DIRECTORIES} ${catkin_INCLUDE_DIRS} ${HDF5_INCLUDE_DIRS})
add_library(${PROJECT_NAME} ${base_placement_plugin_SRCS} ${base_placement_plugin_MOCS} ${base_placement_plugin_UIS_H}) # ${base_placement_plugin_UIS_H}
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} yaml-cpp -lhdf5 -lhdf5_cpp create_marker)
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_LIBRARIES} yaml-cpp ${HDF5_LIBRARIES} create_marker)
## target_link_libraries(${PROJECT_NAME} yaml-cpp)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,19 @@
#include <Eigen/Eigen>
#include <eigen_conversions/eigen_msg.h>

#include<moveit/move_group_interface/move_group.h>
#include<moveit/robot_state/robot_state.h>

#include<moveit/robot_model_loader/robot_model_loader.h>
#include<moveit/robot_model/robot_model.h>
#include<moveit/robot_model/joint_model_group.h>
#include<moveit/robot_model/link_model.h>

#if ROS_VERSION_MINIMUM(1,12,0)
#include <moveit/move_group_interface/move_group_interface.h>
typedef moveit::planning_interface::MoveGroupInterface MoveGroupInterface;
#else
#include <moveit/move_group_interface/move_group.h>
typedef moveit::planning_interface::MoveGroup MoveGroupInterface;
#endif

typedef std::multimap<std::vector<double>,geometry_msgs::Pose> BasePoseJoint;

Expand Down Expand Up @@ -52,7 +57,7 @@ class CreateMarker{

std::string group_name_;
ros::AsyncSpinner spinner;
boost::scoped_ptr<moveit::planning_interface::MoveGroup> group_;
boost::scoped_ptr<MoveGroupInterface> group_;
std::string parent_link;
moveit::core::RobotModelConstPtr robot_model_; //Robot model const pointer
};
Expand Down
13 changes: 12 additions & 1 deletion base_placement_plugin/include/base_placement_plugin/place_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@
#include<base_placement_plugin/create_marker.h>

#include<moveit/planning_scene_monitor/planning_scene_monitor.h>
#include<moveit/move_group_interface/move_group.h>
#include<moveit/robot_model_loader/robot_model_loader.h>
#if ROS_VERSION_MINIMUM(1,12,0)
#include <moveit/move_group_interface/move_group_interface.h>
typedef moveit::planning_interface::MoveGroupInterface MoveGroupInterface;
#else
#include <moveit/move_group_interface/move_group.h>
typedef moveit::planning_interface::MoveGroup MoveGroupInterface;
#endif
#include<moveit/robot_model/robot_model.h>
#include<moveit/robot_model/joint_model_group.h>
#include<moveit/robot_state/robot_state.h>
Expand All @@ -19,7 +25,12 @@

#include <QObject>
#include <QTimer>
#if QT_VERSION < 0x050000
#error oh dear
#include <QtConcurrentRun>
#else
#include <QtConcurrent>
#endif
#include <QFuture>

#ifndef PLACE_BASE_H_
Expand Down
2 changes: 1 addition & 1 deletion base_placement_plugin/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<library path="lib/libbase_placement_plugin">
<class name="base_placement_plugin/Base Placement Plug-in"
type="base_placement_plugin::AddWayPoint"
base_class_type="rviz::Panel">
base_class_type="rviz::Panel"/>
<description>
Tool for visualizing base placement methods
</description>
Expand Down
2 changes: 1 addition & 1 deletion base_placement_plugin/src/create_marker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ double unifRand()
CreateMarker::CreateMarker(std::string group_name) : spinner(1), group_name_(group_name)
{
spinner.start();
group_.reset(new moveit::planning_interface::MoveGroup(group_name_));
group_.reset(new MoveGroupInterface(group_name_));
//ROS_INFO_STREAM("Selected planning group: "<< group_->getName());
robot_model_ = group_->getRobotModel();
}
Expand Down
4 changes: 2 additions & 2 deletions base_placement_plugin/src/widgets/base_placement_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

#include <map_creator/hdf5_dataset.h>

#include <H5Cpp.h>
#include <hdf5.h>
#include <hdf5/serial/H5Cpp.h>
#include <hdf5/serial/hdf5.h>

namespace base_placement_plugin
{
Expand Down
11 changes: 7 additions & 4 deletions map_creator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ find_package(catkin REQUIRED COMPONENTS
)

find_package(octomap REQUIRED)

find_package(HDF5 REQUIRED)
find_package(MPI REQUIRED)
find_package(LAPACK REQUIRED)
add_message_files(
FILES
capShape.msg
Expand All @@ -44,15 +46,16 @@ catkin_package(
CATKIN_DEPENDS message_runtime
)

include_directories(include ${catkin_INCLUDE_DIRS} ${OCTOMAP_INCLUDE_DIRS} ${HDF5_INCLUDE_DIR} ${PCL_INCLUDE_DIR})
include_directories(include ${catkin_INCLUDE_DIRS} ${OCTOMAP_INCLUDE_DIRS} ${HDF5_INCLUDE_DIRS} ${PCL_INCLUDE_DIR}
${MPI_CXX_INCLUDE_DIRS})

add_library(sphere_discretization src/sphere_discretization.cpp)
add_library(kinematics src/kinematics.cpp )
add_library(hdf5_dataset src/hdf5_dataset.cpp)

target_link_libraries(sphere_discretization ${catkin_LIBRARIES} ${OCTOMAP_LIBRARIES} ${PCL_LIBRARY_DIRS})
target_link_libraries(kinematics ${catkin_LIBRARIES} -llapack)
target_link_libraries(hdf5_dataset ${catkin_LIBRARIES} -lhdf5 -lhdf5_cpp)
target_link_libraries(kinematics ${catkin_LIBRARIES} ${LAPACK_LIBRARIES})
target_link_libraries(hdf5_dataset ${catkin_LIBRARIES} ${HDF5_LIBRARIES} ${MPI_CXX_LIBRARIES})

install(TARGETS sphere_discretization kinematics hdf5_dataset
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
Expand Down
4 changes: 2 additions & 2 deletions map_creator/include/map_creator/hdf5_dataset.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef HDF5_DATASET_H
#define HDF5_DATASET_H
#include "H5Cpp.h"
#include <hdf5.h>
#include <hdf5/serial/H5Cpp.h>
#include <hdf5/serial/hdf5.h>
#include <iostream>
#include <ros/ros.h>

Expand Down
1 change: 1 addition & 0 deletions map_creator/include/map_creator/mh5_ikfast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#define IKFAST_HAS_LIBRARY
#include "ikfast.h" // found inside share/openrave-X.Y/python/ikfast.h
using namespace ikfast;
using namespace std;

// check if the included ikfast version matches what this file was compiled with
#define IKFAST_COMPILE_ASSERT(x) extern int __dummy[(int)x]
Expand Down
Binary file modified map_creator/maps/motoman_mh5_r0.08_reachability.h5
Binary file not shown.
3 changes: 2 additions & 1 deletion map_creator/src/create_capability_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
#include <sstream>
#include <map_creator/sphere_discretization.h>
#include <map_creator/kinematics.h>
#include<map_creator/hdf5_dataset.h>
#include <map_creator/hdf5_dataset.h>
#include <boost/format.hpp>

//struct stat st;

Expand Down
5 changes: 3 additions & 2 deletions map_creator/src/create_inverse_reachability_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include <string>
#include <time.h>
#include <boost/format.hpp>
//struct stat st;

int main(int argc, char **argv)
Expand Down Expand Up @@ -63,8 +64,8 @@ ros::init(argc, argv, "inverse_workspace");
h5_res.open();
h5_res.h5ToResolution(res);
h5_res.close();
file = str(boost::format("%s_r%d_Inv_reachability.h5") % k.getRobotName() % res);
filename = path + file;
file = (boost::format("%s_r%d_Inv_reachability.h5") % k.getRobotName() % res).str();
filename = path + file;
}
}

Expand Down
4 changes: 2 additions & 2 deletions map_creator/src/create_reachability_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#include <sstream>
#include <map_creator/sphere_discretization.h>
#include <map_creator/kinematics.h>
#include<map_creator/hdf5_dataset.h>

#include <map_creator/hdf5_dataset.h>
#include <boost/format.hpp>
//struct stat st;

typedef std::vector<std::pair< std::vector< double >, const std::vector< double >* > > MultiVector;
Expand Down
12 changes: 8 additions & 4 deletions map_creator/src/hdf5_dataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ bool Hdf5Dataset::open()

this->attr_ = H5Aopen(this->sphere_dataset_, "Resolution", H5P_DEFAULT);
herr_t ret = H5Aread(this->attr_, H5T_NATIVE_FLOAT, &this->res_);

return true;
}

bool Hdf5Dataset::open_cap()
Expand All @@ -88,7 +88,7 @@ bool Hdf5Dataset::open_cap()

this->attr_ = H5Aopen(this->capability_dataset_, "Resolution", H5P_DEFAULT);
herr_t ret = H5Aread(this->attr_, H5T_NATIVE_FLOAT, &this->res_);

return true;
}

void Hdf5Dataset::close()
Expand Down Expand Up @@ -116,6 +116,7 @@ bool Hdf5Dataset::checkPath(std::string path)
ROS_INFO("Path does not exist yet");
//return false;
}
return true;
}

void Hdf5Dataset::createPath(std::string path)
Expand All @@ -137,6 +138,7 @@ bool Hdf5Dataset::checkFileName(std::string filename)
ROS_ERROR("Please provide an extension of .h5 It will make life easy");
exit(1);
}
return true;
}

bool Hdf5Dataset::saveCapMapsToDataset(VectorOfVectors &capability_data, float &resolution)
Expand Down Expand Up @@ -248,7 +250,7 @@ bool Hdf5Dataset::saveReachMapsToDataset( MultiMapPtr& poses, MapVecDoublePtr&
// Create Dataset Property list
hid_t plist = H5Pcreate(H5P_DATASET_CREATE);
H5Pset_layout(plist, H5D_CHUNKED);
hsize_t chunk_dims[ndims] = {chunk_size, ncols};
hsize_t chunk_dims[ndims] = {hsize_t(chunk_size), ncols};
H5Pset_chunk(plist, ndims, chunk_dims);


Expand Down Expand Up @@ -288,7 +290,7 @@ bool Hdf5Dataset::saveReachMapsToDataset( MultiMapPtr& poses, MapVecDoublePtr&
// Selecting hyperslab on the dataset
file_space = H5Dget_space(this->poses_dataset_);
hsize_t start[2] = {0, 0};
hsize_t count[2] = {chunk_size, ncols};
hsize_t count[2] = {hsize_t(chunk_size), ncols};
H5Sselect_hyperslab(file_space, H5S_SELECT_SET, start, NULL, count, NULL);

// Writing buffer to the dataset
Expand Down Expand Up @@ -376,6 +378,7 @@ bool Hdf5Dataset::saveReachMapsToDataset( MultiMapPtr& poses, MapVecDoublePtr&
H5Sclose(file_space);
H5Sclose(mem_space);
close();
return true;
}

bool Hdf5Dataset::h5ToVectorCap(VectorOfVectors &capability_data)
Expand Down Expand Up @@ -458,6 +461,7 @@ bool Hdf5Dataset::h5ToMultiMapPoses(MultiMap& pose_col)
{
MapVecDouble sphere_col;
h5ToMultiMapPoses(pose_col, sphere_col);
return true;
}

bool Hdf5Dataset::h5ToMultiMapPoses(MultiMap& pose_col, MapVecDouble& sphere_col)
Expand Down
2 changes: 2 additions & 0 deletions workspace_visualization/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ link_directories(${catkin_LIBRARY_DIRS})

set(CMAKE_AUTOMOC ON)

message(rviz_QT_VERSION=${rviz_QT_VERSION})

if(rviz_QT_VERSION VERSION_LESS "5")
message(STATUS "Using Qt4 based on the rviz_QT_VERSION: ${rviz_QT_VERSION}")
find_package(Qt4 ${rviz_QT_VERSION} EXACT REQUIRED QtCore QtGui)
Expand Down

0 comments on commit 3cc0081

Please sign in to comment.