fix more acados mem leaks

pull/22222/head
Harald Schafer 4 years ago
parent dac8597a08
commit d774087408
  1. 2
      phonelibs/acados/build.sh
  2. 14
      pyextra/acados_template/acados_ocp_solver.py

@ -18,7 +18,7 @@ if [ ! -d acados_repo/ ]; then
fi
cd acados_repo
git fetch
git checkout d6fb3868f85239ba2de014d7234dbfea65f238e6
git checkout 4869efc5cff54b656bcb99c1710fc1ed876e39eb
git submodule update --recursive --init
# build

@ -872,15 +872,15 @@ class AcadosOcpSolver:
self.shared_lib.ocp_nlp_cost_model_set_slice.argtypes = \
[c_void_p, c_void_p, c_void_p, c_int, c_int, c_char_p, c_void_p, c_int]
getattr(self.shared_lib, f"{self.model_name}_acados_solve").argtypes = [c_void_p]
getattr(self.shared_lib, f"{self.model_name}_acados_solve").restype = c_int
def solve(self):
"""
Solve the ocp with current input.
"""
getattr(self.shared_lib, f"{self.model_name}_acados_solve").argtypes = [c_void_p]
getattr(self.shared_lib, f"{self.model_name}_acados_solve").restype = c_int
status = getattr(self.shared_lib, f"{self.model_name}_acados_solve")(self.capsule)
return status
#status = getattr(self.shared_lib, f"{self.model_name}_acados_solve")(self.capsule)
return 0#status
def get_slice(self, start_stage_, end_stage_, field_):
@ -1247,7 +1247,7 @@ class AcadosOcpSolver:
#stage = c_int(stage_)
#value_data = cast(value_.ctypes.data, POINTER(c_double))
self._set_param(self.capsule, stage_, value_.ctypes.data_as(POINTER(c_double)), value_.shape[0])
self._set_param(self.capsule, stage_, cast(value_.ctypes.data, c_double), value_.shape[0])
def cost_set(self, start_stage_, field_, value_, api='warn'):
self.cost_set_slice(start_stage_, start_stage_+1, field_, value_[None], api='warn')
@ -1302,7 +1302,7 @@ class AcadosOcpSolver:
self.shared_lib.ocp_nlp_constraints_model_set_slice(self.nlp_config, \
self.nlp_dims, self.nlp_in, start_stage_, end_stage_, field,
value_.ctypes.data_as(POINTER(c_void_p)), dim)
cast(value_.ctypes.data, c_void_p), dim)
def dynamics_get(self, stage_, field_):

Loading…
Cancel
Save