Okay, this is going to be a smaller log. Holidays and everything has made life pretty busy so short and sweet for now.
The camera, communication and control has been put together for the ESP32 along with some code clean up. Got ride of some commented out code related to allot of earlier debugging, fixed some logic in the code layout primarily in the TCP end of things. Got rid of allot of over nesting and unnecessary logic bits. After everything has been put together I'm getting about 13 FPS from the ESP. This can probably be improved upon, but that will have to come later. All this has been uploaded to ESP_Drone on GitHub for those interested in having a look.
Along with my code clean up for the ESP32 I did about the same thing for the android side of things. Cleaned up allot of over nesting and unnecessary code. Along with the clean up another thing that I wanted to do was scale up the image since it's only at 320 x 240. This was done using a global added to rawdraws CNFGFunctions.c the globals used are scale_h and scale_w used respectively in CNFGBlitTex().
float scale_h = 0, scale_w = 0;
void CNFGBlitTex( unsigned int tex, int x, int y, int w, int h )
{
if( w == 0 || h == 0 ) return;
CNFGFlushRender();
CNFGglUseProgram( gRDBlitProg );
CNFGglUniform4f( gRDBlitProgUX,
1.f/gRDLastResizeW, -1.f/gRDLastResizeH,
-0.5f+x/(float)gRDLastResizeW, 0.5f-y/(float)gRDLastResizeH );
CNFGglUniform1i( gRDBlitProgUT, 0 );
glBindTexture(GL_TEXTURE_2D, tex);
/* two triangles
(0,255)----------(255,255)
| |
| |
| |
(0,0)------------(255,0)
*/
volatile uint8_t a = 255, b = 255;
// Added scaling to the rectangle that the image will be drawn on
const float verts[] = {
0,0, (float)w * scale_w,0, (float)w * scale_w,(float)h * scale_h,
0,0, (float)w * scale_w,(float)h * scale_h, 0,(float)h * scale_h };
const uint8_t tex_verts[] = {
0,0, a,0, a,b,
0,0, a,b, 0,b };
CNFGglVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, verts);
CNFGglVertexAttribPointer(1, 2, GL_UNSIGNED_BYTE, GL_TRUE, 0, tex_verts);
glDrawArrays( GL_TRIANGLES, 0, 6);
}
Along with the above code modification, moved around the order of the drawing for the top hat control so it is not drawn over by the displayed image.
Results:
Sorry for the pic of my ceiling fan lol. It's just how I got the camera wired up right now. There is also a good bit of noise in the images that I will need to clean up, most of this is due to how it's currently wired up for the time being. Got some work to do on the image and getting the controls fully flushed out. For now I'm content with that it's giving me, till after I get some running tests with the full unit. The code for the android side of things can be found here ESPStream. I will have the updated code pushed to GitHub later tonight.
Now I'll be working on getting the drone wired up and ready for some testing. I do plan on building a gimbal rig to check for proper flight instead of yolo'ing it and hoping it works. That would only spell disaster and possibly breaking the unit and parts them selves. I plan on having a gimbal designed and printed up in the next week. I'll post the wiring up process and the first proto unit here in the next few days.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.