def testPlanConstraints(): ikPlanner.planningMode = 'dummy' constraints = buildConstraints() poses = ce.getPlanPoses(constraints, ikPlanner) poseJsonStr = json.dumps(poses, indent=4) constraintsJsonStr = ce.encodeConstraints(constraints, indent=4) print poseJsonStr print constraintsJsonStr constraints = ce.decodeConstraints(constraintsJsonStr) pprint.pprint(constraints)
def testPlanConstraints(): # this is required for now, makes it avoid communication with matlab # inside the call to ikPlanner.addPose ikPlanner.pushToMatlab = False constraints = buildConstraints() poses = ce.getPlanPoses(constraints, ikPlanner) poseJsonStr = json.dumps(poses, indent=4) constraintsJsonStr = ce.encodeConstraints(constraints, indent=4) print poseJsonStr print constraintsJsonStr constraints = ce.decodeConstraints(constraintsJsonStr) pprint.pprint(constraints)
def setupMessage(self, constraints, endPoseName="", nominalPoseName="", seedPoseName="", additionalTimeSamples=None): poses = ikconstraintencoder.getPlanPoses(constraints, self.ikPlanner) poses.update(self.poses) msg = lcmdrc.exotica_planner_request_t() msg.utime = getUtime() msg.poses = json.dumps(poses) msg.constraints = ikconstraintencoder.encodeConstraints(constraints) msg.seed_pose = seedPoseName msg.nominal_pose = nominalPoseName msg.end_pose = endPoseName msg.joint_names = json.dumps(list(self.ikPlanner.jointController.jointNames)) msg.affordances = self.processAffordances() opt=ikplanner.getIkOptions()._properties if additionalTimeSamples: opt.update({'timeSamples':additionalTimeSamples}) opt['jointLimits']=self.jointLimits msg.options = json.dumps(opt) return msg
def setupMessage(self, fields): # todo, exotica should migrate to new style option names. # for backward compatibility, override the options field here # and insert jointLimits to options list options = OrderedDict(self.ikPlanner.getIkOptions()._properties) options['jointLimits'] = fields.jointLimits import drc as lcmdrc msg = lcmdrc.exotica_planner_request_t() msg.utime = fields.utime msg.poses = json.dumps(fields.poses) msg.constraints = ikconstraintencoder.encodeConstraints(fields.constraints) msg.seed_pose = fields.seedPose msg.nominal_pose = fields.nominalPose msg.end_pose = fields.endPose msg.joint_names = json.dumps(fields.jointNames) msg.affordances = fields.affordances msg.options = json.dumps(options) return msg
def testPlanConstraints(): ikPlanner.planningMode = 'dummy' constraints = buildConstraints() poses = ce.getPlanPoses(constraints, ikPlanner) poseJsonStr = json.dumps(poses, indent=4) constraintsJsonStr = ce.encodeConstraints(constraints, indent=4) print poseJsonStr print constraintsJsonStr print '--------------decoding--------------------' constraints = ce.decodeConstraints(constraintsJsonStr) pprint.pprint(constraints) print '--------------reconstructing--------------' constraints = reconstructConstraints(constraints) print '--------------matlab commands---------------' for c in constraints: c.printCommands()
def setupMessage(self, constraints, endPoseName="", nominalPoseName="", seedPoseName="", additionalTimeSamples=None): poses = ikconstraintencoder.getPlanPoses(constraints, self.ikPlanner) poses.update(self.poses) msg = lcmdrc.exotica_planner_request_t() msg.utime = getUtime() msg.poses = json.dumps(poses) msg.constraints = ikconstraintencoder.encodeConstraints(constraints) msg.seed_pose = seedPoseName msg.nominal_pose = nominalPoseName msg.end_pose = endPoseName msg.joint_names = json.dumps( list(self.ikPlanner.jointController.jointNames)) msg.affordances = self.processAffordances() opt = ikplanner.getIkOptions()._properties if additionalTimeSamples: opt.update({'timeSamples': additionalTimeSamples}) opt['jointLimits'] = self.jointLimits msg.options = json.dumps(opt) return msg