Skip to content

Commit

Permalink
Merge pull request ros-industrial#47 from shaun-edwards/hydro-devel
Browse files Browse the repository at this point in the history
Merged changes from groovy-devel into hydro-devel.
  • Loading branch information
shaun-edwards committed Dec 27, 2013
2 parents 8c5e107 + 2d193d3 commit c6cd08e
Show file tree
Hide file tree
Showing 14 changed files with 372 additions and 176 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
*.svn

# Temp files
.*~
*~
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
industrial_core
===============
# Industrial Core

ROS-Industrial core meta-package. http://ros.org/wiki/industrial_core. This repo holds source code for all versions > groovy. For those versions <= groovy see: http://swri-ros-pkg.googlecode.com/svn/trunk/
[ROS-Industrial][] core meta-package. See the [ROS wiki][] page for more information.

## Contents

This repo holds source code for all versions > groovy. For those versions <= groovy see: [SVN repo][]

[ROS-Industrial]: http://www.ros.org/wiki/Industrial
[ROS wiki]: http://ros.org/wiki/industrial_core
[SVN repo]: https://code.google.com/p/swri-ros-pkg/source/browse
4 changes: 0 additions & 4 deletions industrial_deprecated/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,4 @@
<build_depend>rospy</build_depend>
<run_depend>rosgraph_msgs</run_depend>
<run_depend>rospy</run_depend>

<export>

</export>
</package>
4 changes: 0 additions & 4 deletions industrial_msgs/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,4 @@
<run_depend>trajectory_msgs</run_depend>
<run_depend>genmsg</run_depend>
<run_depend>message_runtime</run_depend>

<export>

</export>
</package>
45 changes: 36 additions & 9 deletions industrial_robot_client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,16 @@ set(SRC_FILES src/joint_relay_handler.cpp
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need

# NOTE: The libraries generated this package are not included in the catkin_package
# macro because libraries must be explicitly linked in projects that depend on this
# package. If this is not done (and these libraries were exported), then multiple
# library definitions (normal - industrial_robot_client and byteswapped -
# industrial_robot_client_bswap) are both included (this is bad).

catkin_package(
CATKIN_DEPENDS roscpp std_msgs sensor_msgs control_msgs trajectory_msgs simple_message actionlib_msgs actionlib urdf industrial_msgs industrial_utils
INCLUDE_DIRS include
LIBRARIES industrial_robot_client industrial_robot_client_bswap
)


Expand Down Expand Up @@ -96,31 +102,49 @@ target_link_libraries(industrial_robot_client_bswap simple_message_bswap)

add_executable(robot_state
src/generic_robot_state_node.cpp)
target_link_libraries(robot_state industrial_robot_client ${catkin_LIBRARIES})
target_link_libraries(robot_state
industrial_robot_client
simple_message
${catkin_LIBRARIES})

add_executable(motion_streaming_interface
src/generic_joint_streamer_node.cpp)
target_link_libraries(motion_streaming_interface industrial_robot_client ${catkin_LIBRARIES})
target_link_libraries(motion_streaming_interface
industrial_robot_client
simple_message
${catkin_LIBRARIES})

add_executable(motion_download_interface
src/generic_joint_downloader_node.cpp)
target_link_libraries(motion_download_interface industrial_robot_client ${catkin_LIBRARIES})
target_link_libraries(motion_download_interface
industrial_robot_client
simple_message
${catkin_LIBRARIES})

# The following executables(nodes) are for applications where the robot
# controller and pc have different same byte order (i.e. byte swapping IS
# required)

add_executable(robot_state_bswap
src/generic_robot_state_node.cpp)
target_link_libraries(robot_state_bswap industrial_robot_client_bswap ${catkin_LIBRARIES})
target_link_libraries(robot_state_bswap
industrial_robot_client_bswap
simple_message_bswap
${catkin_LIBRARIES})

add_executable(motion_streaming_interface_bswap
src/generic_joint_streamer_node.cpp)
target_link_libraries(motion_streaming_interface_bswap industrial_robot_client_bswap ${catkin_LIBRARIES})
target_link_libraries(motion_streaming_interface_bswap
industrial_robot_client_bswap
simple_message_bswap
${catkin_LIBRARIES})

add_executable(motion_download_interface_bswap
src/generic_joint_downloader_node.cpp)
target_link_libraries(motion_download_interface_bswap industrial_robot_client_bswap ${catkin_LIBRARIES})
target_link_libraries(motion_download_interface_bswap
industrial_robot_client_bswap
simple_message_bswap
${catkin_LIBRARIES})

# The following executables(nodes) interface with the robot controller
# at a higher level so there is no need to create two versions (one with
Expand All @@ -129,12 +153,15 @@ target_link_libraries(motion_download_interface_bswap industrial_robot_client_bs
add_executable(joint_trajectory_action
src/generic_joint_trajectory_action_node.cpp
src/joint_trajectory_action.cpp)
target_link_libraries(joint_trajectory_action industrial_robot_client ${catkin_LIBRARIES})
target_link_libraries(joint_trajectory_action
industrial_robot_client ${catkin_LIBRARIES})
add_dependencies(joint_trajectory_action industrial_robot_client_gencpp)

# Testing - Only performed on normal (non byte swapped library)
catkin_add_gtest(utest_robot_client test/utest.cpp)
target_link_libraries(utest_robot_client industrial_robot_client ${catkin_LIBRARIES})
target_link_libraries(utest_robot_client
industrial_robot_client
${catkin_LIBRARIES})


#############
Expand Down
4 changes: 0 additions & 4 deletions industrial_robot_client/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,4 @@
<run_depend>urdf</run_depend>
<run_depend>industrial_msgs</run_depend>
<run_depend>industrial_utils</run_depend>

<export>
<cpp lflags="-L${prefix}/lib" cflags="-I${prefix}/include/"/>
</export>
</package>
2 changes: 2 additions & 0 deletions industrial_robot_simulator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ catkin_package(
# See http://ros.org/doc/groovy/api/catkin/html/adv_user_guide/variables.html

install(PROGRAMS industrial_robot_simulator DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})

install(DIRECTORY launch/ DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch)
4 changes: 0 additions & 4 deletions industrial_robot_simulator/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,4 @@
<run_depend>control_msgs</run_depend>
<run_depend>trajectory_msgs</run_depend>
<run_depend>industrial_robot_client</run_depend>

<export>
<cpp cflags="-I${prefix}/include/"/>
</export>
</package>
4 changes: 0 additions & 4 deletions industrial_utils/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,4 @@
<build_depend>urdf</build_depend>
<run_depend>roscpp</run_depend>
<run_depend>urdf</run_depend>

<export>
<cpp lflags="-Wl,-rpath,${prefix}/lib -L${prefix}/lib -lindustrial_utils" cflags="-I${prefix}/include"/>
</export>
</package>
14 changes: 12 additions & 2 deletions simple_message/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,16 @@ set(UTEST_SRC_FILES test/utest.cpp test/utest_message.cpp)
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need

# NOTE: The libraries generated this package are not included in the catkin_package
# macro because libraries must be explicitly linked in projects that depend on this
# package. If this is not done (and these libraries were exported), then multiple
# library definitions (normal - simple_message and byteswapped - simple_message_bswap)
# are both included (this is bad).

catkin_package(
CATKIN_DEPENDS roscpp industrial_msgs
INCLUDE_DIRS include
LIBRARIES simple_message_bswap simple_message
)

###########
Expand All @@ -85,13 +91,16 @@ include_directories(include
${catkin_INCLUDE_DIRS}
)

# NOTE: All test files require TEST_PORT_BASE to be defined. Defining different
# ports for each test executable allows them to run in parallel.

# DEFAULT LIBRARY (SAME ENDIAN)
add_library(simple_message ${SRC_FILES})
target_link_libraries(simple_message ${catkin_LIBRARIES})
add_dependencies(simple_message ${industrial_msgs_EXPORTED_TARGETS})

catkin_add_gtest(utest ${UTEST_SRC_FILES})
set_target_properties(utest PROPERTIES COMPILE_DEFINITIONS "TEST_PORT_BASE=11000")
target_link_libraries(utest simple_message)

# ALTERNATIVE LIBRARY (DIFFERENT ENDIAN)
Expand All @@ -101,6 +110,7 @@ target_link_libraries(simple_message_bswap ${catkin_LIBRARIES})
add_dependencies(simple_message_bswap ${industrial_msgs_EXPORTED_TARGETS})

catkin_add_gtest(utest_byte_swapping ${UTEST_SRC_FILES})
set_target_properties(utest_byte_swapping PROPERTIES COMPILE_DEFINITIONS "TEST_PORT_BASE=12000")
target_link_libraries(utest_byte_swapping simple_message_bswap)

# ALTERNATIVE LIBRARY (64-bit floats)
Expand All @@ -110,7 +120,7 @@ target_link_libraries(simple_message_float64 ${catkin_LIBRARIES})
add_dependencies(simple_message_float64 ${industrial_msgs_EXPORTED_TARGETS})

catkin_add_gtest(utest_float64 ${UTEST_SRC_FILES})
set_target_properties(utest_float64 PROPERTIES COMPILE_DEFINITIONS "FLOAT64")
set_target_properties(utest_float64 PROPERTIES COMPILE_DEFINITIONS "TEST_PORT_BASE=13000;FLOAT64")
target_link_libraries(utest_float64 simple_message_float64)


Expand Down
27 changes: 24 additions & 3 deletions simple_message/include/simple_message/socket/simple_socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,11 @@ class SimpleSocket : public industrial::smpl_msg_connection::SmplMsgConnection
*
* \return true if data is ready to recieve
*/
bool isReadyReceive(int timeout);
bool isReadyReceive(int timeout)
{
bool r, e;
return poll(timeout, r, e);
}

protected:

Expand Down Expand Up @@ -190,6 +194,12 @@ class SimpleSocket : public industrial::smpl_msg_connection::SmplMsgConnection
* in order to avoid dynamic memory allocation)
*/
static const int MAX_BUFFER_SIZE = 1024;

/**
* \brief socket ready polling timeout (ms)
*/
static const int SOCKET_POLL_TO = 1000;

/**
* \brief internal data buffer for receiving
*/
Expand All @@ -212,9 +222,20 @@ class SimpleSocket : public industrial::smpl_msg_connection::SmplMsgConnection

void logSocketError(const char* msg, int rc)
{
LOG_ERROR("%s, rc: %d, errno: %d", msg, rc, errno);
int errno_ = errno;
LOG_ERROR("%s, rc: %d. Error: '%s' (errno: %d)", msg, rc, strerror(errno_), errno_);
}


/**
* \brief polls socket for data or error
*
* \param timeout (ms) negative or zero values result in blocking
* \param ready true if ready
* \param except true if exception
*
* \return true if function DID NOT timeout (must check flags)
*/
bool poll(int timeout, bool & ready, bool & error);

// Send/Receive functions (inherited classes should override raw methods
// Virtual
Expand Down
4 changes: 0 additions & 4 deletions simple_message/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,4 @@
<build_depend>industrial_msgs</build_depend>
<run_depend>roscpp</run_depend>
<run_depend>industrial_msgs</run_depend>

<export>
<cpp lflags="-Wl,-rpath,${prefix}/lib -L${prefix}/lib" cflags="-I${prefix}/include -DROS=1"/>
</export>
</package>
Loading

0 comments on commit c6cd08e

Please sign in to comment.