Hi Guys,
I’m trying to get a simple C-API app to work – sorry, I haven’t worked with C/C++ in a decade.
Why? If I can get this to work, I can write a quick+dirty golang bindings up and running. Eventually, I’d like to build a small data pipeline so I can stream data to a webgl project.
Everything is ok (aka. device is working) when I run the capi samples – specifically DepthReaderPoll. However, when I try it with my simple C-API program and/or my mirror golang-program… astra_depthstream_get_vfov responds with an error (rc = 4).
// output from the code below
hfov=4 vfov=4
depth sensor -- hFov: 0.000000 radians vFov: 0.000000 radians
Can someone spot check this for me? I think it prob has to do something with my astra-lib linking… but, I’m not seeing the exact problem.
Thanks!
Andy
main.c
#include <stdio.h>
#include <astra/capi/astra.h>
int main(int argc, char* argv[])
{
astra_initialize();
astra_streamsetconnection_t sensor;
astra_streamset_open("device/default", &sensor);
astra_reader_t reader;
astra_reader_create(sensor, &reader);
astra_depthstream_t depthStream;
astra_reader_get_depthstream(reader, &depthStream);
float hFov, vFov;
astra_status_t hfov_rc = astra_depthstream_get_hfov(depthStream, &hFov);
astra_status_t vfov_rc = astra_depthstream_get_vfov(depthStream, &vFov);
printf("hfov=%d vfov=%d\n", hfov_rc, vfov_rc);
printf("depth sensor -- hFov: %f radians vFov: %f radians\n", hFov, vFov);
// ...
// hfov_rc should return SUCCESS (0) + hFov should be some real value
// BUT it returns INVALID_TOKEN (4)
}
makefile
CC=gcc
CFLAGS=-I/Users/andy/Desktop/AstraSDK-0.5.0-20160426T102621Z-darwin-x64/include
LDFLAGS=-Wl,-rpath,./lib/ -lastra -lastra_core -lastra_core_api
main: main.c
$(CC) $(CFLAGS) $(LDFLAGS) main.c -o main
clean:
rm -f main main.o
gcc
gcc --version
gcc (Homebrew gcc49 4.9.3) 4.9.3
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.