3 Replies - 674 Views - Last Post: 10 February 2011 - 04:24 PM Rate Topic: -----

#1 yarok  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 12
  • Joined: 11-January 10

Drawing and updating a map

Posted 10 February 2011 - 03:55 PM

Hello all,
I am writing a control program for a robot (the Create robot from iRobot).
One of the things we need to do is to create a map of the robot's suroundings, and to display it to the user.
The map is done by polling a sensor and updating a matrix wich contains the information about obstacles and about the robot's location. So far, so good.
The problem we encountered was displaying the map to the user in an aesthetic way. Currently we use the ZedGraph set of classes, but the result is somewhat ugly...

the matrix of the map ( MapMat ) is 80 by 40 cells, each one representing a 5 cm square. It contains zeros for clear path, ones for obstacles and 2 for the robot's location, and we implemented it using a list - namely, the PointPairList from the ZedGraph library. we then proceeded drawing it as a graph using the library's methods:
//
// The Obstacles and myLocation are lists containing Points 
// (X and Y coords). 
// The three points below signify that the lists are being updated as // the robot goes, by reading the MapMat matrix and adding 
// obstacles to cells containing 1 and updating the robot's location // to the cell containing 2.
//
PointPairList Obstacles = new PointPairList();
PointPairList myLocation = new PointPairList();
...
LineItem DrawObstacles = myPane.AddCurve("Obstacle", Obstacles, 
                                       Color.Crimson, SymbolType.Plus);
LineItem DrawLocation = myPane.AddCurve("Robot's Location",myLocation, 
                                  Color.BlueViolet, SymbolType.Circle);



We also tried using the dataGridView control, but that is ugly also... :)

Currently we have pretty much ran out of ideas, and would appreciate your input in that.
Thanks for the time and effort!

This post has been edited by yarok: 10 February 2011 - 03:58 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Drawing and updating a map

#2 Curtis Rutland  Icon User is offline

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 4576
  • View blog
  • Posts: 8,018
  • Joined: 08-June 10

Re: Drawing and updating a map

Posted 10 February 2011 - 04:01 PM

Maybe if you explain what you're looking for, because I have no idea what you find ugly or pretty. It's subjective, so it would help if you gave some more details about the type of display you actually want.

This post has been edited by insertAlias: 10 February 2011 - 04:02 PM

Was This Post Helpful? 0
  • +
  • -

#3 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5674
  • View blog
  • Posts: 12,189
  • Joined: 02-June 10

Re: Drawing and updating a map

Posted 10 February 2011 - 04:07 PM

Sounds like you might need to do some custom drawing. This really sounds like a custom control, like creating your own dashboard guages type of thing.

Either that or give the user something that looks familiar. I mean it is just a grid after all. Make something that looks like Battleship or Minesweeper.

You could take a panel, and drop 80x40 small pictureboxes on it. Then update the pictureboxes according to the value.
0 = Floor tile
1 = obstacle image
2 = Wall-E the robot image
Was This Post Helpful? 1
  • +
  • -

#4 yarok  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 12
  • Joined: 11-January 10

Re: Drawing and updating a map

Posted 10 February 2011 - 04:24 PM

View PostinsertAlias, on 10 February 2011 - 04:01 PM, said:

Maybe if you explain what you're looking for, because I have no idea what you find ugly or pretty. It's subjective, so it would help if you gave some more details about the type of display you actually want.


thanks for the swift response. here is the current map:

Posted Image

As you can see, it is not the best looking of maps :)
What we want is to have a smoother map, with the ability to change the cell size of the grids (currently we use the built in grids of zedGraph).
Any ideas?

View PosttlhIn, on 10 February 2011 - 04:07 PM, said:

Sounds like you might need to do some custom drawing. This really sounds like a custom control, like creating your own dashboard guages type of thing.

Either that or give the user something that looks familiar. I mean it is just a grid after all. Make something that looks like Battleship or Minesweeper.

You could take a panel, and drop 80x40 small pictureboxes on it. Then update the pictureboxes according to the value.
0 = Floor tile
1 = obstacle image
2 = Wall-E the robot image


Nice one! we will try it, and post back with results.
Thanks!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1