コード例 #1
0
void gpsFixCallback (const gps_common::GPSFix::ConstPtr & msg)
{
    // **** get GTK thread lock
    gdk_threads_enter ();

    gint pixel_x, pixel_y;

    OsmGpsMapPoint *point = osm_gps_map_point_new_degrees (msg->latitude, msg->longitude);
    osm_gps_map_convert_geographic_to_screen (data->map, point, &pixel_x, &pixel_y);

    if (OSM_IS_GPS_MAP (data->map))
    {

        // **** Center map on gps data received
        if (data->lock_view)
        {
            update_uav_pose_osd (data->osd, TRUE, pixel_x, pixel_y);
            osm_gps_map_set_center (data->map, msg->latitude, msg->longitude);
        }
        else
        {
            update_uav_pose_osd (data->osd, FALSE, pixel_x, pixel_y);
            osm_gps_map_gps_clear (data->map);
        }

        // **** Add point to the track
        osm_gps_map_track_add_point (data->uav_track, point);
    }

    // **** release GTK thread lock
    gdk_threads_leave ();
}
コード例 #2
0
ファイル: area_edit.cpp プロジェクト: AMDmi3/osm2go
static gboolean map_gps_update(gpointer data) {
  area_context_t *context = static_cast<area_context_t *>(data);

  pos_t pos = context->area.gps_state->get_pos();

  if(pos.valid()) {
    g_object_set(context->map.widget, "gps-track-highlight-radius", 0, nullptr);
    osm_gps_map_gps_add(context->map.widget, pos.lat, pos.lon, NAN);
  } else
    osm_gps_map_gps_clear(context->map.widget);

  return TRUE;
}
コード例 #3
0
void fcuGpsCallback(const sensor_msgs::NavSatFixConstPtr& gps) {
	// **** get GTK thread lock
	gdk_threads_enter();
	//fcuGpsData_ = (*gps);

	if (gps->status.status == sensor_msgs::NavSatStatus::STATUS_NO_FIX) {
		gtk_container_remove(GTK_CONTAINER(data->box_Gps), GTK_WIDGET (data->status_ok_icon_gps));
		gtk_box_pack_end(GTK_BOX (data->box_Gps), data->status_fail_icon_gps, TRUE, TRUE, 0);
	}
	else {
		gtk_container_remove(GTK_CONTAINER(data->box_Gps), GTK_WIDGET (data->status_fail_icon_gps));
		gtk_box_pack_end(GTK_BOX (data->box_Gps), data->status_ok_icon_gps, TRUE, TRUE, 0);

		gint pixel_x, pixel_y;

		ROS_DEBUG_STREAM("GPS coordinates: " << gps->latitude << ", " << gps->longitude);
		ROS_DEBUG_STREAM("GPS altitude information: " << gps->altitude);

		OsmGpsMapPoint *point = osm_gps_map_point_new_degrees(gps->latitude, gps->longitude);
		osm_gps_map_convert_geographic_to_screen(data->map, point, &pixel_x, &pixel_y);

		if (OSM_IS_GPS_MAP (data->map)) {
			// **** Centre map on GPS data received
			if (data->lock_view) {
				update_uav_pose_osd(data->osd, TRUE, pixel_x, pixel_y);
				osm_gps_map_set_center(data->map, gps->latitude, gps->longitude);
			}
			else {
				update_uav_pose_osd(data->osd, FALSE, pixel_x, pixel_y);
				osm_gps_map_gps_clear(data->map);
			}
			// **** Add point to the track
			osm_gps_map_track_add_point(data->uav_track, point);
		}
	}

	// **** release GTK thread lock
	gdk_threads_leave();
}
コード例 #4
0
/**
 * osm_gps_map_clear_gps:
 *
 * Deprecated: 0.7.0: Use osm_gps_map_gps_clear() instead.
 **/
void
osm_gps_map_clear_gps (OsmGpsMap *map)
{
    g_warning("%s is deprecated", G_STRFUNC);
    osm_gps_map_gps_clear (map);
}