Fixed slam.setmap()
This commit is contained in:
@@ -122,7 +122,7 @@ class CoreSLAM(object):
|
||||
Sets current map pixels to values in bytearray, where bytearray length is square of map size passed
|
||||
to CoreSLAM.__init__().
|
||||
'''
|
||||
self.map.__init__(mapbytes)
|
||||
self.map.set(mapbytes)
|
||||
|
||||
def __str__(self):
|
||||
|
||||
|
||||
@@ -537,6 +537,26 @@ Map_get(Map * self, PyObject * args, PyObject * kwds)
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
Map_set(Map * self, PyObject * args, PyObject * kwds)
|
||||
{
|
||||
PyObject * py_mapbytes = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O", &py_mapbytes))
|
||||
{
|
||||
return null_on_raise_argument_exception("Map", "get");
|
||||
}
|
||||
|
||||
if (bad_mapbytes(py_mapbytes, self->map.size_pixels, "get"))
|
||||
{
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
map_set(&self->map, PyByteArray_AsString(py_mapbytes));
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
Map_update(Map *self, PyObject *args, PyObject *kwds)
|
||||
{
|
||||
@@ -584,6 +604,9 @@ static PyMethodDef Map_methods[] =
|
||||
{"get", (PyCFunction)Map_get, METH_VARARGS,
|
||||
"Map.get(bytearray) fills byte array with map pixels, where bytearray length is square of size of map."
|
||||
},
|
||||
{"set", (PyCFunction)Map_set, METH_VARARGS,
|
||||
"Map.set(bytearray) fills current map with pixels in bytearray, where bytearray length is square of size of map."
|
||||
},
|
||||
{NULL} // Sentinel
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user