Java RoboJDE & Java Project: Smoothing Robot Motion

AI Thread Summary
The discussion centers on optimizing the movement of a robot using RoboJDE and Java to track a color swatch. The robot's movement is currently based on the centroid's position and the size of the swatch detected by the camera, with the goal of achieving smooth motion. The initial approach involves using while loops to control movement based on changes in position and pixel count. However, concerns are raised about the sensitivity of the current control method to measurement noise, which results in jerky movements. Suggestions include implementing a control mechanism that accounts for velocity and noise, such as a phase plane controller with deadbands, and coordinating forward/backward and left/right movements simultaneously to enhance smoothness and responsiveness.
glid02
Messages
54
Reaction score
0
Hey, I'm working on a project with RoboJDE and java and I have a few quick questions.

What I'm supposed to do is write code so that the camera will find the coordinates of a swatch of color and move accordingly as the swatch changes positions. The robot is supposed to move from side to side and forward and backward as smoothly as possible.

I've already been provided with the code necessary to move the robot and find the centroid. Basically when the centroid moves to the left or right the robot moves accordingly and when the swatch occupies more pixels on the camera the robot moves backward and when the swatch occupies less pixels the robot moves forward.

Now I'm just trying to figure out the best way to code the commands so the robot moves as smooth as possible.

The best idea I've come up with so far is a series of while loops.

I'd save the original position of the centroid of the swatch and do:
while (new position > old position)
move to the right

and

while(current no. of pixels > original no. of pixels )
move backwards

Is this sound? Any ideas are more than welcome.

Thanks.
 
Technology news on Phys.org
This is not a very good controller.
  • It is too sensitive to measurement noise. Your measurement of the centroid and size of the patch is inherently noisy. No besmirching of how you are accomplishing this as all measurements are inherently noisy.
  • It is not 'smooth'. Your control algorithm needs to account for velocity in some way to make it smooth.
  • It is rather jerky. Suppose the target is moving forward and to the left simultaneously. Your robot will follow the patch by making a series of ninety degree turns.

Some suggestions:
  • Control forward/backward and left/right motion simultaneously.
  • Use a control mechanism that accounts for velocity and noise such as a phase plane controller with deadbands.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...

Similar threads

Replies
2
Views
2K
Replies
1
Views
2K
Replies
2
Views
2K
Replies
4
Views
2K
Replies
2
Views
2K
Replies
1
Views
3K
Replies
1
Views
1K
Back
Top