Exemple #1
0
void MapDisplay::incomingMap(const nav_msgs::OccupancyGrid::ConstPtr& msg)
{
  current_map_ = *msg;
  // updated via signal in case ros spinner is in a different thread
  Q_EMIT mapUpdated();
  loaded_ = true;
}
Exemple #2
0
void MapDisplay::incomingUpdate(const map_msgs::OccupancyGridUpdate::ConstPtr& update)
{
  // Only update the map if we have gotten a full one first.
  if( !loaded_ )
  {
    return;
  }

  // Reject updates which have any out-of-bounds data.
  if( update->x < 0 ||
      update->y < 0 ||
      current_map_.info.width < update->x + update->width ||
      current_map_.info.height < update->y + update->height )
  {
    setStatus( StatusProperty::Error, "Update", "Update area outside of original map area." );
    return;
  }

  // Copy the incoming data into current_map_'s data.
  for( size_t y = 0; y < update->height; y++ )
  {
    memcpy( &current_map_.data[ (update->y + y) * current_map_.info.width + update->x ],
            &update->data[ y * update->width ],
            update->width );
  }
  // updated via signal in case ros spinner is in a different thread
  Q_EMIT mapUpdated();
}
Exemple #3
0
MapDisplay::MapDisplay()
  : Display()
  , manual_object_( NULL )
  , loaded_( false )
  , resolution_( 0.0f )
  , width_( 0 )
  , height_( 0 )
{
  connect(this, SIGNAL( mapUpdated() ), this, SLOT( showMap() ));
  topic_property_ = new RosTopicProperty( "Topic", "",
                                          QString::fromStdString( ros::message_traits::datatype<nav_msgs::OccupancyGrid>() ),
                                          "nav_msgs::OccupancyGrid topic to subscribe to.",
                                          this, SLOT( updateTopic() ));

  alpha_property_ = new FloatProperty( "Alpha", 0.7,
                                       "Amount of transparency to apply to the map.",
                                       this, SLOT( updateAlpha() ));
  alpha_property_->setMin( 0 );
  alpha_property_->setMax( 1 );

  color_scheme_property_ = new EnumProperty( "Color Scheme", "map", "How to color the occupancy values.",
                                             this, SLOT( updatePalette() ));
  // Option values here must correspond to indices in palette_textures_ array in onInitialize() below.
  color_scheme_property_->addOption( "map", 0 );
  color_scheme_property_->addOption( "costmap", 1 );

  draw_under_property_ = new Property( "Draw Behind", false,
                                       "Rendering option, controls whether or not the map is always"
                                       " drawn behind everything else.",
                                       this, SLOT( updateDrawUnder() ));

  resolution_property_ = new FloatProperty( "Resolution", 0,
                                            "Resolution of the map. (not editable)", this );
  resolution_property_->setReadOnly( true );

  width_property_ = new IntProperty( "Width", 0,
                                     "Width of the map, in meters. (not editable)", this );
  width_property_->setReadOnly( true );
  
  height_property_ = new IntProperty( "Height", 0,
                                      "Height of the map, in meters. (not editable)", this );
  height_property_->setReadOnly( true );

  position_property_ = new VectorProperty( "Position", Ogre::Vector3::ZERO,
                                           "Position of the bottom left corner of the map, in meters. (not editable)",
                                           this );
  position_property_->setReadOnly( true );

  orientation_property_ = new QuaternionProperty( "Orientation", Ogre::Quaternion::IDENTITY,
                                                  "Orientation of the map. (not editable)",
                                                  this );
  orientation_property_->setReadOnly( true );
}
Exemple #4
0
  void GoogleMapLoader::onManagerFinished(QNetworkReply* reply)
  {

    QByteArray bufByteArray(reply->readAll());
    if (bufByteArray.size() != 0)
    {
      byteArray.clear();
      byteArray.append(bufByteArray);
      qDebug ("loaded picture size: %d", bufByteArray.size());

      emit mapUpdated(byteArray);
    }

  }
Exemple #5
0
void Bus::mapSystem(Slot _slot, u8 data) {
	switch ( slot[_slot].type ) {
		case Cart::STANDARD:
		case Cart::BIOS:
			if (page0update) {
                map(0x00, 0x03, *slot[_slot].access); //first k of rom
                map(0x04, 0x3f, *slot[_slot].access, calcSwift(_slot, slot[_slot].page0bank) * 0x4000 + 0x400); //15k slot 0
			}
            if (page1update) map(0x40, 0x7F, *slot[_slot].access, calcSwift(_slot, slot[_slot].page1bank) * 0x4000); //16k slot 1
			if (page2update) {
				if (slot[_slot].ramSelector & 0x8) { //map sram
                    mapSram(0x80, 0xbf, _slot, slot[_slot].ramSelector & 0x4 ? 16 * 1024 : 0);
				} else {
                    map(0x80, 0xbf, *slot[_slot].access, calcSwift(_slot, slot[_slot].page2bank) * 0x4000); //16k slot 2
				}
			}
			break;
        case Cart::CUSTOM_4_PAK:
            if (page0update) map(0x00, 0x3F, *slot[_slot].access, slot[_slot].page0bank * 0x4000); //16k slot 0
            if (page1update) map(0x40, 0x7F, *slot[_slot].access, slot[_slot].page1bank * 0x4000); //16k slot 1
            if (page2update) map(0x80, 0xBF, *slot[_slot].access, slot[_slot].page2bank * 0x4000); //16k slot 2
            break;
        case Cart::CODEMASTERS:
			if (page0update) {
                map(0x00, 0x3F, *slot[_slot].access, slot[_slot].page0bank * 0x4000); //16k slot 0
            } if (page1update) {
                map(0x40, 0x7F, *slot[_slot].access, slot[_slot].page1bank * 0x4000); //16k slot 1
                if ((data & 0x80) && (cartWram.size() != 0)) map(0xa0, 0xbf, cartWram);
            } if (page2update) {
                map(0x80, 0xBF, *slot[_slot].access, slot[_slot].page2bank * 0x4000); //16k slot 2
                if ((data & 0x80) && (cartWram.size() != 0)) map(0xa0, 0xbf, cartWram);
			}
			break;
        case Cart::NO_BANK_SWITCHING:
            map(0x00, 0x3F, *slot[_slot].access); //16k slot 0
            map(0x40, 0x7F, *slot[_slot].access, 0x4000); //16k slot 1
            map(0x80, 0xbf, *slot[_slot].access, 2 * 0x4000); //16k slot 2
            if (cartWram.size() != 0) {//the castle, othello, kings valley have additional cart wram
                map(cart.getCartWramMapStart(), cart.getCartWramMapEnd(), cartWram);
            }
            break;
		case Cart::KOREAN:
            if (page0update) map(0x00, 0x3F, *slot[_slot].access); //16k slot 0
            if (page1update) map(0x40, 0x7F, *slot[_slot].access, 0x4000); //16k slot 1
            if (page2update) map(0x80, 0xBF, *slot[_slot].access, slot[_slot].page2bank * 0x4000); //16k slot 2
			break;
		case Cart::KOREAN_8K:
        case Cart::KOREAN_8K_NEMESIS:
        case Cart::CUSTOM_JANGGUN:
            if (page0update) map(0x00, 0x3F, *slot[_slot].access, slot[_slot].page0bank * 0x4000); //16k slot 0
			if (page1update) {
                map(0x40, 0x5F, *slot[_slot].access, slot[_slot].page1bank * 0x2000); //8k slot 1
                map(0x60, 0x7F, *slot[_slot].access, slot[_slot].page2bank * 0x2000); //8k slot 2
			}
			if (page2update) {
                map(0x80, 0x9F, *slot[_slot].access, slot[_slot].page3bank * 0x2000); //8k slot 3
                map(0xA0, 0xBF, *slot[_slot].access, slot[_slot].page4bank * 0x2000); //8k slot 4
			}
			break;
	}
	mapUpdated();
}