diff --git a/gymz/gym_wrapper.py b/gymz/gym_wrapper.py index f5386a8..26c1c0d 100644 --- a/gymz/gym_wrapper.py +++ b/gymz/gym_wrapper.py @@ -94,7 +94,7 @@ def execute_action(self): # Gym expects actions in different format depending on type of # action space if isinstance(self._env.action_space, gym.spaces.Discrete): - action = self._command_buffer[0][0]['value'] + action = int(self._command_buffer[0][0]['value']) else: action = [self._command_buffer[0][0]['value']] diff --git a/gymz/messages.py b/gymz/messages.py index 154e283..b9ea0c3 100644 --- a/gymz/messages.py +++ b/gymz/messages.py @@ -6,6 +6,6 @@ def to_message(low, high, value): assert(np.shape(low) == np.shape(high) == np.shape(value)) try: - return [{'min': low[i], 'max': high[i], 'value': value[i]} for i in range(len(low))] + return [{'min': float(low[i]), 'max': float(high[i]), 'value': float(value[i])} for i in range(len(low))] except TypeError: - return [{'min': low, 'max': high, 'value': value}] + return [{'min': float(low), 'max': float(high), 'value': float(value)}]