i have programmed for my two wheeled robot 2 separate controller for each wheel so that afer approx. 1 second both motors reach my desired speed. But my problem is that one of those motors is faster at the desired speed than the other one, so if i turn it on my robot doesnt stay on a straight line but an angle of the desired position. I wanted to ask how can i realize that both reach the desired speed at the same time so my robot will go straigt.
If going completely straight is the goal then you'll need more feedback than just the wheel speeds. Even if you could guarantee the wheels turned at exact same speed (say for instance they were attached together on the same axle) then it still wouldn't go in a straight line. Any tiny difference in wheel circumference or bump, crumb or surface change will move it off course.
A common approach to this problem is to use an IMU gyro. This gives you a reference for your heading and allows you to change motors speeds to correct.
You should use the individual wheel velocities at all times to compute the robot's heading and angular and linear velocity and super-impose another controller that works to correct the same. This could be a PID that works on the desired changed in angular velocity of the robot which you could reduce down to each individual wheels.
Making both the wheels reach the desired speed at the same time would not be possible because, they are two different wheels with different performance. You should rather aim to solve the larger problem and obtain its dependency on each individual wheel. I believe this picture could be of some reference.