I am currently trying to develop an inverted pendulum stablisation system using matlab and simulink utilising visual feedback. I have been trying to use 'Image Acquisition Toolbox' with imfindcircles to identify angles, this is what i currently have in place:
- Getting a snapshot of the current video
- Using imfindcircles to locate the main circles on the lever/arm of the pendulum
- Drawing line between those two points
- Drawing a vertical line which can be a static reference to compare the angle between lever arm and vertical line.
- computing angle of the two lines using an equation
- (will have to implement a for loop in which 1-5 is completed to ensure its real-time analysis)
I am struggling to determine the following:
- Will this be viable for a time senstive control system?
- Will image acquisition tool be able to compute these processes near real-time?
- is there anyway in which this can be improved (imfindcirlces can be unreliable at times causing the program to crash)?
Below is a snapshot of the code with its results: (above line 40 is simply lots of comments and using "vid = videoinput('winvideo', 1, 'MJPG_1920x1080');
src = getselectedsource(vid);" to import the files).
The current angle displayed is within 1 degree of error which I believe is acceptable (an if statement has been used for the angle formula for occasions the lever is to the left).
Any help or suggestions would be appreciated. Thankyou!
Best Answer