I am wondering how I would incorporate a library in ROS. The library I am trying to install is called ulapi to communicate with the kuka robot we have in the lab.
Thanks
Update (7.13.16): Here is part of my code that I am trying to add the ulapi library. Might be useful.
#include <ros/ros.h>
//library for type of message sent to gazebo topics
#include <std_msgs/Float64.h>
//libraries to control model in gazebo
#include <geometry_msgs/Pose.h>
#include <geometry_msgs/Twist.h>
#include <gazebo_msgs/ModelState.h>
#include <gazebo_msgs/SetModelState.h>
#include <cstdlib>
#include <robsim_gazebo/ulapi.h>
int main (int argc, char** argv)
{
//initialize node
ros::init(argc, argv, "publisher_node");
//create node handle
ros::NodeHandle rob_pose;
ros::NodeHandle a1a2;
ros::NodeHandle a2e1;
ros::NodeHandle e1a3;
ros::NodeHandle a3a4;
ros::NodeHandle a4a5;
ros::NodeHandle a5a6;
ros::NodeHandle a6tp;
Here is the part of my CMakeLists.txt file
add_library(unix_ulapi src/unix_ulapi.c)
#target_link_libraries(publisher_node unix_ulapi)
add_library(ulapi_getopt src/ulapi_getopt.c)
#target_link_libraries(publisher_node ulapi_getopt)
Originally posted by justinkgoh on ROS Answers with karma: 25 on 2016-07-11
Post score: 0
Original comments
Comment by gvdhoorn on 2016-07-12:
Are you just asking how to install the library (.so
file) in some specific location, or do you want to integrate the library into a ROS node? The fist is a file copy action, the second requires you program a node (a C++ program fi) and call into the libraries functions.
Comment by justinkgoh on 2016-07-13:
The files I have are C and H. I am use to installing libraries for Arduino and was wondering how to do it for ROS.
Comment by senreot on 2016-07-13:
After adding the libraries you need to link them to the executable.
Try to uncomment the target_link_libraries() lines or add the next line at the bottom of the CMakeList:
target_link_libraries(publisher_node ulapi_getotp unix_ulapi)
Comment by justinkgoh on 2016-07-14:
When I do that I get an error that says this:
CMake Error at robsim/robsim_gazebo/CMakeLists.txt:214 (target_link_libraries):
Cannot specify link libraries for target "publisher_node" which is not
built by this project.
Comment by gvdhoorn on 2016-07-14:
off-topic, but what I find much more interesting: what are you doing with robsim, gazebo and ulapi? :)
Comment by senreot on 2016-07-14:
This is because the executable has another name.
Try replacing publisher_node
with the name of the executable.
If you can show us the complete CMakeList we can help you better ;)