Thanks for the reply Carlos. I just updated the code in DepthCameraSensor.cc & .hh to add an image publisher & followed the steps you had pointed to above. When I load the kinect now, I am able to see an ImageStamped topic. When I click on that topic to display the image, gazebo crashes (the image is about half copied I think). With gdb, I got the following error:
Program received signal SIGSEGV,
Segmentation fault.
__memcpy_sse2_unaligned () at ../sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S:33
33 ../sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S: No such file or directory. (gdb) bt
%0 __memcpy_sse2_unaligned () at ../sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S:33
%1 0x00007ffff7b9095b in std::string::_M_replace_safe(unsigned long, unsigned long, char const*, unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
%2 0x00007ffff5bde8a5 in gazebo::msgs::Image::set_data (this=0x393b380, value=0x0, size=1228800)
at gazebo/msgs/image.pb.h:303
%3 0x00007ffff5bf0f2e in gazebo::sensors::DepthCameraSensor::UpdateImpl (this=0x7fff682bb050)
at gazebo/sensors/DepthCameraSensor.cc:223
%4 0x00007ffff5c33837 in gazebo::sensors::Sensor::Update (this=0x7fff682bb050, _force=false) at gazebo/sensors/Sensor.cc:221
%5 0x00007ffff5c41f0d in gazebo::sensors::SensorManager::SensorContainer::Update (this=0xc0a730, _force=false)
at gazebo/sensors/SensorManager.cc:541
%6 0x00007ffff5c426e6 in gazebo::sensors::SensorManager::ImageSensorContainer::Update (this=0xc0a730, _force=false)
at gazebo/sensors/SensorManager.cc:658
%7 0x00007ffff5c40216 in gazebo::sensors::SensorManager::Update (this=0x7ffff63debc0 <SingletonT<gazebo::sensors::SensorManager>::GetInstance()::t>, _force=false)
at gazebo/sensors/SensorManager.cc:159
%8 0x00007ffff5c3168c in gazebo::sensors::run_once (_force=false) at gazebo/sensors/SensorsIface.cc:118
%9 0x00007ffff786c9b0 in gazebo::Server::Run (this=0x6f2d50) at gazebo/Server.cc:516
%10 0x000000000402bd0 in main (argc=1, argv=0x7fffffffd478) at /home/barun/Projects/ExternalPackages/gazebo/gazebo/server_main.cc:40
which occurs when it tries to copy the data from the depth sensor (line 223 of DepthCameraSensor.cc):
msg.mutable_image()->set_data(this->camera->GetDepthData(),
msg.image().width() * 4 *
msg.image().height()); // NOTE: We need to get the depth data, not image data! ImageDepth = 4 bytes (float)
My ImageStamped msg format is
gazebo::common::Image::PixelFormat::R_FLOAT32
Any idea what's causing this issue? I've attached the source files.
DepthCameraSensor.cc DepthCameraSensor.hh