[Robotics] pose mode and game engine

saint saint at cyberchaos.nl
Tue Jan 11 00:25:25 CET 2011


yeah well 

anyway figured I'd bring us back onto toppic a litle bit... (robots ,
blender and python etc)

here is my function that retrieves bone angels that I then translate later
into values for my servos

def get_bone_angle(arma,bone):
	ob = Blender.Object.Get(arma)
	pose = ob.getPose()
	posebone = pose.bones[bone]
	restbone = ob.data.bones[bone]
	returner ='No parent'

	rest_matrix = restbone.matrix['ARMATURESPACE']
	axis=[]

	if not str(restbone.parent)=="None":
		rest_matrix *= mtx_inv(restbone.parent.matrix['ARMATURESPACE'])
		mtx = (rest_matrix * posebone.parent.poseMatrix).rotationPart()
		pose_matrix = posebone.poseMatrix.rotationPart()
		returner=pose_matrix * mtx_inv(mtx)
		axis.append(returner.toEuler()[0])
		axis.append(returner.toEuler()[1])
		axis.append(returner.toEuler()[2])
	return axis

# this works for my hardware (css32 servo controller) maybe not for
yours..
def con_ser(alpha,invert=0):
	xst=2000/180
	if invert:
		a=-alpha
	else:
		a=alpha
	delta=int(round((a*xst)+1500,0))
	if delta>=2250:
		delta=2250
	if delta<=800:
		delta=800
		

	return delta


On Tue, 4 Jan 2011 12:07:40 -0500, David Hutto <smokefloat at gmail.com>
wrote:
> But then again, maybe I'm just hinged on the functions blender makes
> available, as well as, the libraries blender uses, and need to learn
> how to utilize them myself.
> _______________________________________________
> Robotics mailing list
> Robotics at blender.org
> http://lists.blender.org/mailman/listinfo/robotics


More information about the Robotics mailing list