locked
Robot Tracking Program? RRS feed

  • Question

  • Hello all, I'm sorry I have no idea where I should of posted this particular thing... :( anyways,

    I am trying to make a simple tracking program and I am at a loss of where I should begin. I've used this before and it was mega helpful in a lot of ways.

    What I have so far is the form made but from that point I'm at a loss. Basically it is a program with N, S, E, and W button and a Coordinate label that displays the current coordinate it starts at {X=0, Y=0} then their is also a Go 1 button and a Go 10 button so how it functions is like first:

    I click the lets say the E (East) Button >

    Then I click the Go 10 button >

    The label will change to {X=10, Y=0}.

    A continuation of said example would be:

    I then click S (South) >

    Followed by Go 1 >

    The label would then be {X=10, Y=-1}...

    Hopefully that makes sense but that's what I am currently trying to achieve.


    Thursday, May 1, 2014 5:18 PM

All replies

  • I'd store the direction of the robot internally.  You'll be best served to represent the direction as a pair of numbers that represent what a "Go 1" would do to your position if you started at 0,0. (This is called a "direction vector")

    For example, if you click 'W' to face west you might update your direction vector like this:

    directionX = -1;
    directionY = 0;

    Apply this technique appropriately for the other cardinal direction handlers.

    Go 1 would do:

    positionX += directionX;
    positionY += directionY;

    and Go 10 would do:

    positionX += directionX * 10;
    positionY += directionY * 10;

    You can decide whether North is +Y or -Y.

    If North is positive Y, then "face north" would do:

    directionX = 0;
    directionY = 1;

    • Proposed as answer by Amanda Zhu Monday, May 5, 2014 9:44 AM
    Thursday, May 1, 2014 7:28 PM
  • Hi,

    Thank you for posting in the MSDN forum.

    I am afraid that the issue is out of support range of VS General Question forum which mainly discusses the usage issue of Visual Studio IDE such as WPF & SL designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System and Visual Studio Editor.

    I am moving your question to the moderator forum ("Where is the forum for..?"). The owner of the forum will direct you to a right forum.

    Maybe Wyck's answer can help you.

    Best regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, May 6, 2014 8:49 AM