locked
Virtual sensor doesn't work - please help! RRS feed

  • Question

  • Hi people,

    I tried this example from the book Robot Development Using Microsoft Robotics Developer Studio:

    This is a virtual sensor example whereby the math functions randomly generate two numbers for the variables DistanceR and DistanceL telling the virtual robot the distance from the right side or the left side of the wall so that it can make appropriate adjustments to its trajectory.

    However this bit of code doesn't work - it seems that it is impossible to write an activity that outputs two variables.

    The error message written is "The incoming message type (DistanceR -> Unknown, DistanceL -> Unknown), does not match the output type needed for this activity."

    The main program is as follows:

    Please help!



    Monday, January 2, 2012 7:21 AM

Answers

  • Yes, this is possible. Please check the book again. Maybe the instructions are not clear enough.

    You need to define the Notification first. Include two fields in the Notification message as shown below:

     

    Now hook up the output of the Join to the Notification pin and make sure that the Data Connections match (as you can see on the right-hand side below). You might have to check the box that says to use explicit connections. I named the two fields in the Join for consistency, although that is not necessary because you can set the Data Connections to anything you like.

     

    Trevor

     

    Tuesday, January 10, 2012 8:42 AM

All replies

  • Wow! Either no one cares or no one's ever come across this problem?!
    Sunday, January 8, 2012 7:10 AM
  • Yes, this is possible. Please check the book again. Maybe the instructions are not clear enough.

    You need to define the Notification first. Include two fields in the Notification message as shown below:

     

    Now hook up the output of the Join to the Notification pin and make sure that the Data Connections match (as you can see on the right-hand side below). You might have to check the box that says to use explicit connections. I named the two fields in the Join for consistency, although that is not necessary because you can set the Data Connections to anything you like.

     

    Trevor

     

    Tuesday, January 10, 2012 8:42 AM