Commit 416e7fa5 authored by Florent Lamiraux's avatar Florent Lamiraux Committed by Florent Lamiraux florent@laas.fr
Browse files

Remove simulation member and replace simu by device in AbstractRobot class.

parent 184bea08
......@@ -58,10 +58,6 @@ class AbstractHumanoidRobot (object):
name = None
"""Entity name (internal use)"""
#FIXME: it should be some kind of global flag instead.
simulation = False
"""Are we in simulation or not?"""
halfSitting = None
"""
The half-sitting position is the robot initial pose.
......@@ -155,12 +151,12 @@ class AbstractHumanoidRobot (object):
if not self.dynamic:
raise "robots models have to be initialized first"
if self.simulation:
self.simu = RobotSimu(self.name + '.simu')
if not self.device:
self.device = RobotSimu(self.name + '.device')
# Freeflyer reference frame should be the same as global
# frame so that operational point positions correspond to
# position in freeflyer frame.
self.simu.set(self.halfSitting)
self.device.set(self.halfSitting)
self.dynamic.position.value = self.halfSitting
self.dynamic.velocity.value = self.dimension*(0.,)
......@@ -203,7 +199,7 @@ class AbstractHumanoidRobot (object):
setattr(self, memberName, self.features[op])
def __init__(self, name, simulation):
def __init__(self, name):
self.name = name
if simulation:
self.simulation = True
......@@ -227,11 +223,10 @@ class HumanoidRobot(AbstractHumanoidRobot):
halfSitting = [] #FIXME
name = None
simulation = None
filename = None
def __init__(self, name, simulation, filename):
AbstractHumanoidRobot.__init__(self, name, simulation)
def __init__(self, name, filename):
AbstractHumanoidRobot.__init__(self, name)
self.filename = filename
self.dynamic = \
self.loadModelFromKxml (self.name + '.dynamics', self.filename)
......
......@@ -90,8 +90,8 @@ solver.sot.push(robot.name + '.task.com')
dynamicWalking = DynamicWalking(robot)
for i in xrange(100):
robot.simu.increment(timeStep)
robot.device.increment(timeStep)
if clt:
clt.updateElementConfig(
'hrp', robot.smallToFull(robot.simu.state.value))
'hrp', robot.smallToFull(robot.device.state.value))
......@@ -44,11 +44,11 @@ solver.sot.push(robot.name + '.task.com')
# Main.
# Main loop
for i in xrange(500):
robot.simu.increment(timeStep)
robot.device.increment(timeStep)
if clt:
clt.updateElementConfig(
'hrp', robot.smallToFull(robot.simu.state.value))
'hrp', robot.smallToFull(robot.device.state.value))
finalPosition = (
......@@ -64,5 +64,5 @@ finalPosition = (
0.23896800000000001, 0.21485599999999999, -0.18973400000000001,
-0.49457699999999999, 0.040646799999999997, 0.16970299999999999, 0.100067)
checkFinalConfiguration(robot.simu.state.value, finalPosition)
checkFinalConfiguration(robot.device.state.value, finalPosition)
print "Exiting."
......@@ -180,13 +180,13 @@ totalSteps = int((stepTime / timeStep) * steps)
t = 0
for i in xrange(totalSteps + 1):
t += timeStep
robot.simu.increment(timeStep)
robot.device.increment(timeStep)
quasiStaticWalking.update(t)
if clt:
clt.updateElementConfig(
'hrp', robot.smallToFull(robot.simu.state.value))
'hrp', robot.smallToFull(robot.device.state.value))
# Security: switch back to double support.
quasiStaticWalking.moveCoM('origin')
......@@ -194,11 +194,11 @@ duration = quasiStaticWalking.time[quasiStaticWalking.stateCoM_singleToDouble]
for i in xrange(int(duration / timeStep)):
t += timeStep
robot.simu.increment(timeStep)
robot.device.increment(timeStep)
if clt:
clt.updateElementConfig(
'hrp', robot.smallToFull(robot.simu.state.value))
'hrp', robot.smallToFull(robot.device.state.value))
finalPosition = (
-0.0082169200000000008, -0.0126068, -0.00022860999999999999,
......@@ -213,5 +213,5 @@ finalPosition = (
0.26377400000000001, 0.171155, -0.00065098499999999998,
-0.52324700000000002, -1.23291e-05, 6.0469500000000001e-05, 0.100009)
checkFinalConfiguration(robot.simu.state.value, finalPosition)
checkFinalConfiguration(robot.device.state.value, finalPosition)
print "Exiting."
......@@ -35,11 +35,11 @@ solver.sot.push(robot.name + '.task.com')
# Main.
# Main loop
for i in xrange(500):
robot.simu.increment(timeStep)
robot.device.increment(timeStep)
if clt:
clt.updateElementConfig(
'hrp', robot.smallToFull(robot.simu.state.value))
'hrp', robot.smallToFull(robot.device.state.value))
finalPosition = (
-0.0357296, -0.0024092699999999998, 0.033870600000000001,
......@@ -55,5 +55,5 @@ finalPosition = (
-0.109959, -0.60156299999999996, -0.082422700000000002,
1.0207200000000001, 0.10037500000000001)
checkFinalConfiguration(robot.simu.state.value, finalPosition)
checkFinalConfiguration(robot.device.state.value, finalPosition)
print "Exiting."
......@@ -34,11 +34,11 @@ solver.sot.push(robot.name + '.task.com')
# Main.
# Main loop
for i in xrange(500):
robot.simu.increment(timeStep)
robot.device.increment(timeStep)
if clt:
clt.updateElementConfig(
'hrp', robot.smallToFull(robot.simu.state.value))
'hrp', robot.smallToFull(robot.device.state.value))
finalPosition = (
-0.015183500000000001, -0.00037148200000000002, -0.00065935600000000005,
......@@ -53,5 +53,5 @@ finalPosition = (
0.170987, 0.100064, -0.117492, 0.24870200000000001, 0.016264399999999998,
-0.56795700000000005, 0.0040012399999999997, 0.18956200000000001, 0.100089)
checkFinalConfiguration(robot.simu.state.value, finalPosition)
checkFinalConfiguration(robot.device.state.value, finalPosition)
print "Exiting."
......@@ -33,11 +33,11 @@ solver.sot.push(robot.name + '.task.com')
# Main.
# Main loop
for i in xrange(500):
robot.simu.increment(timeStep)
robot.device.increment(timeStep)
if clt:
clt.updateElementConfig(
'hrp', robot.smallToFull(robot.simu.state.value))
'hrp', robot.smallToFull(robot.device.state.value))
finalPosition = (
......@@ -53,5 +53,5 @@ finalPosition = (
0.23896800000000001, 0.21485599999999999, -0.18973400000000001,
-0.49457699999999999, 0.040646799999999997, 0.16970299999999999, 0.100067)
checkFinalConfiguration(robot.simu.state.value, finalPosition)
checkFinalConfiguration(robot.device.state.value, finalPosition)
print "Exiting."
......@@ -154,9 +154,9 @@ class Solver:
self.sot.signal('damping').value = 1e-6
self.sot.setNumberDofs(self.robot.dimension)
if robot.simu:
plug(self.sot.signal('control'), robot.simu.signal('control'))
plug(self.robot.simu.state,
if robot.device:
plug(self.sot.signal('control'), robot.device.signal('control'))
plug(self.robot.device.state,
self.robot.dynamic.position)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment