From af85ef6bec00dcec7e6a473bacc6e76dcb0e4ac2 Mon Sep 17 00:00:00 2001 From: aplyer Date: Fri, 15 Mar 2019 11:24:33 +0100 Subject: [PATCH] compatibility to aravis 0.6 tested on ubuntu 16.04 + kinetic --- CMakeModules/FindAravis.cmake | 4 ++-- src/camnode.cpp | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CMakeModules/FindAravis.cmake b/CMakeModules/FindAravis.cmake index ec27609..7b17873 100644 --- a/CMakeModules/FindAravis.cmake +++ b/CMakeModules/FindAravis.cmake @@ -2,10 +2,10 @@ INCLUDE(FindPackageHandleStandardArgs) FIND_PATH(ARAVIS_INCLUDE_PATH arv.h "$ENV{ARAVIS_INCLUDE_PATH}" - /usr/local/include/aravis-0.4 + /usr/local/include/aravis-0.6 ) -FIND_LIBRARY(ARAVIS_LIBRARY aravis-0.4 +FIND_LIBRARY(ARAVIS_LIBRARY aravis-0.6 "$ENV{ARAVIS_LIBRARY}" /usr/local/lib ) diff --git a/src/camnode.cpp b/src/camnode.cpp index d3e6608..29082cc 100644 --- a/src/camnode.cpp +++ b/src/camnode.cpp @@ -515,17 +515,19 @@ static void NewBuffer_callback (ArvStream *pStream, ApplicationData *pApplicatio pBuffer = arv_stream_try_pop_buffer (pStream); if (pBuffer != NULL) { - if (pBuffer->status == ARV_BUFFER_STATUS_SUCCESS) + if (arv_buffer_get_status(pBuffer) == ARV_BUFFER_STATUS_SUCCESS) { sensor_msgs::Image msg; pApplicationdata->nBuffers++; - std::vector this_data(pBuffer->size); - memcpy(&this_data[0], pBuffer->data, pBuffer->size); + size_t size; + const void *ptr = arv_buffer_get_data(pBuffer, &size); + std::vector this_data(size); + memcpy(&this_data[0], ptr, size); // Camera/ROS Timestamp coordination. - cn = (uint64_t)pBuffer->timestamp_ns; // Camera now + cn = (uint64_t)arv_buffer_get_timestamp(pBuffer); // Camera now rn = ros::Time::now().toNSec(); // ROS now if (iFrame < 10) @@ -558,7 +560,7 @@ static void NewBuffer_callback (ArvStream *pStream, ApplicationData *pApplicatio // Construct the image message. msg.header.stamp.fromNSec(tn); - msg.header.seq = pBuffer->frame_id; + msg.header.seq = arv_buffer_get_frame_id(pBuffer); msg.header.frame_id = global.config.frame_id; msg.width = global.widthRoi; msg.height = global.heightRoi; @@ -578,7 +580,7 @@ static void NewBuffer_callback (ArvStream *pStream, ApplicationData *pApplicatio } else - ROS_WARN ("Frame error: %s", szBufferStatusFromInt[pBuffer->status]); + ROS_WARN ("Frame error: %s", szBufferStatusFromInt[arv_buffer_get_status(pBuffer)]); arv_stream_push_buffer (pStream, pBuffer); iFrame++;