Exemple #1
0
def map_callback(msg):
    global latest_map
    global latest_data

    width = int(math.sqrt(len(msg.data)))
    size = (width, width)
    im = Image.new('RGBA', size)
    im.putdata([color_filter(x) for x in msg.data])
    latest_map = trim_map.trim(im)
    latest_data = np.reshape(msg.data, size)
    if isinstance(msg, OccupancyGrid):
        rospy.Subscriber("/move_base/global_costmap/costmap_updates",
            OccupancyGridUpdate, update_map_callback)
Exemple #2
0
def map_callback(msg):
    global latest_map
    global latest_data

    width = int(math.sqrt(len(msg.data)))
    size = (width, width)
    im = Image.new('RGBA', size)
    im.putdata([color_filter(x) for x in msg.data])
    latest_map = trim_map.trim(im)
    latest_data = np.reshape(msg.data, size)
    if isinstance(msg, OccupancyGrid):
        rospy.Subscriber("/move_base/global_costmap/costmap_updates",
                         OccupancyGridUpdate, update_map_callback)
Exemple #3
0
from nav_msgs.msg import *
from map_msgs.msg import *
from std_msgs.msg import String
from alfred_server.msg import *

import numpy as np
import trim_map
import random

MAP_FILE = "/home/avengineer/alfred_ws/ros_alfred/src/alfred_maps/pharos_lab/pharos_lab.pgm"
inventory = {}
inventory.update(DEFAULT_INV)

latest_data = [0 for i in range(1984 * 1984)]
im = Image.open(MAP_FILE)
latest_map = trim_map.trim(im)
latest_odom = (0, 0, 0)

def update_odom_callback(msg):
    global latest_odom
    latest_odom = msg.pose.pose.position

def color_filter(x):
  if x == 0:
    #return (0xe8,0xcf,0xb7,0x0)
    #return (240, 240, 240, 150)
    return (204, 235, 250, 150)
  if x == 100:
    return (0, 0, 0, 255)
  #return (0xe8-x/2, 0xcf-x/2, 0xb7-x/2, 255)
  return (204-x/2, 235-x/2, 250-x/2, 255)
Exemple #4
0
from nav_msgs.msg import *
from map_msgs.msg import *
from std_msgs.msg import String
from alfred_server.msg import *

import numpy as np
import trim_map
import random

MAP_FILE = "/home/avengineer/alfred_ws/ros_alfred/src/alfred_maps/pharos_lab/pharos_lab.pgm"
inventory = {}
inventory.update(DEFAULT_INV)

latest_data = [0 for i in range(1984 * 1984)]
im = Image.open(MAP_FILE)
latest_map = trim_map.trim(im)
latest_odom = (0, 0, 0)


def update_odom_callback(msg):
    global latest_odom
    latest_odom = msg.pose.pose.position


def color_filter(x):
    if x == 0:
        #return (0xe8,0xcf,0xb7,0x0)
        #return (240, 240, 240, 150)
        return (204, 235, 250, 150)
    if x == 100:
        return (0, 0, 0, 255)