Hi, Edge…
Thanks for your response, I’ve tried that code, but unfortunately I’ve got a -3(Chirp Parse Error) as a response.
I noticed that in Pixymon -> View -> Console I can get the “reference” of the function cam_getFrame(), it is
help cam_getFrame
> cam_getFrame(INT8 mode, INT16 xOffset, INT16 yOffset, INT16 width, INT16 height)
Get a frame from the camera
Parameters:
mode: one of the following CAM_GRAB_M0R0 (0x00), CAM_GRAB_M1R1 (0x11), CAM_GRAB_M1R2 (0x21)
xOffset: x offset counting from left
yOffset: y offset counting from top
width: width of frame
height: height of frame
Returns:
0 if success, negative if error
BA81 formatted data
So I format the command callChirp() as you can see in the reference, whatever, I still getting the same error, I think that I’m bad formatting my callChirp arguments due my code is stuck on Chirp::loadArgs library…
How can I debug that args to get the image?
#include "libpixyusb2.h"
using namespace std;
void errores(int resultado, String proceso) {
if (resultado == PIXY_RESULT_OK) cout << proceso << " Comando finalizado satisfactoriamente " << resultado << endl;
else if (resultado == PIXY_RESULT_ERROR) cout << proceso << " Comando con error de resultado " << resultado << endl;
else if (resultado == CRP_RES_ERROR_CRC) cout << proceso << " Error CRC " << resultado << endl;
else if (resultado == CRP_RES_ERROR_PARSE) cout << proceso << " Parse error " << resultado << endl;
else if (resultado == PIXY_RESULT_ERROR) cout << proceso << " Comando sin respuesta " << resultado << endl;
else if (resultado == PIXY_RESULT_BUTTON_OVERRIDE) cout << proceso << " Comando, buscando override" << resultado << endl;
}
Pixy2 camarapixy;
int estadopixy = 0;
int Result;
int main(int argc, char** argv) {
uint8_t Purple_Color = 0xFF;
uint8_t Green_Color = 0x00;
uint32_t Color;
Color = (Purple_Color << 16) + (Green_Color << 8) + Purple_Color;
estadopixy = camarapixy.init();
if (estadopixy) {
cout << "Error de conexion con Pixy, seguro que esta conectada?" << endl;
return -1;
}
//cout << "Version: " << camarapixy->version << std::endl;
int return_value = camarapixy.m_link.callChirp("led_set", INT32(Color), END_OUT_ARGS, &Result, END_IN_ARGS);
errores(return_value, "Led_set");
int32_t response;
uint32_t fourcc;
int8_t renderflags;
uint16_t width, height;
uint32_t numPixels;
uint8_t frame[316 * 208];
return_value = camarapixy.m_link.callChirp("cam_getFrame", // String id for remote procedure
INT8(0x21), // mode
INT16(0), // xoffset
INT16(0), // yoffset
INT16(316), // width
INT16(208), // height
END_OUT_ARGS,
&response, // pointer to mem address for return value
&fourcc,
&renderflags,
&width,
&height,
&numPixels,
&frame//z, // pointer to mem address for returned frame
//END_IN_ARGS
);
errores(return_value, "cam_getFrame");
cout << "Respuesta camara: " << response << endl;
cout << "Codec FourCC: " << fourcc << endl;
cout << "Render flags: " << renderflags << endl;
cout << "width: " << width << endl;
cout << "height: " << height << endl;
cout << "Numero Pixeles: " << numPixels << endl;
cout << "Captura: " << frame << endl;
return_value = camarapixy.m_link.callChirp("cam_getFrame", // String id for remote procedure
1, 0x21, // mode
2, 0, // xoffset
2, 0, // yoffset
2, 316, // width
2, 208, // height
0, // separator
&response, // pointer to mem address for return value
&fourcc,
&renderflags,
&width,
&height,
&numPixels,
&frame, // pointer to mem address for returned frame
0);
errores(return_value, "cam_getFrame");
return_value = camarapixy.m_link.callChirp("version");
errores(return_value, "Version");
return_value = camarapixy.m_link.callChirp("led_setRGB", INT8(55), INT8(125), INT8(255));
errores(return_value, "led_setRGB");
sleep(3);
return_value = camarapixy.m_link.callChirp("led_setRGB", INT8(255), INT8(125), INT8(5));
errores(return_value, "led_set_RGB");
sleep(3);
return 0;
}
Response
Led_set Comando finalizado satisfactoriamente 0
cam_getFrame Parse error -3
Respuesta camara: -1
Codec FourCC: 0
Render flags:
width: 0
height: 0
Numero Pixeles: 0
Captura:
cam_getFrame Parse error -3
Version Parse error -3
led_setRGB Parse error -3
led_set_RGB Parse error -3