0

I'm developing a surveillance robot in which I'm using a PcDuino2 board (ARM Cortex A8 Single-Core) as the unique processor in the project. Ubuntu is installed on the board as my OS of choice.

My software was written in this way: I'm using Posix threads, I've a threaded TCP server which receives commands from a HTML interface (Websocket), thus, this commands are validated as soon as the server receives them and some functions are called in order to move the robot (up, down, left, right) or start/stop a OpenCV thread that looks for a colored ball (just an example).

The fact is when the OpenCV thread isn't running, the robot's movement works as expected, but when OpenCV thread is running I can't move the robot with my interface (even receiving the commands correctly and calling the correct functions).

It seems like the OpenCV thread consumes all the processor resources.

Well, my source files are hosted in my github:

https://github.com/victorsantosdev/thesis-arm/tree/master/thr_tennisBall

The main files to take a look are server.cpp and tasks.cpp, so you'll get a better understanding of what I've written.

It's possible, using a sigle-core processor, to keep motors running in parallel with OpenCV thread processing?

  • can you add some tiny sleep commands during your processing? Or maybe using thread-priority would help? – Micka Mar 01 '16 at 22:25
  • I've tried to implement the motors movement in another thread, then when the server receives the command it executes a thread calling the motor moving functions and executes a sleep after that.But it didn't work. I've googled with no success for some code snippet related to Posix thread priorities. Do you have something there to help? – Victor Santos Mar 01 '16 at 22:53
  • http://stackoverflow.com/questions/3649281/how-to-increase-thread-priority-in-pthreads – Micka Mar 01 '16 at 23:41
  • Thanks. I'll test it. But I didn't post with the objective of "solve" my code's undesirable behaviour but to discuss for alternative ways to solve the problem, in order to improve my coding skills. – Victor Santos Mar 02 '16 at 23:52
  • not sure what the "right" way is to implement it. maybe som event-loop like system? – Micka Mar 08 '16 at 00:03

0 Answers0