How to use the klampt.math.so3.identity function in Klampt

To help you get started, we’ve selected a few Klampt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github krishauser / IROS2016ManipulationChallenge / shelf_controller.py View on Github external
f3_contact = [s.getMeasurements()[0] for s in f3_proximal_takktile_sensors] + [s.getMeasurements()[0] for s in f3_distal_takktile_sensors]
			print "Contact sensors"
			print "  finger 1:",[int(v) for v in f1_contact]
			print "  finger 2:",[int(v) for v in f2_contact]
			print "  finger 3:",[int(v) for v in f3_contact]
		except:
			pass
		t_lift = 1
		lift_traj_duration = 0.5
		if sim.getTime() < 0.05:
			#the controller sends a command to the hand: f1,f2,f3,preshape
			hand.setCommand([0.2,0.2,0.2,0])
		if sim.getTime() >t_lift:
			#the controller sends a command to the base after 1 s to lift the object
			t_traj = min(1, max(0, (sim.getTime() - t_lift) / lift_traj_duration))
			desired = se3.mul((so3.identity(), [0, 0, 0.10 * t_traj]), xform)
			send_moving_base_xform_PID(controller, desired[0], desired[1])
		#need to manually call the hand emulator
		hand.process({},dt)
	return controlfunc
github krishauser / IROS2016ManipulationChallenge / balls_controller.py View on Github external
self.state = 'lowering'
		elif self.state == 'lowering':
			if sim.getTime() > 1:
				#this is needed to stop at the current position in case there's some residual velocity
				controller.setPIDCommand(controller.getCommandedConfig(),[0.0]*len(controller.getCommandedConfig()))
				#the controller sends a command to the hand: f1,f2,f3,preshape
				self.hand.setCommand([0.2,0.2,0.2,0])
				self.state = 'closing'
		elif self.state == 'closing':
			if sim.getTime() > t_lift:
				self.base_xform = get_moving_base_xform(self.sim.controller(0).model())
				self.state = 'raising'
		elif self.state == 'raising':
			#the controller sends a command to the base after 1 s to lift the object
			t_traj = min(1, max(0, (sim.getTime() - t_lift) / lift_traj_duration))
			desired = se3.mul((so3.identity(), [0, 0, 0.10 * t_traj]), xform)
			send_moving_base_xform_PID(controller, desired[0], desired[1])
			if sim.getTime() > (t_lift + lift_traj_duration):
				self.state = 'raised'
github krishauser / IROS2016ManipulationChallenge / balls_controller.py View on Github external
def __call__(self,controller):
		sim = self.sim
		xform = self.base_xform
		#turn this to false to turn off print statements
		ReflexController.verbose = True
		ReflexController.__call__(self,controller)

		#controller state machine
		#print "State:",state
		t_lift = 2
		lift_traj_duration = 0.5
		if self.state == 'idle':
			if sim.getTime() > 0.5:
				desired = se3.mul((so3.identity(),[0,0,-0.10]),xform)
				send_moving_base_xform_linear(controller,desired[0],desired[1],lift_traj_duration)
				self.state = 'lowering'
		elif self.state == 'lowering':
			if sim.getTime() > 1:
				#this is needed to stop at the current position in case there's some residual velocity
				controller.setPIDCommand(controller.getCommandedConfig(),[0.0]*len(controller.getCommandedConfig()))
				#the controller sends a command to the hand: f1,f2,f3,preshape
				self.hand.setCommand([0.2,0.2,0.2,0])
				self.state = 'closing'
		elif self.state == 'closing':
			if sim.getTime() > t_lift:
				self.base_xform = get_moving_base_xform(self.sim.controller(0).model())
				self.state = 'raising'
		elif self.state == 'raising':
			#the controller sends a command to the base after 1 s to lift the object
			t_traj = min(1, max(0, (sim.getTime() - t_lift) / lift_traj_duration))
github krishauser / IROS2016ManipulationChallenge / simple_controller.py View on Github external
f3_contact = [s.getMeasurements()[0] for s in f3_proximal_takktile_sensors] + [s.getMeasurements()[0] for s in f3_distal_takktile_sensors]
			print "Contact sensors"
			print "  finger 1:",[int(v) for v in f1_contact]
			print "  finger 2:",[int(v) for v in f2_contact]
			print "  finger 3:",[int(v) for v in f3_contact]
		except:
			pass
		t_lift = 1
		lift_traj_duration = 0.5
		if sim.getTime() < 0.05:
			#the controller sends a command to the hand: f1,f2,f3,preshape
			hand.setCommand([0.2,0.2,0.2,0])
		if sim.getTime() > t_lift:
			#the controller sends a command to the base after 1 s to lift the object
			t_traj = min(1, max(0, (sim.getTime() - t_lift) / lift_traj_duration))
			desired = se3.mul((so3.identity(), [0, 0, 0.10 * t_traj]), xform)
			send_moving_base_xform_PID(controller, desired[0], desired[1])
		#need to manually call the hand emulator
		hand.process({},dt)
	return controlfunc