Cast lidar distances as int during extraction from Python

This commit is contained in:
simondlevy
2018-07-04 15:01:33 -04:00
parent b64defee23
commit e62c308cf6

View File

@@ -304,9 +304,6 @@ Scan_update(Scan *self, PyObject *args, PyObject *kwds)
return null_on_raise_argument_exception_with_details("Scan", "update", return null_on_raise_argument_exception_with_details("Scan", "update",
"number of scan angles must equal number of scan distances"); "number of scan angles must equal number of scan distances");
} }
printf("Interpolate!\n");
Py_RETURN_NONE;
} }
// No scan angles provided; lidar-list size must match scan size // No scan angles provided; lidar-list size must match scan size
@@ -339,10 +336,9 @@ Scan_update(Scan *self, PyObject *args, PyObject *kwds)
} }
// Extract LIDAR values from argument // Extract LIDAR values from argument
int k = 0; for (int k=0; k<self->scan.size; ++k)
for (k=0; k<self->scan.size; ++k)
{ {
self->lidar_mm[k] = PyFloat_AsDouble(PyList_GetItem(py_lidar, k)); self->lidar_mm[k] = (int)PyFloat_AsDouble(PyList_GetItem(py_lidar, k));
} }
// Update the scan // Update the scan
@@ -354,7 +350,8 @@ Scan_update(Scan *self, PyObject *args, PyObject *kwds)
dtheta_degrees); dtheta_degrees);
Py_RETURN_NONE; Py_RETURN_NONE;
}
} // Scan_update
static PyMethodDef Scan_methods[] = static PyMethodDef Scan_methods[] =