brax icon indicating copy to clipboard operation
brax copied to clipboard

Active_pos or Active_rot is not an attribute of brax_sys in version 0.0.13? Is some other version containing it?

Open davidkillerhahaha opened this issue 3 years ago • 1 comments
trafficstars

Hi~ I am currently following a physics-informed work repo Physics-informed nn which use brax as a benchmark. In there they use active_pos and 'active_rot' to remove the inactive state dimension from the total state like this:

	""" This function computes the indexes of the states of the system that are active during the simulation
		:param brax_sys : A brax object of class System representing a dynamical system
	"""
	pos_indx, quat_indx, rot_indx = [], [], []
	pos_indx = brax_sys.active_pos.astype(bool)
	rot_indx = brax_sys.active_rot.astype(bool)
	quat_indx = jnp.sum(brax_sys.active_rot, axis=1) >= 1
	quat_indx = jnp.hstack((quat_indx.reshape(-1,1), brax_sys.active_rot.astype(bool)))
	return pos_indx, quat_indx, rot_indx

But I CANNOT find the active_pos and 'active_rot' as an attribute of brax_system? Could it be the problem of brax version? My brax version is 0.0.13, and which version should I choose? And where can I found the source code of the corresponding version? Could you help us please?

davidkillerhahaha avatar May 26 '22 04:05 davidkillerhahaha

Hello! It looks like that change was made in October:

https://github.com/google/brax/commit/73a59dbc598b77667fd65dd623d2eebb87850e52

So you might want to try v0.0.5, see the code here:

https://github.com/google/brax/blob/v0.0.5/brax/physics/system.py#L43

Otherwise if you'd like to get onto latest brax, we now represent those fields as frozen.position and frozen.rotation on bodies:

https://github.com/google/brax/blob/main/brax/physics/integrators.py#L37

erikfrey avatar May 27 '22 18:05 erikfrey