Skip to content
Draft
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
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,15 @@ endif()
include_directories(SYSTEM ${RapidJSON_INCLUDE_DIRS})
add_definitions("-DRAPIDJSON_ASSERT=BOOST_ASSERT")

# msgpack-cxx
find_package(msgpack-cxx 6.0.0)
if (NOT msgpack-cxx_FOUND)
message(FATAL_ERROR "could not find msgpack-cxx")
endif()

include_directories(${msgpack-cxx_INCLUDE_DIRS})
set(MUJINCLIENT_LINK_DIRS ${MUJINCLIENT_LINK_DIRS} ${msgpack-cxx_LIBDIR})

if( Boost_FOUND )
include_directories(${Boost_INCLUDE_DIRS})
set(MUJINCLIENT_LINK_DIRS ${MUJINCLIENT_LINK_DIRS} ${Boost_LIBRARY_DIRS})
Expand Down
3 changes: 2 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ set(SOURCE_FILES
mujincontrollerclient.cpp
mujindefinitions.cpp
mujinjson.cpp
mujinmsgpack.cpp
utf8.h )

if (libzmq_FOUND)
Expand Down Expand Up @@ -70,7 +71,7 @@ if( OPT_BUILD_STATIC )
CLEAN_DIRECT_OUTPUT 1
COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} ${Boost_CFLAGS} -DMUJINCLIENT_DLL_EXPORTS -DMUJINCLIENT_DLL"
LINK_FLAGS "")

target_link_libraries(libmujincontrollerclient_static ${CURL_LIBRARIES} ${EXTRA_LIBRARIES} ${libzmq_LIBRARIES} ${libzmq_LIBRARIES} ${LOG4CXX_LIBRARIES})
install(TARGETS libmujincontrollerclient_static DESTINATION lib${LIB_SUFFIX})
endif()
7 changes: 3 additions & 4 deletions src/binpickingtaskzmq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "common.h"
#include "controllerclientimpl.h"
#include "binpickingtaskzmq.h"
#include "mujinmsgpack.h"
#include "mujincontrollerclient/mujinzmq.h"

#include <algorithm> // find
Expand Down Expand Up @@ -257,11 +258,9 @@ void BinPickingTaskZmqResource::_HeartbeatMonitorThread(const double reinitializ
if (pollitem.revents & ZMQ_POLLIN) {
zmq::message_t reply;
socket->recv(&reply);
std::string replystring((char *)reply.data (), (size_t)reply.size());
rapidjson::Document pt(rapidjson::kObjectType);
try{
std::stringstream replystring_ss(replystring);
ParseJson(pt, replystring_ss.str());
mujinmsgpack::ParseMsgPack(pt, reply.data(), reply.size());
heartbeat.Parse(pt);
{
boost::mutex::scoped_lock lock(_mutexTaskState);
Expand All @@ -275,7 +274,7 @@ void BinPickingTaskZmqResource::_HeartbeatMonitorThread(const double reinitializ
}
catch (std::exception const &e) {
MUJIN_LOG_ERROR("HeartBeat reply is not JSON");
MUJIN_LOG_ERROR(replystring);
MUJIN_LOG_ERROR(std::string((char *)reply.data (), (size_t)reply.size()));
MUJIN_LOG_ERROR(e.what());
continue;
}
Expand Down
Loading