Open mjm522 opened 7 years ago
Look for the calls to memmove
in mjtypes.py, (most of the mjdata
properties have setters that call it) and do something more like that.
@tlbtlbtlb Using memmove doesn't work for model.body_pos
or model.geom_rgba
. It replaces the existing values with random values -1.08420217e-19, 1.82499993e+00, etc instead of the value actually stored in val_ptr
.
Is it because these properties were initialized with write=False
?
That is likely a mismatch between C float and double types. Make sure you’re passing in the right numpy type, which is float64.
On Sat, Nov 18, 2017 at 14:59 Aravind Srinivas notifications@github.com wrote:
Using memmove doesn't work for model.body_pos or model.geom_rgba. It replaces the existing values with random values -1.08420217e-19, 1.82499993e+00, etc instead of the value actually stored in val_ptr.
Is it because these properties were initialized with write=False?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/openai/mujoco-py/issues/19#issuecomment-345477732, or mute the thread https://github.com/notifications/unsubscribe-auth/AANZdNqrKPqOnf5tTGIRs9uhs1aOMX4wks5s32FTgaJpZM4KVEO7 .
-- Trevor Blackwell tlb@tlb.org 650 776 7870
When I try to copy a value to this variable like this,
model.data_pos = newValue
it says,ValueError: assignment destination is read-only
. So I tried to using the inbuilt functionmjlib.mju_copy(data_d.ctypes.data_as(POINTER(c_double)), data_s.ctypes.data_as(POINTER(c_double)), c_int(length))
in the following way.mjlib.mju_copy(model.data_pos.ctypes.data_as(POINTER(c_double)), newValue.ctypes.data_as(POINTER(c_double)), c_int(3))
This statement does not produce any error, nevertheless the value remain unchanged. Could anyone please tell me how to copy a new value to it?