I just started using an Astra Pro and was running through the “API how to C++” in the AstraSDK help file. I got to the part where you start receiving sensor data from the depth stream, but my application always returns a depth of 0. The camera is looking at an object in range, and the SFML applications work so I know the camera is functional. The program executes successfully, and I don’t receive any errors from VS2015, but the depth value is always listed as 0. My code is copied directly from the tutorial, so I don’t know why it does not work. I’ve tried recording multiple frames and moving the camera while recording, but there is no change and the value remains at 0.
I’m hoping someone can help me make any progress on this.
Can you please post relevant section of code? I have used Astra with VS2015 for some time and, apart from initial teething trouble, have had no problems with it at all.
#include <astra/astra.hpp>
#include <cstdio>
#include <iostream>
int main(int argc, char** argv)
{
astra::initialize();
astra::StreamSet streamSet;
//Creates a StreamReader
astra::StreamReader reader = streamSet.create_reader();
//Starts the depth stream
reader.stream<astra::DepthStream>().start();
//Retrieves the latest frame
astra::Frame frame = reader.get_latest_frame();
//Gets the depth frame from the latest frame
const auto depthFrame = frame.get<astra::DepthFrame>();
//Gets a copy of the frame index from our depth frame
const int frameIndex = depthFrame.frame_index();
//Gets a copy of the value within the first pixel of our depth frame's data
const short pixelValue = depthFrame.data()[0];
//Prints the two aforementioned values to the console
std::cout << std::endl
<< "Depth frameIndex: " << frameIndex
<< " pixelValue: " << pixelValue
<< std::endl
<< std::endl;
astra::terminate();
std::cout << "hit enter to exit program" << std::endl;
std::cin.get();
return 0;
}