Please read the sticky post, "How to use this forum," posted near the top of the subject listings for nearly every section of the forum. In particular, please read the part about using code tags. After that, please edit your post to put your code inside code tags.
rosdino:
What's wrong with this logic
I can't tell. It looks like the first thing that it does is try to convert some x and y coordinates to radians. If that's what it's doing, it's unlikely to work, since coordinates are in units of distance, and radians describe angles.
I think that (xt, yt) are the coordinates of the target point, and (xc, yc) are the coordinates of the robot's current position. Can you confirm that?
I think that the intent is ultimately to move the robot to the target point, (xt, yt). If that's so, the code will need some way of updating the robots position. I don't see that update; maybe it happens outside the snippet. Can you confirm that the sketch is intended to move the robot to (xt, yt)? Can you tell us how the robot's position is updated?
This line baffles me:
heading = atan2(sin(yt-yc)*cos(xt),cos(xc)*sin(xt)-sin(xc)*cos(xt)*cos(yt-yc)),2*3.1415926535;
as far as I can tell, this will return the result of the atan2 calculation, and discard the rest. What do you expect from "2*3.1415926535" at the end of the line? I'm not going to try to address the math, until we know whether xt, yt, xc, and yc are angles, or distances.
We'd typically expect that you would describe what you're doing, and describe esoteric formulae that you use, rather than ask us to divine your intent from a partial listing.
These statements are not executing
How can you tell?