Skip to content
Snippets Groups Projects
Commit fad55256 authored by Olivier Stasse's avatar Olivier Stasse
Browse files

Add a clean up procedure and change the dependency from bullet to tf2_bullet.

parent 211bdd65
No related branches found
No related tags found
No related merge requests found
...@@ -67,7 +67,7 @@ dynamic_graph_bridge_msgs) ...@@ -67,7 +67,7 @@ dynamic_graph_bridge_msgs)
add_required_dependency(roscpp) add_required_dependency(roscpp)
add_required_dependency(tf) add_required_dependency(tf)
add_required_dependency("realtime_tools >= 1.8") add_required_dependency("realtime_tools >= 1.8")
add_required_dependency(bullet) add_required_dependency(tf2_bullet)
ADD_REQUIRED_DEPENDENCY("pinocchio") ADD_REQUIRED_DEPENDENCY("pinocchio")
ADD_REQUIRED_DEPENDENCY("dynamic-graph >= 3.0.0") ADD_REQUIRED_DEPENDENCY("dynamic-graph >= 3.0.0")
ADD_REQUIRED_DEPENDENCY("dynamic-graph-python >= 3.0.0") ADD_REQUIRED_DEPENDENCY("dynamic-graph-python >= 3.0.0")
...@@ -89,7 +89,7 @@ add_library(ros_bridge ...@@ -89,7 +89,7 @@ add_library(ros_bridge
include/dynamic_graph_bridge/ros_init.hh src/ros_init.cpp include/dynamic_graph_bridge/ros_init.hh src/ros_init.cpp
src/sot_to_ros.hh src/sot_to_ros.cpp src/sot_to_ros.hh src/sot_to_ros.cpp
) )
pkg_config_use_dependency(ros_bridge bullet) pkg_config_use_dependency(ros_bridge tf2_bullet)
pkg_config_use_dependency(ros_bridge dynamic_graph_bridge_msgs) pkg_config_use_dependency(ros_bridge dynamic_graph_bridge_msgs)
install(TARGETS ros_bridge DESTINATION lib) install(TARGETS ros_bridge DESTINATION lib)
...@@ -184,7 +184,7 @@ generate_messages( DEPENDENCIES std_msgs ) ...@@ -184,7 +184,7 @@ generate_messages( DEPENDENCIES std_msgs )
# This is necessary so that the pc file generated by catking is similar to the on # This is necessary so that the pc file generated by catking is similar to the on
# done directly by jrl-cmake-modules # done directly by jrl-cmake-modules
catkin_package(CATKIN_DEPENDS message_runtime roscpp realtime_tools bullet ${SOT_PKGNAMES} tf catkin_package(CATKIN_DEPENDS message_runtime roscpp realtime_tools tf2_bullet ${SOT_PKGNAMES} tf
LIBRARIES ros_bridge ros_interpreter sot_loader LIBRARIES ros_bridge ros_interpreter sot_loader
) )
......
...@@ -60,6 +60,8 @@ protected: ...@@ -60,6 +60,8 @@ protected:
po::variables_map vm_; po::variables_map vm_;
std::string dynamicLibraryName_; std::string dynamicLibraryName_;
/// \brief Handle on the SoT library.
void * sotRobotControllerLibrary_;
/// \brief Map between SoT state vector and some joint_state_links /// \brief Map between SoT state vector and some joint_state_links
XmlRpc::XmlRpcValue stateVectorMap_; XmlRpc::XmlRpcValue stateVectorMap_;
...@@ -89,9 +91,12 @@ public: ...@@ -89,9 +91,12 @@ public:
// \brief Read user input to extract the path of the SoT dynamic library. // \brief Read user input to extract the path of the SoT dynamic library.
int parseOptions(int argc, char *argv[]); int parseOptions(int argc, char *argv[]);
// \brief Load the SoT /// \brief Load the SoT device corresponding to the robot.
void Initialization(); void Initialization();
/// \brief Unload the library which handles the robot device.
void CleanUp();
// \brief Create a thread for ROS. // \brief Create a thread for ROS.
virtual void initializeRosNode(int argc, char *argv[]); virtual void initializeRosNode(int argc, char *argv[]);
......
<package format="2"> <package format="2">
<name>dynamic_graph_bridge</name> <name>dynamic_graph_bridge</name>
<version>3.0.4</version> <version>3.0.6</version>
<description> <description>
ROS bindings for dynamic graph. ROS bindings for dynamic graph.
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
<depend>realtime_tools</depend> <depend>realtime_tools</depend>
<depend>message_generation</depend> <depend>message_generation</depend>
<depend>message_runtime</depend> <depend>message_runtime</depend>
<depend>bullet</depend> <depend>tf2_bullet</depend>
<depend>dynamic-graph</depend> <depend>dynamic-graph</depend>
<depend>dynamic-graph-python</depend> <depend>dynamic-graph-python</depend>
<depend>sot-core</depend> <depend>sot-core</depend>
......
...@@ -54,7 +54,8 @@ void createRosSpin(SotLoaderBasic *aSotLoaderBasic) ...@@ -54,7 +54,8 @@ void createRosSpin(SotLoaderBasic *aSotLoaderBasic)
SotLoaderBasic::SotLoaderBasic(): SotLoaderBasic::SotLoaderBasic():
dynamic_graph_stopped_(true) dynamic_graph_stopped_(true),
sotRobotControllerLibrary_(0)
{ {
readSotVectorStateParam(); readSotVectorStateParam();
initPublication(); initPublication();
...@@ -192,9 +193,9 @@ void SotLoaderBasic::Initialization() ...@@ -192,9 +193,9 @@ void SotLoaderBasic::Initialization()
{ {
// Load the SotRobotBipedController library. // Load the SotRobotBipedController library.
void * SotRobotControllerLibrary = dlopen( dynamicLibraryName_.c_str(), sotRobotControllerLibrary_ = dlopen( dynamicLibraryName_.c_str(),
RTLD_LAZY | RTLD_GLOBAL ); RTLD_LAZY | RTLD_GLOBAL );
if (!SotRobotControllerLibrary) { if (!sotRobotControllerLibrary_) {
std::cerr << "Cannot load library: " << dlerror() << '\n'; std::cerr << "Cannot load library: " << dlerror() << '\n';
return ; return ;
} }
...@@ -206,7 +207,7 @@ void SotLoaderBasic::Initialization() ...@@ -206,7 +207,7 @@ void SotLoaderBasic::Initialization()
createSotExternalInterface_t * createSot = createSotExternalInterface_t * createSot =
reinterpret_cast<createSotExternalInterface_t *> reinterpret_cast<createSotExternalInterface_t *>
(reinterpret_cast<long> (reinterpret_cast<long>
(dlsym(SotRobotControllerLibrary, (dlsym(sotRobotControllerLibrary_,
"createSotExternalInterface"))); "createSotExternalInterface")));
const char* dlsym_error = dlerror(); const char* dlsym_error = dlerror();
if (dlsym_error) { if (dlsym_error) {
...@@ -219,6 +220,12 @@ void SotLoaderBasic::Initialization() ...@@ -219,6 +220,12 @@ void SotLoaderBasic::Initialization()
cout <<"Went out from Initialization." << endl; cout <<"Went out from Initialization." << endl;
} }
void SotLoaderBasic::CleanUp()
{
/// Uncount the number of access to this library.
dlclose(sotRobotControllerLibrary_);
}
bool SotLoaderBasic::start_dg(std_srvs::Empty::Request& , bool SotLoaderBasic::start_dg(std_srvs::Empty::Request& ,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment