示例#1
0
def calibration(simulation=False):
	"""calibration"""
	if simulation:
		dyn.enable_vrep()
	
	ctrl = init_ctrl()

	if simulation:
		peter = SymbiotSpidey(ctrl)
	else:
		peter = Spidey(ctrl)

	if simulation:
		ctrl.start_sim()

	peter.compliant = True
	ctrl.wait(10)

	leg = peter.legs[0]
	leg.led = True
	ctrl.wait(10)

	raw_input("Calibration. Press enter when done...")

	peter.compliant = False
	ctrl.wait(10)

	references = (motor.position for motor in leg.motors)
	print("references :", references)

	if simulation:
		ctrl.stop_sim()
示例#2
0
def test(simulation=False):
	"""test of inverse model"""
	simulation = False
	if simulation:
		dyn.enable_vrep()
	
	ctrl = init_ctrl()

	if simulation:
		peter = SymbiotSpidey(ctrl)
	else:
		peter = Spidey(ctrl)

	if simulation:
		ctrl.start_sim()

	peter.compliant = False
	print peter.legs_references

	leg = peter.legs[0]
	pos = leg.position()
	pos = Vector3D(pos.x+6, pos.y, pos.z)
	leg.move(pos)
	ctrl.wait(200)
	print pos.x, leg.position().x, pos.x ==  leg.position().x

	peter.compliant = True

	if simulation:
		ctrl.stop_sim()