file_path
stringlengths
20
202
content
stringlengths
9
3.85M
size
int64
9
3.85M
lang
stringclasses
9 values
avg_line_length
float64
3.33
100
max_line_length
int64
8
993
alphanum_fraction
float64
0.26
0.93
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/motion/motion_planners/smoothing.py
from random import randint, random from .utils import INF, elapsed_time, irange, waypoints_from_path, get_pairs, get_distance, \ convex_combination, flatten, traverse, compute_path_cost import time import numpy as np def smooth_path_old(path, extend, collision, iterations=50, max_time=INF, verbose=False, **kwargs): assert (iterations < INF) or (max_time < INF) start_time = time.time() smoothed_path = path for iteration in irange(iterations): if (elapsed_time(start_time) > max_time) or (len(smoothed_path) <= 2): break if verbose: print('Iteration: {} | Waypoints: {} | Euclidean distance: {:.3f} | Time: {:.3f}'.format( iteration, len(smoothed_path), compute_path_cost(smoothed_path), elapsed_time(start_time))) i = randint(0, len(smoothed_path) - 1) j = randint(0, len(smoothed_path) - 1) if abs(i - j) <= 1: continue if j < i: i, j = j, i shortcut = list(extend(smoothed_path[i], smoothed_path[j])) if (len(shortcut) < (j - i)) and all(not collision(q) for q in traverse(shortcut)): smoothed_path = smoothed_path[:i + 1] + shortcut + smoothed_path[j + 1:] return smoothed_path def refine_waypoints(waypoints, extend_fn): #if len(waypoints) <= 1: # return waypoints return list(flatten(extend_fn(q1, q2) for q1, q2 in get_pairs(waypoints))) # [waypoints[0]] + def smooth_path(path, extend, collision, distance_fn=None, iterations=50, max_time=INF, verbose=False): # TODO: makes an assumption on the distance metric # TODO: smooth until convergence assert (iterations < INF) or (max_time < INF) start_time = time.time() if distance_fn is None: distance_fn = get_distance waypoints = waypoints_from_path(path) for iteration in irange(iterations): #waypoints = waypoints_from_path(waypoints) if (elapsed_time(start_time) > max_time) or (len(waypoints) <= 2): break # TODO: smoothing in the same linear segment when circular indices = list(range(len(waypoints))) segments = list(get_pairs(indices)) distances = [distance_fn(waypoints[i], waypoints[j]) for i, j in segments] total_distance = sum(distances) if verbose: print('Iteration: {} | Waypoints: {} | Distance: {:.3f} | Time: {:.3f}'.format( iteration, len(waypoints), total_distance, elapsed_time(start_time))) probabilities = np.array(distances) / total_distance #segment1, segment2 = choices(segments, weights=probabilities, k=2) seg_indices = list(range(len(segments))) seg_idx1, seg_idx2 = np.random.choice(seg_indices, size=2, replace=True, p=probabilities) if seg_idx1 == seg_idx2: continue if seg_idx2 < seg_idx1: # choices samples with replacement seg_idx1, seg_idx2 = seg_idx2, seg_idx1 segment1, segment2 = segments[seg_idx1], segments[seg_idx2] # TODO: option to sample only adjacent pairs point1, point2 = [convex_combination(waypoints[i], waypoints[j], w=random()) for i, j in [segment1, segment2]] i, _ = segment1 _, j = segment2 new_waypoints = waypoints[:i+1] + [point1, point2] + waypoints[j:] # TODO: reuse computation if compute_path_cost(new_waypoints, cost_fn=distance_fn) >= total_distance: continue if all(not collision(q) for q in traverse(extend(point1, point2))): waypoints = new_waypoints #return waypoints return refine_waypoints(waypoints, extend) #smooth_path = smooth_path_old
3,687
Python
45.683544
107
0.625712
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/motion/motion_planners/graph.py
from collections import namedtuple, Mapping from heapq import heappush, heappop class Vertex(object): def __init__(self, value): self.value = value self.edges = [] def __repr__(self): return self.__class__.__name__ + '(' + str(self.value) + ')' class Edge(object): def __init__(self, v1, v2, value, cost): self.v1, self.v2 = v1, v2 self.v1.edges.append(self) self.value = value self.cost = cost def __repr__(self): return self.__class__.__name__ + '(' + str(self.v1.value) + ' -> ' + str(self.v2.value) + ')' SearchNode = namedtuple('SearchNode', ['cost', 'edge']) class Graph(Mapping, object): def __init__(self): self.vertices = {} self.edges = [] def __getitem__(self, value): return self.vertices[value] def __len__(self): return len(self.vertices) def __iter__(self): return iter(self.vertices) def __call__(self, value1, value2): # TODO - goal_test if value1 not in self or value2 not in self: return None start, goal = self[value1], self[value2] queue = [(0, start)] nodes, processed = {start: SearchNode(0, None)}, set() def retrace(v): edge = nodes[v].edge if edge is None: return [v.value], [] vertices, edges = retrace(edge.v1) return vertices + [v.value], edges + [edge.value] while len(queue) != 0: _, cv = heappop(queue) if cv in processed: continue processed.add(cv) if cv == goal: return retrace(cv) for edge in cv.edges: cost = nodes[cv].cost + edge.cost if edge.v2 not in nodes or cost < nodes[edge.v2].cost: nodes[edge.v2] = SearchNode(cost, edge) heappush(queue, (cost, edge.v2)) return None def add(self, value): if value not in self: self.vertices[value] = Vertex(value) return self.vertices[value] def connect(self, value1, value2, edge_value=None, edge_cost=1): v1, v2 = self.add(value1), self.add(value2) edge = Edge(v1, v2, edge_value, edge_cost) self.edges.append(edge) return edge
2,335
Python
27.144578
101
0.529336
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/motion/motion_planners/rrt_star.py
from __future__ import print_function from random import random from time import time from .utils import INF, argmin, elapsed_time class OptimalNode(object): def __init__(self, config, parent=None, d=0, path=[], iteration=None): self.config = config self.parent = parent self.children = set() self.d = d self.path = path if parent is not None: self.cost = parent.cost + d self.parent.children.add(self) else: self.cost = d self.solution = False self.creation = iteration self.last_rewire = iteration def set_solution(self, solution): if self.solution is solution: return self.solution = solution if self.parent is not None: self.parent.set_solution(solution) def retrace(self): if self.parent is None: return self.path + [self.config] return self.parent.retrace() + self.path + [self.config] def rewire(self, parent, d, path, iteration=None): if self.solution: self.parent.set_solution(False) self.parent.children.remove(self) self.parent = parent self.parent.children.add(self) if self.solution: self.parent.set_solution(True) self.d = d self.path = path self.update() self.last_rewire = iteration def update(self): self.cost = self.parent.cost + self.d for n in self.children: n.update() def clear(self): self.node_handle = None self.edge_handle = None def draw(self, env): from manipulation.primitives.display import draw_node, draw_edge color = (0, 0, 1, .5) if self.solution else (1, 0, 0, .5) self.node_handle = draw_node(env, self.config, color=color) if self.parent is not None: self.edge_handle = draw_edge( env, self.config, self.parent.config, color=color) def __str__(self): return self.__class__.__name__ + '(' + str(self.config) + ')' __repr__ = __str__ def safe_path(sequence, collision): path = [] for q in sequence: if collision(q): break path.append(q) return path def rrt_star(start, goal, distance, sample, extend, collision, radius, max_time=INF, max_iterations=INF, goal_probability=.2, informed=True): if collision(start) or collision(goal): return None nodes = [OptimalNode(start)] goal_n = None t0 = time() it = 0 while (t0 - time()) < max_time and it < max_iterations: do_goal = goal_n is None and (it == 0 or random() < goal_probability) s = goal if do_goal else sample() # Informed RRT* if informed and goal_n is not None and distance(start, s) + distance(s, goal) >= goal_n.cost: continue if it % 100 == 0: success = goal_n is not None cost = goal_n.cost if success else INF print(it, elapsed_time(t0), success, do_goal, cost) it += 1 nearest = argmin(lambda n: distance(n.config, s), nodes) path = safe_path(extend(nearest.config, s), collision) if len(path) == 0: continue new = OptimalNode(path[-1], parent=nearest, d=distance( nearest.config, path[-1]), path=path[:-1], iteration=it) # if safe and do_goal: if do_goal and distance(new.config, goal) < 1e-6: goal_n = new goal_n.set_solution(True) # TODO - k-nearest neighbor version neighbors = filter(lambda n: distance( n.config, new.config) < radius, nodes) nodes.append(new) for n in neighbors: d = distance(n.config, new.config) if n.cost + d < new.cost: path = safe_path(extend(n.config, new.config), collision) if len(path) != 0 and distance(new.config, path[-1]) < 1e-6: new.rewire(n, d, path[:-1], iteration=it) for n in neighbors: # TODO - avoid repeating work d = distance(new.config, n.config) if new.cost + d < n.cost: path = safe_path(extend(new.config, n.config), collision) if len(path) != 0 and distance(n.config, path[-1]) < 1e-6: n.rewire(new, d, path[:-1], iteration=it) if goal_n is None: return None return goal_n.retrace()
4,467
Python
33.10687
141
0.564585
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/motion/motion_planners/tkinter/viewer.py
try: from Tkinter import Tk, Canvas, Toplevel, LAST #import TKinter as tk except ModuleNotFoundError: from tkinter import Tk, Canvas, Toplevel, LAST #import tkinter as tk import numpy as np from collections import namedtuple from ..utils import get_pairs, get_delta, INF Box = namedtuple('Box', ['lower', 'upper']) Circle = namedtuple('Circle', ['center', 'radius']) class PRMViewer(object): def __init__(self, width=500, height=500, title='PRM', background='tan'): tk = Tk() tk.withdraw() top = Toplevel(tk) top.wm_title(title) top.protocol('WM_DELETE_WINDOW', top.destroy) self.width = width self.height = height self.canvas = Canvas(top, width=self.width, height=self.height, background=background) self.canvas.pack() def pixel_from_point(self, point): (x, y) = point # return (int(x*self.width), int(self.height - y*self.height)) return (x * self.width, self.height - y * self.height) def draw_point(self, point, radius=5, color='black'): (x, y) = self.pixel_from_point(point) self.canvas.create_oval(x - radius, y - radius, x + radius, y + radius, fill=color, outline='') def draw_line(self, segment, color='black'): (point1, point2) = segment (x1, y1) = self.pixel_from_point(point1) (x2, y2) = self.pixel_from_point(point2) self.canvas.create_line(x1, y1, x2, y2, fill=color, width=1) def draw_arrow(self, point1, point2, color='black'): (x1, y1) = self.pixel_from_point(point1) (x2, y2) = self.pixel_from_point(point2) self.canvas.create_line(x1, y1, x2, y2, fill=color, width=2, arrow=LAST) def draw_rectangle(self, box, width=2, color='brown'): (point1, point2) = box (x1, y1) = self.pixel_from_point(point1) (x2, y2) = self.pixel_from_point(point2) self.canvas.create_rectangle(x1, y1, x2, y2, fill=color, width=width) def draw_circle(self, center, radius, width=2, color='black'): (x1, y1) = self.pixel_from_point(np.array(center) - radius * np.ones(2)) (x2, y2) = self.pixel_from_point(np.array(center) + radius * np.ones(2)) self.canvas.create_oval(x1, y1, x2, y2, outline='black', fill=color, width=width) def clear(self): self.canvas.delete('all') ################################################################# def contains(q, box): (lower, upper) = box return np.greater_equal(q, lower).all() and \ np.greater_equal(upper, q).all() #return np.all(q >= lower) and np.all(upper >= q) def point_collides(point, boxes): return any(contains(point, box) for box in boxes) def sample_line(segment, step_size=2e-2): (q1, q2) = segment diff = get_delta(q1, q2) dist = np.linalg.norm(diff) for l in np.arange(0., dist, step_size): yield tuple(np.array(q1) + l * diff / dist) yield q2 def line_collides(line, box): # TODO - could also compute this exactly return any(point_collides(point, boxes=[box]) for point in sample_line(line)) def is_collision_free(line, boxes): return not any(line_collides(line, box) for box in boxes) def create_box(center, extents): (x, y) = center (w, h) = extents lower = (x - w / 2., y - h / 2.) upper = (x + w / 2., y + h / 2.) return Box(np.array(lower), np.array(upper)) def get_box_center(box): lower, upper = box return np.average([lower, upper], axis=0) def get_box_extent(box): lower, upper = box return get_delta(lower, upper) def sample_box(box): (lower, upper) = box return np.random.random(len(lower)) * get_box_extent(box) + lower ################################################################# def draw_environment(obstacles, regions): viewer = PRMViewer() for box in obstacles: viewer.draw_rectangle(box, color='brown') for name, region in regions.items(): if name != 'env': viewer.draw_rectangle(region, color='green') return viewer def add_segments(viewer, segments, step_size=INF, **kwargs): if segments is None: return for line in segments: viewer.draw_line(line, **kwargs) #for p in [p1, p2]: for p in sample_line(line, step_size=step_size): viewer.draw_point(p, radius=2, **kwargs) def add_path(viewer, path, **kwargs): segments = list(get_pairs(path)) return add_segments(viewer, segments, **kwargs) def draw_solution(segments, obstacles, regions): viewer = draw_environment(obstacles, regions) add_segments(viewer, segments) def add_roadmap(viewer, roadmap, **kwargs): for line in roadmap: viewer.draw_line(line, **kwargs) def draw_roadmap(roadmap, obstacles, regions): viewer = draw_environment(obstacles, regions) add_roadmap(viewer, roadmap) def add_points(viewer, points, **kwargs): for sample in points: viewer.draw_point(sample, **kwargs) def get_distance_fn(weights): difference_fn = get_delta def fn(q1, q2): diff = np.array(difference_fn(q2, q1)) return np.sqrt(np.dot(weights, diff * diff)) return fn
5,167
Python
32.558441
103
0.613122
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/motion/motion_planners/tkinter/run.py
from __future__ import print_function import numpy as np import math from .viewer import sample_box, is_collision_free, \ create_box, draw_environment, point_collides, sample_line, add_points, \ add_roadmap, get_box_center, add_path, get_distance_fn from ..utils import user_input, profiler, INF, compute_path_cost, get_distance from ..rrt_connect import rrt_connect from ..meta import random_restarts from ..diverse import score_portfolio, exhaustively_select_portfolio ################################################## def get_sample_fn(region, obstacles=[]): samples = [] collision_fn = get_collision_fn(obstacles) def region_gen(): #lower, upper = region #area = np.product(upper - lower) # TODO: sample proportional to area while True: q = sample_box(region) if collision_fn(q): continue samples.append(q) return q # TODO: sampling with state (e.g. deterministic sampling) return region_gen, samples def get_connected_test(obstacles, max_distance=0.25): # 0.25 | 0.2 | 0.25 | 0.5 | 1.0 roadmap = [] def connected_test(q1, q2): #n = len(samples) #threshold = gamma * (math.log(n) / n) ** (1. / d) threshold = max_distance are_connected = (get_distance(q1, q2) <= threshold) and is_collision_free((q1, q2), obstacles) if are_connected: roadmap.append((q1, q2)) return are_connected return connected_test, roadmap def get_threshold_fn(): # http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.419.5503&rep=rep1&type=pdf d = 2 vol_free = (1 - 0) * (1 - 0) vol_ball = math.pi * (1 ** 2) gamma = 2 * ((1 + 1. / d) * (vol_free / vol_ball)) ** (1. / d) threshold_fn = lambda n: gamma * (math.log(n) / n) ** (1. / d) return threshold_fn def get_collision_fn(obstacles): def collision_fn(q): #time.sleep(1e-3) return point_collides(q, obstacles) return collision_fn def get_extend_fn(obstacles=[]): #collision_fn = get_collision_fn(obstacles) roadmap = [] def extend_fn(q1, q2): path = [q1] for q in sample_line(segment=(q1, q2)): #if collision_fn(q): # return yield q roadmap.append((path[-1], q)) path.append(q) return extend_fn, roadmap ################################################## def main(smooth=True, num_restarts=1, max_time=0.1): """ Creates and solves the 2D motion planning problem. """ # https://github.com/caelan/pddlstream/blob/master/examples/motion/run.py # TODO: 3D work and CSpace # TODO: visualize just the tool frame of an end effector np.set_printoptions(precision=3) obstacles = [ create_box(center=(.35, .75), extents=(.25, .25)), create_box(center=(.75, .35), extents=(.225, .225)), create_box(center=(.5, .5), extents=(.225, .225)), ] # TODO: alternate sampling from a mix of regions regions = { 'env': create_box(center=(.5, .5), extents=(1., 1.)), 'green': create_box(center=(.8, .8), extents=(.1, .1)), } start = np.array([0., 0.]) goal = 'green' if isinstance(goal, str) and (goal in regions): goal = get_box_center(regions[goal]) else: goal = np.array([1., 1.]) viewer = draw_environment(obstacles, regions) ######################### #connected_test, roadmap = get_connected_test(obstacles) collision_fn = get_collision_fn(obstacles) distance_fn = get_distance_fn(weights=[1, 1]) # distance_fn # samples = list(islice(region_gen('env'), 100)) with profiler(field='cumtime'): # cumtime | tottime # TODO: cost bound & best cost for _ in range(num_restarts): sample_fn, samples = get_sample_fn(regions['env']) extend_fn, roadmap = get_extend_fn(obstacles=obstacles) # obstacles | [] #path = rrt_connect(start, goal, distance_fn, sample_fn, extend_fn, collision_fn, # iterations=100, tree_frequency=1, max_time=1) #, **kwargs) #path = birrt(start, goal, distance=distance_fn, sample=sample_fn, # extend=extend_fn, collision=collision_fn, smooth=100) #, smooth=1000, **kwargs) paths = random_restarts(rrt_connect, start, goal, distance_fn=distance_fn, sample_fn=sample_fn, extend_fn=extend_fn, collision_fn=collision_fn, restarts=INF, max_time=2, max_solutions=INF, smooth=100) #, smooth=1000, **kwargs) #path = paths[0] if paths else None #if path is None: # continue #paths = [path] #paths = exhaustively_select_portfolio(paths, k=2) #print(score_portfolio(paths)) for path in paths: print('Distance: {:.3f}'.format(compute_path_cost(path, distance_fn))) add_path(viewer, path, color='green') # extend_fn, _ = get_extend_fn(obstacles=obstacles) # obstacles | [] # smoothed = smooth_path(path, extend_fn, collision_fn, iterations=INF, max_tine=max_time) # print('Smoothed distance: {:.3f}'.format(compute_path_cost(smoothed, distance_fn))) # add_path(viewer, smoothed, color='red') ######################### roadmap = samples = [] add_roadmap(viewer, roadmap, color='black') add_points(viewer, samples, color='blue') #if path is None: # user_input('Finish?') # return user_input('Finish?') if __name__ == '__main__': main()
5,682
Python
34.080247
107
0.569342
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/examples/teleop_pr2.py
#!/usr/bin/env python from __future__ import print_function import select import sys import termios import tty from pybullet_tools.pr2_utils import PR2_GROUPS, DRAKE_PR2_URDF from pybullet_tools.utils import add_data_path, connect, enable_gravity, load_model, \ joints_from_names, load_pybullet, \ velocity_control_joints, disconnect, enable_real_time, HideOutput HELP_MSG = """ Reading from the keyboard and Publishing to Twist! --------------------------- Moving around: u i o j k l m , . For Holonomic mode (strafing), hold down the shift key: --------------------------- U I O J K L M < > t : up (+z) b : down (-z) anything else : stop q/z : increase/decrease max speeds by 10% w/x : increase/decrease only linear speed by 10% e/c : increase/decrease only angular speed by 10% CTRL-C to quit """ MOVE_BINDINGS = { 'i': (1, 0, 0, 0), 'o': (1, 0, 0, -1), 'j': (0, 0, 0, 1), 'l': (0, 0, 0, -1), 'u': (1, 0, 0, 1), ',': (-1, 0, 0, 0), '.': (-1, 0, 0, 1), 'm': (-1, 0, 0, -1), 'O': (1, -1, 0, 0), 'I': (1, 0, 0, 0), 'J': (0, 1, 0, 0), 'L': (0, -1, 0, 0), 'U': (1, 1, 0, 0), '<': (-1, 0, 0, 0), '>': (-1, -1, 0, 0), 'M': (-1, 1, 0, 0), 't': (0, 0, 1, 0), 'b': (0, 0, -1, 0), } SPEED_BINDINGS = { 'q': (1.1, 1.1), 'z': (.9, .9), 'w': (1.1, 1), 'x': (.9, 1), 'e': (1, 1.1), 'c': (1, .9), } ESCAPE = '\x03' ##################################### def get_key(settings): tty.setraw(sys.stdin.fileno()) select.select([sys.stdin], [], [], 0) key = sys.stdin.read(1) termios.tcsetattr(sys.stdin, termios.TCSADRAIN, settings) return key def print_velocities(speed, turn): print("Speed: {} | Turn: {} ".format(speed, turn)) ##################################### def run_simulate(pr2): joints = joints_from_names(pr2, PR2_GROUPS['base']) dx = dy = dz = dth = 1 speed, turn = 0.5, 1.0 while True: velocities = [dx * speed, dy * speed, dth * turn] velocity_control_joints(pr2, joints, velocities) def run_thread(pr2): joints = joints_from_names(pr2, PR2_GROUPS['base']) dx = dy = dz = dth = 0 speed, turn = 0.5, 1.0 settings = termios.tcgetattr(sys.stdin) try: print(HELP_MSG) print_velocities(speed, turn) while True: # TODO: getKeyboardEvents key = get_key(settings) # Waits until a key is read if key in MOVE_BINDINGS: dx, dy, dz, dth = MOVE_BINDINGS[key] elif key in SPEED_BINDINGS: mspeed, mturn = SPEED_BINDINGS[key] speed *= mspeed turn *= mturn print_velocities(speed, turn) else: # When it receives another key dx = dy = dz = dth = 0 if key == ESCAPE: break # twist.linear.dz = dz * speed velocities = [dx * speed, dy * speed, dth * turn] velocity_control_joints(pr2, joints, velocities) except Exception as e: print(e) finally: termios.tcsetattr(sys.stdin, termios.TCSADRAIN, settings) ##################################### def main(): # https://github.com/ros-teleop/teleop_twist_keyboard # http://openrave.org/docs/latest_stable/_modules/openravepy/misc/#SetViewerUserThread connect(use_gui=True) add_data_path() load_pybullet("plane.urdf") #load_pybullet("models/table_collision/table.urdf") with HideOutput(): pr2 = load_model(DRAKE_PR2_URDF, fixed_base=True) enable_gravity() enable_real_time() # TODO: won't work as well on OS X due to simulation thread #run_simulate(pr2) run_thread(pr2) # TODO: keep working on this #userthread = threading.Thread(target=run_thread, args=[pr2]) #userthread.start() #userthread.join() disconnect() if __name__=="__main__": main()
3,571
Python
23.465753
87
0.58555
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/examples/test_kinbody.py
#!/usr/bin/env python from __future__ import print_function from lxml import etree # pip install lxml import os def find_insensitive(elem, pattern): result1 = elem.find(pattern) if result1 is not None: return result1 return elem.find(pattern.lower()) # https://github.mit.edu/mtoussai/KOMO-stream/blob/master/01-basicKOMOinTheKitchen/env2rai.py # https://github.mit.edu/mtoussai/KOMO-stream/blob/master/01-basicKOMOinTheKitchen/collada2rai.py # http://openrave.programmingvision.com/wiki/index.php/Format:XML # http://wiki.ros.org/collada_urdf # http://openrave.org/docs/latest_stable/collada_robot_extensions/ # http://openrave.org/docs/0.8.2/robots_overview/#openrave-xml def parse_shape(link): elem = link.find("origin") if elem is not None: if elem.find("rby") is not None: print('rel=<T t(%s) E(%s)>' % (elem.attrib['xyz'], elem.attrib['rpy'])) else: print('rel=<T t(%s)>' % elem.attrib['xyz']) elem = link.find("geometry/box") if elem is not None: print('type=ST_box size=[%s 0]' % elem.attrib['size']) elem = link.find("geometry/sphere") if elem is not None: print('type=ST_sphere size=[0 0 0 %s]' % elem.attrib['radius']) elem = link.find("geometry/cylinder") if elem is not None: print('type=ST_cylinder size=[0 0 %s %s]' % (elem.attrib['length'], elem.attrib['radius'])) elem = link.find("geometry/mesh") if elem is not None: print('type=ST_mesh mesh=\'%s\'' % elem.attrib['filename']) if elem.find("scale") is not None: print('meshscale=[%s]' % elem.attrib['scale']) elem = link.find("material/color") if elem is not None: print('color=[%s]' % elem.attrib['rgba']) elem = link.find("material") if elem is not None: if elem.attrib['name'] is not None: print('colorName=%s' % elem.attrib['name']) # TODO: this is case sensitive... def parse_body(body): name = body.attrib['name'] print('body %s { X=<' % name) elem = body.find("Body/Translation") if elem is not None: print('t(%s)' % elem.text) elem = body.find("Body/rotationaxis") if elem is not None: rot = [float(i) for i in elem.text.split(' ')] print('d(%f %f %f %f)' % (rot[3], rot[0], rot[1], rot[2])) print('> }\n') # end of body for geom in body.findall("Body/Geom"): print('shape (%s) {' % name) type = geom.attrib['type'] if type == "box": size = [2 * float(i) for i in find_insensitive(geom, "Extents").text.split(' ')] print('type=ST_box size=', size) else: pass #raise NotImplementedError(type) elem = geom.find("translation") if elem is not None: print('rel=<t(%s)>' % elem.text) elem = geom.find("diffuseColor") if elem is not None: print('color=[%s]' % elem.text) print(' }\n') def parse_path(path): xmlData = etree.parse(path) print(xmlData) root = xmlData.getroot() parse_body(root) #bodies = xmlData.find("/Environment") #print(bodies) #bodies = xmlData.findall("/KinBody") #print(bodies) #for body in bodies: # parse_body(body) # TODO: store things as JSONs? def main(): root_directory = os.path.dirname(os.path.abspath(__file__)) openrave_directory = os.path.join(root_directory, '..', 'openrave') rel_path = 'data/ikeatable.kinbody.xml' path = os.path.join(openrave_directory, rel_path) parse_path(path) #connect(use_gui=True) #wait_if_gui('Finish?') #disconnect() if __name__ == '__main__': main()
3,675
Python
31.821428
99
0.596463
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/examples/test_turtlebot_motion.py
from __future__ import print_function import argparse import random import numpy as np import time import math from collections import OrderedDict, defaultdict from pybullet_tools.utils import load_model, TURTLEBOT_URDF, joints_from_names, \ set_joint_positions, HideOutput, get_bodies, sample_placement, pairwise_collision, \ set_point, Point, create_box, stable_z, TAN, GREY, connect, PI, OrderedSet, \ wait_if_gui, dump_body, set_all_color, BLUE, child_link_from_joint, link_from_name, draw_pose, Pose, pose_from_pose2d, \ get_random_seed, get_numpy_seed, set_random_seed, set_numpy_seed, plan_joint_motion, plan_nonholonomic_motion, \ joint_from_name, safe_zip, draw_base_limits, BodySaver, WorldSaver, LockRenderer, elapsed_time, disconnect, flatten, \ INF, wait_for_duration, get_unbuffered_aabb, draw_aabb, DEFAULT_AABB_BUFFER, get_link_pose, get_joint_positions, \ get_subtree_aabb, get_pairs, get_distance_fn, get_aabb, set_all_static, step_simulation, get_bodies_in_region, \ AABB, update_scene, Profiler, pairwise_link_collision, BASE_LINK, get_collision_data, draw_pose2d, \ normalize_interval, wrap_angle, CIRCULAR_LIMITS, wrap_interval, Euler, rescale_interval, adjust_path BASE_LINK_NAME = 'base_link' BASE_JOINTS = ['x', 'y', 'theta'] DRAW_Z = 1e-3 DRAW_LENGTH = 0.5 MIN_AABB_VOLUME = DEFAULT_AABB_BUFFER**3 ################################################## def create_custom_base_limits(robot, base_limits): return {joint_from_name(robot, joint): limits for joint, limits in safe_zip(BASE_JOINTS[:2], zip(*base_limits))} def sample_placements(body_surfaces, obstacles=None, savers=[], min_distances={}): if obstacles is None: obstacles = OrderedSet(get_bodies()) - set(body_surfaces) obstacles = list(obstacles) savers = list(savers) + [BodySaver(obstacle) for obstacle in obstacles] if not isinstance(min_distances, dict): min_distances = {body: min_distances for body in body_surfaces} # TODO: max attempts here for body, surface in body_surfaces.items(): # TODO: shuffle min_distance = min_distances.get(body, 0.) while True: pose = sample_placement(body, surface) if pose is None: for saver in savers: saver.restore() return False for saver in savers: obstacle = saver.body if obstacle in [body, surface]: continue saver.restore() if pairwise_collision(body, obstacle, max_distance=min_distance): break else: obstacles.append(body) break for saver in savers: saver.restore() return True def draw_path(path2d, z=DRAW_Z, **kwargs): if path2d is None: return [] #return list(flatten(draw_pose(pose_from_pose2d(pose2d, z=z), **kwargs) for pose2d in path2d)) #return list(flatten(draw_pose2d(pose2d, z=z, **kwargs) for pose2d in path2d)) base_z = 1. start = path2d[0] mid_yaw = start[2] #mid_yaw = wrap_interval(mid_yaw) interval = (mid_yaw - PI, mid_yaw + PI) #interval = CIRCULAR_LIMITS draw_pose(pose_from_pose2d(start, z=base_z), length=1, **kwargs) # TODO: draw the current pose # TODO: line between orientations when there is a jump return list(flatten(draw_pose2d(pose2d, z=base_z+rescale_interval( wrap_interval(pose2d[2], interval=interval), old_interval=interval, new_interval=(-0.5, 0.5)), **kwargs) for pose2d in path2d)) def plan_motion(robot, joints, goal_positions, attachments=[], obstacles=None, holonomic=False, reversible=False, **kwargs): attached_bodies = [attachment.child for attachment in attachments] moving_bodies = [robot] + attached_bodies if obstacles is None: obstacles = get_bodies() obstacles = OrderedSet(obstacles) - set(moving_bodies) if holonomic: return plan_joint_motion(robot, joints, goal_positions, attachments=attachments, obstacles=obstacles, **kwargs) # TODO: just sample the x, y waypoint and use the resulting orientation # TODO: remove overlapping configurations/intervals due to circular joints return plan_nonholonomic_motion(robot, joints, goal_positions, reversible=reversible, linear_tol=1e-6, angular_tol=0., attachments=attachments, obstacles=obstacles, **kwargs) ################################################## def problem1(n_obstacles=10, wall_side=0.1, obst_width=0.25, obst_height=0.5): floor_extent = 5.0 base_limits = (-floor_extent/2.*np.ones(2), +floor_extent/2.*np.ones(2)) floor_height = 0.001 floor = create_box(floor_extent, floor_extent, floor_height, color=TAN) set_point(floor, Point(z=-floor_height/2.)) wall1 = create_box(floor_extent + wall_side, wall_side, wall_side, color=GREY) set_point(wall1, Point(y=floor_extent/2., z=wall_side/2.)) wall2 = create_box(floor_extent + wall_side, wall_side, wall_side, color=GREY) set_point(wall2, Point(y=-floor_extent/2., z=wall_side/2.)) wall3 = create_box(wall_side, floor_extent + wall_side, wall_side, color=GREY) set_point(wall3, Point(x=floor_extent/2., z=wall_side/2.)) wall4 = create_box(wall_side, floor_extent + wall_side, wall_side, color=GREY) set_point(wall4, Point(x=-floor_extent/2., z=wall_side/2.)) walls = [wall1, wall2, wall3, wall4] initial_surfaces = OrderedDict() for _ in range(n_obstacles): body = create_box(obst_width, obst_width, obst_height, color=GREY) initial_surfaces[body] = floor obstacles = walls + list(initial_surfaces) initial_conf = np.array([+floor_extent/3, -floor_extent/3, 3*PI/4]) goal_conf = -initial_conf with HideOutput(): robot = load_model(TURTLEBOT_URDF) base_joints = joints_from_names(robot, BASE_JOINTS) # base_link = child_link_from_joint(base_joints[-1]) base_link = link_from_name(robot, BASE_LINK_NAME) set_all_color(robot, BLUE) dump_body(robot) set_point(robot, Point(z=stable_z(robot, floor))) draw_pose(Pose(), parent=robot, parent_link=base_link, length=0.5) set_joint_positions(robot, base_joints, initial_conf) sample_placements(initial_surfaces, obstacles=[robot] + walls, savers=[BodySaver(robot, joints=base_joints, positions=goal_conf)], min_distances=10e-2) return robot, base_limits, goal_conf, obstacles ################################################## def iterate_path(robot, joints, path, step_size=None): # 1e-2 | None if path is None: return path = adjust_path(robot, joints, path) with LockRenderer(): handles = draw_path(path) wait_if_gui(message='Begin?') for i, conf in enumerate(path): set_joint_positions(robot, joints, conf) if step_size is None: wait_if_gui(message='{}/{} Continue?'.format(i, len(path))) else: wait_for_duration(duration=step_size) wait_if_gui(message='Finish?') def main(): parser = argparse.ArgumentParser() parser.add_argument('-c', '--cfree', action='store_true', help='When enabled, disables collision checking.') # parser.add_argument('-p', '--problem', default='test_pour', choices=sorted(problem_fn_from_name), # help='The name of the problem to solve.') parser.add_argument('--holonomic', action='store_true', # '-h', help='') parser.add_argument('-l', '--lock', action='store_false', help='') parser.add_argument('-s', '--seed', default=None, type=int, help='The random seed to use.') parser.add_argument('-v', '--viewer', action='store_false', help='') args = parser.parse_args() connect(use_gui=args.viewer) seed = args.seed #seed = 0 #seed = time.time() set_random_seed(seed=seed) # None: 2147483648 = 2**31 set_numpy_seed(seed=seed) print('Random seed:', get_random_seed(), random.random()) print('Numpy seed:', get_numpy_seed(), np.random.random()) ######################### robot, base_limits, goal_conf, obstacles = problem1() draw_base_limits(base_limits) custom_limits = create_custom_base_limits(robot, base_limits) base_joints = joints_from_names(robot, BASE_JOINTS) base_link = link_from_name(robot, BASE_LINK_NAME) if args.cfree: obstacles = [] # for obstacle in obstacles: # draw_aabb(get_aabb(obstacle)) # Updates automatically resolutions = None #resolutions = np.array([0.05, 0.05, math.radians(10)]) set_all_static() # Doesn't seem to affect region_aabb = AABB(lower=-np.ones(3), upper=+np.ones(3)) draw_aabb(region_aabb) step_simulation() # Need to call before get_bodies_in_region #update_scene() # TODO: https://github.com/bulletphysics/bullet3/pull/3331 bodies = get_bodies_in_region(region_aabb) print(len(bodies), bodies) # https://github.com/bulletphysics/bullet3/search?q=broadphase # https://github.com/bulletphysics/bullet3/search?p=1&q=getCachedOverlappingObjects&type=&utf8=%E2%9C%93 # https://andysomogyi.github.io/mechanica/bullet.html # http://www.cs.kent.edu/~ruttan/GameEngines/lectures/Bullet_User_Manual #draw_pose(get_link_pose(robot, base_link), length=0.5) for conf in [get_joint_positions(robot, base_joints), goal_conf]: draw_pose(pose_from_pose2d(conf, z=DRAW_Z), length=DRAW_LENGTH) aabb = get_aabb(robot) #aabb = get_subtree_aabb(robot, base_link) draw_aabb(aabb) for link in [BASE_LINK, base_link]: print(link, get_collision_data(robot, link), pairwise_link_collision(robot, link, robot, link)) ######################### saver = WorldSaver() start_time = time.time() profiler = Profiler(field='tottime', num=50) # tottime | cumtime | None profiler.save() with LockRenderer(lock=args.lock): path = plan_motion(robot, base_joints, goal_conf, holonomic=args.holonomic, obstacles=obstacles, custom_limits=custom_limits, resolutions=resolutions, use_aabb=True, cache=True, max_distance=0., restarts=2, iterations=20, smooth=20) # 20 | None saver.restore() #wait_for_duration(duration=1e-3) profiler.restore() ######################### solved = path is not None length = INF if path is None else len(path) cost = sum(get_distance_fn(robot, base_joints, weights=resolutions)(*pair) for pair in get_pairs(path)) print('Solved: {} | Length: {} | Cost: {:.3f} | Runtime: {:.3f} sec'.format( solved, length, cost, elapsed_time(start_time))) if path is None: disconnect() return iterate_path(robot, base_joints, path) disconnect() if __name__ == '__main__': main()
11,128
Python
43.162698
124
0.626168
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/examples/test_se3.py
#!/usr/bin/env python from __future__ import print_function import numpy as np from pybullet_tools.utils import connect, disconnect, wait_for_user, create_box, dump_body, \ get_link_pose, euler_from_quat, RED, set_camera_pose, create_flying_body, create_shape, get_cylinder_geometry, \ BLUE, get_movable_joints, get_links, SE3, set_joint_positions, \ plan_joint_motion, add_line, GREEN, intrinsic_euler_from_quat SIZE = 1. CUSTOM_LIMITS = { 'x': (-SIZE, SIZE), 'y': (-SIZE, SIZE), 'z': (-SIZE, SIZE), } def main(group=SE3): connect(use_gui=True) set_camera_pose(camera_point=SIZE*np.array([1., -1., 1.])) # TODO: can also create all links and fix some joints # TODO: SE(3) motion planner (like my SE(3) one) where some dimensions are fixed obstacle = create_box(w=SIZE, l=SIZE, h=SIZE, color=RED) #robot = create_cylinder(radius=0.025, height=0.1, color=BLUE) obstacles = [obstacle] collision_id, visual_id = create_shape(get_cylinder_geometry(radius=0.025, height=0.1), color=BLUE) robot = create_flying_body(group, collision_id, visual_id) body_link = get_links(robot)[-1] joints = get_movable_joints(robot) joint_from_group = dict(zip(group, joints)) print(joint_from_group) #print(get_aabb(robot, body_link)) dump_body(robot, fixed=False) custom_limits = {joint_from_group[j]: l for j, l in CUSTOM_LIMITS.items()} # sample_fn = get_sample_fn(robot, joints, custom_limits=custom_limits) # for i in range(10): # conf = sample_fn() # set_joint_positions(robot, joints, conf) # wait_for_user('Iteration: {}'.format(i)) # return initial_point = SIZE*np.array([-1., -1., 0]) #initial_point = -1.*np.ones(3) final_point = -initial_point initial_euler = np.zeros(3) add_line(initial_point, final_point, color=GREEN) initial_conf = np.concatenate([initial_point, initial_euler]) final_conf = np.concatenate([final_point, initial_euler]) set_joint_positions(robot, joints, initial_conf) #print(initial_point, get_link_pose(robot, body_link)) #set_pose(robot, Pose(point=-1.*np.ones(3))) # TODO: sample orientation uniformly at random # http://planning.cs.uiuc.edu/node198.html #from pybullet_tools.transformations import random_quaternion path = plan_joint_motion(robot, joints, final_conf, obstacles=obstacles, self_collisions=False, custom_limits=custom_limits) if path is None: disconnect() return for i, conf in enumerate(path): set_joint_positions(robot, joints, conf) point, quat = get_link_pose(robot, body_link) #euler = euler_from_quat(quat) euler = intrinsic_euler_from_quat(quat) print(conf) print(point, euler) wait_for_user('Step: {}/{}'.format(i, len(path))) wait_for_user('Finish?') disconnect() if __name__ == '__main__': main()
2,957
Python
34.214285
116
0.646601
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/examples/test_movo.py
#!/usr/bin/env python from __future__ import print_function import time import numpy as np import pybullet as p from examples.test_franka import test_retraction from pybullet_tools.ikfast.ikfast import get_ik_joints, check_ik_solver from pybullet_tools.movo_constants import get_closed_positions, get_open_positions, TOOL_LINK, get_gripper_joints, ARMS, \ MOVO_URDF, MOVO_INFOS, RIGHT, get_arm_joints, MOVO_COLOR, BASE_JOINTS from pybullet_tools.pr2_utils import get_side_grasps, close_until_collision from pybullet_tools.utils import add_data_path, connect, dump_body, load_model, disconnect, wait_if_gui, \ get_sample_fn, set_joint_positions, LockRenderer, link_from_name, HideOutput, \ joints_from_names, set_color, get_links, get_max_limits, get_min_limits, get_extend_fn, get_link_pose, \ get_joint_names, draw_pose, remove_handles, draw_base_limits, \ elapsed_time, create_box, RED, \ unit_pose, multiply, set_pose, assign_link_colors, set_all_color def test_close_gripper(robot, arm): gripper_joints = get_gripper_joints(robot, arm) extend_fn = get_extend_fn(robot, gripper_joints) for positions in extend_fn(get_open_positions(robot, arm), get_closed_positions(robot, arm)): set_joint_positions(robot, gripper_joints, positions) print(positions) wait_if_gui('Continue?') def test_grasps(robot, block): for arm in ARMS: gripper_joints = get_gripper_joints(robot, arm) tool_link = link_from_name(robot, TOOL_LINK.format(arm)) tool_pose = get_link_pose(robot, tool_link) #handles = draw_pose(tool_pose) #grasps = get_top_grasps(block, under=True, tool_pose=unit_pose()) grasps = get_side_grasps(block, under=True, tool_pose=unit_pose()) for i, grasp_pose in enumerate(grasps): block_pose = multiply(tool_pose, grasp_pose) set_pose(block, block_pose) close_until_collision(robot, gripper_joints, bodies=[block], open_conf=get_open_positions(robot, arm), closed_conf=get_closed_positions(robot, arm)) handles = draw_pose(block_pose) wait_if_gui('Grasp {}'.format(i)) remove_handles(handles) ##################################### def main(num_iterations=10): # The URDF loader seems robust to package:// and slightly wrong relative paths? connect(use_gui=True) add_data_path() plane = p.loadURDF("plane.urdf") side = 0.05 block = create_box(w=side, l=side, h=side, color=RED) start_time = time.time() with LockRenderer(): with HideOutput(): # TODO: MOVO must be loaded last robot = load_model(MOVO_URDF, fixed_base=True) #set_all_color(robot, color=MOVO_COLOR) assign_link_colors(robot) base_joints = joints_from_names(robot, BASE_JOINTS) draw_base_limits((get_min_limits(robot, base_joints), get_max_limits(robot, base_joints)), z=1e-2) print('Load time: {:.3f}'.format(elapsed_time(start_time))) dump_body(robot) #print(get_colliding(robot)) #for arm in ARMS: # test_close_gripper(robot, arm) #test_grasps(robot, block) arm = RIGHT tool_link = link_from_name(robot, TOOL_LINK.format(arm)) #joint_names = HEAD_JOINTS #joints = joints_from_names(robot, joint_names) joints = base_joints + get_arm_joints(robot, arm) #joints = get_movable_joints(robot) print('Joints:', get_joint_names(robot, joints)) ik_info = MOVO_INFOS[arm] check_ik_solver(ik_info) ik_joints = get_ik_joints(robot, ik_info, tool_link) #fixed_joints = [] fixed_joints = ik_joints[:1] #fixed_joints = ik_joints wait_if_gui('Start?') sample_fn = get_sample_fn(robot, joints) handles = [] for i in range(num_iterations): conf = sample_fn() print('Iteration: {}/{} | Conf: {}'.format(i+1, num_iterations, np.array(conf))) set_joint_positions(robot, joints, conf) tool_pose = get_link_pose(robot, tool_link) remove_handles(handles) handles = draw_pose(tool_pose) wait_if_gui() #conf = next(ikfast_inverse_kinematics(robot, MOVO_INFOS[arm], tool_link, tool_pose, # fixed_joints=fixed_joints, max_time=0.1), None) #if conf is not None: # set_joint_positions(robot, ik_joints, conf) #wait_if_gui() test_retraction(robot, ik_info, tool_link, fixed_joints=fixed_joints, max_time=0.05, max_candidates=100) disconnect() if __name__ == '__main__': main()
4,625
Python
39.578947
122
0.637189
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/examples/test_clone.py
#!/usr/bin/env python from __future__ import print_function from pybullet_tools.pr2_utils import PR2_GROUPS from pybullet_tools.utils import HideOutput, disconnect, set_base_values, joint_from_name, connect, wait_if_gui, \ dump_world, get_link_name, wait_if_gui, clone_body, get_link_parent, get_link_descendants, load_model def test_clone_robot(pr2): # TODO: j toggles frames, p prints timings, w is wire, a is boxes new_pr2 = clone_body(pr2, visual=True, collision=False) #new_pr2 = clone_body_editor(pr2, visual=True, collision=True) dump_world() #print(load_srdf_collisions()) #print(load_dae_collisions()) # TODO: some unimportant quats are off for both URDF and other # TODO: maybe all the frames are actually correct when I load things this way? # TODO: the visual geometries are off but not the collision frames? """ import numpy as np for link in get_links(pr2): if not get_visual_data(new_pr2, link): # pybullet.error: Error receiving visual shape info? continue #print(get_link_name(pr2, link)) data1 = VisualShapeData(*get_visual_data(pr2, link)[0]) data2 = VisualShapeData(*get_visual_data(new_pr2, link)[0]) pose1 = (data1.localVisualFrame_position, data1.localVisualFrame_orientation) pose2 = (data2.localVisualFrame_position, data2.localVisualFrame_orientation) #pose1 = get_link_pose(pr2, link) # Links are fine #pose2 = get_link_pose(new_pr2, link) #pose1 = get_joint_parent_frame(pr2, link) #pose2 = get_joint_parent_frame(new_pr2, link) #pose1 = get_joint_inertial_pose(pr2, link) # Inertia is fine #pose2 = get_joint_inertial_pose(new_pr2, link) if not np.allclose(pose1[0], pose2[0], rtol=0, atol=1e-3): print('Point', get_link_name(pr2, link), link, pose1[0], pose2[0]) #print(data1) #print(data2) #print(get_joint_parent_frame(pr2, link), get_joint_parent_frame(new_pr2, link)) print(get_joint_inertial_pose(pr2, link)) #, get_joint_inertial_pose(new_pr2, link)) print() if not np.allclose(euler_from_quat(pose1[1]), euler_from_quat(pose2[1]), rtol=0, atol=1e-3): print('Quat', get_link_name(pr2, link), link, euler_from_quat(pose1[1]), euler_from_quat(pose2[1])) joint_info1 = get_joint_info(pr2, link) joint_info2 = get_joint_info(new_pr2, link) # TODO: the axis is off for some of these if not np.allclose(joint_info1.jointAxis, joint_info2.jointAxis, rtol=0, atol=1e-3): print('Axis', get_link_name(pr2, link), link, joint_info1.jointAxis, joint_info2.jointAxis) """ set_base_values(new_pr2, (2, 0, 0)) wait_if_gui() # TODO: the drake one has a large out-of-place cylinder as well def test_clone_arm(pr2): first_joint_name = PR2_GROUPS['left_arm'][0] first_joint = joint_from_name(pr2, first_joint_name) parent_joint = get_link_parent(pr2, first_joint) print(get_link_name(pr2, parent_joint), parent_joint, first_joint_name, first_joint) print(get_link_descendants(pr2, first_joint)) # TODO: least common ancestor links = [first_joint] + get_link_descendants(pr2, first_joint) new_arm = clone_body(pr2, links=links, collision=False) dump_world() set_base_values(pr2, (-2, 0, 0)) wait_if_gui() def main(): connect(use_gui=True) with HideOutput(): pr2 = load_model("models/pr2_description/pr2.urdf") test_clone_robot(pr2) test_clone_arm(pr2) wait_if_gui('Finish?') disconnect() if __name__ == '__main__': main()
3,645
Python
43.463414
114
0.651578
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/examples/test_tamp_xml.py
#!/usr/bin/env python from __future__ import print_function import colorsys import glob import os import pybullet as p import random import sys import numpy as np from lxml import etree from pybullet_tools.pr2_utils import DRAKE_PR2_URDF, set_group_conf from pybullet_tools.utils import STATIC_MASS, CLIENT, connect, \ disconnect, set_pose, wait_if_gui, load_model, HideOutput, base_values_from_pose, create_shape, \ get_mesh_geometry, point_from_pose, set_camera_pose, draw_global_system from pybullet_tools.utils import quaternion_from_matrix # https://docs.python.org/3.5/library/xml.etree.elementtree.html # https://lxml.de/tutorial.html def parse_array(element): return np.array(element.text.split(), dtype=np.float) def parse_pose(element): homogenous = [0, 0, 0, 1] matrix = np.reshape(np.concatenate([parse_array(element), homogenous]), [4, 4]) point = matrix[:3, 3] quat = quaternion_from_matrix(matrix) return (point, quat) def parse_boolean(element): text = element.text if text == 'true': return True if text == 'false': return False raise ValueError(text) MAX_INT = sys.maxsize + 1 def parse_object(obj, mesh_directory): name = obj.find('name').text mesh_filename = obj.find('geom').text geom = get_mesh_geometry(os.path.join(mesh_directory, mesh_filename)) pose = parse_pose(obj.find('pose')) movable = parse_boolean(obj.find('moveable')) color = (.75, .75, .75, 1) if 'red' in name: color = (1, 0, 0, 1) elif 'green' in name: color = (0, 1, 0, 1) elif 'blue' in name: color = (0, 0, 1, 1) elif movable: # TODO: assign new color #size = 2 * MAX_INT #size = 255 #n = id(obj) % size #n = hash(obj) % size #h = float(n) / size h = random.random() r, g, b = colorsys.hsv_to_rgb(h, .75, .75) color = (r, g, b, 1) print(name, mesh_filename, movable, color) collision_id, visual_id = create_shape(geom, color=color) body_id = p.createMultiBody(baseMass=STATIC_MASS, baseCollisionShapeIndex=collision_id, baseVisualShapeIndex=visual_id, physicsClientId=CLIENT) set_pose(body_id, pose) return body_id def parse_robot(robot): name = robot.find('name').text urdf = robot.find('urdf').text fixed_base = not parse_boolean(robot.find('movebase')) print(name, urdf, fixed_base) pose = parse_pose(robot.find('basepose')) torso = parse_array(robot.find('torso')) left_arm = parse_array(robot.find('left_arm')) right_arm = parse_array(robot.find('right_arm')) assert (name == 'pr2') with HideOutput(): robot_id = load_model(DRAKE_PR2_URDF, fixed_base=True) set_pose(robot_id, pose) #set_group_conf(robot_id, 'base', base_values_from_pose(pose)) set_group_conf(robot_id, 'torso', torso) set_group_conf(robot_id, 'left_arm', left_arm) set_group_conf(robot_id, 'right_arm', right_arm) #set_point(robot_id, Point(z=point_from_pose(pose)[2])) # TODO: base pose isn't right # print(robot.tag) # print(robot.attrib) # print(list(robot.iter('basepose'))) return robot_id DISC = 'disc' BLOCK = 'cube' PEG = 'peg' def main(): benchmark = 'tmp-benchmark-data' problem = 'problem1' # Hanoi #problem = 'problem2' # Blocksworld #problem = 'problem3' # Clutter #problem = 'problem4' # Nonmono root_directory = os.path.dirname(os.path.abspath(__file__)) directory = os.path.join(root_directory, '..', 'problems', benchmark, problem) [mesh_directory] = list(filter(os.path.isdir, (os.path.join(directory, o) for o in os.listdir(directory) if o.endswith('meshes')))) [xml_path] = [os.path.join(directory, o) for o in os.listdir(directory) if o.endswith('xml')] if os.path.isdir(xml_path): xml_path = glob.glob(os.path.join(xml_path, '*.xml'))[0] print(mesh_directory) print(xml_path) xml_data = etree.parse(xml_path) connect(use_gui=True) #add_data_path() #load_pybullet("plane.urdf") draw_global_system() set_camera_pose(camera_point=[+1, -1, 1]) #root = xml_data.getroot() #print(root.items()) for obj in xml_data.findall('/objects/obj'): parse_object(obj, mesh_directory) for robot in xml_data.findall('/robots/robot'): parse_robot(robot) wait_if_gui() disconnect() if __name__ == '__main__': main()
4,511
Python
31.228571
106
0.629129
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/examples/test_franka.py
#!/usr/bin/env python from __future__ import print_function import pybullet as p from pybullet_tools.utils import add_data_path, connect, dump_body, disconnect, wait_for_user, \ get_movable_joints, get_sample_fn, set_joint_positions, get_joint_name, LockRenderer, link_from_name, get_link_pose, \ multiply, Pose, Point, interpolate_poses, HideOutput, draw_pose, set_camera_pose, load_pybullet, \ assign_link_colors, add_line, point_from_pose, remove_handles, BLUE from pybullet_tools.ikfast.franka_panda.ik import PANDA_INFO, FRANKA_URDF from pybullet_tools.ikfast.ikfast import get_ik_joints, either_inverse_kinematics, check_ik_solver def test_retraction(robot, info, tool_link, distance=0.1, **kwargs): ik_joints = get_ik_joints(robot, info, tool_link) start_pose = get_link_pose(robot, tool_link) end_pose = multiply(start_pose, Pose(Point(z=-distance))) handles = [add_line(point_from_pose(start_pose), point_from_pose(end_pose), color=BLUE)] #handles.extend(draw_pose(start_pose)) #handles.extend(draw_pose(end_pose)) path = [] pose_path = list(interpolate_poses(start_pose, end_pose, pos_step_size=0.01)) for i, pose in enumerate(pose_path): print('Waypoint: {}/{}'.format(i+1, len(pose_path))) handles.extend(draw_pose(pose)) conf = next(either_inverse_kinematics(robot, info, tool_link, pose, **kwargs), None) if conf is None: print('Failure!') path = None wait_for_user() break set_joint_positions(robot, ik_joints, conf) path.append(conf) wait_for_user() # for conf in islice(ikfast_inverse_kinematics(robot, info, tool_link, pose, max_attempts=INF, max_distance=0.5), 1): # set_joint_positions(robot, joints[:len(conf)], conf) # wait_for_user() remove_handles(handles) return path ##################################### def main(): connect(use_gui=True) add_data_path() draw_pose(Pose(), length=1.) set_camera_pose(camera_point=[1, -1, 1]) plane = p.loadURDF("plane.urdf") with LockRenderer(): with HideOutput(True): robot = load_pybullet(FRANKA_URDF, fixed_base=True) assign_link_colors(robot, max_colors=3, s=0.5, v=1.) #set_all_color(robot, GREEN) obstacles = [plane] # TODO: collisions with the ground dump_body(robot) print('Start?') wait_for_user() info = PANDA_INFO tool_link = link_from_name(robot, 'panda_hand') draw_pose(Pose(), parent=robot, parent_link=tool_link) joints = get_movable_joints(robot) print('Joints', [get_joint_name(robot, joint) for joint in joints]) check_ik_solver(info) sample_fn = get_sample_fn(robot, joints) for i in range(10): print('Iteration:', i) conf = sample_fn() set_joint_positions(robot, joints, conf) wait_for_user() test_retraction(robot, info, tool_link, use_pybullet=False, max_distance=0.1, max_time=0.05, max_candidates=100) disconnect() if __name__ == '__main__': main()
3,124
Python
36.650602
125
0.633483
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/examples/test_json.py
#!/usr/bin/env python from __future__ import print_function import json import os from pybullet_tools.parse_json import parse_pose, parse_robot, parse_region, parse_body from pybullet_tools.utils import connect, \ disconnect, wait_for_interrupt, point_from_pose, set_camera_pose, \ reset_simulation, wait_if_gui from pybullet_tools.pr2_problems import Problem BODY_FIELDS = [u'table_names', u'sink_names', u'stove_names'] # [u'goal_cleaned', u'regions', u'goal_stackings', u'name', # u'sink_names', u'goal_regions', u'goal_cooked', # u'goal_config', u'table_names', u'floor_object_names', # u'grasp_types', u'goal_holding', u'object_names', u'stove_names', u'goal_poses'] def parse_task(task, robots, bodies, regions): [robot] = robots.values() arm = 'left' goal_holding = [] if task['goal_holding'] is not None: goal_holding.append((arm, bodies[task['goal_holding']])) # TODO: combine robots, bodies, regions arms = [arm] movable = [bodies[n] for n in task['object_names']] grasp_types = [grasp_type.lower() for grasp_type in task['grasp_types']] #grasp_types = ['top'] sinks = [bodies[n] for n in task['sink_names']] stoves = [bodies[n] for n in task['stove_names']] surfaces = [bodies[n] for n in task['table_names']] + list(regions.values()) + sinks + stoves #buttons = tuple() #assert not task['goal_poses'] assert task['goal_config'] is None goal_conf = None goal_on = [(bodies[n1], bodies[n2]) for n1, n2 in task['goal_stackings'].items()] + \ [(bodies[n1], regions[n2]) for n1, n2 in task['goal_regions'].items()] goal_cleaned = [bodies[n] for n in task['goal_cleaned']] goal_cooked = [bodies[n] for n in task['goal_cooked']] body_names = {body: name for name, body in list(bodies.items()) + list(regions.items())} return Problem(robot=robot, arms=arms, movable=movable, grasp_types=grasp_types, surfaces=surfaces, sinks=sinks, stoves=stoves, goal_conf=goal_conf, goal_on=goal_on, goal_cleaned=goal_cleaned, goal_cooked=goal_cooked, body_names=body_names) ################################################## JSON_DIRECTORY = 'problems/json/' def get_json_directory(): root_directory = os.path.dirname(os.path.abspath(__file__)) return os.path.join(root_directory, '..', JSON_DIRECTORY) def get_json_filenames(): return os.listdir(get_json_directory()) def load_json_problem(problem_filename): reset_simulation() json_path = os.path.join(get_json_directory(), problem_filename) with open(json_path, 'r') as f: problem_json = json.loads(f.read()) set_camera_pose(point_from_pose(parse_pose(problem_json['camera']))) task_json = problem_json['task'] important_bodies = [] for field in BODY_FIELDS: important_bodies.extend(task_json[field]) robots = {robot['name']: parse_robot(robot) for robot in problem_json['robots']} bodies = {body['name']: parse_body(body, (body['name'] in important_bodies)) for body in problem_json['bodies']} regions = {region['name']: parse_region(region) for region in task_json['regions']} #print(get_image()) return parse_task(task_json, robots, bodies, regions) ################################################## # TODO: cannot solve any FFRob FFROB = ['blocks_row', 'bury', 'clean', 'cook', 'dig', 'invert', 'move', 'move_distractions', 'organize', 'panel', 'real_regrasp', 'regrasp', 'regrasp_distractions', 'table', 'transporter', 'walls'] # ['blocked.json', # 'dantam.json', 'dantam2.json', 'dantam_3.json', 'decision_namo.json', # 'decision_wall_namo_2.json', 'decision_wall_namo_3.json', # 'dinner.json', 'disconnected.json', 'distract_0.json', 'distract_10.json', # 'distract_12.json', 'distract_16.json', 'distract_20.json', 'distract_24.json', # 'distract_30.json', 'distract_4.json', 'distract_40.json', 'distract_8.json', # 'distractions.json', 'easy_dinner.json', 'kitchen.json', # 'move_regrasp.json', 'move_several_10.json', # 'move_several_12.json', 'move_several_14.json', 'move_several_16.json', 'move_several_18.json', # 'move_several_20.json', 'move_several_24.json', 'move_several_28.json', 'move_several_32.json', # 'move_several_4.json', 'move_several_8.json', 'nonmonotonic_4_1.json', 'nonmonotonic_4_2.json', # 'nonmonotonic_4_3.json', 'nonmonotonic_4_4.json', 'push_table.json', # 'push_wall.json', 'rearrangement_10.json', 'rearrangement_12.json', # 'rearrangement_14.json', 'rearrangement_16.json', 'rearrangement_18.json', 'rearrangement_20.json', # 'rearrangement_4.json', 'rearrangement_6.json', 'rearrangement_8.json', # 'replace.json', 'separate_2.json', 'separate_4.json', 'separate_6.json', # 'separate_7.json', 'shelf_arrangement.json', 'simple.json', 'simple2.json', 'simple_holding.json', # 'simple_namo.json', 'simple_push.json', # 'srivastava_table.json', 'stacking.json', # 'trivial_namo.json', 'two_tables_1.json', 'two_tables_2.json', # 'two_tables_3.json', 'two_tables_4.json', 'wall_namo_2.json', 'wall_namo_3.json'] IJRR = [] # HBF RSS = ['blocked.json', 'dinner.json', 'disconnected.json', 'distract_0.json', 'distract_10.json', 'distract_12.json', 'distract_16.json', 'distract_20.json', 'distract_24.json', 'distract_30.json', 'distract_4.json', 'distract_40.json', 'distract_8.json', 'distractions.json', 'easy_dinner.json', 'kitchen.json', 'move_regrasp.json', 'move_several_10.json', 'move_several_12.json', 'move_several_14.json', 'move_several_16.json', 'move_several_18.json', 'move_several_20.json', 'move_several_24.json', 'move_several_28.json', 'move_several_32.json', 'move_several_4.json', 'move_several_8.json', 'nonmonotonic_4_1.json', 'nonmonotonic_4_2.json', 'push_table.json', 'push_wall.json', 'rearrangement_10.json', 'rearrangement_12.json', 'rearrangement_14.json', 'rearrangement_16.json', 'rearrangement_18.json', 'rearrangement_20.json', 'rearrangement_4.json', 'rearrangement_6.json', 'rearrangement_8.json', 'replace.json', 'separate_2.json', 'separate_4.json', 'separate_6.json', 'separate_7.json', 'shelf_arrangement.json', 'simple.json', 'simple2.json', 'simple_holding.json', 'simple_push.json', 'srivastava_table.json', 'stacking.json', 'two_tables_1.json', 'two_tables_2.json', 'two_tables_3.json', 'two_tables_4.json'] IJCAI = ['exists_hold_obs_0.json', 'exists_hold_obs_1.json', 'exists_hold_obs_2.json', 'exists_hold_obs_4.json', 'exists_hold_obs_5.json', 'exists_holding_1.json', 'exists_holding_2.json', 'exists_holding_3.json', 'exists_holding_blocked.json', 'exists_holding_unreachable.json', 'exists_region_1.json', 'sink_stove_2_16.json', 'sink_stove_2_20.json', 'sink_stove_2_4.json', 'sink_stove_2_8.json', 'sink_stove_4_0.json', 'sink_stove_4_12.json', 'sink_stove_4_15.json', 'sink_stove_4_16.json', 'sink_stove_4_20.json', 'sink_stove_4_30.json', 'sink_stove_4_4.json', 'sink_stove_4_40.json', 'sink_stove_4_8.json'] ################################################## SCREENSHOT_DIR = 'images/json' def main(screenshot=False): connect(use_gui=True) print(get_json_filenames()) #problem_filenames = sorted(os.listdir(openrave_directory)) #problem_filenames = ['{}.json'.format(name) for name in FFROB] #problem_filenames = ['sink_stove_4_30.json'] # 'dinner.json' | 'simple.json' problem_filenames = ['simple.json'] # 'dinner.json' | 'simple.json' # Mac width/height #width = 2560 #height = 1600 # #640, 480 for problem_filename in problem_filenames: load_json_problem(problem_filename) if screenshot: problem_name = problem_filename.split('.')[0] image_filename = "{}.png".format(problem_name) image_path = os.path.join(SCREENSHOT_DIR, image_filename) wait_for_interrupt(max_time=0.5) os.system("screencapture -R {},{},{},{} {}".format( 225, 200, 600, 500, image_path)) else: wait_if_gui() disconnect() if __name__ == '__main__': main()
8,112
Python
44.578651
115
0.642751
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/examples/test_models.py
import os import pybullet as p from pybullet_tools.utils import create_mesh, set_point, read_pcd_file, disconnect, \ wait_if_gui, mesh_from_points, get_links, get_num_links, connect, load_pybullet, \ create_obj, WHITE, get_client, NULL_ID, set_color, get_all_links SODA_CLOUD = 'soda.pcd' CLOUDS = { 'oil': 'oilBottle.pcd', 'soup': 'soup16.pcd', 'block': SODA_CLOUD, 'red': SODA_CLOUD, 'orange': SODA_CLOUD, 'green': SODA_CLOUD, 'blue': SODA_CLOUD, 'purple': SODA_CLOUD, } SODA_MESH = 'soda.off' MESHES = { # Cap is literally the bottle cap 'oil': 'oil_bottle_simple_new.off', # oil_bottle_simple_cap, oil_bottle_simple_new, oilBottleWithCapNew, oilBottleWithCap, ... 'soup': 'soup16.off', # 'block': SODA_MESH, # soda.off, soda_original.off, soda_points.off 'red': SODA_MESH, 'orange': SODA_MESH, 'green': SODA_MESH, 'blue': SODA_MESH, 'purple': SODA_MESH, } LIS_DIRECTORY = "/Users/caelan/Programs/LIS/git/lis-data/" def test_lis(world): #model = 'oil' model = 'soup' point_path = os.path.join(LIS_DIRECTORY, 'clouds', CLOUDS[model]) mesh_path = os.path.join(LIS_DIRECTORY, 'meshes', MESHES[model]) # off | ply | wrl #ycb_path = os.path.join(DATA_DIRECTORY, 'ycb', 'plastic_wine_cup', 'meshes', 'tsdf.stl') # stl | ply ycb_path = os.path.join(LIS_DIRECTORY, 'ycb', 'plastic_wine_cup', 'textured_meshes', 'optimized_tsdf_texture_mapped_mesh.obj') # ply print(point_path) print(mesh_path) print(ycb_path) #mesh = read_mesh_off(mesh_path, scale=0.001) #print(mesh) points = read_pcd_file(point_path) #print(points) #print(convex_hull(points)) mesh = mesh_from_points(points) #print(mesh) body = create_mesh(mesh, color=(1, 0, 0, 1)) #print(get_num_links(body)) #print(mesh_from_body(body)) #set_point(body, (1, 1, 1)) wait_if_gui() ##################################### YCB_DIRECTORY = "/Users/caelan/Programs/ycb_benchmarks/processed_data/" YCB_TEMPLATE = '{:03d}_{}' POISSON = 'poisson/' TSDF = 'tsdf/' OBJ_PATH = 'textured.obj' PNG_PATH = 'textured.png' SENSOR = POISSON # POISSON | TSDF def get_ycb_objects(): return {name.split('_', 1)[-1]: name for name in os.listdir(YCB_DIRECTORY) if os.path.isdir(os.path.join(YCB_DIRECTORY, name))} def set_texture(body, image_path): #if color is not None: # set_color(body, color) assert image_path.endswith('.png') texture = p.loadTexture(image_path) assert 0 <= texture p.changeVisualShape(body, linkIndex=NULL_ID, shapeIndex=NULL_ID, #rgbaColor=WHITE, textureUniqueId=texture, #specularColor=(0, 0, 0), physicsClientId=get_client()) return texture def test_ycb(world): name = 'mustard_bottle' # potted_meat_can | cracker_box | sugar_box | mustard_bottle | bowl path_from_name = get_ycb_objects() print(path_from_name) ycb_directory = os.path.join(YCB_DIRECTORY, path_from_name[name], SENSOR) obj_path = os.path.join(ycb_directory, OBJ_PATH) image_path = os.path.join(ycb_directory, PNG_PATH) print(obj_path) #body = load_pybullet(obj_path) #, fixed_base=True) body = create_obj(obj_path, color=WHITE) set_texture(body, image_path) for link in get_all_links(body): set_color(body, link=link, color=WHITE) wait_if_gui() ##################################### def main(): world = connect(use_gui=True) #test_lis(world) test_ycb(world) disconnect() if __name__ == '__main__': main()
3,595
Python
28.719008
105
0.619471
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/examples/test_kuka_pick.py
#!/usr/bin/env python from __future__ import print_function from pybullet_tools.kuka_primitives import BodyPose, BodyConf, Command, get_grasp_gen, \ get_ik_fn, get_free_motion_gen, get_holding_motion_gen from pybullet_tools.utils import WorldSaver, enable_gravity, connect, dump_world, set_pose, \ draw_global_system, draw_pose, set_camera_pose, Pose, Point, set_default_camera, stable_z, \ BLOCK_URDF, load_model, wait_if_gui, disconnect, DRAKE_IIWA_URDF, wait_if_gui, update_state, disable_real_time, HideOutput def plan(robot, block, fixed, teleport): grasp_gen = get_grasp_gen(robot, 'top') ik_fn = get_ik_fn(robot, fixed=fixed, teleport=teleport) free_motion_fn = get_free_motion_gen(robot, fixed=([block] + fixed), teleport=teleport) holding_motion_fn = get_holding_motion_gen(robot, fixed=fixed, teleport=teleport) pose0 = BodyPose(block) conf0 = BodyConf(robot) saved_world = WorldSaver() for grasp, in grasp_gen(block): saved_world.restore() result1 = ik_fn(block, pose0, grasp) if result1 is None: continue conf1, path2 = result1 pose0.assign() result2 = free_motion_fn(conf0, conf1) if result2 is None: continue path1, = result2 result3 = holding_motion_fn(conf1, conf0, block, grasp) if result3 is None: continue path3, = result3 return Command(path1.body_paths + path2.body_paths + path3.body_paths) return None def main(display='execute'): # control | execute | step connect(use_gui=True) disable_real_time() draw_global_system() with HideOutput(): robot = load_model(DRAKE_IIWA_URDF) # KUKA_IIWA_URDF | DRAKE_IIWA_URDF floor = load_model('models/short_floor.urdf') block = load_model(BLOCK_URDF, fixed_base=False) set_pose(block, Pose(Point(y=0.5, z=stable_z(block, floor)))) set_default_camera(distance=2) dump_world() saved_world = WorldSaver() command = plan(robot, block, fixed=[floor], teleport=False) if (command is None) or (display is None): print('Unable to find a plan!') return saved_world.restore() update_state() wait_if_gui('{}?'.format(display)) if display == 'control': enable_gravity() command.control(real_time=False, dt=0) elif display == 'execute': command.refine(num_steps=10).execute(time_step=0.005) elif display == 'step': command.step() else: raise ValueError(display) print('Quit?') wait_if_gui() disconnect() if __name__ == '__main__': main()
2,687
Python
33.461538
126
0.627838
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/examples/test_turtlebot.py
#!/usr/bin/env python from __future__ import print_function import random import numpy as np from pybullet_tools.utils import connect, load_model, disconnect, wait_if_gui, create_box, set_point, dump_body, \ TURTLEBOT_URDF, HideOutput, LockRenderer, joint_from_name, set_euler, get_euler, get_point, \ set_joint_position, get_joint_positions, pairwise_collision, stable_z, wait_for_duration, get_link_pose, \ link_from_name, get_pose, euler_from_quat, multiply, invert, draw_pose, unit_point, unit_quat, \ remove_debug, get_aabb, draw_aabb, get_subtree_aabb, ROOMBA_URDF, set_all_static, assign_link_colors, \ set_camera_pose, RGBA, draw_point # RGBA colors (alpha is transparency) RED = RGBA(1, 0, 0, 1) TAN = RGBA(0.824, 0.706, 0.549, 1) def main(floor_width=2.0): # Creates a pybullet world and a visualizer for it connect(use_gui=True) set_camera_pose(camera_point=[1, -1, 1], target_point=unit_point()) # Sets the camera's position identity_pose = (unit_point(), unit_quat()) origin_handles = draw_pose(identity_pose, length=1.0) # Draws the origin coordinate system (x:RED, y:GREEN, z:BLUE) # Bodies are described by an integer index floor = create_box(w=floor_width, l=floor_width, h=0.001, color=TAN) # Creates a tan box object for the floor set_point(floor, [0, 0, -0.001 / 2.]) # Sets the [x,y,z] translation of the floor obstacle = create_box(w=0.5, l=0.5, h=0.1, color=RED) # Creates a red box obstacle set_point(obstacle, [0.5, 0.5, 0.1 / 2.]) # Sets the [x,y,z] position of the obstacle print('Position:', get_point(obstacle)) set_euler(obstacle, [0, 0, np.pi / 4]) # Sets the [roll,pitch,yaw] orientation of the obstacle print('Orientation:', get_euler(obstacle)) with LockRenderer(): # Temporarily prevents the renderer from updating for improved loading efficiency with HideOutput(): # Temporarily suppresses pybullet output robot = load_model(TURTLEBOT_URDF) # TURTLEBOT_URDF | ROOMBA_URDF # Loads a robot from a *.urdf file assign_link_colors(robot) robot_z = stable_z(robot, floor) # Returns the z offset required for robot to be placed on floor set_point(robot, [0, 0, robot_z]) # Sets the z position of the robot dump_body(robot) # Prints joint and link information about robot set_all_static() # Joints are also described by an integer index # The turtlebots has explicit joints representing x, y, theta x_joint = joint_from_name(robot, 'x') # Looks up the robot joint named 'x' y_joint = joint_from_name(robot, 'y') # Looks up the robot joint named 'y' theta_joint = joint_from_name(robot, 'theta') # Looks up the robot joint named 'theta' joints = [x_joint, y_joint, theta_joint] base_link = link_from_name(robot, 'base_link') # Looks up the robot link named 'base_link' world_from_obstacle = get_pose(obstacle) # Returns the pose of the origin of obstacle wrt the world frame obstacle_aabb = get_subtree_aabb(obstacle) draw_aabb(obstacle_aabb) random.seed(0) # Sets the random number generator state handles = [] for i in range(10): for handle in handles: remove_debug(handle) print('\nIteration: {}'.format(i)) x = random.uniform(-floor_width/2., floor_width/2.) set_joint_position(robot, x_joint, x) # Sets the current value of the x joint y = random.uniform(-floor_width/2., floor_width/2.) set_joint_position(robot, y_joint, y) # Sets the current value of the y joint yaw = random.uniform(-np.pi, np.pi) set_joint_position(robot, theta_joint, yaw) # Sets the current value of the theta joint values = get_joint_positions(robot, joints) # Obtains the current values for the specified joints print('Joint values: [x={:.3f}, y={:.3f}, yaw={:.3f}]'.format(*values)) world_from_robot = get_link_pose(robot, base_link) # Returns the pose of base_link wrt the world frame position, quaternion = world_from_robot # Decomposing pose into position and orientation (quaternion) x, y, z = position # Decomposing position into x, y, z print('Base link position: [x={:.3f}, y={:.3f}, z={:.3f}]'.format(x, y, z)) euler = euler_from_quat(quaternion) # Converting from quaternion to euler angles roll, pitch, yaw = euler # Decomposing orientation into roll, pitch, yaw print('Base link orientation: [roll={:.3f}, pitch={:.3f}, yaw={:.3f}]'.format(roll, pitch, yaw)) handles.extend(draw_pose(world_from_robot, length=0.5)) # # Draws the base coordinate system (x:RED, y:GREEN, z:BLUE) obstacle_from_robot = multiply(invert(world_from_obstacle), world_from_robot) # Relative transformation from robot to obstacle robot_aabb = get_subtree_aabb(robot, base_link) # Computes the robot's axis-aligned bounding box (AABB) lower, upper = robot_aabb # Decomposing the AABB into the lower and upper extrema center = (lower + upper)/2. # Computing the center of the AABB extent = upper - lower # Computing the dimensions of the AABB handles.extend(draw_point(center)) handles.extend(draw_aabb(robot_aabb)) collision = pairwise_collision(robot, obstacle) # Checks whether robot is currently colliding with obstacle print('Collision: {}'.format(collision)) wait_for_duration(1.0) # Like sleep() but also updates the viewer wait_if_gui() # Like raw_input() but also updates the viewer # Destroys the pybullet world disconnect() if __name__ == '__main__': main()
5,622
Python
55.797979
134
0.672714
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/examples/test_pr2_motion.py
#!/usr/bin/env python import os import sys import pybullet as p sys.path.append('..') from pybullet_tools.pr2_utils import TOP_HOLDING_LEFT_ARM, PR2_URDF, DRAKE_PR2_URDF, \ SIDE_HOLDING_LEFT_ARM, PR2_GROUPS, open_arm, get_disabled_collisions, REST_LEFT_ARM, rightarm_from_leftarm from pybullet_tools.utils import set_base_values, joint_from_name, quat_from_euler, set_joint_position, \ set_joint_positions, add_data_path, connect, plan_base_motion, plan_joint_motion, enable_gravity, \ joint_controller, dump_body, load_model, joints_from_names, wait_if_gui, disconnect, get_joint_positions, \ get_link_pose, link_from_name, HideOutput, get_pose, wait_if_gui, load_pybullet, set_quat, Euler, PI, RED, add_line, \ wait_for_duration, LockRenderer # TODO: consider making this a function SLEEP = None # None | 0.05 def test_base_motion(pr2, base_start, base_goal, obstacles=[]): #disabled_collisions = get_disabled_collisions(pr2) set_base_values(pr2, base_start) wait_if_gui('Plan Base?') base_limits = ((-2.5, -2.5), (2.5, 2.5)) with LockRenderer(lock=False): base_path = plan_base_motion(pr2, base_goal, base_limits, obstacles=obstacles) if base_path is None: print('Unable to find a base path') return print(len(base_path)) for bq in base_path: set_base_values(pr2, bq) if SLEEP is None: wait_if_gui('Continue?') else: wait_for_duration(SLEEP) def test_drake_base_motion(pr2, base_start, base_goal, obstacles=[]): # TODO: combine this with test_arm_motion """ Drake's PR2 URDF has explicit base joints """ disabled_collisions = get_disabled_collisions(pr2) base_joints = [joint_from_name(pr2, name) for name in PR2_GROUPS['base']] set_joint_positions(pr2, base_joints, base_start) base_joints = base_joints[:2] base_goal = base_goal[:len(base_joints)] wait_if_gui('Plan Base?') with LockRenderer(lock=False): base_path = plan_joint_motion(pr2, base_joints, base_goal, obstacles=obstacles, disabled_collisions=disabled_collisions) if base_path is None: print('Unable to find a base path') return print(len(base_path)) for bq in base_path: set_joint_positions(pr2, base_joints, bq) if SLEEP is None: wait_if_gui('Continue?') else: wait_for_duration(SLEEP) ##################################### def test_arm_motion(pr2, left_joints, arm_goal): disabled_collisions = get_disabled_collisions(pr2) wait_if_gui('Plan Arm?') with LockRenderer(lock=False): arm_path = plan_joint_motion(pr2, left_joints, arm_goal, disabled_collisions=disabled_collisions) if arm_path is None: print('Unable to find an arm path') return print(len(arm_path)) for q in arm_path: set_joint_positions(pr2, left_joints, q) #wait_if_gui('Continue?') wait_for_duration(0.01) def test_arm_control(pr2, left_joints, arm_start): wait_if_gui('Control Arm?') real_time = False enable_gravity() p.setRealTimeSimulation(real_time) for _ in joint_controller(pr2, left_joints, arm_start): if not real_time: p.stepSimulation() #wait_for_duration(0.01) ##################################### def test_ikfast(pr2): from pybullet_tools.ikfast.pr2.ik import get_tool_pose, get_ik_generator left_joints = joints_from_names(pr2, PR2_GROUPS['left_arm']) #right_joints = joints_from_names(pr2, PR2_GROUPS['right_arm']) torso_joints = joints_from_names(pr2, PR2_GROUPS['torso']) torso_left = torso_joints + left_joints print(get_link_pose(pr2, link_from_name(pr2, 'l_gripper_tool_frame'))) # print(forward_kinematics('left', get_joint_positions(pr2, torso_left))) print(get_tool_pose(pr2, 'left')) arm = 'left' pose = get_tool_pose(pr2, arm) generator = get_ik_generator(pr2, arm, pose, torso_limits=False) for i in range(100): solutions = next(generator) print(i, len(solutions)) for q in solutions: set_joint_positions(pr2, torso_left, q) wait_if_gui() ##################################### def main(use_pr2_drake=True): connect(use_gui=True) add_data_path() plane = p.loadURDF("plane.urdf") directory = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) add_data_path(directory) table_path = "models/table_collision/table.urdf" table = load_pybullet(table_path, fixed_base=True) set_quat(table, quat_from_euler(Euler(yaw=PI/2))) # table/table.urdf, table_square/table_square.urdf, cube.urdf, block.urdf, door.urdf obstacles = [plane, table] pr2_urdf = DRAKE_PR2_URDF if use_pr2_drake else PR2_URDF with HideOutput(): pr2 = load_model(pr2_urdf, fixed_base=True) # TODO: suppress warnings? dump_body(pr2) base_start = (-2, -2, 0) base_goal = (2, 2, 0) arm_start = SIDE_HOLDING_LEFT_ARM #arm_start = TOP_HOLDING_LEFT_ARM #arm_start = REST_LEFT_ARM arm_goal = TOP_HOLDING_LEFT_ARM #arm_goal = SIDE_HOLDING_LEFT_ARM left_joints = joints_from_names(pr2, PR2_GROUPS['left_arm']) right_joints = joints_from_names(pr2, PR2_GROUPS['right_arm']) torso_joints = joints_from_names(pr2, PR2_GROUPS['torso']) set_joint_positions(pr2, left_joints, arm_start) set_joint_positions(pr2, right_joints, rightarm_from_leftarm(REST_LEFT_ARM)) set_joint_positions(pr2, torso_joints, [0.2]) open_arm(pr2, 'left') add_line(base_start, base_goal, color=RED) print(base_start, base_goal) if use_pr2_drake: test_drake_base_motion(pr2, base_start, base_goal, obstacles=obstacles) else: test_base_motion(pr2, base_start, base_goal, obstacles=obstacles) test_arm_motion(pr2, left_joints, arm_goal) # test_arm_control(pr2, left_joints, arm_start) test_ikfast(pr2) wait_if_gui('Finish?') disconnect() if __name__ == '__main__': main()
6,062
Python
35.745454
122
0.639888
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/examples/test_hsr.py
#!/usr/bin/env python import os import sys import numpy as np import pybullet as p sys.path.append('..') from pybullet_tools.hsrb_utils import TOP_HOLDING_ARM, SIDE_HOLDING_ARM, HSRB_URDF, \ HSR_GROUPS, open_arm, get_disabled_collisions from pybullet_tools.utils import set_base_values, joint_from_name, quat_from_euler, set_joint_position, \ set_joint_positions, add_data_path, connect, plan_base_motion, plan_joint_motion, enable_gravity, \ joint_controller, dump_body, load_model, joints_from_names, wait_if_gui, disconnect, get_joint_positions, \ get_link_pose, link_from_name, get_pose, wait_if_gui, load_pybullet, set_quat, Euler, PI, RED, add_line, \ wait_for_duration, LockRenderer, HideOutput SLEEP = None def test_base_motion(hsr, base_start, base_goal, obstacles=[]): #disabled_collisions = get_disabled_collisions(hsr) set_base_values(hsr, base_start) wait_if_gui('Plan Base?') base_limits = ((-2.5, -2.5), (2.5, 2.5)) with LockRenderer(lock=False): base_path = plan_base_motion(hsr, base_goal, base_limits, obstacles=obstacles) if base_path is None: print('Unable to find a base path') return print(len(base_path)) for bq in base_path: set_base_values(hsr, bq) if SLEEP is None: wait_if_gui('Continue?') else: wait_for_duration(SLEEP) ##################################### def test_arm_motion(hsr, arm_joints, arm_goal): disabled_collisions = get_disabled_collisions(hsr) wait_if_gui('Plan Arm?') with LockRenderer(lock=False): arm_path = plan_joint_motion(hsr, arm_joints, arm_goal, disabled_collisions=disabled_collisions) if arm_path is None: print('Unable to find an arm path') return print(len(arm_path)) for q in arm_path: set_joint_positions(hsr, arm_joints, q) wait_for_duration(0.01) def test_arm_control(hsr, arm_joints, arm_start): wait_if_gui('Control Arm?') real_time = False enable_gravity() p.setRealTimeSimulation(real_time) for _ in joint_controller(hsr, arm_joints, arm_start): if not real_time: p.stepSimulation() ##################################### def test_ikfast(hsr): from pybullet_tools.ikfast.hsrb.ik import get_tool_pose, get_ikfast_generator, hsr_inverse_kinematics arm_joints = joints_from_names(hsr, HSR_GROUPS['arm']) base_joints = joints_from_names(hsr, HSR_GROUPS['base']) base_arm_joints = base_joints + arm_joints arm = 'arm' pose = get_tool_pose(hsr, arm) print('get_link_pose: ', get_link_pose(hsr, link_from_name(hsr, 'hand_palm_link'))) print('get_tool_pose: ', pose) for i in range(100): pose_x = 2.5 pose_y = 2.0 pose_z = 0.5 rotation = np.random.choice(['foward', 'back', 'right', 'left']) if rotation == 'foward': angle = ([0.707107, 0.0, 0.707107, 0.0]) elif rotation == 'back': angle = ([0.0, -0.70710678, 0.0, 0.70710678]) elif rotation == 'right': angle = ([0.5, -0.5, 0.5, 0.5]) elif rotation == 'left': angle = ([0.5, 0.5, 0.5, -0.5]) tool_pose = ((pose_x, pose_y, pose_z), angle) ik_poses = hsr_inverse_kinematics(hsr, arm, tool_pose) if ik_poses != None: set_joint_positions(hsr, base_arm_joints, ik_poses) ee_pose = get_tool_pose(hsr, arm) print("ee_pose:", ee_pose) wait_if_gui() ##################################### def main(): connect(use_gui=True) add_data_path() plane = p.loadURDF("plane.urdf") directory = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) add_data_path(directory) table_path = "models/table_collision/table.urdf" table = load_pybullet(table_path, fixed_base=True) set_quat(table, quat_from_euler(Euler(yaw=PI/2))) obstacles = [table] hsr_urdf = HSRB_URDF with HideOutput(): hsr = load_model(hsr_urdf, fixed_base=True) dump_body(hsr) base_start = (-2, -2, 0) base_goal = (2, 2, 0) arm_start = SIDE_HOLDING_ARM arm_goal = TOP_HOLDING_ARM arm_joints = joints_from_names(hsr, HSR_GROUPS['arm']) torso_joints = joints_from_names(hsr, HSR_GROUPS['torso']) gripper_joints = joints_from_names(hsr, HSR_GROUPS['gripper']) print('Set joints') set_joint_positions(hsr, arm_joints, arm_start) set_joint_positions(hsr, torso_joints, [0.0]) set_joint_positions(hsr, gripper_joints, [0, 0]) add_line(base_start, base_goal, color=RED) print(base_start, base_goal) print('Test base motion') test_base_motion(hsr, base_start, base_goal, obstacles=obstacles) print('Test arm motion') test_arm_motion(hsr, arm_joints, arm_goal) test_ikfast(hsr) while True: word = input('Input something: ') if word == 'Finish': disconnect() break if __name__ == '__main__': main()
4,985
Python
32.24
111
0.608826
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/examples/test_visibility.py
#!/usr/bin/env python from __future__ import print_function import pybullet as p from pybullet_tools.pr2_utils import HEAD_LINK_NAME, PR2_GROUPS, get_viewcone, get_detections, \ REST_LEFT_ARM, rightarm_from_leftarm, inverse_visibility, get_detection_cone, visible_base_generator, \ DRAKE_PR2_URDF from pybullet_tools.utils import joint_from_name, set_joint_position, disconnect, HideOutput, \ set_joint_positions, connect, wait_if_gui, get_link_pose, link_from_name, set_point, set_pose, \ dump_body, load_model, create_mesh, point_from_pose, get_pose, joints_from_names, BLOCK_URDF, \ remove_body, child_link_from_joint, RED, BLUE, get_link_name, add_line, draw_point def main(): # TODO: update this example connect(use_gui=True) with HideOutput(): pr2 = load_model(DRAKE_PR2_URDF) set_joint_positions(pr2, joints_from_names(pr2, PR2_GROUPS['left_arm']), REST_LEFT_ARM) set_joint_positions(pr2, joints_from_names(pr2, PR2_GROUPS['right_arm']), rightarm_from_leftarm(REST_LEFT_ARM)) set_joint_positions(pr2, joints_from_names(pr2, PR2_GROUPS['torso']), [0.2]) dump_body(pr2) block = load_model(BLOCK_URDF, fixed_base=False) set_point(block, [2, 0.5, 1]) target_point = point_from_pose(get_pose(block)) draw_point(target_point) head_joints = joints_from_names(pr2, PR2_GROUPS['head']) #head_link = child_link_from_joint(head_joints[-1]) #head_name = get_link_name(pr2, head_link) head_name = 'high_def_optical_frame' # HEAD_LINK_NAME | high_def_optical_frame | high_def_frame head_link = link_from_name(pr2, head_name) #max_detect_distance = 2.5 max_register_distance = 1.0 distance_range = (max_register_distance/2, max_register_distance) base_generator = visible_base_generator(pr2, target_point, distance_range) base_joints = joints_from_names(pr2, PR2_GROUPS['base']) for i in range(5): base_conf = next(base_generator) set_joint_positions(pr2, base_joints, base_conf) handles = [ add_line(point_from_pose(get_link_pose(pr2, head_link)), target_point, color=RED), add_line(point_from_pose(get_link_pose(pr2, link_from_name(pr2, HEAD_LINK_NAME))), target_point, color=BLUE), ] # head_conf = sub_inverse_kinematics(pr2, head_joints[0], HEAD_LINK, ) head_conf = inverse_visibility(pr2, target_point, head_name=head_name, head_joints=head_joints) assert head_conf is not None set_joint_positions(pr2, head_joints, head_conf) print(get_detections(pr2)) # TODO: does this detect the robot sometimes? detect_mesh, z = get_detection_cone(pr2, block) detect_cone = create_mesh(detect_mesh, color=(0, 1, 0, 0.5)) set_pose(detect_cone, get_link_pose(pr2, link_from_name(pr2, HEAD_LINK_NAME))) view_cone = get_viewcone(depth=2.5, color=(1, 0, 0, 0.25)) set_pose(view_cone, get_link_pose(pr2, link_from_name(pr2, HEAD_LINK_NAME))) wait_if_gui() remove_body(detect_cone) remove_body(view_cone) disconnect() if __name__ == '__main__': main()
3,137
Python
41.986301
121
0.664967
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/examples/test_kiva.py
#!/usr/bin/env python from __future__ import print_function import argparse import os from pybullet_tools.pr2_problems import create_floor from pybullet_tools.utils import connect, disconnect, wait_for_user, LockRenderer, stable_z, \ load_model, ROOMBA_URDF, \ HideOutput, set_point, Point, load_pybullet, get_model_path, set_color, get_all_links, \ KIVA_SHELF_SDF, add_data_path, draw_pose, unit_pose, dump_body # TODO: Kiva robot # TODO: stow, pick, and recharge stations ORANGE = (1, 0.5, 0, 1) def main(): # TODO: move to pybullet-planning for now parser = argparse.ArgumentParser() parser.add_argument('-viewer', action='store_true', help='enable the viewer while planning') args = parser.parse_args() print(args) connect(use_gui=True) with LockRenderer(): draw_pose(unit_pose(), length=1) floor = create_floor() with HideOutput(): robot = load_pybullet(get_model_path(ROOMBA_URDF), fixed_base=True, scale=2.0) for link in get_all_links(robot): set_color(robot, link=link, color=ORANGE) robot_z = stable_z(robot, floor) set_point(robot, Point(z=robot_z)) #set_base_conf(robot, rover_confs[i]) data_path = add_data_path() shelf, = load_model(os.path.join(data_path, KIVA_SHELF_SDF), fixed_base=True) # TODO: returns a tuple dump_body(shelf) #draw_aabb(get_aabb(shelf)) wait_for_user() disconnect() if __name__ == '__main__': main()
1,526
Python
30.812499
109
0.639581
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/examples/test_water.py
#!/usr/bin/env python from __future__ import print_function import time import numpy as np from pybullet_tools.utils import add_data_path, connect, enable_gravity, wait_if_gui, disconnect, create_sphere, set_point, Point, \ enable_real_time, dump_world, load_model, wait_if_gui, set_camera, stable_z, \ set_color, get_lower_upper, wait_for_duration, simulate_for_duration, load_pybullet, \ safe_zip, HideOutput, draw_global_system def main(): connect(use_gui=True) add_data_path() draw_global_system() set_camera(0, -30, 1) with HideOutput(): plane = load_pybullet('plane.urdf', fixed_base=True) #plane = load_model('plane.urdf') cup = load_model('models/cup.urdf', fixed_base=True) #set_point(cup, Point(z=stable_z(cup, plane))) set_point(cup, Point(z=.2)) set_color(cup, (1, 0, 0, .4)) num_droplets = 100 #radius = 0.025 #radius = 0.005 radius = 0.0025 # TODO: more efficient ways to make all of these droplets = [create_sphere(radius, mass=0.01) for _ in range(num_droplets)] # kg cup_thickness = 0.001 lower, upper = get_lower_upper(cup) print(lower, upper) buffer = cup_thickness + radius lower = np.array(lower) + buffer*np.ones(len(lower)) upper = np.array(upper) - buffer*np.ones(len(upper)) limits = safe_zip(lower, upper) x_range, y_range = limits[:2] z = upper[2] + 0.1 #x_range = [-1, 1] #y_range = [-1, 1] #z = 1 for droplet in droplets: x = np.random.uniform(*x_range) y = np.random.uniform(*y_range) set_point(droplet, Point(x, y, z)) for i, droplet in enumerate(droplets): x, y = np.random.normal(0, 1e-3, 2) set_point(droplet, Point(x, y, z+i*(2*radius+1e-3))) #dump_world() wait_if_gui() #wait_if_gui('Start?') enable_gravity() simulate_for_duration(5.0) # enable_real_time() # try: # while True: # enable_gravity() # enable_real_time requires a command # #time.sleep(dt) # except KeyboardInterrupt: # pass # print() #time.sleep(1.0) wait_if_gui('Finish?') disconnect() if __name__ == '__main__': main()
2,215
Python
27.77922
132
0.602257
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/examples/gripper/test_side.py
#!/usr/bin/env python from __future__ import print_function import argparse import os import numpy as np from pybullet_tools.pr2_problems import create_floor, create_table from pybullet_tools.pr2_utils import get_top_grasps, get_side_grasps from pybullet_tools.utils import connect, get_pose, set_pose, Point, disconnect, HideOutput, \ wait_for_user, load_pybullet, WSG_50_URDF, get_model_path, draw_pose, \ link_from_name, get_max_limit, get_movable_joints, set_joint_position, unit_pose, create_box, RED, set_point, \ stable_z, set_camera_pose, LockRenderer, add_line, multiply, invert, get_relative_pose, GREEN, BLUE, TAN, Euler, Pose from .test_top import EPSILON, TABLE_WIDTH, BLOCK_SIDE, open_gripper # TODO: NAMO def main(): parser = argparse.ArgumentParser() # Automatically includes help parser.add_argument('-viewer', action='store_true', help='enable viewer.') args = parser.parse_args() connect(use_gui=True) with LockRenderer(): draw_pose(unit_pose(), length=1, width=1) floor = create_floor() set_point(floor, Point(z=-EPSILON)) table1 = create_table(width=TABLE_WIDTH, length=TABLE_WIDTH/2, height=TABLE_WIDTH/2, top_color=TAN, cylinder=False) set_point(table1, Point(y=+0.5)) table2 = create_table(width=TABLE_WIDTH, length=TABLE_WIDTH/2, height=TABLE_WIDTH/2, top_color=TAN, cylinder=False) set_point(table2, Point(y=-0.5)) tables = [table1, table2] #set_euler(table1, Euler(yaw=np.pi/2)) with HideOutput(): # data_path = add_data_path() # robot_path = os.path.join(data_path, WSG_GRIPPER) robot_path = get_model_path(WSG_50_URDF) # WSG_50_URDF | PANDA_HAND_URDF robot = load_pybullet(robot_path, fixed_base=True) #dump_body(robot) block1 = create_box(w=BLOCK_SIDE, l=BLOCK_SIDE, h=BLOCK_SIDE, color=RED) block_z = stable_z(block1, table1) set_point(block1, Point(y=-0.5, z=block_z)) block2 = create_box(w=BLOCK_SIDE, l=BLOCK_SIDE, h=BLOCK_SIDE, color=GREEN) set_point(block2, Point(x=-0.25, y=-0.5, z=block_z)) block3 = create_box(w=BLOCK_SIDE, l=BLOCK_SIDE, h=BLOCK_SIDE, color=BLUE) set_point(block3, Point(x=-0.15, y=+0.5, z=block_z)) blocks = [block1, block2, block3] set_camera_pose(camera_point=Point(x=-1, z=block_z+1), target_point=Point(z=block_z)) block_pose = get_pose(block1) open_gripper(robot) tool_link = link_from_name(robot, 'tool_link') base_from_tool = get_relative_pose(robot, tool_link) #draw_pose(unit_pose(), parent=robot, parent_link=tool_link) grasps = get_side_grasps(block1, tool_pose=Pose(euler=Euler(yaw=np.pi/2)), top_offset=0.02, grasp_length=0.03, under=False)[1:2] for grasp in grasps: gripper_pose = multiply(block_pose, invert(grasp)) set_pose(robot, multiply(gripper_pose, invert(base_from_tool))) wait_for_user() wait_for_user('Finish?') disconnect() if __name__ == '__main__': main()
3,158
Python
38.4875
121
0.635212
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/examples/gripper/test_top.py
#!/usr/bin/env python from __future__ import print_function import argparse import os from pybullet_tools.pr2_problems import create_floor, create_table from pybullet_tools.pr2_utils import get_top_grasps from pybullet_tools.utils import connect, get_pose, set_pose, Point, disconnect, HideOutput, \ wait_for_user, load_pybullet, WSG_50_URDF, get_model_path, draw_pose, \ link_from_name, get_max_limit, get_movable_joints, set_joint_position, unit_pose, create_box, RED, set_point, \ stable_z, set_camera_pose, LockRenderer, add_line, multiply, invert, get_relative_pose, GREEN, BLUE, TAN, create_cylinder #from hsr_tamp.pddlstream.utils import get_file_path # https://www.generationrobots.com/en/403318-fe-gripper-for-panda-robotic-arm.html # /usr/local/lib/python2.7/site-packages/pybullet_data/gripper/ # drake/manipulation/models/ycb/sdf/005_tomato_soup_can.sdf def close_gripper(robot): for joint in get_movable_joints(robot): set_joint_position(robot, joint, get_max_limit(robot, joint)) def open_gripper(robot): for joint in get_movable_joints(robot): set_joint_position(robot, joint, get_max_limit(robot, joint)) BLOCK_SIDE = 0.07 TABLE_WIDTH = 1.0 EPSILON = 1e-3 DRAKE_PATH = '/Users/caelan/Programs/external/drake' DRAKE_YCB = 'manipulation/models/ycb/sdf/003_cracker_box.sdf' YCB_PATH = '/Users/caelan/Programs/external/ycb_benchmarks/16k_laser_scan' YCB_TEMPLATE = '{}/google_16k/textured.obj' def main(): parser = argparse.ArgumentParser() # Automatically includes help parser.add_argument('-viewer', action='store_true', help='enable viewer.') args = parser.parse_args() connect(use_gui=True) #ycb_path = os.path.join(DRAKE_PATH, DRAKE_YCB) #ycb_path = os.path.join(YCB_PATH, YCB_TEMPLATE.format('003_cracker_box')) #print(ycb_path) #load_pybullet(ycb_path) with LockRenderer(): draw_pose(unit_pose(), length=1, width=1) floor = create_floor() set_point(floor, Point(z=-EPSILON)) table = create_table(width=TABLE_WIDTH, length=TABLE_WIDTH/2, height=TABLE_WIDTH/2, top_color=TAN, cylinder=False) #set_euler(table, Euler(yaw=np.pi/2)) with HideOutput(False): # data_path = add_data_path() # robot_path = os.path.join(data_path, WSG_GRIPPER) robot_path = get_model_path(WSG_50_URDF) # WSG_50_URDF | PANDA_HAND_URDF #robot_path = get_file_path(__file__, 'mit_arch_suction_gripper/mit_arch_suction_gripper.urdf') robot = load_pybullet(robot_path, fixed_base=True) #dump_body(robot) #robot = create_cylinder(radius=0.5*BLOCK_SIDE, height=4*BLOCK_SIDE) # vacuum gripper block1 = create_box(w=BLOCK_SIDE, l=BLOCK_SIDE, h=BLOCK_SIDE, color=RED) block_z = stable_z(block1, table) set_point(block1, Point(z=block_z)) block2 = create_box(w=BLOCK_SIDE, l=BLOCK_SIDE, h=BLOCK_SIDE, color=GREEN) set_point(block2, Point(x=+0.25, z=block_z)) block3 = create_box(w=BLOCK_SIDE, l=BLOCK_SIDE, h=BLOCK_SIDE, color=BLUE) set_point(block3, Point(x=-0.15, z=block_z)) blocks = [block1, block2, block3] add_line(Point(x=-TABLE_WIDTH/2, z=block_z - BLOCK_SIDE/2 + EPSILON), Point(x=+TABLE_WIDTH/2, z=block_z - BLOCK_SIDE/2 + EPSILON), color=RED) set_camera_pose(camera_point=Point(y=-1, z=block_z+1), target_point=Point(z=block_z)) wait_for_user() block_pose = get_pose(block1) open_gripper(robot) tool_link = link_from_name(robot, 'tool_link') base_from_tool = get_relative_pose(robot, tool_link) #draw_pose(unit_pose(), parent=robot, parent_link=tool_link) y_grasp, x_grasp = get_top_grasps(block1, tool_pose=unit_pose(), grasp_length=0.03, under=False) grasp = y_grasp # fingers won't collide gripper_pose = multiply(block_pose, invert(grasp)) set_pose(robot, multiply(gripper_pose, invert(base_from_tool))) wait_for_user('Finish?') disconnect() if __name__ == '__main__': main()
4,046
Python
41.6
125
0.671775
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/pybullet_tools/movo_constants.py
#!/usr/bin/env python from __future__ import print_function from itertools import combinations import numpy as np from .ikfast.utils import IKFastInfo from .utils import joints_from_names, has_joint, get_max_limits, get_min_limits, apply_alpha, \ pairwise_link_collision, get_all_links, get_link_name, are_links_adjacent #MOVO_URDF = "models/movo_description/movo.urdf" #MOVO_URDF = "models/movo_description/movo_lis.urdf" #MOVO_URDF = "models/movo_description/movo_robotiq.urdf" MOVO_URDF = "models/movo_description/movo_robotiq_collision.urdf" # https://github.mit.edu/Learning-and-Intelligent-Systems/ltamp_pr2/blob/master/control_tools/ik/ik_tools/movo_ik/movo_robotiq.urdf # https://github.com/Learning-and-Intelligent-Systems/movo_ws/blob/master/src/kinova-movo-bare/movo_common/movo_description/urdf/movo.custom.urdf # https://github.mit.edu/Learning-and-Intelligent-Systems/ltamp_pr2/tree/master/control_tools/ik/ik_tools/movo_ik ##################################### LEFT = 'left' # KG3 RIGHT = 'right' # ROBOTIQ ARMS = [RIGHT, LEFT] BASE_JOINTS = ['x', 'y', 'theta'] TORSO_JOINTS = ['linear_joint'] HEAD_JOINTS = ['pan_joint', 'tilt_joint'] ARM_JOINTS = ['{}_shoulder_pan_joint', '{}_shoulder_lift_joint', '{}_arm_half_joint', '{}_elbow_joint', '{}_wrist_spherical_1_joint', '{}_wrist_spherical_2_joint', '{}_wrist_3_joint'] KG3_GRIPPER_JOINTS = ['{}_gripper_finger1_joint', '{}_gripper_finger2_joint', '{}_gripper_finger3_joint'] ROBOTIQ_GRIPPER_JOINTS = ['{}_gripper_finger1_joint', '{}_gripper_finger2_joint', '{}_gripper_finger1_inner_knuckle_joint', '{}_gripper_finger1_finger_tip_joint', '{}_gripper_finger2_inner_knuckle_joint', '{}_gripper_finger2_finger_tip_joint'] EE_LINK = '{}_ee_link' TOOL_LINK = '{}_tool_link' #PASSIVE_JOINTS = ['mid_body_joint'] # TODO: mid_body_joint - might be passive # https://github.com/Kinovarobotics/kinova-movo/blob/master/movo_moveit_config/config/movo_kg2.srdf # https://github.mit.edu/Learning-and-Intelligent-Systems/ltamp_pr2/blob/master/control_tools/ik/ik_tools/movo_ik/movo_ik_generator.py MOVO_INFOS = { arm: IKFastInfo(module_name='movo.movo_{}_arm_ik'.format(arm), base_link='base_link', ee_link=EE_LINK.format(arm), free_joints=['linear_joint', '{}_arm_half_joint'.format(arm)]) for arm in ARMS} MOVO_COLOR = apply_alpha(0.25*np.ones(3), 1) ##################################### def names_from_templates(templates, *args): return [template.format(*args) for template in templates] def get_arm_joints(robot, arm): assert arm in ARMS return joints_from_names(robot, names_from_templates(ARM_JOINTS, arm)) def has_kg3_gripper(robot, arm): assert arm in ARMS return all(has_joint(robot, joint_name) for joint_name in names_from_templates(KG3_GRIPPER_JOINTS, arm)) def has_robotiq_gripper(robot, arm): assert arm in ARMS return all(has_joint(robot, joint_name) for joint_name in names_from_templates(ROBOTIQ_GRIPPER_JOINTS, arm)) def get_gripper_joints(robot, arm): assert arm in ARMS if has_kg3_gripper(robot, arm): return joints_from_names(robot, names_from_templates(KG3_GRIPPER_JOINTS, arm)) elif has_robotiq_gripper(robot, arm): return joints_from_names(robot, names_from_templates(ROBOTIQ_GRIPPER_JOINTS, arm)) raise ValueError(arm) def get_open_positions(robot, arm): assert arm in ARMS joints = get_gripper_joints(robot, arm) if has_kg3_gripper(robot, arm): return get_min_limits(robot, joints) elif has_robotiq_gripper(robot, arm): return 6 * [0.] raise ValueError(arm) def get_closed_positions(robot, arm): assert arm in ARMS joints = get_gripper_joints(robot, arm) if has_kg3_gripper(robot, arm): return get_max_limits(robot, joints) elif has_robotiq_gripper(robot, arm): return [0.32]*6 raise ValueError(arm) ##################################### def get_colliding(robot): disabled = [] for link1, link2 in combinations(get_all_links(robot), r=2): if not are_links_adjacent(robot, link1, link2) and pairwise_link_collision(robot, link1, robot, link2): disabled.append((get_link_name(robot, link1), get_link_name(robot, link2))) return disabled NEVER_COLLISIONS = [ ('linear_actuator_fixed_link', 'right_base_link'), ('linear_actuator_fixed_link', 'right_shoulder_link'), ('linear_actuator_fixed_link', 'left_base_link'), ('linear_actuator_fixed_link', 'left_shoulder_link'), ('linear_actuator_fixed_link', 'front_laser_link'), ('linear_actuator_fixed_link', 'rear_laser_link'), ('linear_actuator_link', 'pan_link'), ('linear_actuator_link', 'right_shoulder_link'), ('linear_actuator_link', 'right_arm_half_1_link'), ('linear_actuator_link', 'left_shoulder_link'), ('linear_actuator_link', 'left_arm_half_1_link'), ('right_wrist_spherical_2_link', 'right_robotiq_coupler_link'), ('right_wrist_3_link', 'right_robotiq_coupler_link'), ('right_wrist_3_link', 'right_gripper_base_link'), ('right_gripper_finger1_finger_link', 'right_gripper_finger1_finger_tip_link'), ('right_gripper_finger2_finger_link', 'right_gripper_finger2_finger_tip_link'), ('left_wrist_spherical_2_link', 'left_gripper_base_link'), ('left_wrist_3_link', 'left_gripper_base_link'), ]
5,348
Python
43.949579
145
0.678571
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/pybullet_tools/hsrb_utils.py
import os import re import math import random import numpy as np from itertools import combinations from collections import namedtuple from .utils import multiply, get_link_pose, set_joint_position, set_joint_positions, get_joint_positions, get_min_limit, get_max_limit, quat_from_euler, read_pickle, set_pose, \ get_pose, euler_from_quat, link_from_name, point_from_pose, invert, Pose, \ unit_pose, joints_from_names, PoseSaver, get_aabb, get_joint_limits, ConfSaver, get_bodies, create_mesh, remove_body, \ unit_from_theta, violates_limit, \ violates_limits, add_line, get_body_name, get_num_joints, approximate_as_cylinder, \ approximate_as_prism, unit_quat, unit_point, angle_between, quat_from_pose, compute_jacobian, \ movable_from_joints, quat_from_axis_angle, LockRenderer, Euler, get_links, get_link_name, \ get_extend_fn, get_moving_links, link_pairs_collision, get_link_subtree, \ clone_body, get_all_links, pairwise_collision, tform_point, get_camera_matrix, ray_from_pixel, pixel_from_ray, dimensions_from_camera_matrix, \ wrap_angle, TRANSPARENT, PI, OOBB, pixel_from_point, set_all_color, wait_if_gui from .hsrb_never_collisions import NEVER_COLLISIONS ARM = 'arm' ARM_NAMES = (ARM) ##################################### HSR_GROUPS = { 'base': ['joint_x', 'joint_y', 'joint_rz'], 'torso': ['torso_lift_joint'], 'head': ['head_pan_joint', 'head_tilt_joint'], 'arm': ['arm_lift_joint', 'arm_flex_joint', 'arm_roll_joint', 'wrist_flex_joint', 'wrist_roll_joint'], 'gripper': ['hand_l_proximal_joint', 'hand_r_proximal_joint'], 'gripper_passive': ['hand_l_distal_joint', 'hand_r_distal_joint'] } HSR_TOOL_FRAMES = {ARM: 'hand_palm_link'} HSR_GRIPPER_ROOTS = {ARM: 'hand_palm_link'} HSR_BASE_LINK = 'base_footprint' HEAD_LINK_NAME = 'high_def_optical_frame' # Arm tool poses TOOL_POSE = Pose(euler=Euler(pitch=np.pi/2)) ##################################### # Special configurations TOP_HOLDING_ARM = [0.1, -PI/2, 0.0, -PI/2, 0.0] SIDE_HOLDING_ARM = [0.1, -PI/2, 0.0, 0.0, 0.0] # [0.1, -PI/8, 0.0, -PI/8, 1.0] BOTTOM_HOLDING_AMR = [0.1, -PI/2, 0.0, 0.0, -PI/2] HSR_CARRY_CONFS = { 'top': TOP_HOLDING_ARM, 'side': SIDE_HOLDING_ARM, 'bottom': BOTTOM_HOLDING_AMR } ##################################### HSRB_URDF = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'models/hsrb_description/robots/hsrb.urdf') ##################################### def get_base_pose(hsr): return get_link_pose(hsr, link_from_name(hsr, HSR_BASE_LINK)) def arm_conf(arm, arm_config): if arm == ARM: return arm_config def base_conf(arm, base_config): if arm == ARM: return base_config def base_arm_conf(arm, base_config, arm_config): base_arm_conf = [] if arm == ARM: for base in base_config: base_arm_conf.append(base) for arm in arm_config: base_arm_conf.append(arm) return base_arm_conf def get_carry_conf(arm, grasp_type): return arm_conf(arm, HSR_CARRY_CONFS[grasp_type]) def get_other_arm(arm): for other_arm in ARM_NAMES: if other_arm != arm: return other_arm raise ValueError(arm) ##################################### def get_disabled_collisions(hsr): disabled_names = NEVER_COLLISIONS link_mapping = {get_link_name(hsr, link): link for link in get_links(hsr)} return {(link_mapping[name1], link_mapping[name2]) for name1, name2 in disabled_names if (name1 in link_mapping) and (name2 in link_mapping)} def load_dae_collisions(): dae_file = 'models/hsr_description/hsr-beta-static.dae' dae_string = open(dae_file).read() link_regex = r'<\s*link\s+sid="(\w+)"\s+name="(\w+)"\s*>' link_mapping = dict(re.findall(link_regex, dae_string)) ignore_regex = r'<\s*ignore_link_pair\s+link0="kmodel1/(\w+)"\s+link1="kmodel1/(\w+)"\s*/>' disabled_collisions = [] for link1, link2 in re.findall(ignore_regex, dae_string): disabled_collisions.append((link_mapping[link1], link_mapping[link2])) return disabled_collisions def load_srdf_collisions(): srdf_file = 'models/hsrb_description/hsrb4s.srdf' srdf_string = open(srdf_file).read() regex = r'<\s*disable_collisions\s+link1="(\w+)"\s+link2="(\w+)"\s+reason="(\w+)"\s*/>' disabled_collisions = [] for link1, link2, reason in re.findall(regex, srdf_string): if reason == 'Never': disabled_collisions.append((link1, link2)) return disabled_collisions ##################################### def get_groups(): return sorted(HSR_GROUPS) def get_group_joints(robot, group): return joints_from_names(robot, HSR_GROUPS[group]) def get_group_conf(robot, group): return get_joint_positions(robot, get_group_joints(robot, group)) def set_group_conf(robot, group, positions): set_joint_positions(robot, get_group_joints(robot, group), positions) def set_group_positions(robot, group_positions): for group, positions in group_positions.items(): set_group_conf(robot, group, positions) def get_group_positions(robot): return {group: get_group_conf(robot, group) for group in get_groups()} ##################################### # End-effectors def get_arm_joints(robot, arm): return get_group_joints(robot, arm) def get_base_joints(robot, arm): return joints_from_names(robot, HSR_GROUPS['base']) def get_torso_joints(robot, arm): return joints_from_names(robot, HSR_GROUPS['torso']) def get_torso_arm_joints(robot, arm): return joints_from_names(robot, HSR_GROUPS['torso'] + HSR_GROUPS[arm]) def get_base_arm_joints(robot, arm): return joints_from_names(robot, HSR_GROUPS['base'] + HSR_GROUPS[arm]) def get_base_torso_joints(robot): return joints_from_names(robot, HSR_GROUPS['base'] + HSR_GROUPS['torso']) def get_base_torso_arm_joints(robot): return joints_from_names(robot, HSR_GROUPS['base'] + HSR_GROUPS['torso'] + HSR_GROUPS['arm']) def set_arm_conf(robot, arm, conf): set_joint_positions(robot, get_arm_joints(robot, arm), conf) def get_gripper_link(robot, arm): return link_from_name(robot, HSR_TOOL_FRAMES[arm]) def get_gripper_joints(robot, arm): return get_group_joints(robot, 'gripper') def set_gripper_position(robot, arm, position): gripper_joints = get_gripper_joints(robot, arm) set_joint_positions(robot, gripper_joints, [position] * len(gripper_joints)) def open_arm(robot, arm): for joint in get_gripper_joints(robot, arm): set_joint_position(robot, joint, get_max_limit(robot, joint)) def close_arm(robot, arm): for joint in get_gripper_joints(robot, arm): set_joint_position(robot, joint, get_min_limit(robot, joint)) open_gripper = open_arm close_gripper = close_arm ##################################### # Box grasps GRASP_LENGTH = 0. MAX_GRASP_WIDTH = np.inf SIDE_HEIGHT_OFFSET = 0.03 def get_top_grasps(body, under=False, tool_pose=TOOL_POSE, body_pose=unit_pose(), max_width=MAX_GRASP_WIDTH, grasp_length=GRASP_LENGTH): center, (w, l, h) = approximate_as_prism(body, body_pose=body_pose) reflect_z = Pose(euler=[0, math.pi, 0]) translate_z = Pose(point=[0, 0, h / 2 - grasp_length]) translate_center = Pose(point=point_from_pose(body_pose)-center) grasps = [] if w <= max_width: for i in range(1 + under): rotate_z = Pose(euler=[0, 0, math.pi / 2 + i * math.pi]) grasps += [multiply(tool_pose, translate_z, rotate_z, reflect_z, translate_center, body_pose)] if l <= max_width: for i in range(1 + under): rotate_z = Pose(euler=[0, 0, i * math.pi]) grasps += [multiply(tool_pose, translate_z, rotate_z, reflect_z, translate_center, body_pose)] return grasps def get_side_grasps(body, under=False, tool_pose=TOOL_POSE, body_pose=unit_pose(), max_width=MAX_GRASP_WIDTH, grasp_length=GRASP_LENGTH, top_offset=SIDE_HEIGHT_OFFSET): center, (w, l, h) = approximate_as_prism(body, body_pose=body_pose) translate_center = Pose(point=point_from_pose(body_pose)-center) grasps = [] x_offset = h / 2 - top_offset for j in range(1 + under): swap_xz = Pose(euler=[0, -math.pi / 2 + j * math.pi, 0]) if w <= max_width: translate_z = Pose(point=[x_offset, 0, l / 2 - grasp_length]) for i in range(2): rotate_z = Pose(euler=[math.pi / 2 + i * math.pi, 0, 0]) grasps += [multiply(tool_pose, translate_z, rotate_z, swap_xz, translate_center, body_pose)] # , np.array([w]) if l <= max_width: translate_z = Pose(point=[x_offset, 0, w / 2 - grasp_length]) for i in range(2): rotate_z = Pose(euler=[i * math.pi, 0, 0]) grasps += [multiply(tool_pose, translate_z, rotate_z, swap_xz, translate_center, body_pose)] # , np.array([l]) return grasps ##################################### # Cylinder grasps def get_top_cylinder_grasps(body, tool_pose=TOOL_POSE, body_pose=unit_pose(), max_width=MAX_GRASP_WIDTH, grasp_length=GRASP_LENGTH): # Apply transformations right to left on object pose center, (diameter, height) = approximate_as_cylinder(body, body_pose=body_pose) reflect_z = Pose(euler=[0, math.pi, 0]) translate_z = Pose(point=[0, 0, height / 2 - grasp_length]) translate_center = Pose(point=point_from_pose(body_pose)-center) if max_width < diameter: return while True: theta = random.uniform(0, 2*np.pi) rotate_z = Pose(euler=[0, 0, theta]) yield multiply(tool_pose, translate_z, rotate_z, reflect_z, translate_center, body_pose) def get_side_cylinder_grasps(body, under=False, tool_pose=TOOL_POSE, body_pose=unit_pose(), max_width=MAX_GRASP_WIDTH, grasp_length=GRASP_LENGTH, top_offset=SIDE_HEIGHT_OFFSET): center, (diameter, height) = approximate_as_cylinder(body, body_pose=body_pose) translate_center = Pose(point_from_pose(body_pose)-center) x_offset = height/2 - top_offset if max_width < diameter: return while True: theta = random.uniform(0, 2*np.pi) translate_rotate = ([x_offset, 0, diameter / 2 - grasp_length], quat_from_euler([theta, 0, 0])) for j in range(1 + under): swap_xz = Pose(euler=[0, -math.pi / 2 + j * math.pi, 0]) yield multiply(tool_pose, translate_rotate, swap_xz, translate_center, body_pose) def get_edge_cylinder_grasps(body, under=False, tool_pose=TOOL_POSE, body_pose=unit_pose(), grasp_length=GRASP_LENGTH): center, (diameter, height) = approximate_as_cylinder(body, body_pose=body_pose) translate_yz = Pose(point=[0, diameter/2, height/2 - grasp_length]) reflect_y = Pose(euler=[0, math.pi, 0]) translate_center = Pose(point=point_from_pose(body_pose)-center) while True: theta = random.uniform(0, 2*np.pi) rotate_z = Pose(euler=[0, 0, theta]) for i in range(1 + under): rotate_under = Pose(euler=[0, 0, i * math.pi]) yield multiply(tool_pose, rotate_under, translate_yz, rotate_z, reflect_y, translate_center, body_pose) ##################################### # Cylinder pushes def get_cylinder_push(body, theta, under=False, body_quat=unit_quat(), tilt=0., base_offset=0.02, side_offset=0.03): body_pose = (unit_point(), body_quat) center, (diameter, height) = approximate_as_cylinder(body, body_pose=body_pose) translate_center = Pose(point=point_from_pose(body_pose)-center) tilt_gripper = Pose(euler=Euler(pitch=tilt)) translate_x = Pose(point=[-diameter / 2 - side_offset, 0, 0]) # Compute as a function of theta translate_z = Pose(point=[0, 0, -height / 2 + base_offset]) rotate_x = Pose(euler=Euler(yaw=theta)) reflect_z = Pose(euler=Euler(pitch=math.pi)) grasps = [] for i in range(1 + under): rotate_z = Pose(euler=Euler(yaw=i * math.pi)) grasps.append(multiply(tilt_gripper, translate_x, translate_z, rotate_x, rotate_z, reflect_z, translate_center, body_pose)) return grasps ##################################### # Button presses PRESS_OFFSET = 0.02 def get_x_presses(body, max_orientations=1, body_pose=unit_pose(), top_offset=PRESS_OFFSET): # gripper_from_object center, (w, _, h) = approximate_as_prism(body, body_pose=body_pose) translate_center = Pose(-center) press_poses = [] for j in range(max_orientations): swap_xz = Pose(euler=[0, -math.pi / 2 + j * math.pi, 0]) translate = Pose(point=[0, 0, w / 2 + top_offset]) press_poses += [multiply(TOOL_POSE, translate, swap_xz, translate_center, body_pose)] return press_poses def get_top_presses(body, tool_pose=TOOL_POSE, body_pose=unit_pose(), top_offset=PRESS_OFFSET, **kwargs): center, (_, height) = approximate_as_cylinder(body, body_pose=body_pose, **kwargs) reflect_z = Pose(euler=[0, math.pi, 0]) translate_z = Pose(point=[0, 0, height / 2 + top_offset]) translate_center = Pose(point=point_from_pose(body_pose)-center) while True: theta = random.uniform(0, 2*np.pi) rotate_z = Pose(euler=[0, 0, theta]) yield multiply(tool_pose, translate_z, rotate_z, reflect_z, translate_center, body_pose) GET_GRASPS = { 'top': get_top_grasps, 'side': get_side_grasps, } ##################################### # Inverse reachability DATABASES_DIR = '../databases' IR_FILENAME = '{}_{}_ir.pickle' IR_CACHE = {} def get_database_file(filename): directory = os.path.dirname(os.path.abspath(__file__)) return os.path.join(directory, DATABASES_DIR, filename) def load_inverse_reachability(arm, grasp_type): key = (arm, grasp_type) if key not in IR_CACHE: filename = IR_FILENAME.format(grasp_type, arm) path = get_database_file(filename) IR_CACHE[key] = read_pickle(path)['gripper_from_base'] return IR_CACHE[key] def learned_forward_generator(robot, base_pose, arm, grasp_type): gripper_from_base_list = list(load_inverse_reachability(arm, grasp_type)) random.shuffle(gripper_from_base_list) for gripper_from_base in gripper_from_base_list: yield multiply(base_pose, invert(gripper_from_base)) def learned_pose_generator(robot, gripper_pose, arm, grasp_type): gripper_from_base_list = load_inverse_reachability(arm, grasp_type) random.shuffle(gripper_from_base_list) for gripper_from_base in gripper_from_base_list: base_point, base_quat = multiply(gripper_pose, gripper_from_base) x, y, _ = base_point _, _, theta = euler_from_quat(base_quat) base_values = (x, y, theta) yield base_values ##################################### # Camera MAX_VISUAL_DISTANCE = 5.0 MAX_KINECT_DISTANCE = 2.5 HSR_CAMERA_MATRIX = get_camera_matrix( width=640, height=480, fx=772.55, fy=772.5) def get_hsr_view_section(z, camera_matrix=None): if camera_matrix is None: camera_matrix = HSR_CAMERA_MATRIX width, height = dimensions_from_camera_matrix(camera_matrix) pixels = [(0, 0), (width, height)] return [z*ray_from_pixel(camera_matrix, p) for p in pixels] def get_hsr_field_of_view(**kwargs): z = 1 view_lower, view_upper = get_hsr_view_section(z=z, **kwargs) horizontal = angle_between([view_lower[0], 0, z], [view_upper[0], 0, z]) vertical = angle_between([0, view_lower[1], z], [0, view_upper[1], z]) return horizontal, vertical def is_visible_point(camera_matrix, depth, point_world, camera_pose=unit_pose()): point_camera = tform_point(invert(camera_pose), point_world) if not (0 <= point_camera[2] < depth): return False pixel = pixel_from_point(camera_matrix, point_camera) return pixel is not None def is_visible_aabb(aabb, **kwargs): body_lower, body_upper = aabb z = body_lower[2] if z < 0: return False view_lower, view_upper = get_hsr_view_section(z, **kwargs) return not (np.any(body_lower[:2] < view_lower[:2]) or np.any(view_upper[:2] < body_upper[:2])) def support_from_aabb(aabb, near=True): lower, upper = aabb min_x, min_y, min_z = lower max_x, max_y, max_z = upper z = min_z if near else max_z return [(min_x, min_y, z), (min_x, max_y, z), (max_x, max_y, z), (max_x, min_y, z)] ##################################### def cone_vertices_from_base(base): return [np.zeros(3)] + base def cone_wires_from_support(support, cone_only=True): apex = np.zeros(3) lines = [] for vertex in support: lines.append((apex, vertex)) if cone_only: for i, v2 in enumerate(support): v1 = support[i-1] lines.append((v1, v2)) else: for v1, v2 in combinations(support, 2): lines.append((v1, v2)) center = np.average(support, axis=0) lines.append((apex, center)) return lines def cone_mesh_from_support(support): assert(len(support) == 4) vertices = cone_vertices_from_base(support) faces = [(1, 4, 3), (1, 3, 2)] for i in range(len(support)): index1 = 1+i index2 = 1+(i+1)%len(support) faces.append((0, index1, index2)) return vertices, faces def get_viewcone_base(depth=MAX_VISUAL_DISTANCE, camera_matrix=None): if camera_matrix is None: camera_matrix = HSR_CAMERA_MATRIX width, height = dimensions_from_camera_matrix(camera_matrix) vertices = [] for pixel in [(0, 0), (width, 0), (width, height), (0, height)]: ray = depth * ray_from_pixel(camera_matrix, pixel) vertices.append(ray[:3]) return vertices def get_viewcone(depth=MAX_VISUAL_DISTANCE, camera_matrix=None, **kwargs): mesh = cone_mesh_from_support(get_viewcone_base( depth=depth, camera_matrix=camera_matrix)) assert (mesh is not None) return create_mesh(mesh, **kwargs) def attach_viewcone(robot, head_name=HEAD_LINK_NAME, depth=MAX_VISUAL_DISTANCE, camera_matrix=None, color=(1, 0, 0), **kwargs): head_link = link_from_name(robot, head_name) lines = [] for v1, v2 in cone_wires_from_support(get_viewcone_base( depth=depth, camera_matrix=camera_matrix)): if is_optical(head_name): rotation = Pose() else: rotation = Pose(euler=Euler(roll=-np.pi/2, yaw=-np.pi/2)) # Apply in reverse order p1 = tform_point(rotation, v1) p2 = tform_point(rotation, v2) lines.append(add_line(p1, p2, color=color, parent=robot, parent_link=head_link, **kwargs)) return lines def draw_viewcone(pose, depth=MAX_VISUAL_DISTANCE, camera_matrix=None, color=(1, 0, 0), **kwargs): lines = [] for v1, v2 in cone_wires_from_support(get_viewcone_base( depth=depth, camera_matrix=camera_matrix)): p1 = tform_point(pose, v1) p2 = tform_point(pose, v2) lines.append(add_line(p1, p2, color=color, **kwargs)) return lines ##################################### def is_optical(link_name): return 'optical' in link_name def inverse_visibility(hsr, point, head_name=HEAD_LINK_NAME, head_joints=None, max_iterations=100, step_size=0.5, tolerance=np.pi*1e-2, verbose=False): head_link = link_from_name(hsr, head_name) camera_axis = np.array([0, 0, 1]) if is_optical(head_name) else np.array([1, 0, 0]) if head_joints is None: head_joints = joints_from_names(hsr, HSR_GROUPS['head']) head_conf = np.zeros(len(head_joints)) with LockRenderer(lock=True): with ConfSaver(hsr): for iteration in range(max_iterations): set_joint_positions(hsr, head_joints, head_conf) world_from_head = get_link_pose(hsr, head_link) point_head = tform_point(invert(world_from_head), point) error_angle = angle_between(camera_axis, point_head) if abs(error_angle) <= tolerance: break normal_head = np.cross(camera_axis, point_head) normal_world = tform_point((unit_point(), quat_from_pose(world_from_head)), normal_head) correction_quat = quat_from_axis_angle(normal_world, step_size*error_angle) correction_euler = euler_from_quat(correction_quat) _, angular = compute_jacobian(hsr, head_link) correction_conf = np.array([np.dot(angular[mj], correction_euler) for mj in movable_from_joints(hsr, head_joints)]) if verbose: print('Iteration: {} | Error: {:.3f} | Correction: {}'.format( iteration, error_angle, correction_conf)) head_conf += correction_conf if np.all(correction_conf == 0): return None else: return None if violates_limits(hsr, head_joints, head_conf): return None return head_conf def plan_scan_path(hsr, tilt=0): head_joints = joints_from_names(hsr, HSR_GROUPS['head']) start_conf = get_joint_positions(hsr, head_joints) lower_limit, upper_limit = get_joint_limits(hsr, head_joints[0]) first_conf = np.array([lower_limit, tilt]) second_conf = np.array([upper_limit, tilt]) if start_conf[0] > 0: first_conf, second_conf = second_conf, first_conf return [first_conf, second_conf] def plan_pause_scan_path(hsr, tilt=0): head_joints = joints_from_names(hsr, HSR_GROUPS['head']) assert(not violates_limit(hsr, head_joints[1], tilt)) theta, _ = get_hsr_field_of_view() lower_limit, upper_limit = get_joint_limits(hsr, head_joints[0]) # Add one because half visible on limits n = int(np.math.ceil((upper_limit - lower_limit) / theta) + 1) epsilon = 1e-3 return [np.array([pan, tilt]) for pan in np.linspace(lower_limit + epsilon, upper_limit - epsilon, n, endpoint=True)] ##################################### Detection = namedtuple('Detection', ['body', 'distance']) def get_view_aabb(body, view_pose, **kwargs): with PoseSaver(body): body_view = multiply(invert(view_pose), get_pose(body)) set_pose(body, body_view) return get_aabb(body, **kwargs) def get_view_oobb(body, view_pose, **kwargs): return OOBB(get_view_aabb(body, view_pose, **kwargs), view_pose) def get_detection_cone(hsr, body, camera_link=HEAD_LINK_NAME, depth=MAX_VISUAL_DISTANCE, **kwargs): head_link = link_from_name(hsr, camera_link) body_aabb = get_view_aabb(body, get_link_pose(hsr, head_link)) lower_z = body_aabb[0][2] if depth < lower_z: return None, lower_z if not is_visible_aabb(body_aabb, **kwargs): return None, lower_z return cone_mesh_from_support(support_from_aabb(body_aabb)), lower_z def get_detections(hsr, p_false_neg=0, camera_link=HEAD_LINK_NAME, exclude_links=set(), color=None, **kwargs): camera_pose = get_link_pose(hsr, link_from_name(hsr, camera_link)) detections = [] for body in get_bodies(): if (hsr == body) or (np.random.random() < p_false_neg): continue mesh, z = get_detection_cone(hsr, body, camera_link=camera_link, **kwargs) if mesh is None: continue cone = create_mesh(mesh, color=color) set_pose(cone, camera_pose) if not any(pairwise_collision(cone, obst) for obst in set(get_bodies()) - {hsr, body, cone}) \ and not any(link_pairs_collision(hsr, [link], cone) for link in set(get_all_links(hsr)) - exclude_links): detections.append(Detection(body, z)) remove_body(cone) return detections def get_visual_detections(hsr, **kwargs): return [body for body, _ in get_detections(hsr, depth=MAX_VISUAL_DISTANCE, **kwargs)] def get_kinect_registrations(hsr, **kwargs): return [body for body, _ in get_detections(hsr, depth=MAX_KINECT_DISTANCE, **kwargs)] ##################################### def visible_base_generator(robot, target_point, base_range=(1., 1.), theta_range=(0., 0.)): while True: base_from_target = unit_from_theta(np.random.uniform(0., 2 * np.pi)) look_distance = np.random.uniform(*base_range) base_xy = target_point[:2] - look_distance * base_from_target base_theta = np.math.atan2(base_from_target[1], base_from_target[0]) + np.random.uniform(*theta_range) base_q = np.append(base_xy, wrap_angle(base_theta)) yield base_q def get_base_extend_fn(robot): raise NotImplementedError() ##################################### def close_until_collision(robot, gripper_joints, bodies=[], open_conf=None, closed_conf=None, num_steps=25, **kwargs): if not gripper_joints: return None if open_conf is None: open_conf = [get_max_limit(robot, joint) for joint in gripper_joints] if closed_conf is None: closed_conf = [get_min_limit(robot, joint) for joint in gripper_joints] resolutions = np.abs(np.array(open_conf) - np.array(closed_conf)) / num_steps extend_fn = get_extend_fn(robot, gripper_joints, resolutions=resolutions) close_path = [open_conf] + list(extend_fn(open_conf, closed_conf)) collision_links = frozenset(get_moving_links(robot, gripper_joints)) for i, conf in enumerate(close_path): set_joint_positions(robot, gripper_joints, conf) if any(pairwise_collision((robot, collision_links), body, **kwargs) for body in bodies): if i == 0: return None return close_path[i-1][0] return close_path[-1][0] def compute_grasp_width(robot, arm, body, grasp_pose, **kwargs): tool_link = get_gripper_link(robot, arm) tool_pose = get_link_pose(robot, tool_link) body_pose = multiply(tool_pose, grasp_pose) set_pose(body, body_pose) gripper_joints = get_gripper_joints(robot, arm) return close_until_collision(robot, gripper_joints, bodies=[body], **kwargs) def create_gripper(robot, arm, visual=True): # link_name = HSR_GRIPPER_ROOTS[arm] # links = get_link_subtree(robot, link_from_name(robot, link_name)) # gripper = clone_body(robot, links=links, visual=False, collision=True) gripper = get_gripper_link(robot, arm) if not visual: set_all_color(robot, TRANSPARENT) return gripper
26,893
Python
38.376281
177
0.613617
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/pybullet_tools/pr2_primitives.py
from __future__ import print_function import copy import pybullet as p import random import time from itertools import islice, count import numpy as np from .ikfast.pr2.ik import is_ik_compiled, pr2_inverse_kinematics from .ikfast.utils import USE_CURRENT, USE_ALL from .pr2_problems import get_fixed_bodies from .pr2_utils import TOP_HOLDING_LEFT_ARM, SIDE_HOLDING_LEFT_ARM, GET_GRASPS, get_gripper_joints, \ get_carry_conf, get_top_grasps, get_side_grasps, open_arm, arm_conf, get_gripper_link, get_arm_joints, \ learned_pose_generator, PR2_TOOL_FRAMES, get_x_presses, PR2_GROUPS, joints_from_names, \ is_drake_pr2, get_group_joints, get_group_conf, compute_grasp_width, PR2_GRIPPER_ROOTS from .utils import invert, multiply, get_name, set_pose, get_link_pose, is_placement, \ pairwise_collision, set_joint_positions, get_joint_positions, sample_placement, get_pose, waypoints_from_path, \ unit_quat, plan_base_motion, plan_joint_motion, base_values_from_pose, pose_from_base_values, \ uniform_pose_generator, sub_inverse_kinematics, add_fixed_constraint, remove_debug, remove_fixed_constraint, \ disable_real_time, enable_gravity, joint_controller_hold, get_distance, \ get_min_limit, user_input, step_simulation, get_body_name, get_bodies, BASE_LINK, \ add_segments, get_max_limit, link_from_name, BodySaver, get_aabb, Attachment, interpolate_poses, \ plan_direct_joint_motion, has_gui, create_attachment, wait_for_duration, get_extend_fn, set_renderer, \ get_custom_limits, all_between, get_unit_vector, wait_if_gui, \ set_base_values, euler_from_quat, INF, elapsed_time, get_moving_links, flatten_links, get_relative_pose BASE_EXTENT = 3.5 # 2.5 BASE_LIMITS = (-BASE_EXTENT*np.ones(2), BASE_EXTENT*np.ones(2)) GRASP_LENGTH = 0.03 APPROACH_DISTANCE = 0.1 + GRASP_LENGTH SELF_COLLISIONS = False BASE_CONSTANT = 1 BASE_VELOCITY = 0.25 def distance_fn(q1, q2): distance = get_distance(q1.values[:2], q2.values[:2]) return BASE_CONSTANT + distance / BASE_VELOCITY def move_cost_fn(t): distance = t.distance(distance_fn=lambda q1, q2: get_distance(q1[:2], q2[:2])) return BASE_CONSTANT + distance / BASE_VELOCITY ####################################################### def get_cfree_pose_pose_test(collisions=True, **kwargs): def test(b1, p1, b2, p2): if not collisions or (b1 == b2): return True p1.assign() p2.assign() return not pairwise_collision(b1, b2, **kwargs) #, max_distance=0.001) return test def get_cfree_obj_approach_pose_test(collisions=True): def test(b1, p1, g1, b2, p2): if not collisions or (b1 == b2): return True p2.assign() grasp_pose = multiply(p1.value, invert(g1.value)) approach_pose = multiply(p1.value, invert(g1.approach), g1.value) for obj_pose in interpolate_poses(grasp_pose, approach_pose): set_pose(b1, obj_pose) if pairwise_collision(b1, b2): return False return True return test def get_cfree_approach_pose_test(problem, collisions=True): # TODO: apply this before inverse kinematics as well arm = 'left' gripper = problem.get_gripper() def test(b1, p1, g1, b2, p2): if not collisions or (b1 == b2): return True p2.assign() for _ in iterate_approach_path(problem.robot, arm, gripper, p1, g1, body=b1): if pairwise_collision(b1, b2) or pairwise_collision(gripper, b2): return False return True return test def get_cfree_traj_pose_test(robot, collisions=True): def test(c, b2, p2): # TODO: infer robot from c if not collisions: return True state = c.assign() if b2 in state.attachments: return True p2.assign() for _ in c.apply(state): state.assign() for b1 in state.attachments: if pairwise_collision(b1, b2): #wait_for_user() return False if pairwise_collision(robot, b2): return False # TODO: just check collisions with moving links return True return test def get_cfree_traj_grasp_pose_test(problem, collisions=True): def test(c, a, b1, g, b2, p2): raise NotImplementedError() if not collisions or (b1 == b2): return True state = c.assign() if (b1 in state.attachments) or (b2 in state.attachments): return True p2.assign() grasp_attachment = g.get_attachment(problem.robot, a) for _ in c.apply(state): state.assign() grasp_attachment.assign() if pairwise_collision(b1, b2): return False if pairwise_collision(problem.robot, b2): return False return True return ################################################## def get_base_limits(robot): if is_drake_pr2(robot): joints = get_group_joints(robot, 'base')[:2] lower = [get_min_limit(robot, j) for j in joints] upper = [get_max_limit(robot, j) for j in joints] return lower, upper return BASE_LIMITS ################################################## class Pose(object): num = count() #def __init__(self, position, orientation): # self.position = position # self.orientation = orientation def __init__(self, body, value=None, support=None, init=False): self.body = body if value is None: value = get_pose(self.body) self.value = tuple(value) self.support = support self.init = init self.index = next(self.num) @property def bodies(self): return flatten_links(self.body) def assign(self): set_pose(self.body, self.value) def iterate(self): yield self def to_base_conf(self): values = base_values_from_pose(self.value) return Conf(self.body, range(len(values)), values) def __repr__(self): index = self.index #index = id(self) % 1000 return 'p{}'.format(index) class Grasp(object): def __init__(self, grasp_type, body, value, approach, carry): self.grasp_type = grasp_type self.body = body self.value = tuple(value) # gripper_from_object self.approach = tuple(approach) self.carry = tuple(carry) def get_attachment(self, robot, arm): tool_link = link_from_name(robot, PR2_TOOL_FRAMES[arm]) return Attachment(robot, tool_link, self.value, self.body) def __repr__(self): return 'g{}'.format(id(self) % 1000) class Conf(object): def __init__(self, body, joints, values=None, init=False): self.body = body self.joints = joints if values is None: values = get_joint_positions(self.body, self.joints) self.values = tuple(values) self.init = init @property def bodies(self): # TODO: misnomer return flatten_links(self.body, get_moving_links(self.body, self.joints)) def assign(self): set_joint_positions(self.body, self.joints, self.values) def iterate(self): yield self def __repr__(self): return 'q{}'.format(id(self) % 1000) ##################################### class Command(object): def control(self, dt=0): raise NotImplementedError() def apply(self, state, **kwargs): raise NotImplementedError() def iterate(self): raise NotImplementedError() class Commands(object): def __init__(self, state, savers=[], commands=[]): self.state = state self.savers = tuple(savers) self.commands = tuple(commands) def assign(self): for saver in self.savers: saver.restore() return copy.copy(self.state) def apply(self, state, **kwargs): for command in self.commands: for result in command.apply(state, **kwargs): yield result def __repr__(self): return 'c{}'.format(id(self) % 1000) ##################################### class Trajectory(Command): _draw = False def __init__(self, path): self.path = tuple(path) # TODO: constructor that takes in this info def apply(self, state, sample=1): handles = add_segments(self.to_points()) if self._draw and has_gui() else [] for conf in self.path[::sample]: conf.assign() yield end_conf = self.path[-1] if isinstance(end_conf, Pose): state.poses[end_conf.body] = end_conf for handle in handles: remove_debug(handle) def control(self, dt=0, **kwargs): # TODO: just waypoints for conf in self.path: if isinstance(conf, Pose): conf = conf.to_base_conf() for _ in joint_controller_hold(conf.body, conf.joints, conf.values): step_simulation() time.sleep(dt) def to_points(self, link=BASE_LINK): # TODO: this is computationally expensive points = [] for conf in self.path: with BodySaver(conf.body): conf.assign() #point = np.array(point_from_pose(get_link_pose(conf.body, link))) point = np.array(get_group_conf(conf.body, 'base')) point[2] = 0 point += 1e-2*np.array([0, 0, 1]) if not (points and np.allclose(points[-1], point, atol=1e-3, rtol=0)): points.append(point) points = get_target_path(self) return waypoints_from_path(points) def distance(self, distance_fn=get_distance): total = 0. for q1, q2 in zip(self.path, self.path[1:]): total += distance_fn(q1.values, q2.values) return total def iterate(self): for conf in self.path: yield conf def reverse(self): return Trajectory(reversed(self.path)) #def __repr__(self): # return 't{}'.format(id(self) % 1000) def __repr__(self): d = 0 if self.path: conf = self.path[0] d = 3 if isinstance(conf, Pose) else len(conf.joints) return 't({},{})'.format(d, len(self.path)) def create_trajectory(robot, joints, path): return Trajectory(Conf(robot, joints, q) for q in path) ################################################## class GripperCommand(Command): def __init__(self, robot, arm, position, teleport=False): self.robot = robot self.arm = arm self.position = position self.teleport = teleport def apply(self, state, **kwargs): joints = get_gripper_joints(self.robot, self.arm) start_conf = get_joint_positions(self.robot, joints) end_conf = [self.position] * len(joints) if self.teleport: path = [start_conf, end_conf] else: extend_fn = get_extend_fn(self.robot, joints) path = [start_conf] + list(extend_fn(start_conf, end_conf)) for positions in path: set_joint_positions(self.robot, joints, positions) yield positions def control(self, **kwargs): joints = get_gripper_joints(self.robot, self.arm) positions = [self.position]*len(joints) for _ in joint_controller_hold(self.robot, joints, positions): yield def __repr__(self): return '{}({},{},{})'.format(self.__class__.__name__, get_body_name(self.robot), self.arm, self.position) class Attach(Command): vacuum = True def __init__(self, robot, arm, grasp, body): self.robot = robot self.arm = arm self.grasp = grasp self.body = body self.link = link_from_name(self.robot, PR2_TOOL_FRAMES.get(self.arm, self.arm)) #self.attachment = None def assign(self): gripper_pose = get_link_pose(self.robot, self.link) body_pose = multiply(gripper_pose, self.grasp.value) set_pose(self.body, body_pose) def apply(self, state, **kwargs): state.attachments[self.body] = create_attachment(self.robot, self.link, self.body) state.grasps[self.body] = self.grasp del state.poses[self.body] yield def control(self, dt=0, **kwargs): if self.vacuum: add_fixed_constraint(self.body, self.robot, self.link) #add_fixed_constraint(self.body, self.robot, self.link, max_force=1) # Less force makes it easier to pick else: # TODO: the gripper doesn't quite work yet gripper_name = '{}_gripper'.format(self.arm) joints = joints_from_names(self.robot, PR2_GROUPS[gripper_name]) values = [get_min_limit(self.robot, joint) for joint in joints] # Closed for _ in joint_controller_hold(self.robot, joints, values): step_simulation() time.sleep(dt) def __repr__(self): return '{}({},{},{})'.format(self.__class__.__name__, get_body_name(self.robot), self.arm, get_name(self.body)) class Detach(Command): def __init__(self, robot, arm, body): self.robot = robot self.arm = arm self.body = body self.link = link_from_name(self.robot, PR2_TOOL_FRAMES.get(self.arm, self.arm)) # TODO: pose argument to maintain same object def apply(self, state, **kwargs): del state.attachments[self.body] state.poses[self.body] = Pose(self.body, get_pose(self.body)) del state.grasps[self.body] yield def control(self, **kwargs): remove_fixed_constraint(self.body, self.robot, self.link) def __repr__(self): return '{}({},{},{})'.format(self.__class__.__name__, get_body_name(self.robot), self.arm, get_name(self.body)) ################################################## class Clean(Command): def __init__(self, body): self.body = body def apply(self, state, **kwargs): state.cleaned.add(self.body) self.control() yield def control(self, **kwargs): p.addUserDebugText('Cleaned', textPosition=(0, 0, .25), textColorRGB=(0,0,1), #textSize=1, lifeTime=0, parentObjectUniqueId=self.body) #p.setDebugObjectColor(self.body, 0, objectDebugColorRGB=(0,0,1)) def __repr__(self): return '{}({})'.format(self.__class__.__name__, self.body) class Cook(Command): # TODO: global state here? def __init__(self, body): self.body = body def apply(self, state, **kwargs): state.cleaned.remove(self.body) state.cooked.add(self.body) self.control() yield def control(self, **kwargs): # changeVisualShape # setDebugObjectColor #p.removeUserDebugItem # TODO: remove cleaned p.addUserDebugText('Cooked', textPosition=(0, 0, .5), textColorRGB=(1,0,0), #textSize=1, lifeTime=0, parentObjectUniqueId=self.body) #p.setDebugObjectColor(self.body, 0, objectDebugColorRGB=(1,0,0)) def __repr__(self): return '{}({})'.format(self.__class__.__name__, self.body) ################################################## def get_grasp_gen(problem, collisions=False, randomize=True): for grasp_type in problem.grasp_types: if grasp_type not in GET_GRASPS: raise ValueError('Unexpected grasp type:', grasp_type) def fn(body): # TODO: max_grasps # TODO: return grasps one by one grasps = [] arm = 'left' #carry_conf = get_carry_conf(arm, 'top') if 'top' in problem.grasp_types: approach_vector = APPROACH_DISTANCE*get_unit_vector([1, 0, 0]) grasps.extend(Grasp('top', body, g, multiply((approach_vector, unit_quat()), g), TOP_HOLDING_LEFT_ARM) for g in get_top_grasps(body, grasp_length=GRASP_LENGTH)) if 'side' in problem.grasp_types: approach_vector = APPROACH_DISTANCE*get_unit_vector([2, 0, -1]) grasps.extend(Grasp('side', body, g, multiply((approach_vector, unit_quat()), g), SIDE_HOLDING_LEFT_ARM) for g in get_side_grasps(body, grasp_length=GRASP_LENGTH)) filtered_grasps = [] for grasp in grasps: grasp_width = compute_grasp_width(problem.robot, arm, body, grasp.value) if collisions else 0.0 if grasp_width is not None: grasp.grasp_width = grasp_width filtered_grasps.append(grasp) if randomize: random.shuffle(filtered_grasps) return [(g,) for g in filtered_grasps] #for g in filtered_grasps: # yield (g,) return fn ################################################## def accelerate_gen_fn(gen_fn, max_attempts=1): def new_gen_fn(*inputs): generator = gen_fn(*inputs) while True: for i in range(max_attempts): try: output = next(generator) except StopIteration: return if output is not None: print(gen_fn.__name__, i) yield output break return new_gen_fn def get_stable_gen(problem, collisions=True, **kwargs): obstacles = problem.fixed if collisions else [] def gen(body, surface): # TODO: surface poses are being sampled in pr2_belief if surface is None: surfaces = problem.surfaces else: surfaces = [surface] while True: surface = random.choice(surfaces) # TODO: weight by area body_pose = sample_placement(body, surface, **kwargs) if body_pose is None: break p = Pose(body, body_pose, surface) p.assign() if not any(pairwise_collision(body, obst) for obst in obstacles if obst not in {body, surface}): yield (p,) # TODO: apply the acceleration technique here return gen ################################################## def get_tool_from_root(robot, arm): root_link = link_from_name(robot, PR2_GRIPPER_ROOTS[arm]) tool_link = link_from_name(robot, PR2_TOOL_FRAMES[arm]) return get_relative_pose(robot, root_link, tool_link) def iterate_approach_path(robot, arm, gripper, pose, grasp, body=None): tool_from_root = get_tool_from_root(robot, arm) grasp_pose = multiply(pose.value, invert(grasp.value)) approach_pose = multiply(pose.value, invert(grasp.approach)) for tool_pose in interpolate_poses(grasp_pose, approach_pose): set_pose(gripper, multiply(tool_pose, tool_from_root)) if body is not None: set_pose(body, multiply(tool_pose, grasp.value)) yield def get_ir_sampler(problem, custom_limits={}, max_attempts=25, collisions=True, learned=True): robot = problem.robot obstacles = problem.fixed if collisions else [] gripper = problem.get_gripper() def gen_fn(arm, obj, pose, grasp): pose.assign() approach_obstacles = {obst for obst in obstacles if not is_placement(obj, obst)} for _ in iterate_approach_path(robot, arm, gripper, pose, grasp, body=obj): if any(pairwise_collision(gripper, b) or pairwise_collision(obj, b) for b in approach_obstacles): return gripper_pose = multiply(pose.value, invert(grasp.value)) # w_f_g = w_f_o * (g_f_o)^-1 default_conf = arm_conf(arm, grasp.carry) arm_joints = get_arm_joints(robot, arm) base_joints = get_group_joints(robot, 'base') if learned: base_generator = learned_pose_generator(robot, gripper_pose, arm=arm, grasp_type=grasp.grasp_type) else: base_generator = uniform_pose_generator(robot, gripper_pose) lower_limits, upper_limits = get_custom_limits(robot, base_joints, custom_limits) while True: count = 0 for base_conf in islice(base_generator, max_attempts): count += 1 if not all_between(lower_limits, base_conf, upper_limits): continue bq = Conf(robot, base_joints, base_conf) pose.assign() bq.assign() set_joint_positions(robot, arm_joints, default_conf) if any(pairwise_collision(robot, b) for b in obstacles + [obj]): continue #print('IR attempts:', count) yield (bq,) break else: yield None return gen_fn ################################################## def get_ik_fn(problem, custom_limits={}, collisions=True, teleport=False): robot = problem.robot obstacles = problem.fixed if collisions else [] if is_ik_compiled(): print('Using ikfast for inverse kinematics') else: print('Using pybullet for inverse kinematics') def fn(arm, obj, pose, grasp, base_conf): approach_obstacles = {obst for obst in obstacles if not is_placement(obj, obst)} gripper_pose = multiply(pose.value, invert(grasp.value)) # w_f_g = w_f_o * (g_f_o)^-1 #approach_pose = multiply(grasp.approach, gripper_pose) approach_pose = multiply(pose.value, invert(grasp.approach)) arm_link = get_gripper_link(robot, arm) arm_joints = get_arm_joints(robot, arm) default_conf = arm_conf(arm, grasp.carry) #sample_fn = get_sample_fn(robot, arm_joints) pose.assign() base_conf.assign() open_arm(robot, arm) set_joint_positions(robot, arm_joints, default_conf) # default_conf | sample_fn() grasp_conf = pr2_inverse_kinematics(robot, arm, gripper_pose, custom_limits=custom_limits) #, upper_limits=USE_CURRENT) #nearby_conf=USE_CURRENT) # upper_limits=USE_CURRENT, if (grasp_conf is None) or any(pairwise_collision(robot, b) for b in obstacles): # [obj] #print('Grasp IK failure', grasp_conf) #if grasp_conf is not None: # print(grasp_conf) # #wait_if_gui() return None #approach_conf = pr2_inverse_kinematics(robot, arm, approach_pose, custom_limits=custom_limits, # upper_limits=USE_CURRENT, nearby_conf=USE_CURRENT) approach_conf = sub_inverse_kinematics(robot, arm_joints[0], arm_link, approach_pose, custom_limits=custom_limits) if (approach_conf is None) or any(pairwise_collision(robot, b) for b in obstacles + [obj]): #print('Approach IK failure', approach_conf) #wait_if_gui() return None approach_conf = get_joint_positions(robot, arm_joints) attachment = grasp.get_attachment(problem.robot, arm) attachments = {attachment.child: attachment} if teleport: path = [default_conf, approach_conf, grasp_conf] else: resolutions = 0.05**np.ones(len(arm_joints)) grasp_path = plan_direct_joint_motion(robot, arm_joints, grasp_conf, attachments=attachments.values(), obstacles=approach_obstacles, self_collisions=SELF_COLLISIONS, custom_limits=custom_limits, resolutions=resolutions/2.) if grasp_path is None: print('Grasp path failure') return None set_joint_positions(robot, arm_joints, default_conf) approach_path = plan_joint_motion(robot, arm_joints, approach_conf, attachments=attachments.values(), obstacles=obstacles, self_collisions=SELF_COLLISIONS, custom_limits=custom_limits, resolutions=resolutions, restarts=2, iterations=25, smooth=25) if approach_path is None: print('Approach path failure') return None path = approach_path + grasp_path mt = create_trajectory(robot, arm_joints, path) cmd = Commands(State(attachments=attachments), savers=[BodySaver(robot)], commands=[mt]) return (cmd,) return fn ################################################## def get_ik_ir_gen(problem, max_attempts=25, learned=True, teleport=False, **kwargs): # TODO: compose using general fn ir_sampler = get_ir_sampler(problem, learned=learned, max_attempts=1, **kwargs) ik_fn = get_ik_fn(problem, teleport=teleport, **kwargs) def gen(*inputs): b, a, p, g = inputs ir_generator = ir_sampler(*inputs) attempts = 0 while True: if max_attempts <= attempts: if not p.init: return attempts = 0 yield None attempts += 1 try: ir_outputs = next(ir_generator) except StopIteration: return if ir_outputs is None: continue ik_outputs = ik_fn(*(inputs + ir_outputs)) if ik_outputs is None: continue print('IK attempts:', attempts) yield ir_outputs + ik_outputs return #if not p.init: # return return gen ################################################## def get_motion_gen(problem, custom_limits={}, collisions=True, teleport=False): # TODO: include fluents robot = problem.robot saver = BodySaver(robot) obstacles = problem.fixed if collisions else [] def fn(bq1, bq2, fluents=[]): saver.restore() bq1.assign() if teleport: path = [bq1, bq2] elif is_drake_pr2(robot): raw_path = plan_joint_motion(robot, bq2.joints, bq2.values, attachments=[], obstacles=obstacles, custom_limits=custom_limits, self_collisions=SELF_COLLISIONS, restarts=4, iterations=50, smooth=50) if raw_path is None: print('Failed motion plan!') #set_renderer(True) #for bq in [bq1, bq2]: # bq.assign() # wait_if_gui() return None path = [Conf(robot, bq2.joints, q) for q in raw_path] else: goal_conf = base_values_from_pose(bq2.value) raw_path = plan_base_motion(robot, goal_conf, BASE_LIMITS, obstacles=obstacles) if raw_path is None: print('Failed motion plan!') return None path = [Pose(robot, pose_from_base_values(q, bq1.value)) for q in raw_path] bt = Trajectory(path) cmd = Commands(State(), savers=[BodySaver(robot)], commands=[bt]) return (cmd,) return fn ################################################## def get_press_gen(problem, max_attempts=25, learned=True, teleport=False): robot = problem.robot fixed = get_fixed_bodies(problem) def gen(arm, button): fixed_wo_button = list(filter(lambda b: b != button, fixed)) pose = get_pose(button) grasp_type = 'side' link = get_gripper_link(robot, arm) default_conf = get_carry_conf(arm, grasp_type) joints = get_arm_joints(robot, arm) presses = get_x_presses(button) approach = ((APPROACH_DISTANCE, 0, 0), unit_quat()) while True: for _ in range(max_attempts): press_pose = random.choice(presses) gripper_pose = multiply(pose, invert(press_pose)) # w_f_g = w_f_o * (g_f_o)^-1 #approach_pose = gripper_pose # w_f_g * g_f_o * o_f_a = w_f_a approach_pose = multiply(gripper_pose, invert(multiply(press_pose, approach))) if learned: base_generator = learned_pose_generator(robot, gripper_pose, arm=arm, grasp_type=grasp_type) else: base_generator = uniform_pose_generator(robot, gripper_pose) set_joint_positions(robot, joints, default_conf) set_pose(robot, next(base_generator)) raise NotImplementedError('Need to change this') if any(pairwise_collision(robot, b) for b in fixed): continue approach_movable_conf = sub_inverse_kinematics(robot, joints[0], link, approach_pose) #approach_movable_conf = inverse_kinematics(robot, link, approach_pose) if (approach_movable_conf is None) or any(pairwise_collision(robot, b) for b in fixed): continue approach_conf = get_joint_positions(robot, joints) gripper_movable_conf = sub_inverse_kinematics(robot, joints[0], link, gripper_pose) #gripper_movable_conf = inverse_kinematics(robot, link, gripper_pose) if (gripper_movable_conf is None) or any(pairwise_collision(robot, b) for b in fixed_wo_button): continue grasp_conf = get_joint_positions(robot, joints) bp = Pose(robot, get_pose(robot)) # TODO: don't use this if teleport: path = [default_conf, approach_conf, grasp_conf] else: control_path = plan_direct_joint_motion(robot, joints, approach_conf, obstacles=fixed_wo_button, self_collisions=SELF_COLLISIONS) if control_path is None: continue set_joint_positions(robot, joints, approach_conf) retreat_path = plan_joint_motion(robot, joints, default_conf, obstacles=fixed, self_collisions=SELF_COLLISIONS) if retreat_path is None: continue path = retreat_path[::-1] + control_path[::-1] mt = Trajectory(Conf(robot, joints, q) for q in path) yield (bp, mt) break else: yield None return gen ##################################### def control_commands(commands, **kwargs): wait_if_gui('Control?') disable_real_time() enable_gravity() for i, command in enumerate(commands): print(i, command) command.control(*kwargs) class State(object): def __init__(self, attachments={}, cleaned=set(), cooked=set()): self.poses = {body: Pose(body, get_pose(body)) for body in get_bodies() if body not in attachments} self.grasps = {} self.attachments = attachments self.cleaned = cleaned self.cooked = cooked def assign(self): for attachment in self.attachments.values(): #attach.attachment.assign() attachment.assign() def apply_commands(state, commands, time_step=None, pause=False, **kwargs): #wait_if_gui('Apply?') for i, command in enumerate(commands): print(i, command) for j, _ in enumerate(command.apply(state, **kwargs)): state.assign() if j == 0: continue if time_step is None: wait_for_duration(1e-2) wait_if_gui('Command {}, Step {}) Next?'.format(i, j)) else: wait_for_duration(time_step) if pause: wait_if_gui() ##################################### def get_target_point(conf): # TODO: use full body aabb robot = conf.body link = link_from_name(robot, 'torso_lift_link') #link = BASE_LINK # TODO: center of mass instead? # TODO: look such that cone bottom touches at bottom # TODO: the target isn't the center which causes it to drift with BodySaver(conf.body): conf.assign() lower, upper = get_aabb(robot, link) center = np.average([lower, upper], axis=0) point = np.array(get_group_conf(conf.body, 'base')) #point[2] = upper[2] point[2] = center[2] #center, _ = get_center_extent(conf.body) return point def get_target_path(trajectory): # TODO: only do bounding boxes for moving links on the trajectory return [get_target_point(conf) for conf in trajectory.path]
32,585
Python
39.937186
127
0.56793
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/pybullet_tools/hsrb_problems.py
import os import random import numpy as np from itertools import product from .hsrb_utils import set_arm_conf, set_group_conf, get_carry_conf, get_other_arm, \ create_gripper, arm_conf, open_arm, close_arm, HSRB_URDF from .utils import ( # Setter set_base_values, set_point, set_pose, \ # Getter get_pose, get_bodies, get_box_geometry, get_cylinder_geometry, \ # Utility create_body, create_box, create_virtual_box, create_shape_array, create_virtual_cylinder, create_marker, \ z_rotation, add_data_path, remove_body, load_model, load_pybullet, load_virtual_model, \ LockRenderer, HideOutput, \ # Geometry Point, Pose, \ # URDF FLOOR_URDF, TABLE_URDF, \ # Color LIGHT_GREY, TAN, GREY) class Problem(object): def __init__(self, robot, arms=tuple(), movable=tuple(), bodies=tuple(), fixed=tuple(), holes=tuple(), grasp_types=tuple(), surfaces=tuple(), sinks=tuple(), stoves=tuple(), buttons=tuple(), init_placeable=tuple(), init_insertable=tuple(), goal_conf=None, goal_holding=tuple(), goal_on=tuple(), goal_inserted=tuple(), goal_cleaned=tuple(), goal_cooked=tuple(), costs=False, body_names={}, body_types=[], base_limits=None): self.robot = robot self.arms = arms self.movable = movable self.grasp_types = grasp_types self.surfaces = surfaces self.sinks = sinks self.stoves = stoves self.buttons = buttons self.init_placeable = init_placeable self.init_insertable = init_insertable self.goal_conf = goal_conf self.goal_holding = goal_holding self.goal_on = goal_on self.goal_inserted = goal_inserted self.goal_cleaned = goal_cleaned self.goal_cooked = goal_cooked self.costs = costs self.bodies = bodies self.body_names = body_names self.body_types = body_types self.base_limits = base_limits self.holes = holes self.fixed = fixed # list(filter(lambda b: b not in all_movable, get_bodies())) self.gripper = None def get_gripper(self, arm='arm', visual=True): if self.gripper is None: self.gripper = create_gripper(self.robot, arm=arm, visual=visual) return self.gripper def remove_gripper(self): if self.gripper is not None: remove_body(self.gripper) self.gripper = None def __repr__(self): return repr(self.__dict__) ####################################################### def get_fixed_bodies(problem): return problem.fixed def create_hsr(fixed_base=True, torso=0.0): directory = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'models/hsrb_description') add_data_path(directory) hsr_path = HSRB_URDF hsr_init_pose = [(0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 1.0)] with LockRenderer(): with HideOutput(): hsr = load_model(hsr_path, pose=hsr_init_pose, fixed_base=fixed_base) set_group_conf(hsr, 'torso', [torso]) return hsr def create_floor(**kwargs): directory = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'models') add_data_path(directory) return load_pybullet(FLOOR_URDF, **kwargs) def create_table(width=0.6, length=1.2, height=0.73, thickness=0.03, radius=0.015, top_color=LIGHT_GREY, leg_color=TAN, cylinder=True, **kwargs): surface = get_box_geometry(width, length, thickness) surface_pose = Pose(Point(z=height - thickness/2.)) leg_height = height-thickness if cylinder: leg_geometry = get_cylinder_geometry(radius, leg_height) else: leg_geometry = get_box_geometry(width=2*radius, length=2*radius, height=leg_height) legs = [leg_geometry for _ in range(4)] leg_center = np.array([width, length])/2. - radius*np.ones(2) leg_xys = [np.multiply(leg_center, np.array(signs)) for signs in product([-1, +1], repeat=len(leg_center))] leg_poses = [Pose(point=[x, y, leg_height/2.]) for x, y in leg_xys] geoms = [surface] + legs poses = [surface_pose] + leg_poses colors = [top_color] + len(legs)*[leg_color] collision_id, visual_id = create_shape_array(geoms, poses, colors) body = create_body(collision_id, visual_id, **kwargs) return body def create_door(): return load_pybullet("data/door.urdf") ####################################################### TABLE_MAX_Z = 0.6265 def holding_problem(arm='arm', grasp_type='side'): hsr = create_hsr() initial_conf = get_carry_conf(arm, grasp_type) set_base_values(hsr, (0, 0, 0)) set_arm_conf(hsr, arm, initial_conf) open_arm(hsr, arm) plane = create_floor(fixed_base=True) box = create_box(.04, .04, .04) set_point(box, (1.3, 0.0, 0.22)) table = create_box(0.65, 1.2, 0.20, color=(1, 1, 1, 1)) set_point(table, (1.5, 0.0, 0.1)) block_names = {box: 'block'} return Problem(robot=hsr, movable=[box], arms=[arm], body_names=block_names, grasp_types=[grasp_type], surfaces=[table], goal_holding=[(arm, box)]) def stacking_problem(arm='arm', grasp_type='side'): hsr = create_hsr() initial_conf = get_carry_conf(arm, grasp_type) set_base_values(hsr, (0, 0, 0)) set_arm_conf(hsr, arm, initial_conf) open_arm(hsr, arm) plane = create_floor(fixed_base=True) block1 = create_box(.04, .04, .04, color=(0.0, 1.0, 0.0, 1.0)) set_point(block1, (1.5, 0.45, 0.275)) table1 = create_box(0.5, 0.5, 0.25, color=(.25, .25, .75, 1)) set_point(table1, (1.5, 0.5, 0.125)) table2 = create_box(0.5, 0.5, 0.25, color=(.75, .25, .25, 1)) set_point(table2, (1.5, -0.5, 0.125)) block_names = {block1: 'block', table1: 'table1', table2: 'table2'} return Problem(robot=hsr, movable=[block1], arms=[arm], body_names=block_names, grasp_types=[grasp_type], surfaces=[table1, table2], goal_on=[(block1, table2)]) ####################################################### def create_kitchen(w=.5, h=.2): plane = create_floor(fixed_base=True) table = create_box(w, w, h, color=(.75, .75, .75, 1)) set_point(table, (2, 0, h/2)) mass = 1 cabbage = create_box(.07, .07, .1, mass=mass, color=(0, 1, 0, 1)) set_point(cabbage, (1.80, 0, h + .1/2)) sink = create_box(w, w, h, color=(.25, .25, .75, 1)) set_point(sink, (0, 2, h/2)) stove = create_box(w, w, h, color=(.75, .25, .25, 1)) set_point(stove, (0, -2, h/2)) return table, cabbage, sink, stove ####################################################### def cleaning_problem(arm='arm', grasp_type='side'): initial_conf = get_carry_conf(arm, grasp_type) hsr = create_hsr() set_arm_conf(hsr, arm, initial_conf) table, cabbage, sink, stove = create_kitchen() return Problem(robot=hsr, movable=[cabbage], arms=[arm], grasp_types=[grasp_type], surfaces=[table, sink, stove], sinks=[sink], stoves=[stove], goal_cleaned=[cabbage]) def cooking_problem(arm='arm', grasp_type='side'): initial_conf = get_carry_conf(arm, grasp_type) hsr = create_hsr() set_arm_conf(hsr, arm, initial_conf) table, cabbage, sink, stove = create_kitchen() return Problem(robot=hsr, movable=[cabbage], arms=[arm], grasp_types=[grasp_type], surfaces=[table, sink, stove], sinks=[sink], stoves=[stove], goal_cooked=[cabbage]) def cleaning_button_problem(arm='arm', grasp_type='side'): initial_conf = get_carry_conf(arm, grasp_type) hsr = create_hsr() set_arm_conf(hsr, arm, initial_conf) table, cabbage, sink, stove = create_kitchen() d = 0.1 sink_button = create_box(d, d, d, color=(0, 0, 0, 1)) set_pose(sink_button, ((0, 2-(.5+d)/2, .7-d/2), z_rotation(np.pi/2))) stove_button = create_box(d, d, d, color=(0, 0, 0, 1)) set_pose(stove_button, ((0, -2+(.5+d)/2, .7-d/2), z_rotation(-np.pi/2))) return Problem(robot=hsr, movable=[cabbage], arms=[arm], grasp_types=[grasp_type], surfaces=[table, sink, stove], sinks=[sink], stoves=[stove], buttons=[(sink_button, sink), (stove_button, stove)], goal_conf=get_pose(hsr), goal_holding=[(arm, cabbage)], goal_cleaned=[cabbage]) def cooking_button_problem(arm='arm', grasp_type='side'): initial_conf = get_carry_conf(arm, grasp_type) hsr = create_hsr() set_arm_conf(hsr, arm, initial_conf) table, cabbage, sink, stove = create_kitchen() d = 0.1 sink_button = create_box(d, d, d, color=(0, 0, 0, 1)) set_pose(sink_button, ((0, 2-(.5+d)/2, .7-d/2), z_rotation(np.pi/2))) stove_button = create_box(d, d, d, color=(0, 0, 0, 1)) set_pose(stove_button, ((0, -2+(.5+d)/2, .7-d/2), z_rotation(-np.pi/2))) return Problem(robot=hsr, movable=[cabbage], arms=[arm], grasp_types=[grasp_type], surfaces=[table, sink, stove], sinks=[sink], stoves=[stove], buttons=[(sink_button, sink), (stove_button, stove)], goal_conf=get_pose(hsr), goal_holding=[(arm, cabbage)], goal_cooked=[cabbage]) PROBLEMS = [ holding_problem, stacking_problem, cleaning_problem, cooking_problem, cleaning_button_problem, cooking_button_problem, ]
9,432
Python
34.197761
116
0.590543
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/pybullet_tools/hsrb_primitives.py
from __future__ import print_function import os import copy import json import time import random import numpy as np import pybullet as p from itertools import islice, count from scipy.spatial.transform import Rotation as R from .ikfast.hsrb.ik import is_ik_compiled, hsr_inverse_kinematics from .hsrb_utils import ( # Getter get_gripper_joints, get_carry_conf, get_top_grasps, get_side_grasps, get_x_presses, \ get_group_joints, get_gripper_link, get_arm_joints, get_group_conf, get_base_joints, \ get_base_arm_joints, get_torso_joints, get_base_torso_arm_joints, \ # Utility open_arm, arm_conf, base_arm_conf, learned_pose_generator, joints_from_names, compute_grasp_width, \ # Constant HSR_TOOL_FRAMES, HSR_GROUPS, HSR_GRIPPER_ROOTS, TOP_HOLDING_ARM, SIDE_HOLDING_ARM, GET_GRASPS) from .utils import ( # Getter get_joint_positions, get_distance, get_min_limit, get_relative_pose, get_aabb, get_unit_vector, \ get_moving_links, get_custom_limits, get_custom_limits_with_base, get_body_name, get_bodies, get_extend_fn, \ get_name, get_link_pose, get_point, get_pose, \ # Setter set_pose, is_placement, set_joint_positions, is_inserted, \ # Utility invert, multiply, all_between, pairwise_collision, sample_placement, sample_insertion, \ waypoints_from_path, unit_quat, plan_base_motion, plan_joint_motion, base_values_from_pose, \ pose_from_base_values, uniform_pose_generator, add_fixed_constraint, remove_debug, \ remove_fixed_constraint, disable_real_time, enable_real_time, enable_gravity, step_simulation, \ joint_controller_hold, add_segments, link_from_name, interpolate_poses, plan_linear_motion, \ plan_direct_joint_motion, has_gui, create_attachment, wait_for_duration, wait_if_gui, flatten_links, create_marker, \ BodySaver, Attachment, \ # Constant BASE_LINK) BASE_EXTENT = 3.5 BASE_LIMITS = (-BASE_EXTENT*np.ones(2), BASE_EXTENT*np.ones(2)) GRASP_LENGTH = 0.03 APPROACH_DISTANCE = 0.1 + GRASP_LENGTH SELF_COLLISIONS = False ################################################## def get_base_limits(): return BASE_LIMITS ################################################## class Pose(object): num = count() def __init__(self, body, value=None, support=None, extra=None, init=False): self.body = body if value is None: value = get_pose(self.body) self.value = tuple(value) self.support = support self.extra= extra self.init = init self.index = next(self.num) @property def bodies(self): return flatten_links(self.body) def assign(self): set_pose(self.body, self.value) def iterate(self): yield self def to_base_conf(self): values = base_values_from_pose(self.value) return Conf(self.body, range(len(values)), values) def __repr__(self): index = self.index return 'p{}'.format(index) class Grasp(object): def __init__(self, grasp_type, body, value, approach, carry): self.grasp_type = grasp_type self.body = body self.value = tuple(value) self.approach = tuple(approach) self.carry = tuple(carry) def get_attachment(self, robot, arm): tool_link = link_from_name(robot, HSR_TOOL_FRAMES[arm]) return Attachment(robot, tool_link, self.value, self.body) def __repr__(self): return 'g{}'.format(id(self) % 1000) class Conf(object): def __init__(self, body, joints, values=None, init=False): self.body = body self.joints = joints if values is None: values = get_joint_positions(self.body, self.joints) self.values = tuple(values) self.init = init @property def bodies(self): return flatten_links(self.body, get_moving_links(self.body, self.joints)) def assign(self): set_joint_positions(self.body, self.joints, self.values) def iterate(self): yield self def __repr__(self): return 'q{}'.format(id(self) % 1000) class State(object): def __init__(self, attachments={}, cleaned=set(), cooked=set()): self.poses = {body: Pose(body, get_pose(body)) for body in get_bodies() if body not in attachments} self.grasps = {} self.attachments = attachments self.cleaned = cleaned self.cooked = cooked def assign(self): for attachment in self.attachments.values(): attachment.assign() ##################################### class Command(object): def control(self, dt=0): raise NotImplementedError() def apply(self, state, **kwargs): raise NotImplementedError() def iterate(self): raise NotImplementedError() class Commands(object): def __init__(self, state, savers=[], commands=[]): self.state = state self.savers = tuple(savers) self.commands = tuple(commands) def assign(self): for saver in self.savers: saver.restore() return copy.copy(self.state) def apply(self, state, **kwargs): for command in self.commands: for result in command.apply(state, **kwargs): yield result def __repr__(self): return 'c{}'.format(id(self) % 1000) ##################################### class Trajectory(Command): _draw = False def __init__(self, path): self.path = tuple(path) def apply(self, state, sample=1): handles = add_segments(self.to_points()) if self._draw and has_gui() else [] for conf in self.path[::sample]: conf.assign() yield end_conf = self.path[-1] if isinstance(end_conf, Pose): state.poses[end_conf.body] = end_conf for handle in handles: remove_debug(handle) def control(self, dt=0, **kwargs): for conf in self.path: if isinstance(conf, Pose): conf = conf.to_base_conf() for _ in joint_controller_hold(conf.body, conf.joints, conf.values): step_simulation() time.sleep(dt) def to_points(self, link=BASE_LINK): points = [] for conf in self.path: with BodySaver(conf.body): conf.assign() point = np.array(get_group_conf(conf.body, 'base')) point[2] = 0 point += 1e-2*np.array([0, 0, 1]) if not (points and np.allclose(points[-1], point, atol=1e-3, rtol=0)): points.append(point) points = get_target_path(self) return waypoints_from_path(points) def distance(self, distance_fn=get_distance): total = 0. for q1, q2 in zip(self.path, self.path[1:]): total += distance_fn(q1.values, q2.values) return total def iterate(self): for conf in self.path: yield conf def reverse(self): return Trajectory(reversed(self.path)) def __repr__(self): d = 0 if self.path: conf = self.path[0] d = 3 if isinstance(conf, Pose) else len(conf.joints) return 't({},{})'.format(d, len(self.path)) def create_trajectory(robot, joints, path): return Trajectory(Conf(robot, joints, q) for q in path) ##################################### Actions class GripperCommand(Command): def __init__(self, robot, arm, position, teleport=False): self.robot = robot self.arm = arm self.position = position self.teleport = teleport def apply(self, state, **kwargs): joints = get_gripper_joints(self.robot, self.arm) start_conf = get_joint_positions(self.robot, joints) end_conf = [self.position] * len(joints) if self.teleport: path = [start_conf, end_conf] else: extend_fn = get_extend_fn(self.robot, joints) path = [start_conf] + list(extend_fn(start_conf, end_conf)) for positions in path: set_joint_positions(self.robot, joints, positions) yield positions def control(self, **kwargs): joints = get_gripper_joints(self.robot, self.arm) positions = [self.position]*len(joints) control_mode = p.TORQUE_CONTROL for _ in joint_controller_hold(self.robot, joints, control_mode, positions): yield def __repr__(self): return '{}({},{},{})'.format(self.__class__.__name__, get_body_name(self.robot), self.arm, self.position) class Attach(Command): vacuum = True def __init__(self, robot, arm, grasp, body): self.robot = robot self.arm = arm self.grasp = grasp self.body = body self.link = link_from_name(self.robot, HSR_TOOL_FRAMES.get(self.arm, self.arm)) def assign(self): gripper_pose = get_link_pose(self.robot, self.link) body_pose = multiply(gripper_pose, self.grasp.value) set_pose(self.body, body_pose) def apply(self, state, **kwargs): state.attachments[self.body] = create_attachment(self.robot, self.link, self.body) state.grasps[self.body] = self.grasp del state.poses[self.body] yield def control(self, dt=0, **kwargs): if self.vacuum: add_fixed_constraint(self.body, self.robot, self.link) else: gripper_name = '{}_gripper'.format(self.arm) joints = joints_from_names(self.robot, HSR_GROUPS[gripper_name]) values = [get_min_limit(self.robot, joint) for joint in joints] for _ in joint_controller_hold(self.robot, joints, values): step_simulation() time.sleep(dt) def __repr__(self): return '{}({},{},{})'.format(self.__class__.__name__, get_body_name(self.robot), self.arm, get_name(self.body)) class Detach(Command): def __init__(self, robot, arm, body): self.robot = robot self.arm = arm self.body = body self.link = link_from_name(self.robot, HSR_TOOL_FRAMES.get(self.arm, self.arm)) def apply(self, state, **kwargs): del state.attachments[self.body] state.poses[self.body] = Pose(self.body, get_pose(self.body)) del state.grasps[self.body] yield def control(self, **kwargs): remove_fixed_constraint(self.body, self.robot, self.link) def __repr__(self): return '{}({},{},{})'.format(self.__class__.__name__, get_body_name(self.robot), self.arm, get_name(self.body)) ##################################### Additional Actions class Clean(Command): def __init__(self, body): self.body = body def apply(self, state, **kwargs): state.cleaned.add(self.body) self.control() yield def control(self, **kwargs): p.addUserDebugText('Cleaned', textPosition=(0, 0, .25), textColorRGB=(0,0,1), lifeTime=0, parentObjectUniqueId=self.body) def __repr__(self): return '{}({})'.format(self.__class__.__name__, self.body) class Cook(Command): def __init__(self, body): self.body = body def apply(self, state, **kwargs): state.cleaned.remove(self.body) state.cooked.add(self.body) self.control() yield def control(self, **kwargs): p.addUserDebugText('Cooked', textPosition=(0, 0, .5), textColorRGB=(1,0,0), lifeTime=0, parentObjectUniqueId=self.body) def __repr__(self): return '{}({})'.format(self.__class__.__name__, self.body) ##################################### Streams def get_stable_gen(problem, collisions=True, **kwargs): # Sample place pose obstacles = problem.fixed if collisions else [] extra = 'place' def gen(body, surface): if surface is None: surfaces = problem.surfaces else: surfaces = [surface] while True: surface = random.choice(surfaces) body_pose = sample_placement(body, surface, **kwargs) if body_pose is None: break p = Pose(body, body_pose, surface, extra) p.assign() # If the obstacles is not included in the surface and body, check pairwise collision between body. if not any(pairwise_collision(body, obst) for obst in obstacles if obst not in {body, surface}): yield (p,) return gen def get_insert_gen(problem, collisions=True, **kwargs): # Sample insert pose obstacles = problem.fixed if collisions else [] extra = 'insert' def gen(body, hole): if hole is None: holes = problem.holes else: holes = [hole] while True: hole = random.choice(holes) body_pose = sample_insertion(body, hole, **kwargs) if body_pose is None: break p = Pose(body, body_pose, hole, extra) p.assign() # If the obstacles is not included in the surface and body, check pairwise collision between body. if not any(pairwise_collision(body, obst) for obst in obstacles if obst not in {body, hole}): yield (p,) return gen def get_grasp_gen(problem, collisions=True, randomize=False): # Sample pick pose for grasp_type in problem.grasp_types: if grasp_type not in GET_GRASPS: raise ValueError('Unexpected grasp type:', grasp_type) def fn(body): grasps = [] arm = 'arm' if 'top' in problem.grasp_types: approach_vector = APPROACH_DISTANCE * get_unit_vector([1, 0, 0]) grasps.extend(Grasp('top', body, g, multiply((approach_vector, unit_quat()), g), TOP_HOLDING_ARM) for g in get_top_grasps(body, grasp_length=GRASP_LENGTH)) if 'side' in problem.grasp_types: approach_vector = APPROACH_DISTANCE * get_unit_vector([0, -1, 0]) grasps.extend(Grasp('side', body, g, multiply((approach_vector, unit_quat()), g), SIDE_HOLDING_ARM) for g in get_side_grasps(body, grasp_length=GRASP_LENGTH)) filtered_grasps = [] for grasp in grasps: grasp_width = compute_grasp_width(problem.robot, arm, body, grasp.value) if collisions else 0.125 # TODO: modify if grasp_width is not None: grasp.grasp_width = grasp_width filtered_grasps.append(grasp) if randomize: random.shuffle(filtered_grasps) return [(g,) for g in filtered_grasps] return fn def get_tool_from_root(robot, arm): root_link = link_from_name(robot, HSR_GRIPPER_ROOTS[arm]) tool_link = link_from_name(robot, HSR_TOOL_FRAMES[arm]) return get_relative_pose(robot, root_link, tool_link) def iterate_approach_path(robot, arm, gripper, pose, grasp, body=None): tool_from_root = get_tool_from_root(robot, arm) grasp_pose = multiply(pose.value, invert(grasp.value)) approach_pose = multiply(pose.value, invert(grasp.approach)) for tool_pose in interpolate_poses(grasp_pose, approach_pose): set_pose(gripper, multiply(tool_pose, tool_from_root)) if body is not None: set_pose(body, multiply(tool_pose, grasp.value)) yield def get_ir_sampler(problem, custom_limits={}, max_attempts=25, collisions=True, learned=False): # Sample move_base pose robot = problem.robot obstacles = problem.fixed if collisions else [] gripper = problem.get_gripper() def gen_fn(arm, obj, pose, grasp): pose.assign() approach_obstacles = {obst for obst in obstacles if not is_placement(obj, obst)} for _ in iterate_approach_path(robot, arm, gripper, pose, grasp, body=obj): if any(pairwise_collision(gripper, b) or pairwise_collision(obj, b) for b in approach_obstacles): return gripper_pose = pose.value # multiply(pose.value, invert(grasp.value)) default_conf = arm_conf(arm, grasp.carry) arm_joints = get_arm_joints(robot, arm) base_joints = get_group_joints(robot, 'base') if learned: base_generator = learned_pose_generator(robot, gripper_pose, arm=arm, grasp_type=grasp.grasp_type) else: base_generator = uniform_pose_generator(robot, gripper_pose) lower_limits, upper_limits = get_custom_limits(robot, base_joints, custom_limits) while True: for base_conf in islice(base_generator, max_attempts): if not all_between(lower_limits, base_conf, upper_limits): continue bq = Conf(robot, base_joints, base_conf) pose.assign() bq.assign() set_joint_positions(robot, arm_joints, default_conf) if any(pairwise_collision(robot, b) for b in obstacles + [obj]): continue yield (bq,) break else: yield None return gen_fn def get_ik_fn(problem, custom_limits={}, collisions=True, teleport=False): robot = problem.robot obstacles = problem.fixed if collisions else [] if is_ik_compiled(): print('Using ikfast for inverse kinematics') else: print('Using pybullet for inverse kinematics') saved_place_conf = {} saved_default_conf = {} def fn(arm, obj, pose, grasp, base_conf): # Obstacles approach_obstacles = {obst for obst in obstacles if not is_placement(obj, obst)} # HSR joints arm_joints = get_arm_joints(robot, arm) base_joints = get_base_joints(robot, arm) base_arm_joints = get_base_arm_joints(robot, arm) # Select grasp_type if 'shaft' in str(problem.body_names[obj]): grasp_type = 'side' elif 'gear' in str(problem.body_names[obj]): grasp_type = 'bottom' # Set planning parameters resolutions = 0.05 * np.ones(len(base_arm_joints)) weights = [10, 10, 10, 50, 50, 50, 50, 50] if pose.extra == 'place': # Default confs default_arm_conf = get_carry_conf(arm, grasp_type) default_base_conf = get_joint_positions(robot, base_joints) default_base_arm_conf = [*default_base_conf, *default_arm_conf] pose.assign() base_conf.assign() attachment = grasp.get_attachment(problem.robot, arm) attachments = {attachment.child: attachment} # Get place pose and approach pose from deterministic_place place_pose, approach_pose = deterministic_place(obj, pose) # Set position to default configuration for grasp action set_joint_positions(robot, base_arm_joints, default_base_arm_conf) place_conf = hsr_inverse_kinematics(robot, arm, place_pose, custom_limits=custom_limits) if (place_conf is None) or any(pairwise_collision(robot, b) for b in obstacles): return None approach_conf = hsr_inverse_kinematics(robot, arm, approach_pose, custom_limits=custom_limits) if (approach_conf is None) or any(pairwise_collision(robot, b) for b in obstacles + [obj]): return None approach_conf = get_joint_positions(robot, base_arm_joints) # Plan joint motion for grasp place_path = plan_joint_motion(robot, base_arm_joints, place_conf, attachments=attachments.values(), obstacles=approach_obstacles, self_collisions=SELF_COLLISIONS, custom_limits=custom_limits, resolutions=resolutions/2., weights=weights, restarts=2, iterations=25, smooth=25) if place_path is None: print('Place path failure') return None set_joint_positions(robot, base_arm_joints, default_base_arm_conf) saved_default_conf[str(obj)] = default_base_conf # Plan joint motion for approaching approach_path = plan_direct_joint_motion(robot, base_arm_joints, approach_conf, attachments=attachments.values(), obstacles=obstacles, self_collisions=SELF_COLLISIONS, custom_limits=custom_limits, resolutions=resolutions) if approach_path is None: print('Approach path failure') return None # Save place conf set_joint_positions(robot, base_arm_joints, place_conf) saved_place_conf[str(obj)] = place_conf path1 = approach_path mt1 = create_trajectory(robot, base_arm_joints, path1) path2 = place_path mt2 = create_trajectory(robot, base_arm_joints, path2) cmd = Commands(State(attachments=attachments), savers=[BodySaver(robot)], commands=[mt1, mt2]) return (cmd,) elif pose.extra == 'insert': # Default confs default_arm_conf = arm_conf(arm, grasp.carry) default_base_conf = get_joint_positions(robot, base_joints) default_base_arm_conf = [*default_base_conf, *default_arm_conf] pose.assign() base_conf.assign() attachment = grasp.get_attachment(problem.robot, arm) attachments = {attachment.child: attachment} # Set position to default configuration for grasp action set_joint_positions(robot, base_arm_joints, default_base_arm_conf) # Get insert pose and depart pose from deterministic_insert insert_pose, depart_pose = deterministic_insert(obj, pose) depart_conf = hsr_inverse_kinematics(robot, arm, depart_pose, custom_limits=custom_limits) if (depart_conf is None) or any(pairwise_collision(robot, b) for b in obstacles): return None insert_conf = hsr_inverse_kinematics(robot, arm, insert_pose, custom_limits=custom_limits) if (insert_conf is None) or any(pairwise_collision(robot, b) for b in obstacles): return None # Set joints to place_conf place_conf = saved_place_conf[str(obj)] set_joint_positions(robot, base_arm_joints, place_conf) # Plan joint motion for insert action insert_path = plan_joint_motion(robot, base_arm_joints, insert_conf, attachments=attachments.values(), obstacles=approach_obstacles, self_collisions=SELF_COLLISIONS, custom_limits=custom_limits, resolutions=resolutions/2., weights=weights, restarts=2, iterations=25, smooth=25) if insert_path is None: print('Insert path failure') return None # Set joints to insert_conf set_joint_positions(robot, base_arm_joints, insert_conf) # Plan joint motion for depart action depart_path = plan_direct_joint_motion(robot, base_arm_joints, depart_conf, attachments=attachments.values(), obstacles=obstacles, self_collisions=SELF_COLLISIONS, custom_limits=custom_limits, resolutions=resolutions) if depart_path is None: print('Depart path failure') return None # Get end position to return return_conf = get_joint_positions(robot, base_arm_joints) # Set end positions to return default_arm_conf = arm_conf(arm, grasp.carry) default_base = saved_default_conf[str(obj)] default_base_arm_conf = [*default_base[:3], *default_arm_conf] set_joint_positions(robot, base_arm_joints, default_base_arm_conf) # Plan joint motion for return action return_path = plan_direct_joint_motion(robot, base_arm_joints, return_conf, attachments=attachments.values(), obstacles=obstacles, self_collisions=SELF_COLLISIONS, custom_limits=custom_limits, resolutions=resolutions) if return_path is None: print('Return path failure') return None path1 = insert_path mt1 = create_trajectory(robot, base_arm_joints, path1) path2 = depart_path mt2 = create_trajectory(robot, base_arm_joints, path2) path3 = return_path mt3 = create_trajectory(robot, base_arm_joints, path3) cmd = Commands(State(attachments=attachments), savers=[BodySaver(robot)], commands=[mt1, mt2, mt3]) return (cmd,) else: # Default confs default_arm_conf = arm_conf(arm, grasp.carry) default_base_conf = get_joint_positions(robot, base_joints) default_base_arm_conf = [*default_base_conf, *default_arm_conf] pose.assign() base_conf.assign() attachment = grasp.get_attachment(problem.robot, arm) attachments = {attachment.child: attachment} # If pick action, return grasp pose (pose is obtained from PyBullet at initialization) pick_pose, approach_pose = deterministic_pick(obj, pose) # Set position to default configuration for grasp action set_joint_positions(robot, arm_joints, default_arm_conf) pick_conf = hsr_inverse_kinematics(robot, arm, pick_pose, custom_limits=custom_limits) if (pick_conf is None) or any(pairwise_collision(robot, b) for b in obstacles): return None approach_conf = hsr_inverse_kinematics(robot, arm, approach_pose, custom_limits=custom_limits) if (approach_conf is None) or any(pairwise_collision(robot, b) for b in obstacles + [obj]): return None approach_conf = get_joint_positions(robot, base_arm_joints) # Plan joint motion for grasp grasp_path = plan_joint_motion(robot, base_arm_joints, pick_conf, attachments=attachments.values(), obstacles=approach_obstacles, self_collisions=SELF_COLLISIONS, custom_limits=custom_limits, resolutions=resolutions/2., weights=weights, restarts=2, iterations=25, smooth=25) if grasp_path is None: print('Grasp path failure') return None set_joint_positions(robot, base_arm_joints, default_base_arm_conf) # Plan joint motion for approach approach_path = plan_direct_joint_motion(robot, base_arm_joints, approach_conf, attachments=attachments.values(), obstacles=obstacles, self_collisions=SELF_COLLISIONS, custom_limits=custom_limits, resolutions=resolutions) if approach_path is None: print('Approach path failure') return None grasp_arm_conf = get_carry_conf(arm, grasp_type) grasp_base_conf = default_base_conf grasp_base_arm_conf = [*grasp_base_conf, *grasp_arm_conf] set_joint_positions(robot, base_arm_joints, approach_conf) # Plan joint motion for return return_path = plan_direct_joint_motion(robot, base_arm_joints, grasp_base_arm_conf, attachments=attachments.values(), obstacles=obstacles, self_collisions=SELF_COLLISIONS, custom_limits=custom_limits, resolutions=resolutions) if return_path is None: print('Return path failure') return None path1 = approach_path mt1 = create_trajectory(robot, base_arm_joints, path1) path2 = grasp_path mt2 = create_trajectory(robot, base_arm_joints, path2) path3 = return_path mt3 = create_trajectory(robot, base_arm_joints, path3) cmd = Commands(State(attachments=attachments), savers=[BodySaver(robot)], commands=[mt1, mt2, mt3]) return (cmd,) return fn def get_ik_ir_gen(problem, max_attempts=25, learned=False, teleport=False, **kwargs): ir_sampler = get_ir_sampler(problem, learned=learned, max_attempts=1, **kwargs) ik_fn = get_ik_fn(problem, teleport=teleport, **kwargs) def gen(*inputs): b, a, p, g = inputs ir_generator = ir_sampler(*inputs) attempts = 0 while True: if max_attempts <= attempts: if not p.init: return attempts = 0 yield None attempts += 1 try: ir_outputs = next(ir_generator) except StopIteration: return if ir_outputs is None: continue ik_outputs = ik_fn(*(inputs + ir_outputs)) if ik_outputs is None: continue print('IK attempts:', attempts) yield ir_outputs + ik_outputs return return gen def get_motion_gen(problem, custom_limits={}, collisions=True, teleport=False, motion_plan=False): robot = problem.robot saver = BodySaver(robot) obstacles = problem.fixed if collisions else [] def fn(bq1, bq2, fluents=[]): saver.restore() bq1.assign() if teleport: path = [bq1, bq2] else: resolutions = 0.05 * np.ones(len(bq2.joints)) raw_path = plan_joint_motion(robot, bq2.joints, bq2.values, attachments=[], obstacles=obstacles, custom_limits=custom_limits, self_collisions=SELF_COLLISIONS, resolutions=resolutions/2., restarts=2, iterations=25, smooth=25) if raw_path is None: print('Failed motion plan!') return None path = [Conf(robot, bq2.joints, q) for q in raw_path] if motion_plan: goal_conf = base_values_from_pose(bq2.value) raw_path = plan_base_motion(robot, goal_conf, BASE_LIMITS, obstacles=obstacles) if raw_path is None: print('Failed motion plan!') return None path = [Pose(robot, pose_from_base_values(q, bq1.value)) for q in raw_path] bt = Trajectory(path) cmd = Commands(State(), savers=[BodySaver(robot)], commands=[bt]) return (cmd,) return fn def accelerate_gen_fn(gen_fn, max_attempts=1): def new_gen_fn(*inputs): generator = gen_fn(*inputs) while True: for i in range(max_attempts): try: output = next(generator) except StopIteration: return if output is not None: print(gen_fn.__name__, i) yield output break return new_gen_fn ################################################## def visualize_traj(path): import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import axes3d, Axes3D x_traj = path[0] y_traj = path[1] z_traj = path[2] fig = plt.figure() ax = fig.add_subplot(projection='3d') ax.plot(x_traj, y_traj, z_traj, markersize=5, color='blue', marker='.') plt.show() ################################################## def apply_commands_with_visualization(state, commands, time_step=None, pause=False, **kwargs): x_traj, y_traj, z_traj = [], [], [] for i, command in enumerate(commands): print(i, command) for j, _ in enumerate(command.apply(state, **kwargs)): state.assign() if j == 0: continue if time_step is None: wait_for_duration(1e-2) wait_if_gui('Command {}, Step {}) Next?'.format(i, j)) else: wait_for_duration(time_step) ee_pose = get_link_pose(2, link_from_name(2, HSR_TOOL_FRAMES['arm'])) # hsr is 2 (depends on problem) x_traj.append(ee_pose[0][0]) y_traj.append(ee_pose[0][1]) z_traj.append(ee_pose[0][2]) if pause: wait_if_gui() path = [x_traj, y_traj, z_traj] visualize_traj(path) def apply_commands_with_save(state, commands, time_step=None, pause=False, **kwargs): ee_traj = [] joint_traj = [] movable_joints = get_base_arm_joints(2, 'arm') # 8 joints for i, command in enumerate(commands): print(i, command) for j, _ in enumerate(command.apply(state, **kwargs)): state.assign() if j == 0: continue if time_step is None: wait_for_duration(1e-2) wait_if_gui('Command {}, Step {}) Next?'.format(i, j)) else: wait_for_duration(time_step) ee_pose = get_link_pose(2, link_from_name(2, HSR_TOOL_FRAMES['arm'])) ee_traj.append(ee_pose) joint_pos = get_joint_positions(2, movable_joints) joint_traj.append(joint_pos) if pause: wait_if_gui() np.save('simulation_ee_traj', ee_traj) np.save('simulation_joint_traj', joint_traj) def apply_commands(state, commands, time_step=None, pause=False, **kwargs): for i, command in enumerate(commands): print(i, command) for j, _ in enumerate(command.apply(state, **kwargs)): state.assign() if j == 0: continue if time_step is None: wait_for_duration(1e-2) wait_if_gui('Command {}, Step {}) Next?'.format(i, j)) else: wait_for_duration(time_step) if pause: wait_if_gui() def apply_named_commands(state, commands, time_step=None, pause=False, **kwargs): for action_name, target_object_name, exp_command in commands: print(action_name, target_object_name, exp_command) for command in exp_command: for j, _ in enumerate(command.apply(state, **kwargs)): state.assign() if j == 0: continue if time_step is None: wait_for_duration(1e-2) wait_if_gui('Command {}, Step {}) Next?'.format(i, j)) else: wait_for_duration(time_step) if pause: wait_if_gui() ##################################### Debug def control_commands(commands, **kwargs): wait_if_gui('Control?') disable_real_time() enable_gravity() for i, command in enumerate(commands): print(i, command) command.control(*kwargs) ##################################### Test def get_target_point(conf): robot = conf.body link = link_from_name(robot, 'torso_lift_link') with BodySaver(conf.body): conf.assign() lower, upper = get_aabb(robot, link) center = np.average([lower, upper], axis=0) point = np.array(get_group_conf(conf.body, 'base')) point[2] = center[2] return point def get_target_path(trajectory): return [get_target_point(conf) for conf in trajectory.path] def get_cfree_pose_pose_test(collisions=True, **kwargs): def test(b1, p1, b2, p2): if not collisions or (b1 == b2): return True p1.assign() p2.assign() return not pairwise_collision(b1, b2, **kwargs) return test def get_cfree_obj_approach_pose_test(collisions=True): def test(b1, p1, g1, b2, p2): if not collisions or (b1 == b2): return True p2.assign() grasp_pose = multiply(p1.value, invert(g1.value)) approach_pose = multiply(p1.value, invert(g1.approach), g1.value) for obj_pose in interpolate_poses(grasp_pose, approach_pose): set_pose(b1, obj_pose) if pairwise_collision(b1, b2): return False return True return test def get_cfree_approach_pose_test(problem, collisions=True): arm = 'arm' gripper = problem.get_gripper() def test(b1, p1, g1, b2, p2): if not collisions or (b1 == b2): return True p2.assign() for _ in iterate_approach_path(problem.robot, arm, gripper, p1, g1, body=b1): if pairwise_collision(b1, b2) or pairwise_collision(gripper, b2): return False return True return test def get_cfree_traj_pose_test(problem, collisions=True): def test(c, b2, p2): if not collisions: return True state = c.assign() if b2 in state.attachments: return True p2.assign() for _ in c.apply(state): state.assign() for b1 in state.attachments: if pairwise_collision(b1, b2): return False if pairwise_collision(problem.robot, b2): return False return True return test def get_cfree_traj_grasp_pose_test(problem, collisions=True): def test(c, a, b1, g, b2, p2): if not collisions or (b1 == b2): return True state = c.assign() if (b1 in state.attachments) or (b2 in state.attachments): return True p2.assign() grasp_attachment = g.get_attachment(problem.robot, a) for _ in c.apply(state): state.assign() grasp_attachment.assign() if pairwise_collision(b1, b2): return False if pairwise_collision(problem.robot, b2): return False return True return test def get_supported(problem, collisions=True): def test(b, p1, r, p2): return is_placement(b, r) return test def get_inserted(problem, collisions=True): def test(b, p1, r, p2): return is_inserted(b, r) return test BASE_CONSTANT = 1 BASE_VELOCITY = 0.25 def distance_fn(q1, q2): distance = get_distance(q1.values[:2], q2.values[:2]) return BASE_CONSTANT + distance / BASE_VELOCITY def move_cost_fn(t): distance = t.distance(distance_fn=lambda q1, q2: get_distance(q1[:2], q2[:2])) return BASE_CONSTANT + distance / BASE_VELOCITY ##################################### Dataset def calculate_delta_angular(q1, q2): # Transform r1 = R.from_quat(q1) r2 = R.from_quat(q2) # Calculate difference diff = r2 * r1.inv() # Transform difference to euler 'xyz' delta_euler = diff.as_euler('xyz') return delta_euler.tolist() def create_dataset(problem_name, robot, objects, object_names, state, commands, time_step=None, pause=False, **kwargs): movable_joints = get_base_arm_joints(robot, 'arm') # 8 joints gripper_joints = get_gripper_joints(robot, 'arm') # 2 joints whole_body_joints = movable_joints + gripper_joints # 10 joints full_joint_names = ['joint_x', 'joint_y', 'joint_rz', 'arm_lift_joint', 'torso_lift_joint', 'arm_flex_joint', 'head_pan_joint', 'arm_roll_joint', 'head_tilt_joint', 'wrist_flex_joint', 'wrist_roll_joint', 'hand_l_proximal_joint', 'hand_r_proximal_joint', 'hand_l_distal_joint', 'hand_r_distal_joint'] full_joints = joints_from_names(robot, full_joint_names) # 15 joints # Up to what point should I record? skill_clip_index = {'move_base': 0, 'pick': 1, 'place': 1, 'insert': 2} # Prepare trajectory dict for all pose / positions traj = {'robot_pose': [], 'gripper_pose': [], 'ee_pose': [], 'diff_robot_pose': [], 'diff_gripper_pose': [], 'diff_ee_pose': [], 'object_pose': {object_names[obj]: list() for obj in objects}} # Prepare metadata for robot poses and object poses metadata = {'robot_init_pose': [], # robot initial joint positions 'robot_goal_pose': [], # robot final joint positions 'object_init_pose': {object_names[obj]: list() for obj in objects}, # object initial pose 'object_goal_pose': [], # object goal pose 'target_object_name': [], # pick target object's name 'skill_name': []} goal_robot_poses = [] goal_object_poses = [] # Add metadata (init_data) metadata['robot_init_pose'] = get_joint_positions(robot, full_joints) for obj in objects: metadata['object_init_pose'][object_names[obj]] = get_pose(obj) for action_name, target_object_name, command in commands: # Get previous robot joint positions and end effector pose prev_robot_pose = get_joint_positions(robot, whole_body_joints) prev_gripper_pose = get_joint_positions(robot, gripper_joints) prev_ee_pose = get_link_pose(robot, link_from_name(robot, HSR_TOOL_FRAMES['arm'])) command_num = 0 # Execute commands for c in command: for j, _ in enumerate(c.apply(state, **kwargs)): state.assign() if j == 0: continue if time_step is None: wait_for_duration(1e-2) else: wait_for_duration(time_step) # Get robot poses (10) robot_pose = get_joint_positions(robot, whole_body_joints) # Get gripper_joint poses (2) gripper_pose = get_joint_positions(robot, gripper_joints) # Get end effector poses (7) ee_pose = get_link_pose(robot, link_from_name(robot, HSR_TOOL_FRAMES['arm'])) # Get diff robot poses (10) diff_robot_pose = tuple(curr_pose - prev_pose for curr_pose, prev_pose in zip(robot_pose, prev_robot_pose)) # Get diff gripper_joint poses (2) diff_gripper_pose = tuple(curr_pose - prev_pose for curr_pose, prev_pose in zip(gripper_pose, prev_gripper_pose)) # Get diff end_effector poses (6) diff_ee_pose = tuple([curr_pos - prev_pos for curr_pos, prev_pos in zip(ee_pose[0], prev_ee_pose[0])] + calculate_delta_angular(ee_pose[1], prev_ee_pose[1])) # Absolute pose / positions traj['robot_pose'].append(robot_pose) traj['gripper_pose'].append(gripper_pose) traj['ee_pose'].append(ee_pose) # Relative pose / positions traj['diff_robot_pose'].append(diff_robot_pose) traj['diff_gripper_pose'].append(diff_gripper_pose) traj['diff_ee_pose'].append(diff_ee_pose) for obj in objects: object_name = object_names[obj] object_pose = get_pose(obj) traj['object_pose'][object_name].append(object_pose) prev_robot_pose = robot_pose prev_gripper_pose = gripper_pose prev_ee_pose = ee_pose # Target object name metadata['target_object_name'].append(target_object_name) metadata['skill_name'].append(action_name) # Save each skill's target robot pose if skill_clip_index[action_name] == command_num: goal_robot_poses.append(get_link_pose(robot, link_from_name(robot, HSR_TOOL_FRAMES['arm']))) command_num += 1 for obj in objects: if target_object_name == object_names[obj]: goal_object_poses.append(get_pose(obj)) if action_name == 'move_base': goal_object_poses.append(get_pose(0)) # Create dataset trajectory_path = os.path.join(os.environ['PYTHONPATH'].split(':')[1], 'experiments', 'env_3d', 'dataset', problem_name, 'full', 'trajectory') num_traj_files = sum(os.path.isfile(os.path.join(trajectory_path, _name)) for _name in os.listdir(trajectory_path)) metadata_path = os.path.join(os.environ['PYTHONPATH'].split(':')[1], 'experiments', 'env_3d', 'dataset', problem_name, 'full', 'metadata') num_meta_files = sum(os.path.isfile(os.path.join(metadata_path, _name)) for _name in os.listdir(metadata_path)) # File names traj_name = 'trajectory_' + str(num_traj_files) + '.json' metadata_name = 'metadata_' + str(num_meta_files) + '.json' # File paths traj_path = os.path.join(trajectory_path, traj_name) metadata_path = os.path.join(metadata_path, metadata_name) # Save trajectory / metadata with open(traj_path, 'w') as f: json.dump(traj, f) with open(metadata_path, 'w') as f: json.dump(metadata, f) def create_skill_dataset(problem_name, robot, objects, object_names, state, commands, time_step=None, pause=False, **kwargs): movable_joints = get_base_arm_joints(robot, 'arm') # 8 joints gripper_joints = get_gripper_joints(robot, 'arm') # 2 joints whole_body_joints = movable_joints + gripper_joints # 10 joints full_joint_names = ['joint_x', 'joint_y', 'joint_rz', 'arm_lift_joint', 'torso_lift_joint', 'arm_flex_joint', 'head_pan_joint', 'arm_roll_joint', 'head_tilt_joint', 'wrist_flex_joint', 'wrist_roll_joint', 'hand_l_proximal_joint', 'hand_r_proximal_joint', 'hand_l_distal_joint', 'hand_r_distal_joint'] full_joints = joints_from_names(robot, full_joint_names) # 15 joints # Up to what point should I record? skill_record_index = {'move_base': [0, 0], 'pick': [0, 5], 'place': [0, 1], 'insert': [0, 2]} skill_clip_index = {'move_base': 0, 'pick': 1, 'place': 1, 'insert': 2} for action_name, target_object_name, command in commands: # Prepare trajectory dict for all pose / positions traj = {'robot_pose': [], 'gripper_pose': [], 'ee_pose': [], 'diff_robot_pose': [], 'diff_gripper_pose': [], 'diff_ee_pose': [], 'object_pose': {object_names[obj]: list() for obj in objects}} # Prepare metadata for robot poses and object poses metadata = {'robot_init_pose': [], # robot initial joint positions 'robot_goal_pose': [], # robot final joint positions 'robot_target_pose': [], # robot action target pose 'object_init_pose': {object_names[obj]: list() for obj in objects}, # object initial pose 'object_goal_pose': {object_names[obj]: list() for obj in objects}, # object goal pose 'target_object_name': []} # action target object's name # Add metadata (init_data) metadata['robot_init_pose'] = get_joint_positions(robot, full_joints) for obj in objects: metadata['object_init_pose'][object_names[obj]] = get_pose(obj) metadata['target_object_name'] = target_object_name # Get previous robot joint positions and end effector pose prev_robot_pose = get_joint_positions(robot, whole_body_joints) prev_gripper_pose = get_joint_positions(robot, gripper_joints) prev_ee_pose = get_link_pose(robot, link_from_name(robot, HSR_TOOL_FRAMES['arm'])) command_num = 0 # Execute commands for c in command: for j, _ in enumerate(c.apply(state, **kwargs)): state.assign() if j == 0: continue if time_step is None: wait_for_duration(1e-2) else: wait_for_duration(time_step) # Get robot poses (10) robot_pose = get_joint_positions(robot, whole_body_joints) # Get gripper_joint poses (2) gripper_pose = get_joint_positions(robot, gripper_joints) # Get end effector poses (7) ee_pose = get_link_pose(robot, link_from_name(robot, HSR_TOOL_FRAMES['arm'])) # Get diff robot poses (10) diff_robot_pose = tuple(curr_pose - prev_pose for curr_pose, prev_pose in zip(robot_pose, prev_robot_pose)) # Get diff gripper_joint poses (2) diff_gripper_pose = tuple(curr_pose - prev_pose for curr_pose, prev_pose in zip(gripper_pose, prev_gripper_pose)) # Get diff end_effector poses (6) diff_ee_pose = tuple([curr_pos - prev_pos for curr_pos, prev_pos in zip(ee_pose[0], prev_ee_pose[0])] + calculate_delta_angular(ee_pose[1], prev_ee_pose[1])) if skill_record_index[action_name][0] <= command_num and \ skill_record_index[action_name][1] >= command_num: # Absolute pose / positions traj['robot_pose'].append(robot_pose) traj['gripper_pose'].append(gripper_pose) traj['ee_pose'].append(ee_pose) # Relative pose / positions traj['diff_robot_pose'].append(diff_robot_pose) traj['diff_gripper_pose'].append(diff_gripper_pose) traj['diff_ee_pose'].append(diff_ee_pose) for obj in objects: object_name = object_names[obj] object_pose = get_pose(obj) traj['object_pose'][object_name].append(object_pose) prev_robot_pose = robot_pose prev_gripper_pose = gripper_pose prev_ee_pose = ee_pose # Save each skill's target robot pose if skill_clip_index[action_name] == command_num: metadata['robot_target_pose'] = get_link_pose(robot, link_from_name(robot, HSR_TOOL_FRAMES['arm'])) command_num += 1 if pause: wait_if_gui() # Add metadata (goal_data) metadata['robot_goal_pose'] = get_joint_positions(robot, full_joints) for obj in objects: metadata['object_goal_pose'][object_names[obj]] = get_pose(obj) dataset = [action_name, traj] # Create dataset trajectory_path = os.path.join(os.environ['PYTHONPATH'].split(':')[1], 'experiments', 'env_3d', 'dataset', problem_name, action_name, 'trajectory') num_traj_files = sum(os.path.isfile(os.path.join(trajectory_path, _name)) for _name in os.listdir(trajectory_path)) metadata_path = os.path.join(os.environ['PYTHONPATH'].split(':')[1], 'experiments', 'env_3d', 'dataset', problem_name, action_name, 'metadata') num_meta_files = sum(os.path.isfile(os.path.join(metadata_path, _name)) for _name in os.listdir(metadata_path)) # File names traj_name = 'trajectory_' + str(num_traj_files) + '.json' metadata_name = 'metadata_' + str(num_meta_files) + '.json' # File paths traj_path = os.path.join(trajectory_path, traj_name) metadata_path = os.path.join(metadata_path, metadata_name) # Save trajectory / metadata with open(traj_path, 'w') as f: json.dump(dataset, f) with open(metadata_path, 'w') as f: json.dump(metadata, f) def replay_trajectory(robot, objects, object_names, state, commands, **kwargs): # Up to what point should I record? skill_clip_index = {'move_base': 0, 'pick': 0, 'place': 0, 'insert': 2} # Prepare trajectory dict for all pose / positions pick_metadata = {'init_robot_pose': [], 'goal_robot_pose': [], 'target_robot_pose': [], 'target_object_pose': []} place_metadata = {'init_robot_pose': [], 'goal_robot_pose': [], 'target_robot_pose': [], 'target_object_pose': []} insert_metadata = {'init_robot_pose': [], 'goal_robot_pose': [], 'target_robot_pose': [], 'target_object_pose': []} for action_name, target_object_name, command in commands: # Add metadata (init_data) if action_name == 'pick': pick_metadata['init_robot_pose'].append(get_link_pose(robot, link_from_name(robot, HSR_TOOL_FRAMES['arm']))) elif action_name == 'place': place_metadata['init_robot_pose'].append(get_link_pose(robot, link_from_name(robot, HSR_TOOL_FRAMES['arm']))) elif action_name == 'insert': insert_metadata['init_robot_pose'].append(get_link_pose(robot, link_from_name(robot, HSR_TOOL_FRAMES['arm']))) command_num = 0 # Execute commands for c in command: for j, _ in enumerate(c.apply(state, **kwargs)): state.assign() wait_for_duration(1e-3) # Add metadata (target data) if skill_clip_index[action_name] == command_num: if action_name == 'pick': pick_metadata['target_robot_pose'].append(get_link_pose(robot, link_from_name(robot, HSR_TOOL_FRAMES['arm']))) elif action_name == 'place': place_metadata['target_robot_pose'].append(get_link_pose(robot, link_from_name(robot, HSR_TOOL_FRAMES['arm']))) elif action_name == 'insert': insert_metadata['target_robot_pose'].append(get_link_pose(robot, link_from_name(robot, HSR_TOOL_FRAMES['arm']))) command_num += 1 # Add metadata (goal_data) if action_name == 'pick': pick_metadata['goal_robot_pose'].append(get_link_pose(robot, link_from_name(robot, HSR_TOOL_FRAMES['arm']))) for obj in objects: if object_names[obj] == target_object_name: pick_metadata['target_object_pose'].append(get_pose(obj)) elif action_name == 'place': place_metadata['goal_robot_pose'].append(get_link_pose(robot, link_from_name(robot, HSR_TOOL_FRAMES['arm']))) for obj in objects: if object_names[obj] == target_object_name: place_metadata['target_object_pose'].append(get_pose(obj)) elif action_name == 'insert': insert_metadata['goal_robot_pose'].append(get_link_pose(robot, link_from_name(robot, HSR_TOOL_FRAMES['arm']))) for obj in objects: if object_names[obj] == target_object_name: insert_metadata['target_object_pose'].append(get_pose(obj)) return pick_metadata, place_metadata, insert_metadata ##################################### Custom def deterministic_pick(pose, offset=[0.12, 0.14]): pick_pose = pose.value pick_pose = ((pick_pose[0][0]-offset[0], pick_pose[0][1], pick_pose[0][2]), pick_pose[1]) approach_pose = ((pick_pose[0][0]-offset[1], pick_pose[0][1], pick_pose[0][2]), pick_pose[1]) grasp_euler = np.array((np.pi/2, np.pi/2, 0.0)) grasp_quat = R.from_euler('zyx', grasp_euler).as_quat() pick_pose = (pick_pose[0], grasp_quat) approach_pose = (approach_pose[0], grasp_quat) return pick_pose, approach_pose def deterministic_place(pose, offset=[0.12, 0.0]): place_pose = pose.value place_pose = ((place_pose[0][0]-offset[0], place_pose[0][1], place_pose[0][2]), place_pose[1]) approach_pose = ((place_pose[0][0]-offset[1], place_pose[0][1], place_pose[0][2]), place_pose[1]) grasp_euler = np.array((np.pi/2, np.pi/2, 0.0)) grasp_quat = R.from_euler('zyx', grasp_euler).as_quat() place_pose = (place_pose[0], grasp_quat) approach_pose = (approach_pose[0], grasp_quat) return place_pose, approach_pose def deterministic_insert(pose, offset=[0.12, 0.14]): insert_pose = pose.value insert_pose = ((insert_pose[0][0]-offset[0], insert_pose[0][1], insert_pose[0][2]), insert_pose[1]) depart_pose = ((insert_pose[0][0]-offset[1], insert_pose[0][1], insert_pose[0][2]), insert_pose[1]) grasp_euler = np.array((np.pi/2, np.pi/2, 0.0)) grasp_quat = R.from_euler('zyx', grasp_euler).as_quat() insert_pose = (insert_pose[0], grasp_quat) depart_pose = (depart_pose[0], grasp_quat) return insert_pose, depart_pose
59,348
Python
40.590049
132
0.54632
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/pybullet_tools/utils.py
from __future__ import print_function import os import sys import time import math import json import random import shutil import pstats import signal import pickle import inspect import trimesh import colorsys import platform import datetime import cProfile import collections import pybullet_data import numpy as np import pybullet as p import pybullet_utils.bullet_client as bc from collections import defaultdict, deque, namedtuple from itertools import product, combinations, count, cycle, islice from multiprocessing import TimeoutError from contextlib import contextmanager from scipy.spatial.transform import Rotation as R from .transformations import quaternion_from_matrix, unit_vector, euler_from_quaternion, quaternion_slerp directory = os.path.dirname(os.path.abspath(__file__)) sys.path.append(os.path.join(directory, '../motion')) from motion_planners.rrt_connect import birrt from motion_planners.meta import direct_path try: user_input = raw_input except NameError: user_input = input INF = np.inf PI = np.pi EPSILON = 1e-6 DEFAULT_TIME_STEP = 1./240. Interval = namedtuple('Interval', ['lower', 'upper']) UNIT_LIMITS = Interval(0., 1.) CIRCULAR_LIMITS = Interval(-0.01, 0.01) UNBOUNDED_LIMITS = Interval(-INF, INF) ##################################### # Models # Robots MODEL_DIRECTORY = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, 'models/')) ROOMBA_URDF = 'models/turtlebot/roomba.urdf' TURTLEBOT_URDF = 'models/turtlebot/turtlebot_holonomic.urdf' DRAKE_IIWA_URDF = 'models/drake/iiwa_description/urdf/iiwa14_polytope_collision.urdf' WSG_50_URDF = 'models/drake/wsg_50_description/urdf/wsg_50_mesh_visual.urdf' # wsg_50 | wsg_50_mesh_visual | wsg_50_mesh_collision PANDA_HAND_URDF = "models/franka_description/robots/hand.urdf" PANDA_ARM_URDF = "models/franka_description/robots/panda_arm_hand.urdf" # PyBullet Robots KUKA_IIWA_URDF = 'kuka_iiwa/model.urdf' KUKA_IIWA_GRIPPER_SDF = 'kuka_iiwa/kuka_with_gripper.sdf' R2D2_URDF = 'r2d2.urdf' MINITAUR_URDF = 'quadruped/minitaur.urdf' HUMANOID_MJCF = 'mjcf/humanoid.xml' HUSKY_URDF = 'husky/husky.urdf' RACECAR_URDF = 'racecar/racecar.urdf' # racecar_differential.urdf PR2_GRIPPER = 'pr2_gripper.urdf' PANDA_URDF = 'franka_panda/panda.urdf' # PyBullet wsg50 robots WSG_GRIPPER = 'gripper/wsg50_one_motor_gripper_new.sdf' # PyBullet Objects KIVA_SHELF_SDF = 'kiva_shelf/model.sdf' FLOOR_URDF = 'short_floor.urdf' TABLE_URDF = 'table/table.urdf' # Objects SMALL_BLOCK_URDF = 'models/drake/objects/block_for_pick_and_place.urdf' BLOCK_URDF = 'models/drake/objects/block_for_pick_and_place_mid_size.urdf' SINK_URDF = 'models/sink.urdf' STOVE_URDF = 'models/stove.urdf' ##################################### # I/O SEPARATOR = '\n' + 50*'-' + '\n' inf_generator = count List = lambda *args: list(args) Tuple = lambda *args: tuple(args) def empty_sequence(): return iter([]) def irange(start, end=None, step=1): if end is None: end = start start = 0 n = start while n < end: yield n n += step def count_until(max_iterations=INF, max_time=INF): start_time = time.time() assert (max_iterations < INF) or (max_time < INF) for iteration in irange(max_iterations): if elapsed_time(start_time) >= max_time: break yield iteration def print_separator(n=50): print('\n' + n*'-' + '\n') def is_remote(): return 'SSH_CONNECTION' in os.environ def is_darwin(): return platform.system() == 'Darwin' def get_python_version(): return sys.version_info[0] def read(filename): with open(filename, 'r') as f: return f.read() def write(filename, string): with open(filename, 'w') as f: f.write(string) def read_pickle(filename): # Can sometimes read pickle3 from python2 by calling twice with open(filename, 'rb') as f: try: return pickle.load(f) except UnicodeDecodeError as e: return pickle.load(f, encoding='latin1') def write_pickle(filename, data): with open(filename, 'wb') as f: pickle.dump(data, f) def read_json(path): return json.loads(read(path)) def write_json(path, data): with open(path, 'w') as f: json.dump(data, f, indent=2, sort_keys=True) def safe_remove(path): if os.path.exists(path): if os.path.isdir(path): shutil.rmtree(path) else: os.remove(path) def ensure_dir(f): d = os.path.dirname(f) if not os.path.exists(d): os.makedirs(d) def list_paths(directory): return sorted(os.path.abspath(os.path.join(directory, filename)) for filename in os.listdir(directory)) ################################################## def safe_zip(sequence1, sequence2): sequence1, sequence2 = list(sequence1), list(sequence2) assert len(sequence1) == len(sequence2) return list(zip(sequence1, sequence2)) def get_pairs(sequence): sequence = list(sequence) return safe_zip(sequence[:-1], sequence[1:]) def get_wrapped_pairs(sequence): sequence = list(sequence) return safe_zip(sequence, sequence[1:] + sequence[:1]) def clip(value, min_value=-INF, max_value=+INF): return min(max(min_value, value), max_value) def randomize(iterable): sequence = list(iterable) random.shuffle(sequence) return sequence def get_random_seed(): return random.getstate()[1][1] def get_numpy_seed(): return np.random.get_state()[1][0] def set_random_seed(seed=None): if seed is not None: random.seed(seed) def wrap_numpy_seed(seed): return seed % (2**32) def set_numpy_seed(seed=None): # These generators are different and independent if seed is not None: np.random.seed(wrap_numpy_seed(seed)) DATE_FORMAT = '%y-%m-%d_%H-%M-%S' def get_date(): return datetime.datetime.now().strftime(DATE_FORMAT) def implies(p1, p2): return not p1 or p2 def roundrobin(*iterables): "roundrobin('ABC', 'D', 'EF') --> A D E B F C" pending = len(iterables) nexts = cycle(iter(it).__next__ for it in iterables) while pending: try: for next in nexts: yield next() except StopIteration: pending -= 1 nexts = cycle(islice(nexts, pending)) def chunks(sequence, n=1): for i in range(0, len(sequence), n): yield sequence[i:i + n] def get_function_name(depth=1): return inspect.stack()[depth][3] def load_yaml(path): import yaml with open(path, 'r') as f: try: return yaml.safe_load(f) except yaml.YAMLError as exc: raise exc def flatten(iterable_of_iterables): return (item for iterables in iterable_of_iterables for item in iterables) def find(test, sequence): for item in sequence: if test(item): return item return None def merge_dicts(*args): result = {} for d in args: result.update(d) return result def str_from_object(obj): if type(obj) in [list]: return '[{}]'.format(', '.join(str_from_object(item) for item in obj)) if type(obj) in [tuple]: return '({})'.format(', '.join(str_from_object(item) for item in obj)) if type(obj) in [set, frozenset]: return '{{{}}}'.format(', '.join(sorted(str_from_object(item) for item in obj))) if type(obj) in [dict, defaultdict]: return '{{{}}}'.format(', '.join('{}: {}'.format(*pair) for pair in sorted( tuple(map(str_from_object, pair)) for pair in obj.items()))) return str(obj) def safe_sample(collection, k=1): collection = list(collection) if len(collection) <= k: return collection return random.sample(collection, k) class OrderedSet(collections.OrderedDict, collections.MutableSet): def __init__(self, seq=()): self.update(seq) def update(self, *args, **kwargs): if kwargs: raise TypeError('update() takes no keyword arguments') for s in args: for e in s: self.add(e) def add(self, elem): self[elem] = None def discard(self, elem): self.pop(elem, None) def __le__(self, other): return all(e in other for e in self) def __lt__(self, other): return self <= other and self != other def __ge__(self, other): return all(e in self for e in other) def __gt__(self, other): return self >= other and self != other def __repr__(self): return 'OrderedSet([%s])' % (', '.join(map(repr, self.keys()))) def __str__(self): return '{%s}' % (', '.join(map(repr, self.keys()))) difference = property(lambda self: self.__sub__) difference_update = property(lambda self: self.__isub__) intersection = property(lambda self: self.__and__) intersection_update = property(lambda self: self.__iand__) issubset = property(lambda self: self.__le__) issuperset = property(lambda self: self.__ge__) symmetric_difference = property(lambda self: self.__xor__) symmetric_difference_update = property(lambda self: self.__ixor__) union = property(lambda self: self.__or__) ################################################## BYTES_PER_KILOBYTE = math.pow(2, 10) BYTES_PER_GIGABYTE = math.pow(2, 30) KILOBYTES_PER_GIGABYTE = BYTES_PER_GIGABYTE / BYTES_PER_KILOBYTE def get_memory_in_kb(): import psutil process = psutil.Process(os.getpid()) pmem = process.memory_info() return pmem.vms / BYTES_PER_KILOBYTE def raise_timeout(signum, frame): raise TimeoutError() @contextmanager def timeout(duration): assert 0 < duration if duration == INF: yield return # Register a function to raise a TimeoutError on the signal signal.signal(signal.SIGALRM, raise_timeout) # Schedule the signal to be sent after ``duration`` signal.alarm(int(math.ceil(duration))) try: yield except TimeoutError as e: print('Timeout after {} sec'.format(duration)) pass finally: # Unregister the signal so it won't be triggered # if the timeout is not reached signal.signal(signal.SIGALRM, signal.SIG_IGN) def log_time(method): """ A decorator for methods which will time the method and then emit a log.debug message with the method name and how long it took to execute. """ import logging log = logging.getLogger() def timed(*args, **kwargs): tic = now() result = method(*args, **kwargs) log.debug('%s executed in %.4f seconds.', method.__name__, now() - tic) return result timed.__name__ = method.__name__ timed.__doc__ = method.__doc__ return timed def cached_fn(fn, cache=True, **global_kargs): def normal(*args, **local_kwargs): kwargs = dict(global_kargs) kwargs.update(local_kwargs) return fn(*args, **kwargs) if not cache: return normal @cache_decorator def wrapped(*args, **local_kwargs): return normal(*args, **local_kwargs) return wrapped def cache_decorator(function): """ A decorator for class methods, replaces @property but will store and retrieve function return values in object cache. Parameters ------------ function : method This is used as a decorator: ``` @cache_decorator def foo(self, things): return 'happy days' ``` """ from functools import wraps # use wraps to preserve docstring @wraps(function) def get_cached(*args, **kwargs): """ Only execute the function if its value isn't stored in cache already. """ self = args[0] # use function name as key in cache name = function.__name__ # do the dump logic ourselves to avoid # verifying cache twice per call self._cache.verify() # access cache dict to avoid automatic validation # since we already called cache.verify manually if name in self._cache.cache: # already stored so return value return self._cache.cache[name] # value not in cache so execute the function value = function(*args, **kwargs) # store the value if self._cache.force_immutable and hasattr( value, 'flags') and len(value.shape) > 0: value.flags.writeable = False self._cache.cache[name] = value return value # all cached values are also properties # so they can be accessed like value attributes # rather than functions return property(get_cached) ##################################### class HideOutput(object): # https://stackoverflow.com/questions/5081657/how-do-i-prevent-a-c-shared-library-to-print-on-stdout-in-python # https://stackoverflow.com/questions/4178614/suppressing-output-of-module-calling-outside-library # https://stackoverflow.com/questions/4675728/redirect-stdout-to-a-file-in-python/22434262#22434262 ''' A context manager that block stdout for its scope, usage: with HideOutput(): os.system('ls -l') ''' DEFAULT_ENABLE = True def __init__(self, enable=None): if enable is None: enable = self.DEFAULT_ENABLE self.enable = enable if not self.enable: return sys.stdout.flush() self._origstdout = sys.stdout self._oldstdout_fno = os.dup(sys.stdout.fileno()) self._devnull = os.open(os.devnull, os.O_WRONLY) def __enter__(self): if not self.enable: return self.fd = 1 #self.fd = sys.stdout.fileno() self._newstdout = os.dup(self.fd) os.dup2(self._devnull, self.fd) os.close(self._devnull) sys.stdout = os.fdopen(self._newstdout, 'w') def __exit__(self, exc_type, exc_val, exc_tb): if not self.enable: return sys.stdout.close() sys.stdout = self._origstdout sys.stdout.flush() os.dup2(self._oldstdout_fno, self.fd) os.close(self._oldstdout_fno) # Added ##################################### # Colors RGB = namedtuple('RGB', ['red', 'green', 'blue']) RGBA = namedtuple('RGBA', ['red', 'green', 'blue', 'alpha']) MAX_RGB = 2**8 - 1 RED = RGBA(1, 0, 0, 1) GREEN = RGBA(0, 1, 0, 1) BLUE = RGBA(0, 0, 1, 1) BLACK = RGBA(0, 0, 0, 1) WHITE = RGBA(1, 1, 1, 1) SKIN = RGBA(0.996, 0.8627, 0.7412, 1) BROWN = RGBA(0.396, 0.263, 0.129, 1) TAN = RGBA(0.824, 0.706, 0.549, 1) LIGHT_GREY = (0.7, 0.7, 0.7, 1.) GREY = RGBA(0.5, 0.5, 0.5, 1) YELLOW = RGBA(1, 1, 0, 1) TRANSPARENT = RGBA(0, 0, 0, 0.001) SHADOW = RGBA(0.1, 0.1, 0.1, 0.3) ACHROMATIC_COLORS = { 'white': WHITE, 'grey': GREY, 'black': BLACK, } CHROMATIC_COLORS = { 'red': RED, 'green': GREEN, 'blue': BLUE, } COLOR_FROM_NAME = merge_dicts(ACHROMATIC_COLORS, CHROMATIC_COLORS) def remove_alpha(color): return RGB(*color[:3]) def apply_alpha(color, alpha=1.): if color is None: return None red, green, blue = color[:3] return RGBA(red, green, blue, alpha) def spaced_colors(n, s=1, v=1): return [RGB(*colorsys.hsv_to_rgb(h, s, v)) for h in np.linspace(0, 1, n, endpoint=False)] ##################################### # Savers class Saver(object): def save(self): pass def restore(self): raise NotImplementedError() def __enter__(self): self.save() def __exit__(self, type, value, traceback): self.restore() class ClientSaver(Saver): def __init__(self, new_client=None): self.client = CLIENT if new_client is not None: set_client(new_client) def restore(self): set_client(self.client) def __repr__(self): return '{}({})'.format(self.__class__.__name__, self.client) class VideoSaver(Saver): def __init__(self, path): self.path = path if path is None: self.log_id = None else: name, ext = os.path.splitext(path) assert ext == '.mp4' # STATE_LOGGING_PROFILE_TIMINGS, STATE_LOGGING_ALL_COMMANDS # p.submitProfileTiming('pythontest") self.log_id = p.startStateLogging(p.STATE_LOGGING_VIDEO_MP4, fileName=path, physicsClientId=CLIENT) def restore(self): if self.log_id is not None: p.stopStateLogging(self.log_id) print('Saved', self.path) class Profiler(Saver): fields = ['tottime', 'cumtime', None] def __init__(self, field='tottime', num=10): assert field in self.fields self.field = field self.num = num if field is None: return self.pr = cProfile.Profile() def save(self): if self.field is None: return self.pr.enable() return self.pr def restore(self): if self.field is None: return self.pr.disable() stream = None stats = pstats.Stats(self.pr, stream=stream).sort_stats(self.field) # TODO: print multiple stats.print_stats(self.num) return stats ##################################### class PoseSaver(Saver): def __init__(self, body, pose=None): self.body = body if pose is None: pose = get_pose(self.body) self.pose = pose self.velocity = get_velocity(self.body) def apply_mapping(self, mapping): self.body = mapping.get(self.body, self.body) def restore(self): set_pose(self.body, self.pose) set_velocity(self.body, *self.velocity) def __repr__(self): return '{}({})'.format(self.__class__.__name__, self.body) class ConfSaver(Saver): def __init__(self, body, joints=None, positions=None): self.body = body if joints is None: joints = get_movable_joints(self.body) self.joints = joints if positions is None: positions = get_joint_positions(self.body, self.joints) self.positions = positions self.velocities = get_joint_velocities(self.body, self.joints) @property def conf(self): return self.positions def apply_mapping(self, mapping): self.body = mapping.get(self.body, self.body) def restore(self): set_joint_states(self.body, self.joints, self.positions, self.velocities) def __repr__(self): return '{}({})'.format(self.__class__.__name__, self.body) class BodySaver(Saver): def __init__(self, body, **kwargs): self.body = body self.pose_saver = PoseSaver(body) self.conf_saver = ConfSaver(body, **kwargs) self.savers = [self.pose_saver, self.conf_saver] def apply_mapping(self, mapping): for saver in self.savers: saver.apply_mapping(mapping) def restore(self): for saver in self.savers: saver.restore() def __repr__(self): return '{}({})'.format(self.__class__.__name__, self.body) class WorldSaver(Saver): def __init__(self, bodies=None): if bodies is None: bodies = get_bodies() self.bodies = bodies self.body_savers = [BodySaver(body) for body in self.bodies] def restore(self): for body_saver in self.body_savers: body_saver.restore() ##################################### # Simulation CLIENTS = {} CLIENT = 0 def get_client(client=None): if client is None: return CLIENT return client def set_client(client): global CLIENT CLIENT = client ModelInfo = namedtuple('URDFInfo', ['name', 'path', 'fixed_base', 'scale']) INFO_FROM_BODY = {} def get_model_info(body): key = (CLIENT, body) return INFO_FROM_BODY.get(key, None) def get_urdf_flags(cache=False, cylinder=False): flags = 0 if cache: flags |= p.URDF_ENABLE_CACHED_GRAPHICS_SHAPES if cylinder: flags |= p.URDF_USE_IMPLICIT_CYLINDER return flags def load_pybullet(filename, fixed_base=False, scale=1., **kwargs): with LockRenderer(): if filename.endswith('.urdf'): flags = get_urdf_flags(**kwargs) body = p.loadURDF(filename, useFixedBase=fixed_base, flags=flags, globalScaling=scale, physicsClientId=CLIENT) elif filename.endswith('.sdf'): body = p.loadSDF(filename, physicsClientId=CLIENT) elif filename.endswith('.xml'): body = p.loadMJCF(filename, physicsClientId=CLIENT) elif filename.endswith('.bullet'): body = p.loadBullet(filename, physicsClientId=CLIENT) elif filename.endswith('.obj'): # TODO: fixed_base => mass = 0? body = create_obj(filename, scale=2, **kwargs) elif filename.endswith('.stl'): # TODO: fixed_base => mass = 0? # TODO: fix scale body = create_stl(filename, scale=0.02, **kwargs) else: raise ValueError(filename) INFO_FROM_BODY[CLIENT, body] = ModelInfo(None, filename, fixed_base, scale) return body def load_virtual_model(filename, fixed_base=False, scale=1., **kwargs): with LockRenderer(): if filename.endswith('.urdf'): flags = get_urdf_flags(**kwargs) body = p.loadURDF(filename, useFixedBase=fixed_base, flags=flags, globalScaling=scale, physicsClientId=CLIENT) elif filename.endswith('.obj'): body = create_virtual_obj(filename, scale=2, **kwargs) else: raise ValueError(filename) INFO_FROM_BODY[CLIENT, body] = ModelInfo(None, filename, fixed_base, scale) return body def set_caching(cache): p.setPhysicsEngineParameter(enableFileCaching=int(cache), physicsClientId=CLIENT) def load_model_info(info): if info.path.endswith('.urdf'): return load_pybullet(info.path, fixed_base=info.fixed_base, scale=info.scale) if info.path.endswith('.obj'): mass = STATIC_MASS if info.fixed_base else 1. return create_obj(info.path, mass=mass, scale=info.scale) raise NotImplementedError(info.path) URDF_FLAGS = [p.URDF_USE_INERTIA_FROM_FILE, p.URDF_USE_SELF_COLLISION, p.URDF_USE_SELF_COLLISION_EXCLUDE_PARENT, p.URDF_USE_SELF_COLLISION_EXCLUDE_ALL_PARENTS] def get_model_path(rel_path): directory = os.path.dirname(os.path.abspath(__file__)) return os.path.join(directory, '..', rel_path) def load_model(rel_path, pose=None, **kwargs): abs_path = get_model_path(rel_path) add_data_path() body = load_pybullet(abs_path, **kwargs) if pose is not None: set_pose(body, pose) return body def get_version(): s = str(p.getAPIVersion(physicsClientId=CLIENT)) return datetime.date(year=int(s[:4]), month=int(s[4:6]), day=int(s[7:9])) ##################################### now = time.time def elapsed_time(start_time): return time.time() - start_time MouseEvent = namedtuple('MouseEvent', ['eventType', 'mousePosX', 'mousePosY', 'buttonIndex', 'buttonState']) def get_mouse_events(): return list(MouseEvent(*event) for event in p.getMouseEvents(physicsClientId=CLIENT)) def update_viewer(): get_mouse_events() def wait_for_duration(duration): t0 = time.time() while elapsed_time(t0) <= duration: update_viewer() def simulate_for_duration(duration): dt = get_time_step() for i in range(int(duration / dt)): step_simulation() def get_time_step(): return p.getPhysicsEngineParameters(physicsClientId=CLIENT)['fixedTimeStep'] def enable_separating_axis_test(): p.setPhysicsEngineParameter(enableSAT=1, physicsClientId=CLIENT) def simulate_for_sim_duration(sim_duration, real_dt=0, frequency=INF): t0 = time.time() sim_dt = get_time_step() sim_time = 0 last_print = 0 while sim_time < sim_duration: if frequency < (sim_time - last_print): print('Sim time: {:.3f} | Real time: {:.3f}'.format(sim_time, elapsed_time(t0))) last_print = sim_time step_simulation() sim_time += sim_dt time.sleep(real_dt) def wait_for_user(message='Press enter to continue'): if has_gui() and is_darwin(): return threaded_input(message) return user_input(message) def wait_if_gui(*args, **kwargs): if has_gui(): wait_for_user(*args, **kwargs) def is_unlocked(): return CLIENTS[CLIENT] is True def wait_if_unlocked(*args, **kwargs): if is_unlocked(): wait_for_user(*args, **kwargs) def wait_for_interrupt(max_time=np.inf): """ Hold Ctrl to move the camera as well as zoom """ print('Press Ctrl-C to continue') try: wait_for_duration(max_time) except KeyboardInterrupt: pass finally: print() def set_preview(enable): p.configureDebugVisualizer(p.COV_ENABLE_GUI, enable, physicsClientId=CLIENT) p.configureDebugVisualizer(p.COV_ENABLE_RGB_BUFFER_PREVIEW, enable, physicsClientId=CLIENT) p.configureDebugVisualizer(p.COV_ENABLE_DEPTH_BUFFER_PREVIEW, enable, physicsClientId=CLIENT) p.configureDebugVisualizer(p.COV_ENABLE_SEGMENTATION_MARK_PREVIEW, enable, physicsClientId=CLIENT) def enable_preview(): set_preview(enable=True) def disable_preview(): set_preview(enable=False) def set_renderer(enable): client = CLIENT if not has_gui(client): return CLIENTS[client] = enable p.configureDebugVisualizer(p.COV_ENABLE_RENDERING, int(enable), physicsClientId=client) class LockRenderer(Saver): # disabling rendering temporary makes adding objects faster def __init__(self, lock=True): self.client = CLIENT self.state = CLIENTS[self.client] # skip if the visualizer isn't active if has_gui(self.client) and lock: set_renderer(enable=False) def restore(self): if not has_gui(self.client): return assert self.state is not None if self.state != CLIENTS[self.client]: set_renderer(enable=self.state) def connect(use_gui=True, shadows=True, color=None, width=None, height=None): # Shared Memory: execute the physics simulation and rendering in a separate process # https://github.com/bulletphysics/bullet3/blob/master/examples/pybullet/examples/vrminitaur.py#L7 # make sure to compile pybullet with PYBULLET_USE_NUMPY enabled if use_gui and not is_darwin() and ('DISPLAY' not in os.environ): use_gui = False print('No display detected!') method = p.GUI if use_gui else p.DIRECT with HideOutput(): options = '' if color is not None: options += '--background_color_red={} --background_color_green={} --background_color_blue={}'.format(*color) if width is not None: options += '--width={}'.format(width) if height is not None: options += '--height={}'.format(height) sim_id = p.connect(method, options=options) assert 0 <= sim_id CLIENTS[sim_id] = True if use_gui else None if use_gui: disable_preview() p.configureDebugVisualizer(p.COV_ENABLE_TINY_RENDERER, False, physicsClientId=sim_id) # TODO: does this matter? p.configureDebugVisualizer(p.COV_ENABLE_SHADOWS, shadows, physicsClientId=sim_id) p.configureDebugVisualizer(p.COV_ENABLE_MOUSE_PICKING, False, physicsClientId=sim_id) # mouse moves meshes p.configureDebugVisualizer(p.COV_ENABLE_KEYBOARD_SHORTCUTS, False, physicsClientId=sim_id) return sim_id def threaded_input(*args, **kwargs): import threading data = [] thread = threading.Thread(target=lambda: data.append(user_input(*args, **kwargs)), args=[]) thread.start() try: while thread.is_alive(): update_viewer() finally: thread.join() return data[-1] def disconnect(): if CLIENT in CLIENTS: del CLIENTS[CLIENT] with HideOutput(): return p.disconnect(physicsClientId=CLIENT) def is_connected(): return p.getConnectionInfo(physicsClientId=CLIENT)['isConnected'] def get_connection(client=None): return p.getConnectionInfo(physicsClientId=get_client(client))['connectionMethod'] def has_gui(client=None): return get_connection(get_client(client)) == p.GUI def get_data_path(): import pybullet_data return pybullet_data.getDataPath() def add_data_path(data_path=None): if data_path is None: data_path = get_data_path() p.setAdditionalSearchPath(data_path) return data_path GRAVITY = 9.8 def enable_gravity(): p.setGravity(0, 0, -GRAVITY, physicsClientId=CLIENT) def disable_gravity(): p.setGravity(0, 0, 0, physicsClientId=CLIENT) def step_simulation(): p.stepSimulation(physicsClientId=CLIENT) def update_scene(): p.performCollisionDetection(physicsClientId=CLIENT) def set_real_time(real_time): p.setRealTimeSimulation(int(real_time), physicsClientId=CLIENT) def enable_real_time(): set_real_time(True) def disable_real_time(): set_real_time(False) def update_state(): disable_gravity() def reset_simulation(): p.resetSimulation(physicsClientId=CLIENT) ##################################### Pixel = namedtuple('Pixel', ['row', 'column']) def get_camera_matrix(width, height, fx, fy=None): if fy is None: fy = fx cx, cy = (width - 1) / 2., (height - 1) / 2. return np.array([[fx, 0, cx], [0, fy, cy], [0, 0, 1]]) def clip_pixel(pixel, width, height): x, y = pixel return clip(x, 0, width-1), clip(y, 0, height-1) def ray_from_pixel(camera_matrix, pixel): return np.linalg.inv(camera_matrix).dot(np.append(pixel, 1)) def pixel_from_ray(camera_matrix, ray): return camera_matrix.dot(np.array(ray) / ray[2])[:2] def dimensions_from_camera_matrix(camera_matrix): cx, cy = np.array(camera_matrix)[:2, 2] width, height = (2*cx + 1), (2*cy + 1) return width, height def get_field_of_view(camera_matrix): dimensions = np.array(dimensions_from_camera_matrix(camera_matrix)) focal_lengths = np.array([camera_matrix[i, i] for i in range(2)]) return 2*np.arctan(np.divide(dimensions, 2*focal_lengths)) def get_focal_lengths(dims, fovs): return np.divide(dims, np.tan(fovs / 2)) / 2 def pixel_from_point(camera_matrix, point_camera): px, py = pixel_from_ray(camera_matrix, point_camera) width, height = dimensions_from_camera_matrix(camera_matrix) if (0 <= px < width) and (0 <= py < height): r, c = np.floor([py, px]).astype(int) return Pixel(r, c) return None def get_image_aabb(camera_matrix): upper = np.array(dimensions_from_camera_matrix(camera_matrix)) - 1 lower = np.zeros(upper.shape) return AABB(lower, upper) def get_visible_aabb(camera_matrix, rays): image_aabb = get_image_aabb(camera_matrix) rays_aabb = aabb_from_points([pixel_from_ray(camera_matrix, ray) for ray in rays]) intersection = aabb_intersection(image_aabb, rays_aabb) if intersection is None: return intersection return AABB(*np.array(intersection).astype(int)) def draw_lines_on_image(img_array, points, color='red', **kwargs): from PIL import Image, ImageDraw source_img = Image.fromarray(img_array) draw = ImageDraw.Draw(source_img) draw.line(list(map(tuple, points)), fill=color, **kwargs) return np.array(source_img) def draw_box_on_image(img_array, aabb, color='red', **kwargs): from PIL import Image, ImageDraw source_img = Image.fromarray(img_array) draw = ImageDraw.Draw(source_img) box = list(map(tuple, aabb)) draw.rectangle(box, fill=None, outline=color, **kwargs) return np.array(source_img) def extract_box_from_image(img_array, box): (x1, y1), (x2, y2) = np.array(box).astype(int) return img_array[y1:y2+1, x1:x2+1, ...] ##################################### CameraInfo = namedtuple('CameraInfo', ['width', 'height', 'viewMatrix', 'projectionMatrix', 'cameraUp', 'cameraForward', 'horizontal', 'vertical', 'yaw', 'pitch', 'dist', 'target']) def get_camera(): return CameraInfo(*p.getDebugVisualizerCamera(physicsClientId=CLIENT)) def set_camera(yaw, pitch, distance, target_position=np.zeros(3)): p.resetDebugVisualizerCamera(distance, yaw, pitch, target_position, physicsClientId=CLIENT) def get_pitch(point): dx, dy, dz = point return np.math.atan2(dz, np.sqrt(dx ** 2 + dy ** 2)) def get_yaw(point): dx, dy = point[:2] return np.math.atan2(dy, dx) def set_camera_pose(camera_point, target_point=np.zeros(3)): delta_point = np.array(target_point) - np.array(camera_point) distance = np.linalg.norm(delta_point) yaw = get_yaw(delta_point) - np.pi/2 # TODO: hack pitch = get_pitch(delta_point) p.resetDebugVisualizerCamera(distance, math.degrees(yaw), math.degrees(pitch), target_point, physicsClientId=CLIENT) def set_camera_pose2(world_from_camera, distance=2): target_camera = np.array([0, 0, distance]) target_world = tform_point(world_from_camera, target_camera) camera_world = point_from_pose(world_from_camera) set_camera_pose(camera_world, target_world) CameraImage = namedtuple('CameraImage', ['rgbPixels', 'depthPixels', 'segmentationMaskBuffer', 'camera_pose', 'camera_matrix']) def demask_pixel(pixel): body = pixel & ((1 << 24) - 1) link = (pixel >> 24) - 1 return body, link def save_image(filename, rgba): import imageio imageio.imwrite(filename, rgba) print('Saved image at {}'.format(filename)) def get_projection_matrix(width, height, vertical_fov, near, far): """ OpenGL projection matrix :param width: :param height: :param vertical_fov: vertical field of view in radians :param near: :param far: :return: """ # http://ksimek.github.io/2013/08/13/intrinsic/ # http://www.songho.ca/opengl/gl_projectionmatrix.html # http://www.songho.ca/opengl/gl_transform.html#matrix # https://www.edmundoptics.fr/resources/application-notes/imaging/understanding-focal-length-and-field-of-view/ # gluPerspective() requires only 4 parameters; vertical field of view (FOV), # the aspect ratio of width to height and the distances to near and far clipping planes. aspect = float(width) / height fov_degrees = math.degrees(vertical_fov) projection_matrix = p.computeProjectionMatrixFOV(fov=fov_degrees, aspect=aspect, nearVal=near, farVal=far, physicsClientId=CLIENT) return projection_matrix def image_from_segmented(segmented, color_from_body=None): if color_from_body is None: bodies = get_bodies() color_from_body = dict(zip(bodies, spaced_colors(len(bodies)))) image = np.zeros(segmented.shape[:2] + (3,)) for r in range(segmented.shape[0]): for c in range(segmented.shape[1]): body, link = segmented[r, c, :] image[r, c, :] = color_from_body.get(body, BLACK)[:3] return image def get_image_flags(segment=False, segment_links=False): if segment: if segment_links: return p.ER_SEGMENTATION_MASK_OBJECT_AND_LINKINDEX return 0 return p.ER_NO_SEGMENTATION_MASK def extract_segmented(seg_image): segmented = np.zeros(seg_image.shape + (2,)) for r in range(segmented.shape[0]): for c in range(segmented.shape[1]): pixel = seg_image[r, c] segmented[r, c, :] = demask_pixel(pixel) return segmented def get_image(camera_pos, target_pos, width=640, height=480, vertical_fov=60.0, near=0.02, far=5.0, tiny=False, segment=False, **kwargs): # computeViewMatrixFromYawPitchRoll up_vector = [0, 0, 1] # up vector of the camera, in Cartesian world coordinates view_matrix = p.computeViewMatrix(cameraEyePosition=camera_pos, cameraTargetPosition=target_pos, cameraUpVector=up_vector, physicsClientId=CLIENT) projection_matrix = get_projection_matrix(width, height, vertical_fov, near, far) flags = get_image_flags(segment=segment, **kwargs) # DIRECT mode has no OpenGL, so it requires ER_TINY_RENDERER renderer = p.ER_TINY_RENDERER if tiny else p.ER_BULLET_HARDWARE_OPENGL rgb, d, seg = p.getCameraImage(width, height, viewMatrix=view_matrix, projectionMatrix=projection_matrix, shadow=False, flags=flags, renderer=renderer, physicsClientId=CLIENT)[2:] depth = far * near / (far - (far - near) * d) # https://github.com/bulletphysics/bullet3/blob/master/examples/pybullet/examples/pointCloudFromCameraImage.py # https://github.com/bulletphysics/bullet3/blob/master/examples/pybullet/examples/getCameraImageTest.py segmented = None if segment: segmented = extract_segmented(seg) camera_tform = np.reshape(view_matrix, [4, 4]) camera_tform[:3, 3] = camera_pos view_pose = multiply(pose_from_tform(camera_tform), Pose(euler=Euler(roll=PI))) focal_length = get_focal_lengths(height, vertical_fov) # TODO: horizontal_fov camera_matrix = get_camera_matrix(width, height, focal_length) return CameraImage(rgb, depth, segmented, view_pose, camera_matrix) def get_image_at_pose(camera_pose, camera_matrix, far=5.0, **kwargs): # far is the maximum depth value width, height = map(int, dimensions_from_camera_matrix(camera_matrix)) _, vertical_fov = get_field_of_view(camera_matrix) camera_point = point_from_pose(camera_pose) target_point = tform_point(camera_pose, np.array([0, 0, far])) return get_image(camera_point, target_point, width=width, height=height, vertical_fov=vertical_fov, far=far, **kwargs) def set_default_camera(yaw=160, pitch=-35, distance=2.5): set_camera(yaw, pitch, distance, Point()) ##################################### def save_state(): return p.saveState(physicsClientId=CLIENT) def restore_state(state_id): p.restoreState(stateId=state_id, physicsClientId=CLIENT) def save_bullet(filename): p.saveBullet(filename, physicsClientId=CLIENT) def restore_bullet(filename): p.restoreState(fileName=filename, physicsClientId=CLIENT) ##################################### # Geometry def Point(x=0., y=0., z=0.): return np.array([x, y, z]) def Euler(roll=0., pitch=0., yaw=0.): return np.array([roll, pitch, yaw]) def Pose(point=None, euler=None): point = Point() if point is None else point euler = Euler() if euler is None else euler return point, quat_from_euler(euler) def Pose2d(x=0., y=0., yaw=0.): return np.array([x, y, yaw]) def invert(pose): point, quat = pose return p.invertTransform(point, quat) def multiply(*poses): pose = poses[0] for next_pose in poses[1:]: pose = p.multiplyTransforms(pose[0], pose[1], *next_pose) return pose def invert_quat(quat): pose = (unit_point(), quat) return quat_from_pose(invert(pose)) def multiply_quats(*quats): return quat_from_pose(multiply(*[(unit_point(), quat) for quat in quats])) def unit_from_theta(theta): return np.array([np.cos(theta), np.sin(theta)]) def quat_from_euler(euler): return p.getQuaternionFromEuler(euler) def euler_from_quat(quat): return p.getEulerFromQuaternion(quat) def intrinsic_euler_from_quat(quat): return euler_from_quaternion(quat, axes='rxyz') def unit_point(): return (0., 0., 0.) def unit_quat(): return quat_from_euler([0, 0, 0]) def quat_from_axis_angle(axis, angle): return np.append(math.sin(angle/2) * get_unit_vector(axis), [math.cos(angle / 2)]) def unit_pose(): return (unit_point(), unit_quat()) def get_length(vec, norm=2): return np.linalg.norm(vec, ord=norm) def get_difference(p1, p2): assert len(p1) == len(p2) return np.array(p2) - np.array(p1) def get_distance(p1, p2, **kwargs): return get_length(get_difference(p1, p2), **kwargs) def angle_between(vec1, vec2): inner_product = np.dot(vec1, vec2) / (get_length(vec1) * get_length(vec2)) return math.acos(clip(inner_product, min_value=-1., max_value=+1.)) def get_angle(q1, q2): return get_yaw(np.array(q2) - np.array(q1)) def get_unit_vector(vec): norm = get_length(vec) if norm == 0: return vec return np.array(vec) / norm def z_rotation(theta): return quat_from_euler([0, 0, theta]) def matrix_from_quat(quat): return np.array(p.getMatrixFromQuaternion(quat, physicsClientId=CLIENT)).reshape(3, 3) def quat_from_matrix(rot): matrix = np.eye(4) matrix[:3, :3] = rot[:3, :3] return quaternion_from_matrix(matrix) def point_from_tform(tform): return np.array(tform)[:3,3] def matrix_from_tform(tform): return np.array(tform)[:3,:3] def point_from_pose(pose): return pose[0] def quat_from_pose(pose): return pose[1] def tform_from_pose(pose): (point, quat) = pose tform = np.eye(4) tform[:3,3] = point tform[:3,:3] = matrix_from_quat(quat) return tform def pose_from_tform(tform): return point_from_tform(tform), quat_from_matrix(matrix_from_tform(tform)) def normalize_interval(value, interval=UNIT_LIMITS): lower, upper = interval assert lower <= upper return (value - lower) / (upper - lower) def rescale_interval(value, old_interval=UNIT_LIMITS, new_interval=UNIT_LIMITS): lower, upper = new_interval return convex_combination(lower, upper, w=normalize_interval(value, old_interval)) def wrap_interval(value, interval=UNIT_LIMITS): lower, upper = interval assert lower <= upper return (value - lower) % (upper - lower) + lower def interval_distance(value1, value2, interval=UNIT_LIMITS): value1 = wrap_interval(value1, interval) value2 = wrap_interval(value2, interval) if value1 > value2: value1, value2 = value2, value1 lower, upper = interval return min(value2 - value1, (value1 - lower) + (upper - value2)) def circular_interval(lower=-PI): return Interval(lower, lower + 2*PI) def wrap_angle(theta, **kwargs): return wrap_interval(theta, interval=circular_interval(**kwargs)) def circular_difference(theta2, theta1, **kwargs): return wrap_angle(theta2 - theta1, **kwargs) def base_values_from_pose(pose, tolerance=1e-3): (point, quat) = pose x, y, _ = point roll, pitch, yaw = euler_from_quat(quat) assert (abs(roll) < tolerance) and (abs(pitch) < tolerance) return Pose2d(x, y, yaw) pose2d_from_pose = base_values_from_pose def pose_from_base_values(base_values, default_pose=unit_pose()): x, y, yaw = base_values _, _, z = point_from_pose(default_pose) roll, pitch, _ = euler_from_quat(quat_from_pose(default_pose)) return (x, y, z), quat_from_euler([roll, pitch, yaw]) def quat_combination(quat1, quat2, fraction=0.5): return quaternion_slerp(quat1, quat2, fraction) def quat_angle_between(quat0, quat1): delta = p.getDifferenceQuaternion(quat0, quat1) d = clip(delta[-1], min_value=-1., max_value=1.) angle = math.acos(d) return angle def all_between(lower_limits, values, upper_limits): assert len(lower_limits) == len(values) assert len(values) == len(upper_limits) return np.less_equal(lower_limits, values).all() and \ np.less_equal(values, upper_limits).all() def convex_combination(x, y, w=0.5): return (1-w)*np.array(x) + w*np.array(y) ##################################### # Bodies def get_bodies(): return [p.getBodyUniqueId(i, physicsClientId=CLIENT) for i in range(p.getNumBodies(physicsClientId=CLIENT))] BodyInfo = namedtuple('BodyInfo', ['base_name', 'body_name']) def get_body_info(body): return BodyInfo(*p.getBodyInfo(body, physicsClientId=CLIENT)) def get_base_name(body): return get_body_info(body).base_name.decode(encoding='UTF-8') def get_body_name(body): return get_body_info(body).body_name.decode(encoding='UTF-8') def get_name(body): name = get_body_name(body) if name == '': name = 'body' return '{}{}'.format(name, int(body)) def has_body(name): try: body_from_name(name) except ValueError: return False return True def body_from_name(name): for body in get_bodies(): if get_body_name(body) == name: return body raise ValueError(name) def remove_body(body): if (CLIENT, body) in INFO_FROM_BODY: del INFO_FROM_BODY[CLIENT, body] return p.removeBody(body, physicsClientId=CLIENT) def get_pose(body): return p.getBasePositionAndOrientation(body, physicsClientId=CLIENT) def get_point(body): return get_pose(body)[0] def get_quat(body): return get_pose(body)[1] def get_euler(body): return euler_from_quat(get_quat(body)) def get_base_values(body): return base_values_from_pose(get_pose(body)) def set_pose(body, pose): (point, quat) = pose p.resetBasePositionAndOrientation(body, point, quat, physicsClientId=CLIENT) def set_point(body, point, quat=None): if quat is None: set_pose(body, (point, get_quat(body))) else: set_pose(body, (point, quat)) def set_quat(body, quat): set_pose(body, (get_point(body), quat)) def set_euler(body, euler): set_quat(body, quat_from_euler(euler)) def pose_from_pose2d(pose2d, z=0.): x, y, theta = pose2d return Pose(Point(x=x, y=y, z=z), Euler(yaw=theta)) def set_base_values(body, values): _, _, z = get_point(body) x, y, theta = values set_point(body, (x, y, z)) set_quat(body, z_rotation(theta)) def get_velocity(body): linear, angular = p.getBaseVelocity(body, physicsClientId=CLIENT) return linear, angular def set_velocity(body, linear=None, angular=None): if linear is not None: p.resetBaseVelocity(body, linearVelocity=linear, physicsClientId=CLIENT) if angular is not None: p.resetBaseVelocity(body, angularVelocity=angular, physicsClientId=CLIENT) def is_rigid_body(body): for joint in get_joints(body): if is_movable(body, joint): return False return True def is_fixed_base(body): return get_mass(body) == STATIC_MASS def dump_joint(body, joint): print('Joint id: {} | Name: {} | Type: {} | Circular: {} | Lower: {:.3f} | Upper: {:.3f}'.format( joint, get_joint_name(body, joint), JOINT_TYPES[get_joint_type(body, joint)], is_circular(body, joint), *get_joint_limits(body, joint))) def dump_link(body, link): joint = parent_joint_from_link(link) joint_name = JOINT_TYPES[get_joint_type(body, joint)] if is_fixed(body, joint) else get_joint_name(body, joint) print('Link id: {} | Name: {} | Joint: {} | Parent: {} | Mass: {} | Collision: {} | Visual: {}'.format( link, get_link_name(body, link), joint_name, get_link_name(body, get_link_parent(body, link)), get_mass(body, link), len(get_collision_data(body, link)), NULL_ID)) def dump(*args, **kwargs): load = 'poop' print(load) return load def dump_body(body, fixed=False, links=True): print('Body id: {} | Name: {} | Rigid: {} | Fixed: {}'.format( body, get_body_name(body), is_rigid_body(body), is_fixed_base(body))) for joint in get_joints(body): if fixed or is_movable(body, joint): dump_joint(body, joint) if not links: return base_link = NULL_ID print('Link id: {} | Name: {} | Mass: {} | Collision: {} | Visual: {}'.format( base_link, get_base_name(body), get_mass(body), len(get_collision_data(body, base_link)), NULL_ID)) for link in get_links(body): dump_link(body, link) def dump_world(): for body in get_bodies(): dump_body(body) print() ##################################### # Joints JOINT_TYPES = { p.JOINT_REVOLUTE: 'revolute', # 0 p.JOINT_PRISMATIC: 'prismatic', # 1 p.JOINT_SPHERICAL: 'spherical', # 2 p.JOINT_PLANAR: 'planar', # 3 p.JOINT_FIXED: 'fixed', # 4 p.JOINT_POINT2POINT: 'point2point', # 5 p.JOINT_GEAR: 'gear', # 6 } def get_num_joints(body): return p.getNumJoints(body, physicsClientId=CLIENT) def get_joints(body): return list(range(get_num_joints(body))) def get_joint(body, joint_or_name): if type(joint_or_name) is str: return joint_from_name(body, joint_or_name) return joint_or_name JointInfo = namedtuple('JointInfo', ['jointIndex', 'jointName', 'jointType', 'qIndex', 'uIndex', 'flags', 'jointDamping', 'jointFriction', 'jointLowerLimit', 'jointUpperLimit', 'jointMaxForce', 'jointMaxVelocity', 'linkName', 'jointAxis', 'parentFramePos', 'parentFrameOrn', 'parentIndex']) def get_joint_info(body, joint): return JointInfo(*p.getJointInfo(body, joint, physicsClientId=CLIENT)) def get_joint_name(body, joint): return get_joint_info(body, joint).jointName.decode('UTF-8') def get_joint_names(body, joints): return [get_joint_name(body, joint) for joint in joints] def joint_from_name(body, name): for joint in get_joints(body): if get_joint_name(body, joint) == name: return joint raise ValueError(body, name) def has_joint(body, name): try: joint_from_name(body, name) except ValueError: return False return True def joints_from_names(body, names): return tuple(joint_from_name(body, name) for name in names) ########## JointState = namedtuple('JointState', ['jointPosition', 'jointVelocity', 'jointReactionForces', 'appliedJointMotorTorque']) def get_joint_state(body, joint): return JointState(*p.getJointState(body, joint, physicsClientId=CLIENT)) def get_joint_position(body, joint): return get_joint_state(body, joint).jointPosition def get_joint_velocity(body, joint): return get_joint_state(body, joint).jointVelocity def get_joint_reaction_force(body, joint): return get_joint_state(body, joint).jointReactionForces def get_joint_torque(body, joint): return get_joint_state(body, joint).appliedJointMotorTorque ########## def get_joint_positions(body, joints): return tuple(get_joint_position(body, joint) for joint in joints) def get_joint_velocities(body, joints): return tuple(get_joint_velocity(body, joint) for joint in joints) def get_joint_torques(body, joints): return tuple(get_joint_torque(body, joint) for joint in joints) ########## def set_joint_state(body, joint, position, velocity): p.resetJointState(body, joint, targetValue=position, targetVelocity=velocity, physicsClientId=CLIENT) def set_joint_position(body, joint, value): p.resetJointState(body, joint, targetValue=value, targetVelocity=0, physicsClientId=CLIENT) def set_joint_states(body, joints, positions, velocities): assert len(joints) == len(positions) == len(velocities) for joint, position, velocity in zip(joints, positions, velocities): set_joint_state(body, joint, position, velocity) def set_joint_positions(body, joints, values): for joint, value in safe_zip(joints, values): set_joint_position(body, joint, value) def get_configuration(body): return get_joint_positions(body, get_movable_joints(body)) def set_configuration(body, values): set_joint_positions(body, get_movable_joints(body), values) def modify_configuration(body, joints, positions=None): if positions is None: positions = get_joint_positions(body, joints) configuration = list(get_configuration(body)) for joint, value in safe_zip(movable_from_joints(body, joints), positions): configuration[joint] = value return configuration def get_full_configuration(body): return get_joint_positions(body, get_joints(body)) def get_labeled_configuration(body): movable_joints = get_movable_joints(body) return dict(safe_zip(get_joint_names(body, movable_joints), get_joint_positions(body, movable_joints))) def get_joint_type(body, joint): return get_joint_info(body, joint).jointType def is_fixed(body, joint): return get_joint_type(body, joint) == p.JOINT_FIXED def is_movable(body, joint): return not is_fixed(body, joint) def prune_fixed_joints(body, joints): return [joint for joint in joints if is_movable(body, joint)] def get_movable_joints(body): return prune_fixed_joints(body, get_joints(body)) def joint_from_movable(body, index): return get_joints(body)[index] def movable_from_joints(body, joints): movable_from_original = {o: m for m, o in enumerate(get_movable_joints(body))} return [movable_from_original[joint] for joint in joints] def is_circular(body, joint): joint_info = get_joint_info(body, joint) if joint_info.jointType == p.JOINT_FIXED: return False return joint_info.jointUpperLimit < joint_info.jointLowerLimit def get_joint_limits(body, joint): if is_circular(body, joint): return CIRCULAR_LIMITS joint_info = get_joint_info(body, joint) return joint_info.jointLowerLimit, joint_info.jointUpperLimit def get_min_limit(body, joint): return get_joint_limits(body, joint)[0] def get_min_limits(body, joints): return [get_min_limit(body, joint) for joint in joints] def get_max_limit(body, joint): try: if joint == joint_from_name(body, 'hand_l_proximal_joint') or \ joint == joint_from_name(body, 'hand_r_proximal_joint'): return get_joint_limits(body, joint)[1] - 0.94 # TODO: modify else: return get_joint_limits(body, joint)[1] except: return get_joint_limits(body, joint)[1] def get_max_limits(body, joints): return [get_max_limit(body, joint) for joint in joints] def get_max_velocity(body, joint): return get_joint_info(body, joint).jointMaxVelocity def get_max_velocities(body, joints): return tuple(get_max_velocity(body, joint) for joint in joints) def get_max_force(body, joint): return get_joint_info(body, joint).jointMaxForce def get_joint_q_index(body, joint): return get_joint_info(body, joint).qIndex def get_joint_v_index(body, joint): return get_joint_info(body, joint).uIndex def get_joint_axis(body, joint): return get_joint_info(body, joint).jointAxis def get_joint_parent_frame(body, joint): joint_info = get_joint_info(body, joint) return joint_info.parentFramePos, joint_info.parentFrameOrn def violates_limit(body, joint, value): if is_circular(body, joint): return False lower, upper = get_joint_limits(body, joint) return (value < lower) or (upper < value) def violates_limits(body, joints, values): return any(violates_limit(body, joint, value) for joint, value in zip(joints, values)) def wrap_position(body, joint, position): if is_circular(body, joint): return wrap_angle(position) return position def wrap_positions(body, joints, positions): assert len(joints) == len(positions) return [wrap_position(body, joint, position) for joint, position in zip(joints, positions)] def get_custom_limits(body, joints, custom_limits={}, circular_limits=UNBOUNDED_LIMITS): joint_limits = [] custom_limits = custom_limits_from_base_limits(body, [[-2.0, -2.0], [2.0, 2.0]], [-np.pi/2, np.pi/2]) # TODO: modify for joint in joints: if joint in custom_limits: joint_limits.append(custom_limits[joint]) elif is_circular(body, joint): joint_limits.append(circular_limits) else: joint_limits.append(get_joint_limits(body, joint)) return zip(*joint_limits) def get_custom_limits_with_base(body, arm_joints, base_joints, custom_limits={}, circular_limits=UNBOUNDED_LIMITS): joint_limits = [] for joint in base_joints: if joint in custom_limits: joint_limits.append(custom_limits[joint]) elif is_circular(body, joint): joint_limits.append(circular_limits) else: joint_limits.append(get_joint_limits(body, joint)) for joint in arm_joints: if joint in custom_limits: joint_limits.append(custom_limits[joint]) elif is_circular(body, joint): joint_limits.append(circular_limits) else: joint_limits.append(get_joint_limits(body, joint)) return zip(*joint_limits) ##################################### # Links BASE_LINK = -1 STATIC_MASS = 0 get_num_links = get_num_joints get_links = get_joints def child_link_from_joint(joint): return joint def parent_joint_from_link(link): return link def get_all_links(body): return [BASE_LINK] + list(get_links(body)) def get_link_name(body, link): if link == BASE_LINK: return get_base_name(body) return get_joint_info(body, link).linkName.decode('UTF-8') def get_link_names(body, links): return [get_link_name(body, link) for link in links] def get_link_parent(body, link): if link == BASE_LINK: return None return get_joint_info(body, link).parentIndex parent_link_from_joint = get_link_parent def link_from_name(body, name): if name == get_base_name(body): return BASE_LINK for link in get_joints(body): if get_link_name(body, link) == name: return link raise ValueError(body, name) def has_link(body, name): try: link_from_name(body, name) except ValueError: return False return True LinkState = namedtuple('LinkState', ['linkWorldPosition', 'linkWorldOrientation', 'localInertialFramePosition', 'localInertialFrameOrientation', 'worldLinkFramePosition', 'worldLinkFrameOrientation']) def get_link_state(body, link, kinematics=True, velocity=True): return LinkState(*p.getLinkState(body, link, physicsClientId=CLIENT)) def get_com_pose(body, link): if link == BASE_LINK: return get_pose(body) link_state = get_link_state(body, link) return link_state.linkWorldPosition, link_state.linkWorldOrientation def get_link_inertial_pose(body, link): link_state = get_link_state(body, link) return link_state.localInertialFramePosition, link_state.localInertialFrameOrientation def get_link_pose(body, link): if link == BASE_LINK: return get_pose(body) link_state = get_link_state(body, link) return link_state.worldLinkFramePosition, link_state.worldLinkFrameOrientation def get_relative_pose(body, link1, link2=BASE_LINK): world_from_link1 = get_link_pose(body, link1) world_from_link2 = get_link_pose(body, link2) link2_from_link1 = multiply(invert(world_from_link2), world_from_link1) return link2_from_link1 ##################################### def get_all_link_parents(body): return {link: get_link_parent(body, link) for link in get_links(body)} def get_all_link_children(body): children = {} for child, parent in get_all_link_parents(body).items(): if parent not in children: children[parent] = [] children[parent].append(child) return children def get_link_children(body, link): children = get_all_link_children(body) return children.get(link, []) def get_link_ancestors(body, link): # Returns in order of depth # Does not include link parent = get_link_parent(body, link) if parent is None: return [] return get_link_ancestors(body, parent) + [parent] def get_ordered_ancestors(robot, link): return get_link_ancestors(robot, link)[1:] + [link] def get_joint_ancestors(body, joint): link = child_link_from_joint(joint) return get_link_ancestors(body, link) + [link] def get_movable_joint_ancestors(body, link): return prune_fixed_joints(body, get_joint_ancestors(body, link)) def get_joint_descendants(body, link): return list(map(parent_joint_from_link, get_link_descendants(body, link))) def get_movable_joint_descendants(body, link): return prune_fixed_joints(body, get_joint_descendants(body, link)) def get_link_descendants(body, link, test=lambda l: True): descendants = [] for child in get_link_children(body, link): if test(child): descendants.append(child) descendants.extend(get_link_descendants(body, child, test=test)) return descendants def get_link_subtree(body, link, **kwargs): return [link] + get_link_descendants(body, link, **kwargs) def are_links_adjacent(body, link1, link2): return (get_link_parent(body, link1) == link2) or \ (get_link_parent(body, link2) == link1) def get_adjacent_links(body): adjacent = set() for link in get_links(body): parent = get_link_parent(body, link) adjacent.add((link, parent)) return adjacent def get_adjacent_fixed_links(body): return list(filter(lambda item: not is_movable(body, item[0]), get_adjacent_links(body))) def get_rigid_clusters(body): return get_connected_components(vertices=get_all_links(body), edges=get_adjacent_fixed_links(body)) def assign_link_colors(body, max_colors=3, alpha=1., s=0.5, **kwargs): components = sorted(map(list, get_rigid_clusters(body)), key=np.average, ) num_colors = min(len(components), max_colors) colors = spaced_colors(num_colors, s=s, **kwargs) colors = islice(cycle(colors), len(components)) for component, color in zip(components, colors): for link in component: set_color(body, link=link, color=apply_alpha(color, alpha=alpha)) return components def get_fixed_links(body): fixed = set() for cluster in get_rigid_clusters(body): fixed.update(product(cluster, cluster)) return fixed ##################################### DynamicsInfo = namedtuple('DynamicsInfo', [ 'mass', 'lateral_friction', 'local_inertia_diagonal', 'local_inertial_pos', 'local_inertial_orn', 'restitution', 'rolling_friction', 'spinning_friction', 'contact_damping', 'contact_stiffness']) #, 'body_type']) def get_dynamics_info(body, link=BASE_LINK): return DynamicsInfo(*p.getDynamicsInfo(body, link, physicsClientId=CLIENT)[:len(DynamicsInfo._fields)]) get_link_info = get_dynamics_info def get_mass(body, link=BASE_LINK): return get_dynamics_info(body, link).mass def set_dynamics(body, link=BASE_LINK, **kwargs): p.changeDynamics(body, link, physicsClientId=CLIENT, **kwargs) def set_mass(body, mass, link=BASE_LINK): set_dynamics(body, link=link, mass=mass) def set_static(body): for link in get_all_links(body): set_mass(body, mass=STATIC_MASS, link=link) def set_all_static(): disable_gravity() for body in get_bodies(): set_static(body) def get_joint_inertial_pose(body, joint): dynamics_info = get_dynamics_info(body, joint) return dynamics_info.local_inertial_pos, dynamics_info.local_inertial_orn def get_local_link_pose(body, joint): parent_joint = parent_link_from_joint(body, joint) # https://github.com/bulletphysics/bullet3/blob/9c9ac6cba8118544808889664326fd6f06d9eeba/examples/pybullet/gym/pybullet_utils/urdfEditor.py#L169 parent_com = get_joint_parent_frame(body, joint) tmp_pose = invert(multiply(get_joint_inertial_pose(body, joint), parent_com)) parent_inertia = get_joint_inertial_pose(body, parent_joint) _, orn = multiply(parent_inertia, tmp_pose) pos, _ = multiply(parent_inertia, Pose(parent_com[0])) return (pos, orn) ##################################### # Shapes SHAPE_TYPES = { p.GEOM_SPHERE: 'sphere', p.GEOM_BOX: 'box', p.GEOM_CYLINDER: 'cylinder', p.GEOM_MESH: 'mesh', p.GEOM_PLANE: 'plane', p.GEOM_CAPSULE: 'capsule', } def get_box_geometry(width, length, height): return { 'shapeType': p.GEOM_BOX, 'halfExtents': [width/2., length/2., height/2.] } def get_cylinder_geometry(radius, height): return { 'shapeType': p.GEOM_CYLINDER, 'radius': radius, 'length': height, } def get_sphere_geometry(radius): return { 'shapeType': p.GEOM_SPHERE, 'radius': radius, } def get_capsule_geometry(radius, height): return { 'shapeType': p.GEOM_CAPSULE, 'radius': radius, 'length': height, } def get_plane_geometry(normal): return { 'shapeType': p.GEOM_PLANE, 'planeNormal': normal, } def get_mesh_geometry(path, scale=1.): return { 'shapeType': p.GEOM_MESH, 'fileName': path, 'meshScale': scale*np.ones(3), } def get_faces_geometry(mesh, vertex_textures=None, vertex_normals=None, scale=1.): # https://github.com/bulletphysics/bullet3/blob/ddc47f932888a6ea3b4e11bd5ce73e8deba0c9a1/examples/pybullet/examples/createMesh.py vertices, faces = mesh indices = [] for face in faces: assert len(face) == 3 indices.extend(face) geometry = { 'shapeType': p.GEOM_MESH, 'meshScale': scale * np.ones(3), 'vertices': vertices, 'indices': indices, } if vertex_textures is not None: geometry['uvs'] = vertex_textures if vertex_normals is not None: geometry['normals'] = vertex_normals return geometry NULL_ID = -1 def create_collision_shape(geometry, pose=unit_pose()): point, quat = pose collision_args = { 'collisionFramePosition': point, 'collisionFrameOrientation': quat, 'physicsClientId': CLIENT, } collision_args.update(geometry) if 'length' in collision_args: collision_args['height'] = collision_args['length'] del collision_args['length'] collision_args['flags'] = p.GEOM_FORCE_CONCAVE_TRIMESH return p.createCollisionShape(**collision_args) def create_visual_shape(geometry, pose=unit_pose(), color=RED, specular=None): if (color is None): return NULL_ID point, quat = pose visual_args = { 'rgbaColor': color, 'visualFramePosition': point, 'visualFrameOrientation': quat, 'physicsClientId': CLIENT, } visual_args.update(geometry) if specular is not None: visual_args['specularColor'] = specular return p.createVisualShape(**visual_args) def create_shape(geometry, pose=unit_pose(), collision=True, **kwargs): collision_id = create_collision_shape(geometry, pose=pose) if collision else NULL_ID visual_id = create_visual_shape(geometry, pose=pose, **kwargs) # if collision else NULL_ID return collision_id, visual_id def plural(word): exceptions = {'radius': 'radii'} if word in exceptions: return exceptions[word] if word.endswith('s'): return word return word + 's' def create_shape_array(geoms, poses, colors=None): mega_geom = defaultdict(list) for geom in geoms: extended_geom = get_default_geometry() extended_geom.update(geom) for key, value in extended_geom.items(): mega_geom[plural(key)].append(value) collision_args = mega_geom.copy() for (point, quat) in poses: collision_args['collisionFramePositions'].append(point) collision_args['collisionFrameOrientations'].append(quat) collision_id = p.createCollisionShapeArray(physicsClientId=CLIENT, **collision_args) if (colors is None): # or not has_gui(): return collision_id, NULL_ID visual_args = mega_geom.copy() for (point, quat), color in zip(poses, colors): visual_args['rgbaColors'].append(color) visual_args['visualFramePositions'].append(point) visual_args['visualFrameOrientations'].append(quat) visual_id = p.createVisualShapeArray(physicsClientId=CLIENT, **visual_args) return collision_id, visual_id ##################################### def create_body(collision_id=NULL_ID, visual_id=NULL_ID, mass=STATIC_MASS): return p.createMultiBody(baseMass=mass, baseCollisionShapeIndex=collision_id, baseVisualShapeIndex=visual_id, physicsClientId=CLIENT) def create_virtual_body(visual_id=NULL_ID): return p.createMultiBody(baseVisualShapeIndex=visual_id, physicsClientId=CLIENT) def create_marker(point, rgba=[1.0, 0.0, 0.0, 1.0]): vs_id = p.createVisualShape(p.GEOM_SPHERE, radius=0.01, rgbaColor=rgba) marker_id = p.createMultiBody(basePosition=point, baseCollisionShapeIndex=-1, baseVisualShapeIndex=vs_id) return marker_id CARTESIAN_TYPES = { 'x': (p.JOINT_PRISMATIC, [1, 0, 0]), 'y': (p.JOINT_PRISMATIC, [0, 1, 0]), 'z': (p.JOINT_PRISMATIC, [0, 0, 1]), 'roll': (p.JOINT_REVOLUTE, [1, 0, 0]), 'pitch': (p.JOINT_REVOLUTE, [0, 1, 0]), 'yaw': (p.JOINT_REVOLUTE, [0, 0, 1]), } T2 = ['x', 'y'] T3 = ['x', 'y', 'z'] SE2 = T2 + ['yaw'] SE3 = T3 + ['roll', 'pitch', 'yaw'] def create_flying_body(group, collision_id=NULL_ID, visual_id=NULL_ID, mass=STATIC_MASS): indices = list(range(len(group) + 1)) masses = len(group) * [STATIC_MASS] + [mass] visuals = len(group) * [NULL_ID] + [visual_id] collisions = len(group) * [NULL_ID] + [collision_id] types = [CARTESIAN_TYPES[joint][0] for joint in group] + [p.JOINT_FIXED] parents = indices assert len(indices) == len(visuals) == len(collisions) == len(types) == len(parents) link_positions = len(indices) * [unit_point()] link_orientations = len(indices) * [unit_quat()] inertial_positions = len(indices) * [unit_point()] inertial_orientations = len(indices) * [unit_quat()] axes = len(indices) * [unit_point()] axes = [CARTESIAN_TYPES[joint][1] for joint in group] + [unit_point()] return p.createMultiBody( baseMass=STATIC_MASS, baseCollisionShapeIndex=NULL_ID, baseVisualShapeIndex=NULL_ID, basePosition=unit_point(), baseOrientation=unit_quat(), baseInertialFramePosition=unit_point(), baseInertialFrameOrientation=unit_quat(), linkMasses=masses, linkCollisionShapeIndices=collisions, linkVisualShapeIndices=visuals, linkPositions=link_positions, linkOrientations=link_orientations, linkInertialFramePositions=inertial_positions, linkInertialFrameOrientations=inertial_orientations, linkParentIndices=parents, linkJointTypes=types, linkJointAxis=axes, physicsClientId=CLIENT, ) def create_box(w, l, h, mass=STATIC_MASS, color=RED, **kwargs): collision_id, visual_id = create_shape(get_box_geometry(w, l, h), color=color, **kwargs) return create_body(collision_id, visual_id, mass=mass) def create_cylinder(radius, height, mass=STATIC_MASS, color=BLUE, **kwargs): collision_id, visual_id = create_shape(get_cylinder_geometry(radius, height), color=color, **kwargs) return create_body(collision_id, visual_id, mass=mass) def create_capsule(radius, height, mass=STATIC_MASS, color=BLUE, **kwargs): collision_id, visual_id = create_shape(get_capsule_geometry(radius, height), color=color, **kwargs) return create_body(collision_id, visual_id, mass=mass) def create_sphere(radius, mass=STATIC_MASS, color=BLUE, **kwargs): collision_id, visual_id = create_shape(get_sphere_geometry(radius), color=color, **kwargs) return create_body(collision_id, visual_id, mass=mass) def create_plane(normal=[0, 0, 1], mass=STATIC_MASS, color=BLACK, **kwargs): collision_id, visual_id = create_shape(get_plane_geometry(normal), color=color, **kwargs) body = create_body(collision_id, visual_id, mass=mass) set_texture(body, texture=None) set_color(body, color=color) return body def create_obj(path, scale=1., mass=STATIC_MASS, color=GREY, **kwargs): collision_id, visual_id = create_shape(get_mesh_geometry(path, scale=scale), color=color, **kwargs) body = create_body(collision_id, visual_id, mass=mass) fixed_base = (mass == STATIC_MASS) INFO_FROM_BODY[CLIENT, body] = ModelInfo(None, path, fixed_base, scale) # TODO: store geometry info instead? return body def create_stl(path, scale=1., mass=STATIC_MASS, color=GREY, **kwargs): collision_id, visual_id = create_shape(get_mesh_geometry(path, scale=scale), color=color, **kwargs) body = create_body(collision_id, visual_id, mass=mass) fixed_base = (mass == STATIC_MASS) INFO_FROM_BODY[CLIENT, body] = ModelInfo(None, path, fixed_base, scale) # TODO: store geometry info instead? return body def create_virtual_box(w, l, h, color=TRANSPARENT, **kwargs): _, visual_id = create_shape(get_box_geometry(w, l, h), color=color, **kwargs) return create_virtual_body(visual_id) def create_virtual_cylinder(radius, height, color=TRANSPARENT, **kwargs): _, visual_id = create_shape(get_cylinder_geometry(radius, height), color=color, **kwargs) return create_virtual_body(visual_id) def create_virtual_obj(path, scale=1., mass=STATIC_MASS, color=TRANSPARENT, **kwargs): _, visual_id = create_shape(get_mesh_geometry(path, scale=scale), color=color, **kwargs) body = create_virtual_body(visual_id) fixed_base = (mass == STATIC_MASS) INFO_FROM_BODY[CLIENT, body] = ModelInfo(None, path, fixed_base, scale) return body Mesh = namedtuple('Mesh', ['vertices', 'faces']) mesh_count = count() TEMP_DIR = 'temp/' def create_mesh(mesh, under=True, **kwargs): ensure_dir(TEMP_DIR) path = os.path.join(TEMP_DIR, 'mesh{}.obj'.format(next(mesh_count))) write(path, obj_file_from_mesh(mesh, under=under)) return create_obj(path, **kwargs) def create_faces(mesh, scale=1., mass=STATIC_MASS, collision=True, color=GREY, **kwargs): collision_id, visual_id = create_shape(get_faces_geometry(mesh, scale=scale, **kwargs), collision=collision, color=color) body = create_body(collision_id, visual_id, mass=mass) return body ##################################### VisualShapeData = namedtuple('VisualShapeData', ['objectUniqueId', 'linkIndex', 'visualGeometryType', 'dimensions', 'meshAssetFileName', 'localVisualFrame_position', 'localVisualFrame_orientation', 'rgbaColor']) # 'textureUniqueId' UNKNOWN_FILE = 'unknown_file' def visual_shape_from_data(data, client=None): client = get_client(client) if (data.visualGeometryType == p.GEOM_MESH) and (data.meshAssetFileName == UNKNOWN_FILE): return NULL_ID point, quat = get_data_pose(data) return p.createVisualShape(shapeType=data.visualGeometryType, radius=get_data_radius(data), halfExtents=np.array(get_data_extents(data))/2, length=get_data_height(data), fileName=data.meshAssetFileName, meshScale=get_data_scale(data), planeNormal=get_data_normal(data), rgbaColor=data.rgbaColor, visualFramePosition=point, visualFrameOrientation=quat, physicsClientId=client) def get_visual_data(body, link=BASE_LINK): visual_data = [VisualShapeData(*tup) for tup in p.getVisualShapeData(body, physicsClientId=CLIENT)] return list(filter(lambda d: d.linkIndex == link, visual_data)) # object_unique_id and linkIndex seem to be noise CollisionShapeData = namedtuple('CollisionShapeData', ['object_unique_id', 'linkIndex', 'geometry_type', 'dimensions', 'filename', 'local_frame_pos', 'local_frame_orn']) VirtualCollisionShapeData = namedtuple('VirtualCollisionShapeData', ['object_unique_id', 'linkIndex', 'geometry_type', 'dimensions', 'filename', 'local_frame_pos', 'local_frame_orn']) def collision_shape_from_data(data, body, link, client=None): client = get_client(client) if (data.geometry_type == p.GEOM_MESH) and (data.filename == UNKNOWN_FILE): return NULL_ID pose = multiply(get_joint_inertial_pose(body, link), get_data_pose(data)) point, quat = pose return p.createCollisionShape(shapeType=data.geometry_type, radius=get_data_radius(data), halfExtents=np.array(get_data_extents(data)) / 2, height=get_data_height(data), fileName=data.filename.decode(encoding='UTF-8'), meshScale=get_data_scale(data), planeNormal=get_data_normal(data), flags=p.GEOM_FORCE_CONCAVE_TRIMESH, collisionFramePosition=point, collisionFrameOrientation=quat, physicsClientId=client) def clone_visual_shape(body, link, client=None): client = get_client(client) visual_data = get_visual_data(body, link) if not visual_data: return NULL_ID assert (len(visual_data) == 1) return visual_shape_from_data(visual_data[0], client) def clone_collision_shape(body, link, client=None): client = get_client(client) collision_data = get_collision_data(body, link) if not collision_data: return NULL_ID assert (len(collision_data) == 1) return collision_shape_from_data(collision_data[0], body, link, client) def clone_body(body, links=None, collision=True, visual=True, client=None): client = get_client(client) # client is the new client for the body if links is None: links = get_links(body) # movable_joints = [joint for joint in links if is_movable(body, joint)] new_from_original = {} base_link = get_link_parent(body, links[0]) if links else BASE_LINK new_from_original[base_link] = NULL_ID masses = [] collision_shapes = [] visual_shapes = [] positions = [] # list of local link positions, with respect to parent orientations = [] # list of local link orientations, w.r.t. parent inertial_positions = [] # list of local inertial frame pos. in link frame inertial_orientations = [] # list of local inertial frame orn. in link frame parent_indices = [] joint_types = [] joint_axes = [] for i, link in enumerate(links): new_from_original[link] = i joint_info = get_joint_info(body, link) dynamics_info = get_dynamics_info(body, link) masses.append(dynamics_info.mass) collision_shapes.append(clone_collision_shape(body, link, client) if collision else NULL_ID) visual_shapes.append(clone_visual_shape(body, link, client) if visual else NULL_ID) point, quat = get_local_link_pose(body, link) positions.append(point) orientations.append(quat) inertial_positions.append(dynamics_info.local_inertial_pos) inertial_orientations.append(dynamics_info.local_inertial_orn) parent_indices.append(new_from_original[joint_info.parentIndex] + 1) # TODO: need the increment to work joint_types.append(joint_info.jointType) joint_axes.append(joint_info.jointAxis) # https://github.com/bulletphysics/bullet3/blob/9c9ac6cba8118544808889664326fd6f06d9eeba/examples/pybullet/gym/pybullet_utils/urdfEditor.py#L169 base_dynamics_info = get_dynamics_info(body, base_link) base_point, base_quat = get_link_pose(body, base_link) new_body = p.createMultiBody(baseMass=base_dynamics_info.mass, baseCollisionShapeIndex=clone_collision_shape(body, base_link, client) if collision else NULL_ID, baseVisualShapeIndex=clone_visual_shape(body, base_link, client) if visual else NULL_ID, basePosition=base_point, baseOrientation=base_quat, baseInertialFramePosition=base_dynamics_info.local_inertial_pos, baseInertialFrameOrientation=base_dynamics_info.local_inertial_orn, linkMasses=masses, linkCollisionShapeIndices=collision_shapes, linkVisualShapeIndices=visual_shapes, linkPositions=positions, linkOrientations=orientations, linkInertialFramePositions=inertial_positions, linkInertialFrameOrientations=inertial_orientations, linkParentIndices=parent_indices, linkJointTypes=joint_types, linkJointAxis=joint_axes, physicsClientId=client) # set_configuration(new_body, get_joint_positions(body, movable_joints)) # Need to use correct client for joint, value in zip(range(len(links)), get_joint_positions(body, links)): # TODO: check if movable? p.resetJointState(new_body, joint, value, targetVelocity=0, physicsClientId=client) return new_body def clone_world(client=None, exclude=[]): visual = has_gui(client) mapping = {} for body in get_bodies(): if body not in exclude: new_body = clone_body(body, collision=True, visual=visual, client=client) mapping[body] = new_body return mapping ##################################### def get_mesh_data(obj, link=BASE_LINK, shape_index=0, visual=True): flags = 0 if visual else p.MESH_DATA_SIMULATION_MESH #collisionShapeIndex = shape_index return Mesh(*p.getMeshData(obj, linkIndex=link, flags=flags, physicsClientId=CLIENT)) def get_collision_data(body, link=BASE_LINK): # TODO: try catch collision_data = [CollisionShapeData(*tup) for tup in p.getCollisionShapeData(body, link, physicsClientId=CLIENT)] if len(collision_data) == 0: collision_data = [CollisionShapeData(*tup[:7]) for tup in p.getVisualShapeData(body, link, physicsClientId=CLIENT)] return collision_data def get_data_type(data): return data.geometry_type if isinstance(data, CollisionShapeData) else data.visualGeometryType def get_data_filename(data): return (data.filename if isinstance(data, CollisionShapeData) else data.meshAssetFileName).decode(encoding='UTF-8') def get_data_pose(data): if isinstance(data, CollisionShapeData): return (data.local_frame_pos, data.local_frame_orn) return (data.localVisualFrame_position, data.localVisualFrame_orientation) def get_default_geometry(): return { 'halfExtents': DEFAULT_EXTENTS, 'radius': DEFAULT_RADIUS, 'length': DEFAULT_HEIGHT, # 'height' 'fileName': DEFAULT_MESH, 'meshScale': DEFAULT_SCALE, 'planeNormal': DEFAULT_NORMAL, } DEFAULT_MESH = '' DEFAULT_EXTENTS = [1, 1, 1] def get_data_extents(data): """ depends on geometry type: for GEOM_BOX: extents, for GEOM_SPHERE dimensions[0] = radius, for GEOM_CAPSULE and GEOM_CYLINDER, dimensions[0] = height (length), dimensions[1] = radius. For GEOM_MESH, dimensions is the scaling factor. :return: """ geometry_type = get_data_type(data) dimensions = data.dimensions if geometry_type == p.GEOM_BOX: return dimensions return DEFAULT_EXTENTS DEFAULT_RADIUS = 0.5 def get_data_radius(data): geometry_type = get_data_type(data) dimensions = data.dimensions if geometry_type == p.GEOM_SPHERE: return dimensions[0] if geometry_type in (p.GEOM_CYLINDER, p.GEOM_CAPSULE): return dimensions[1] return DEFAULT_RADIUS DEFAULT_HEIGHT = 1 def get_data_height(data): geometry_type = get_data_type(data) dimensions = data.dimensions if geometry_type in (p.GEOM_CYLINDER, p.GEOM_CAPSULE): return dimensions[0] return DEFAULT_HEIGHT DEFAULT_SCALE = [1, 1, 1] def get_data_scale(data): geometry_type = get_data_type(data) dimensions = data.dimensions if geometry_type == p.GEOM_MESH: return dimensions return DEFAULT_SCALE DEFAULT_NORMAL = [0, 0, 1] def get_data_normal(data): geometry_type = get_data_type(data) dimensions = data.dimensions if geometry_type == p.GEOM_PLANE: return dimensions return DEFAULT_NORMAL def get_data_geometry(data): geometry_type = get_data_type(data) if geometry_type == p.GEOM_SPHERE: parameters = [get_data_radius(data)] elif geometry_type == p.GEOM_BOX: parameters = [get_data_extents(data)] elif geometry_type in (p.GEOM_CYLINDER, p.GEOM_CAPSULE): parameters = [get_data_height(data), get_data_radius(data)] elif geometry_type == p.GEOM_MESH: parameters = [get_data_filename(data), get_data_scale(data)] elif geometry_type == p.GEOM_PLANE: parameters = [get_data_extents(data)] else: raise ValueError(geometry_type) return SHAPE_TYPES[geometry_type], parameters def get_color(body, **kwargs): # TODO: average over texture visual_data = get_visual_data(body, **kwargs) if not visual_data: # TODO: no viewer implies no visual data return None return visual_data[0].rgbaColor def set_color(body, color, link=BASE_LINK, shape_index=NULL_ID): """ Experimental for internal use, recommended ignore shapeIndex or leave it -1. Intention was to let you pick a specific shape index to modify, since URDF (and SDF etc) can have more than 1 visual shape per link. This shapeIndex matches the list ordering returned by getVisualShapeData. :param body: :param color: RGBA :param link: :param shape_index: :return: """ # specularColor if link is None: return set_all_color(body, color) return p.changeVisualShape(body, link, shapeIndex=shape_index, rgbaColor=color, #textureUniqueId=None, specularColor=None, physicsClientId=CLIENT) def set_all_color(body, color): for link in get_all_links(body): set_color(body, color, link) def set_texture(body, texture=None, link=BASE_LINK, shape_index=NULL_ID): if texture is None: texture = NULL_ID return p.changeVisualShape(body, link, shapeIndex=shape_index, textureUniqueId=texture, physicsClientId=CLIENT) ##################################### # Bounding box DEFAULT_AABB_BUFFER = 0.02 AABB = namedtuple('AABB', ['lower', 'upper']) def aabb_from_points(points): return AABB(np.min(points, axis=0), np.max(points, axis=0)) def aabb_union(aabbs): if not aabbs: return None return aabb_from_points(np.vstack([aabb for aabb in aabbs])) def aabb_overlap(aabb1, aabb2): if (aabb1 is None) or (aabb2 is None): return False lower1, upper1 = aabb1 lower2, upper2 = aabb2 return np.less_equal(lower1, upper2).all() and \ np.less_equal(lower2, upper1).all() def aabb_empty(aabb): lower, upper = aabb return np.less(upper, lower).any() def is_aabb_degenerate(aabb): return get_aabb_volume(aabb) <= 0. def aabb_intersection(*aabbs): # https://github.mit.edu/caelan/lis-openrave/blob/master/manipulation/bodies/bounding_volumes.py lower = np.max([lower for lower, _ in aabbs], axis=0) upper = np.min([upper for _, upper in aabbs], axis=0) aabb = AABB(lower, upper) if aabb_empty(aabb): return None return aabb def get_subtree_aabb(body, root_link=BASE_LINK): return aabb_union(get_aabb(body, link) for link in get_link_subtree(body, root_link)) def get_aabbs(body, links=None, only_collision=True): if links is None: links = get_all_links(body) if only_collision: # TODO: return the null bounding box links = [link for link in links if get_collision_data(body, link)] return [get_aabb(body, link=link) for link in links] def get_aabb(body, link=None, **kwargs): # Note that the query is conservative and may return additional objects that don't have actual AABB overlap. # This happens because the acceleration structures have some heuristic that enlarges the AABBs a bit # (extra margin and extruded along the velocity vector). # Contact points with distance exceeding this threshold are not processed by the LCP solver. # AABBs are extended by this number. Defaults to 0.02 in Bullet 2.x # p.setPhysicsEngineParameter(contactBreakingThreshold=0.0, physicsClientId=CLIENT) # Computes the AABB of the collision geometry if link is None: body_aabbs = get_aabbs(body, **kwargs) body_aabbs = post_process_aabb(body_aabbs[0].lower, body_aabbs[0].upper) return aabb_union(body_aabbs) return AABB(*p.getAABB(body, linkIndex=link, physicsClientId=CLIENT)) def post_process_aabb(lower, upper): if np.array_equal(lower, upper): lower_x = lower[0] - 0.001 lower_y = lower[1] - 0.001 lower_z = lower[2] - 0.001 upper_x = upper[0] + 0.001 upper_y = upper[1] + 0.001 upper_z = upper[2] + 0.001 lower = (lower_x, lower_y, lower_z) upper = (upper_x, upper_y, upper_z) return AABB(lower, upper) get_lower_upper = get_aabb def get_aabb_center(aabb): lower, upper = aabb return (np.array(lower) + np.array(upper)) / 2. def get_aabb_extent(aabb): lower, upper = aabb return np.array(upper) - np.array(lower) def get_center_extent(body, **kwargs): aabb = get_aabb(body, **kwargs) return get_aabb_center(aabb), get_aabb_extent(aabb) def aabb2d_from_aabb(aabb): (lower, upper) = aabb return AABB(lower[:2], upper[:2]) def aabb_contains_aabb(contained, container): lower1, upper1 = contained lower2, upper2 = container return np.less_equal(lower2, lower1).all() and \ np.less_equal(upper1, upper2).all() # return np.all(lower2 <= lower1) and np.all(upper1 <= upper2) def aabb_contains_point(point, container): lower, upper = container return np.less_equal(lower, point).all() and \ np.less_equal(point, upper).all() # return np.all(lower <= point) and np.all(point <= upper) def sample_aabb(aabb): lower, upper = aabb return np.random.uniform(lower, upper) def get_bodies_in_region(aabb): (lower, upper) = aabb # step_simulation() # Like visibility, need to step first bodies = p.getOverlappingObjects(lower, upper, physicsClientId=CLIENT) return [] if bodies is None else sorted(bodies) def get_aabb_volume(aabb): if aabb_empty(aabb): return 0. return np.prod(get_aabb_extent(aabb)) def get_aabb_area(aabb): return get_aabb_volume(aabb2d_from_aabb(aabb)) def get_aabb_vertices(aabb): d = len(aabb[0]) return [tuple(aabb[i[k]][k] for k in range(d)) for i in product(range(len(aabb)), repeat=d)] def get_aabb_edges(aabb): d = len(aabb[0]) vertices = list(product(range(len(aabb)), repeat=d)) lines = [] for i1, i2 in combinations(vertices, 2): if sum(i1[k] != i2[k] for k in range(d)) == 1: p1 = [aabb[i1[k]][k] for k in range(d)] p2 = [aabb[i2[k]][k] for k in range(d)] lines.append((p1, p2)) return lines def aabb_from_extent_center(extent, center=None): if center is None: center = np.zeros(len(extent)) else: center = np.array(center) half_extent = np.array(extent) / 2. lower = center - half_extent upper = center + half_extent return AABB(lower, upper) def scale_aabb(aabb, scale): center = get_aabb_center(aabb) extent = get_aabb_extent(aabb) if np.isscalar(scale): scale = scale * np.ones(len(extent)) new_extent = np.multiply(scale, extent) return aabb_from_extent_center(new_extent, center) def buffer_aabb(aabb, buffer): if aabb is None: return aabb extent = get_aabb_extent(aabb) if np.isscalar(buffer): if buffer == 0.: return aabb buffer = buffer * np.ones(len(extent)) new_extent = np.add(2*buffer, extent) center = get_aabb_center(aabb) return aabb_from_extent_center(new_extent, center) ##################################### OOBB = namedtuple('OOBB', ['aabb', 'pose']) def oobb_from_points(points): # Not necessarily minimal volume points = np.array(points).T d = points.shape[0] mu = np.resize(np.mean(points, axis=1), (d, 1)) centered = points - mu u, _, _ = np.linalg.svd(centered) if np.linalg.det(u) < 0: u[:, 1] *= -1 # TODO: rotate such that z is up aabb = aabb_from_points(np.dot(u.T, centered).T) tform = np.identity(4) tform[:d, :d] = u tform[:d, 3] = mu.T return OOBB(aabb, pose_from_tform(tform)) def oobb_contains_point(point, container): aabb, pose = container return aabb_contains_point(tform_point(invert(pose), point), aabb) def tform_oobb(affine, oobb): aabb, pose = oobb return OOBB(aabb, multiply(affine, pose)) def aabb_from_oobb(oobb): aabb, pose = oobb return aabb_from_points(tform_points(pose, get_aabb_vertices(aabb))) ##################################### # AABB approximation def vertices_from_data(data): geometry_type = get_data_type(data) # if geometry_type == p.GEOM_SPHERE: # parameters = [get_data_radius(data)] if geometry_type == p.GEOM_BOX: extents = np.array(get_data_extents(data)) aabb = aabb_from_extent_center(extents) vertices = get_aabb_vertices(aabb) elif geometry_type in (p.GEOM_CYLINDER, p.GEOM_CAPSULE): # TODO: p.URDF_USE_IMPLICIT_CYLINDER radius, height = get_data_radius(data), get_data_height(data) extents = np.array([2*radius, 2*radius, height]) aabb = aabb_from_extent_center(extents) vertices = get_aabb_vertices(aabb) elif geometry_type == p.GEOM_SPHERE: radius = get_data_radius(data) extents = 2*radius*np.ones(3) aabb = aabb_from_extent_center(extents) vertices = get_aabb_vertices(aabb) elif geometry_type == p.GEOM_MESH: filename, scale = get_data_filename(data), get_data_scale(data) if filename == UNKNOWN_FILE: raise RuntimeError(filename) # _, ext = os.path.splitext(filename) # if ext != '.obj': # raise RuntimeError(filename) mesh = read_obj(filename, decompose=False) vertices = [scale*np.array(vertex) for vertex in mesh.vertices] # TODO: could compute AABB here for improved speed at the cost of being conservative # elif geometry_type == p.GEOM_PLANE: # parameters = [get_data_extents(data)] else: raise NotImplementedError(geometry_type) return vertices def oobb_from_data(data): link_from_data = get_data_pose(data) vertices_data = vertices_from_data(data) return OOBB(aabb_from_points(vertices_data), link_from_data) def vertices_from_link(body, link=BASE_LINK, collision=True): # TODO: get_mesh_data(body, link=link) # In local frame vertices = [] # PyBullet creates multiple collision elements (with unknown_file) when nonconvex get_data = get_collision_data if collision else get_visual_data for data in get_data(body, link): # TODO: get_visual_data usually has a valid mesh file unlike get_collision_data # TODO: apply the inertial frame vertices.extend(apply_affine(get_data_pose(data), vertices_from_data(data))) return vertices OBJ_MESH_CACHE = {} def vertices_from_rigid(body, link=BASE_LINK): assert implies(link == BASE_LINK, get_num_links(body) == 0) try: vertices = vertices_from_link(body, link) except: info = get_model_info(body) assert info is not None _, ext = os.path.splitext(info.path) if ext == '.obj': model_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), info.path) if model_path not in OBJ_MESH_CACHE: OBJ_MESH_CACHE[model_path] = read_obj(model_path, decompose=False) mesh = OBJ_MESH_CACHE[model_path] vertices = mesh.vertices if ext == '.urdf': model_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), info.path) model_path = model_path.replace('urdf', 'obj') if model_path not in OBJ_MESH_CACHE: OBJ_MESH_CACHE[model_path] = read_obj(model_path, decompose=False) mesh = OBJ_MESH_CACHE[model_path] vertices = mesh.vertices else: raise NotImplementedError(ext) return vertices def approximate_as_prism(body, body_pose=unit_pose(), **kwargs): # TODO: make it just orientation vertices = apply_affine(body_pose, vertices_from_rigid(body, **kwargs)) aabb = aabb_from_points(vertices) return get_aabb_center(aabb), get_aabb_extent(aabb) # with PoseSaver(body): # set_pose(body, body_pose) # set_velocity(body, linear=np.zeros(3), angular=np.zeros(3)) # return get_center_extent(body, **kwargs) def approximate_as_cylinder(body, **kwargs): center, (width, length, height) = approximate_as_prism(body, **kwargs) diameter = (width + length) / 2 # TODO: check that these are close return center, (diameter, height) ##################################### # Collision MAX_DISTANCE = 0. # 0. | 1e-3 CollisionPair = namedtuple('Collision', ['body', 'links']) def get_buffered_aabb(body, max_distance=MAX_DISTANCE, **kwargs): body, links = parse_body(body, **kwargs) return buffer_aabb(aabb_union(get_aabbs(body, links=links)), buffer=max_distance) def get_unbuffered_aabb(body, **kwargs): return get_buffered_aabb(body, max_distance=-DEFAULT_AABB_BUFFER/2., **kwargs) def contact_collision(): step_simulation() return len(p.getContactPoints(physicsClientId=CLIENT)) != 0 ContactResult = namedtuple('ContactResult', ['contactFlag', 'bodyUniqueIdA', 'bodyUniqueIdB', 'linkIndexA', 'linkIndexB', 'positionOnA', 'positionOnB', 'contactNormalOnB', 'contactDistance', 'normalForce']) def flatten_links(body, links=None): if links is None: links = get_all_links(body) return {CollisionPair(body, frozenset([link])) for link in links} def parse_body(body, link=None): return body if isinstance(body, tuple) else CollisionPair(body, link) def expand_links(body, **kwargs): body, links = parse_body(body, **kwargs) if links is None: links = get_all_links(body) return CollisionPair(body, links) CollisionInfo = namedtuple('CollisionInfo', ''' contactFlag bodyUniqueIdA bodyUniqueIdB linkIndexA linkIndexB positionOnA positionOnB contactNormalOnB contactDistance normalForce lateralFriction1 lateralFrictionDir1 lateralFriction2 lateralFrictionDir2 '''.split()) def draw_collision_info(collision_info, **kwargs): point1 = collision_info.positionOnA point2 = collision_info.positionOnB # point1 = point2 + np.array(collision_info.contactNormalOnB)*collision_info.contactDistance handles = [add_line(point1, point2, **kwargs)] for point in [point1, point2]: handles.extend(draw_point(point, **kwargs)) return handles def get_closest_points(body1, body2, link1=None, link2=None, max_distance=MAX_DISTANCE, use_aabb=False): if use_aabb and not aabb_overlap(get_buffered_aabb(body1, link1, max_distance=max_distance/2.), get_buffered_aabb(body2, link2, max_distance=max_distance/2.)): return [] if (link1 is None) and (link2 is None): results = p.getClosestPoints(bodyA=body1, bodyB=body2, distance=max_distance, physicsClientId=CLIENT) elif link2 is None: results = p.getClosestPoints(bodyA=body1, bodyB=body2, linkIndexA=link1, distance=max_distance, physicsClientId=CLIENT) elif link1 is None: results = p.getClosestPoints(bodyA=body1, bodyB=body2, linkIndexB=link2, distance=max_distance, physicsClientId=CLIENT) else: results = p.getClosestPoints(bodyA=body1, bodyB=body2, linkIndexA=link1, linkIndexB=link2, distance=max_distance, physicsClientId=CLIENT) return [CollisionInfo(*info) for info in results] def pairwise_link_collision(body1, link1, body2, link2=BASE_LINK, **kwargs): return len(get_closest_points(body1, body2, link1=link1, link2=link2, **kwargs)) != 0 def any_link_pair_collision(body1, links1, body2, links2=None, **kwargs): # TODO: this likely isn't needed anymore if links1 is None: links1 = get_all_links(body1) if links2 is None: links2 = get_all_links(body2) for link1, link2 in product(links1, links2): if (body1 == body2) and (link1 == link2): continue if pairwise_link_collision(body1, link1, body2, link2, **kwargs): return True return False link_pairs_collision = any_link_pair_collision def body_collision(body1, body2, **kwargs): return len(get_closest_points(body1, body2, **kwargs)) != 0 def pairwise_collision(body1, body2, **kwargs): if isinstance(body1, tuple) or isinstance(body2, tuple): body1, links1 = expand_links(body1) body2, links2 = expand_links(body2) return any_link_pair_collision(body1, links1, body2, links2, **kwargs) return body_collision(body1, body2, **kwargs) def pairwise_collisions(body, obstacles, link=None, **kwargs): return any(pairwise_collision(body1=body, body2=other, link1=link, **kwargs) for other in obstacles if body != other) # def single_collision(body, max_distance=1e-3): # return len(p.getClosestPoints(body, max_distance=max_distance)) != 0 def single_collision(body, **kwargs): return pairwise_collisions(body, get_bodies(), **kwargs) ##################################### Ray = namedtuple('Ray', ['start', 'end']) def get_ray(ray): start, end = ray return np.array(end) - np.array(start) RayResult = namedtuple('RayResult', ['objectUniqueId', 'linkIndex', 'hit_fraction', 'hit_position', 'hit_normal']) # TODO: store Ray here def ray_collision(ray): # TODO: be careful to disable gravity and set static masses for everything step_simulation() # Needed for some reason start, end = ray result, = p.rayTest(start, end, physicsClientId=CLIENT) # TODO: assign hit_position to be the end? return RayResult(*result) def batch_ray_collision(rays, threads=1): assert 1 <= threads <= p.MAX_RAY_INTERSECTION_BATCH_SIZE if not rays: return [] step_simulation() # Needed for some reason ray_starts = [start for start, _ in rays] ray_ends = [end for _, end in rays] return [RayResult(*tup) for tup in p.rayTestBatch( ray_starts, ray_ends, numThreads=threads, # parentObjectUniqueId= # parentLinkIndex= physicsClientId=CLIENT)] def get_ray_from_to(mouseX, mouseY, farPlane=10000): # https://github.com/bulletphysics/bullet3/blob/afa4fb54505fd071103b8e2e8793c38fd40f6fb6/examples/pybullet/examples/pointCloudFromCameraImage.py # https://github.com/bulletphysics/bullet3/blob/afa4fb54505fd071103b8e2e8793c38fd40f6fb6/examples/pybullet/examples/addPlanarReflection.py width, height, _, _, _, camForward, horizon, vertical, _, _, dist, camTarget = p.getDebugVisualizerCamera() rayFrom = camPos = np.array(camTarget) - dist * np.array(camForward) rayForward = farPlane*get_unit_vector(np.array(camTarget) - rayFrom) dHor = np.array(horizon) / float(width) dVer = np.array(vertical) / float(height) # rayToCenter = rayFrom + rayForward rayTo = rayFrom + rayForward - 0.5*(np.array(horizon) - np.array(vertical)) + (mouseX*dHor - mouseY*dVer) return Ray(rayFrom, rayTo) ##################################### # Joint motion planning def uniform_generator(d): while True: yield np.random.uniform(size=d) def sample_norm(mu, sigma, lower=0., upper=INF): # scipy.stats.truncnorm assert lower <= upper if lower == upper: return lower if sigma == 0.: assert lower <= mu <= upper return mu while True: x = random.gauss(mu=mu, sigma=sigma) if lower <= x <= upper: return x def halton_generator(d, seed=None): import ghalton if seed is None: seed = random.randint(0, 1000) # sequencer = ghalton.Halton(d) sequencer = ghalton.GeneralizedHalton(d, seed) # sequencer.reset() while True: [weights] = sequencer.get(1) yield np.array(weights) def unit_generator(d, use_halton=False): if use_halton: try: import ghalton except ImportError: print('ghalton is not installed (https://pypi.org/project/ghalton/)') use_halton = False return halton_generator(d) if use_halton else uniform_generator(d) def interval_generator(lower, upper, **kwargs): assert len(lower) == len(upper) assert np.less_equal(lower, upper).all() if np.equal(lower, upper).all(): return iter([lower]) return (convex_combination(lower, upper, w=weights) for weights in unit_generator(d=len(lower), **kwargs)) def get_sample_fn(body, joints, custom_limits={}, **kwargs): lower_limits, upper_limits = get_custom_limits(body, joints, custom_limits, circular_limits=CIRCULAR_LIMITS) generator = interval_generator(lower_limits, upper_limits, **kwargs) def fn(): return tuple(next(generator)) return fn def get_halton_sample_fn(body, joints, **kwargs): return get_sample_fn(body, joints, use_halton=True, **kwargs) def get_difference_fn(body, joints): circular_joints = [is_circular(body, joint) for joint in joints] def fn(q2, q1): return tuple(circular_difference(value2, value1) if circular else (value2 - value1) for circular, value2, value1 in zip(circular_joints, q2, q1)) return fn def get_default_weights(body, joints, weights=None): if weights is not None: return weights # TODO: derive from resolutions # TODO: use the energy resulting from the mass matrix here? return 1*np.ones(len(joints)) # TODO: use velocities here def get_distance_fn(body, joints, weights=None): #, norm=2): weights = get_default_weights(body, joints, weights) difference_fn = get_difference_fn(body, joints) def fn(q1, q2): diff = np.array(difference_fn(q2, q1)) return np.sqrt(np.dot(weights, diff * diff)) # return np.linalg.norm(np.multiply(weights * diff), ord=norm) return fn def get_duration_fn(body, joints, velocities=None, norm=INF): # TODO: integrate with get_distance_fn weights # TODO: integrate with get_nonholonomic_distance_fn if velocities is None: velocities = np.array(get_max_velocities(body, joints)) difference_fn = get_difference_fn(body, joints) def fn(q1, q2): distances = np.array(difference_fn(q2, q1)) durations = np.divide(distances, np.abs(velocities)) return np.linalg.norm(durations, ord=norm) return fn def get_refine_fn(body, joints, num_steps=0): difference_fn = get_difference_fn(body, joints) num_steps = num_steps + 1 def fn(q1, q2): q = q1 for i in range(num_steps): positions = (1. / (num_steps - i)) * np.array(difference_fn(q2, q)) + q q = tuple(positions) # q = tuple(wrap_positions(body, joints, positions)) yield q return fn def refine_path(body, joints, waypoints, num_steps): refine_fn = get_refine_fn(body, joints, num_steps) refined_path = [] for v1, v2 in get_pairs(waypoints): refined_path.extend(refine_fn(v1, v2)) return refined_path DEFAULT_RESOLUTION = math.radians(3) # 0.05 def get_default_resolutions(body, joints, resolutions=None): if resolutions is not None: return resolutions return DEFAULT_RESOLUTION*np.ones(len(joints)) def get_extend_fn(body, joints, resolutions=None, norm=2): # norm = 1, 2, INF resolutions = get_default_resolutions(body, joints, resolutions) difference_fn = get_difference_fn(body, joints) def fn(q1, q2): # steps = int(np.max(np.abs(np.divide(difference_fn(q2, q1), resolutions)))) steps = int(np.linalg.norm(np.divide(difference_fn(q2, q1), resolutions), ord=norm)) refine_fn = get_refine_fn(body, joints, num_steps=steps) return refine_fn(q1, q2) return fn def remove_redundant(path, tolerance=1e-3): assert path new_path = [path[0]] for conf in path[1:]: difference = np.array(new_path[-1]) - np.array(conf) if not np.allclose(np.zeros(len(difference)), difference, atol=tolerance, rtol=0): new_path.append(conf) return new_path def waypoints_from_path(path, tolerance=1e-3): path = remove_redundant(path, tolerance=tolerance) if len(path) < 2: return path difference_fn = lambda q2, q1: np.array(q2) - np.array(q1) # difference_fn = get_difference_fn(body, joints) # TODO: account for wrap around or use adjust_path waypoints = [path[0]] last_conf = path[1] last_difference = get_unit_vector(difference_fn(last_conf, waypoints[-1])) for conf in path[2:]: difference = get_unit_vector(difference_fn(conf, waypoints[-1])) if not np.allclose(last_difference, difference, atol=tolerance, rtol=0): waypoints.append(last_conf) difference = get_unit_vector(difference_fn(conf, waypoints[-1])) last_conf = conf last_difference = difference waypoints.append(last_conf) return waypoints def adjust_path(robot, joints, path): difference_fn = get_difference_fn(robot, joints) differences = [difference_fn(q2, q1) for q1, q2 in get_pairs(path)] adjusted_path = [np.array(get_joint_positions(robot, joints))] # Assumed the same as path[0] mod rotation for difference in differences: if not np.array_equal(difference, np.zeros(len(joints))): adjusted_path.append(adjusted_path[-1] + difference) return adjusted_path def get_moving_links(body, joints): moving_links = set() for joint in joints: link = child_link_from_joint(joint) if link not in moving_links: moving_links.update(get_link_subtree(body, link)) return list(moving_links) def get_moving_pairs(body, moving_joints): """ Check all fixed and moving pairs Do not check all fixed and fixed pairs Check all moving pairs with a common """ moving_links = get_moving_links(body, moving_joints) for link1, link2 in combinations(moving_links, 2): ancestors1 = set(get_joint_ancestors(body, link1)) & set(moving_joints) ancestors2 = set(get_joint_ancestors(body, link2)) & set(moving_joints) if ancestors1 != ancestors2: yield link1, link2 def get_self_link_pairs(body, joints, disabled_collisions=set(), only_moving=True): moving_links = get_moving_links(body, joints) fixed_links = list(set(get_links(body)) - set(moving_links)) check_link_pairs = list(product(moving_links, fixed_links)) if only_moving: check_link_pairs.extend(get_moving_pairs(body, joints)) else: check_link_pairs.extend(combinations(moving_links, 2)) check_link_pairs = list(filter(lambda pair: not are_links_adjacent(body, *pair), check_link_pairs)) check_link_pairs = list(filter(lambda pair: (pair not in disabled_collisions) and (pair[::-1] not in disabled_collisions), check_link_pairs)) return check_link_pairs def get_collision_fn(body, joints, obstacles, attachments, self_collisions, disabled_collisions, custom_limits={}, use_aabb=False, cache=False, max_distance=MAX_DISTANCE, **kwargs): # TODO: convert most of these to keyword arguments check_link_pairs = get_self_link_pairs(body, joints, disabled_collisions) if self_collisions else [] moving_links = frozenset(get_moving_links(body, joints)) attached_bodies = [attachment.child for attachment in attachments] moving_bodies = [CollisionPair(body, moving_links)] + list(map(parse_body, attached_bodies)) lower_limits, upper_limits = get_custom_limits(body, joints, custom_limits) get_obstacle_aabb = cached_fn(get_buffered_aabb, cache=cache, max_distance=max_distance/2., **kwargs) def collision_fn(q, verbose=False): if not all_between(lower_limits, q, upper_limits): if verbose: print(lower_limits, q, upper_limits) return True set_joint_positions(body, joints, q) for attachment in attachments: attachment.assign() get_moving_aabb = cached_fn(get_buffered_aabb, cache=True, max_distance=max_distance/2., **kwargs) for link1, link2 in check_link_pairs: # Self-collisions should not have the max_distance parameter # TODO: self-collisions between body and attached_bodies (except for the link adjacent to the robot) if (not use_aabb or aabb_overlap(get_moving_aabb(body), get_moving_aabb(body))) and \ pairwise_link_collision(body, link1, body, link2): if verbose: print(body, link1, body, link2) return True for body1, body2 in product(moving_bodies, obstacles): if (not use_aabb or aabb_overlap(get_moving_aabb(body1), get_obstacle_aabb(body2))) \ and pairwise_collision(body1, body2, **kwargs): if verbose: print(body1, body2) return True return False return collision_fn def interpolate_joint_waypoints(body, joints, waypoints, resolutions=None, collision_fn=lambda *args, **kwargs: False, **kwargs): # TODO: unify with refine_path extend_fn = get_extend_fn(body, joints, resolutions=resolutions, **kwargs) path = waypoints[:1] for waypoint in waypoints[1:]: assert len(joints) == len(waypoint) for q in list(extend_fn(path[-1], waypoint)): if collision_fn(q): return None path.append(q) # TODO: could instead yield return path def plan_waypoints_joint_motion(body, joints, waypoints, start_conf=None, obstacles=[], attachments=[], self_collisions=True, disabled_collisions=set(), resolutions=None, custom_limits={}, max_distance=MAX_DISTANCE, use_aabb=False, cache=True): if start_conf is None: start_conf = get_joint_positions(body, joints) assert len(start_conf) == len(joints) collision_fn = get_collision_fn(body, joints, obstacles, attachments, self_collisions, disabled_collisions, custom_limits=custom_limits, max_distance=max_distance, use_aabb=use_aabb, cache=cache) waypoints = [start_conf] + list(waypoints) for i, waypoint in enumerate(waypoints): if collision_fn(waypoint): return None return interpolate_joint_waypoints(body, joints, waypoints, resolutions=resolutions, collision_fn=collision_fn) def plan_direct_joint_motion(body, joints, end_conf, **kwargs): return plan_waypoints_joint_motion(body, joints, [end_conf], **kwargs) def check_initial_end(start_conf, end_conf, collision_fn): # TODO: collision_fn might not accept kwargs if collision_fn(start_conf): print('Warning: initial configuration is in collision') return False if collision_fn(end_conf): print('Warning: end configuration is in collision') return False return True def plan_joint_motion(body, joints, end_conf, obstacles=[], attachments=[], self_collisions=True, disabled_collisions=set(), weights=None, resolutions=None, max_distance=MAX_DISTANCE, use_aabb=False, cache=True, custom_limits={}, **kwargs): assert len(joints) == len(end_conf) if (weights is None) and (resolutions is not None): weights = np.reciprocal(resolutions) # Functions sample_fn = get_sample_fn(body, joints, custom_limits=custom_limits) distance_fn = get_distance_fn(body, joints, weights=weights) extend_fn = get_extend_fn(body, joints, resolutions=resolutions) collision_fn = get_collision_fn(body, joints, obstacles, attachments, self_collisions, disabled_collisions, custom_limits=custom_limits, max_distance=max_distance, use_aabb=use_aabb, cache=cache) # If start_conf and end_conf is in collision, return None start_conf = get_joint_positions(body, joints) if not check_initial_end(start_conf, end_conf, collision_fn): return None # Motion planning with bi-directional RRT return birrt(start_conf, end_conf, distance_fn, sample_fn, extend_fn, collision_fn, **kwargs) def plan_lazy_prm(start_conf, end_conf, sample_fn, extend_fn, collision_fn, **kwargs): # TODO: cost metric based on total robot movement (encouraging greater distances possibly) from motion_planners.lazy_prm import lazy_prm path, samples, edges, colliding_vertices, colliding_edges = lazy_prm( start_conf, end_conf, sample_fn, extend_fn, collision_fn, num_samples=200, **kwargs) if path is None: return path # lower, upper = get_custom_limits(body, joints, circular_limits=CIRCULAR_LIMITS) def draw_fn(q): # TODO: draw edges instead of vertices return np.append(q[:2], [1e-3]) # return np.array([1, 1, 0.25])*(q + np.array([0., 0., np.pi])) handles = [] for q1, q2 in get_pairs(path): handles.append(add_line(draw_fn(q1), draw_fn(q2), color=GREEN)) for i1, i2 in edges: color = BLUE if any(colliding_vertices.get(i, False) for i in (i1, i2)) or colliding_vertices.get((i1, i2), False): color = RED elif not colliding_vertices.get((i1, i2), True): color = BLACK handles.append(add_line(draw_fn(samples[i1]), draw_fn(samples[i2]), color=color)) wait_if_gui() return path def get_linear_trajectory(start_point, end_point, num_steps=20): start_pos, start_rot = start_point end_pos, end_rot = end_point traj_x = np.linspace(start_pos[0], end_pos[0], num_steps) traj_y = np.linspace(start_pos[1], end_pos[1], num_steps) traj_z = np.linspace(start_pos[2], end_pos[2], num_steps) traj_pos = np.dstack((traj_x, traj_y, traj_z))[0] traj_rx = np.linspace(start_rot[0], end_rot[0], num_steps) traj_ry = np.linspace(start_rot[1], end_rot[1], num_steps) traj_rz = np.linspace(start_rot[2], end_rot[2], num_steps) traj_rw = np.linspace(start_rot[3], end_rot[3], num_steps) traj_rot = np.dstack((traj_rx, traj_ry, traj_rz, traj_rw))[0] return traj_pos, traj_rot def plan_linear_motion(robot, arm, end_point=None, start_point=None, **kwargs): from .ikfast.hsrb.ik import hsr_inverse_kinematics if start_point is None: start_point = get_link_pose(robot, link_from_name(robot, 'hand_palm_link')) traj = [] traj_pos, traj_rot = get_linear_trajectory(start_point, end_point) for pos, rot in zip(traj_pos, traj_rot): pose = (pos, rot) conf = hsr_inverse_kinematics(robot, arm, pose, custom_limits={}) if conf is None: continue traj.append(conf) return traj ##################################### def get_closest_angle_fn(body, joints, weights=None, reversible=True, linear_tol=0., **kwargs): assert len(joints) == 3 weights = get_default_weights(body, joints, weights) linear_distance_fn = get_distance_fn(body, joints[:2], weights=weights[:2]) angular_distance_fn = get_distance_fn(body, joints[2:], weights=weights[2:]) def closest_fn(q1, q2): linear_distance = linear_distance_fn(q1[:2], q2[:2]) if linear_distance < linear_tol: angle = None angular_distance = angular_distance_fn(q1[2:], q2[2:]) return angle, angular_distance angle_and_distance = [] for direction in [0, PI] if reversible else [0]: # TODO: previously was [PI] angle = get_angle(q1[:2], q2[:2]) + direction distance = angular_distance_fn(q1[2:], [angle]) \ + linear_distance \ + angular_distance_fn([angle], q2[2:]) angle_and_distance.append((angle, distance)) return min(angle_and_distance, key=lambda pair: pair[1]) return closest_fn def get_nonholonomic_distance_fn(body, joints, **kwargs): closest_angle_fn = get_closest_angle_fn(body, joints, **kwargs) # distance_fn = get_distance_fn(body, joints, **kwargs) # TODO: close enough threshold def distance_fn(q1, q2): _, distance = closest_angle_fn(q1, q2) return distance return distance_fn def get_nonholonomic_extend_fn(body, joints, resolutions=None, angular_tol=0., **kwargs): assert len(joints) == 3 resolutions = get_default_resolutions(body, joints, resolutions) linear_extend_fn = get_extend_fn(body, joints[:2], resolutions[:2]) angular_extend_fn = get_extend_fn(body, joints[2:], resolutions[2:]) closest_angle_fn = get_closest_angle_fn(body, joints, **kwargs) def extend_fn(q1, q2): angle, _ = closest_angle_fn(q1, q2) if angle is None: return [np.append(q1[:2], aq) for aq in angular_extend_fn(q1[2:], q2[2:])] # TODO: average? path = [] if abs(circular_difference(angle, q1[2])) >= angular_tol: path.extend(np.append(q1[:2], aq) for aq in angular_extend_fn(q1[2:], [angle])) path.extend(np.append(lq, [angle]) for lq in linear_extend_fn(q1[:2], q2[:2])) if abs(circular_difference(q2[2], angle)) >= angular_tol: path.extend(np.append(q2[:2], aq) for aq in angular_extend_fn([angle], q2[2:])) return path return extend_fn def plan_nonholonomic_motion(body, joints, end_conf, obstacles=[], attachments=[], self_collisions=True, disabled_collisions=set(), weights=None, resolutions=None, reversible=True, linear_tol=EPSILON, angular_tol=0., max_distance=MAX_DISTANCE, use_aabb=False, cache=True, custom_limits={}, **kwargs): assert len(joints) == len(end_conf) sample_fn = get_sample_fn(body, joints, custom_limits=custom_limits) distance_fn = get_nonholonomic_distance_fn(body, joints, weights=weights, reversible=reversible, linear_tol=linear_tol) #, angular_tol=angular_tol) extend_fn = get_nonholonomic_extend_fn(body, joints, resolutions=resolutions, reversible=reversible, linear_tol=linear_tol, angular_tol=angular_tol) collision_fn = get_collision_fn(body, joints, obstacles, attachments, self_collisions, disabled_collisions, custom_limits=custom_limits, max_distance=max_distance, use_aabb=use_aabb, cache=cache) start_conf = get_joint_positions(body, joints) if not check_initial_end(start_conf, end_conf, collision_fn): return None return birrt(start_conf, end_conf, distance_fn, sample_fn, extend_fn, collision_fn, **kwargs) plan_differential_motion = plan_nonholonomic_motion ##################################### # SE(2) pose motion planning def get_base_difference_fn(): def fn(q2, q1): dx, dy = np.array(q2[:2]) - np.array(q1[:2]) dtheta = circular_difference(q2[2], q1[2]) return (dx, dy, dtheta) return fn def get_base_distance_fn(weights=1*np.ones(3)): difference_fn = get_base_difference_fn() def fn(q1, q2): difference = np.array(difference_fn(q2, q1)) return np.sqrt(np.dot(weights, difference * difference)) return fn def plan_base_motion(body, end_conf, base_limits, obstacles=[], direct=False, weights=1*np.ones(3), resolutions=0.05*np.ones(3), max_distance=MAX_DISTANCE, **kwargs): def sample_fn(): x, y = np.random.uniform(*base_limits) theta = np.random.uniform(*CIRCULAR_LIMITS) return (x, y, theta) difference_fn = get_base_difference_fn() distance_fn = get_base_distance_fn(weights=weights) def extend_fn(q1, q2): steps = np.abs(np.divide(difference_fn(q2, q1), resolutions)) n = int(np.max(steps)) + 1 q = q1 for i in range(n): q = tuple((1. / (n - i)) * np.array(difference_fn(q2, q)) + q) yield q # TODO: should wrap these joints def collision_fn(q): # TODO: update this function set_base_values(body, q) return any(pairwise_collision(body, obs, max_distance=max_distance) for obs in obstacles) start_conf = get_base_values(body) if not check_initial_end(start_conf, end_conf, collision_fn): return None if direct: return direct_path(start_conf, end_conf, extend_fn, collision_fn) return birrt(start_conf, end_conf, distance_fn, sample_fn, extend_fn, collision_fn, **kwargs) ##################################### # Placements def stable_z_on_aabb(body, aabb): center, extent = get_center_extent(body) _, upper = aabb return (upper + extent/2 + (get_point(body) - center))[2] def stable_z(body, surface, surface_link=None): return stable_z_on_aabb(body, get_aabb(surface, link=surface_link)) def is_placed_on_aabb(body, bottom_aabb, above_epsilon=5e-2, below_epsilon=5e-2): assert (0 <= above_epsilon) and (0 <= below_epsilon) top_aabb = get_aabb(body) # TODO: approximate_as_prism top_z_min = top_aabb[0][2] bottom_z_max = bottom_aabb[1][2] return ((bottom_z_max - below_epsilon) <= top_z_min <= (bottom_z_max + above_epsilon)) and \ (aabb_contains_aabb(aabb2d_from_aabb(top_aabb), aabb2d_from_aabb(bottom_aabb))) def is_placement(body, surface, **kwargs): if get_aabb(surface) is None: return False return is_placed_on_aabb(body, get_aabb(surface), **kwargs) def is_center_on_aabb(body, bottom_aabb, above_epsilon=1e-2, below_epsilon=0.0): # TODO: compute AABB in origin # TODO: use center of mass? assert (0 <= above_epsilon) and (0 <= below_epsilon) center, extent = get_center_extent(body) # TODO: approximate_as_prism base_center = center - np.array([0, 0, extent[2]])/2 top_z_min = base_center[2] bottom_z_max = bottom_aabb[1][2] return ((bottom_z_max - abs(below_epsilon)) <= top_z_min <= (bottom_z_max + abs(above_epsilon))) and \ (aabb_contains_point(base_center[:2], aabb2d_from_aabb(bottom_aabb))) def is_center_stable(body, surface, **kwargs): return is_center_on_aabb(body, get_aabb(surface), **kwargs) def sample_placement_on_aabb(top_body, bottom_aabb, top_pose=unit_pose(), percent=1.0, max_attempts=50, epsilon=1e-3): # TODO: transform into the coordinate system of the bottom # TODO: maybe I should instead just require that already in correct frame for _ in range(max_attempts): theta = np.random.uniform(*CIRCULAR_LIMITS) rotation = Euler(yaw=theta) set_pose(top_body, multiply(Pose(euler=rotation), top_pose)) center, extent = get_center_extent(top_body) lower = (np.array(bottom_aabb[0]))[:2] # - percent*extent/2)[:2] upper = (np.array(bottom_aabb[1]))[:2] # + percent*extent/2)[:2] aabb = AABB(lower, upper) if aabb_empty(aabb): continue x, y = sample_aabb(aabb) z = (bottom_aabb[1])[2] # + extent/2.)[2] + epsilon point = np.array([x, y, z]) + (get_point(top_body) - center) pose = multiply(Pose(point, rotation), top_pose) set_pose(top_body, pose) return pose return None def sample_placement(top_body, bottom_body, bottom_link=None, **kwargs): bottom_aabb = get_aabb(bottom_body, link=bottom_link) return sample_placement_on_aabb(top_body, bottom_aabb, **kwargs) ##################################### # Inserts def is_hole(hole, hole_base): base_x, base_y, base_z = get_point(hole_base) hole_x, hole_y, hole_z = get_point(hole) x_threshold, y_threshold, z_threshold = 0.1, 0.1, 0.1 if (base_x <= hole_x <= base_x+x_threshold) and \ (base_y-y_threshold <= hole_y <= base_y+y_threshold) and \ (base_z-z_threshold <= hole_z <= base_z+z_threshold): return True return False def is_inserted(body, surface, **kwargs): if get_aabb(surface) is None: return False return is_placed_on_aabb(body, get_aabb(surface), **kwargs) def sample_insertion(body, hole, max_attempts=25, percent=1.0, epsilon=1e-3, **kwargs): for _ in range(max_attempts): theta = np.random.uniform(*CIRCULAR_LIMITS) rotation = Euler(yaw=theta) set_pose(body, multiply(Pose(euler=rotation), unit_pose())) center, extent = get_center_extent(body) hole_pose = get_point(hole) x, y, z = hole_pose point = np.array([x, y, z]) + (get_point(body) - center) pose = multiply(Pose(point, rotation), unit_pose()) set_pose(body, pose) return pose return None ##################################### # Reachability def sample_reachable_base(robot, point, reachable_range=(0.8, 0.9)): radius = np.random.uniform(*reachable_range) x, y = radius * unit_from_theta(np.random.uniform(np.pi, 2*np.pi/2)) + point[:2] yaw = np.random.uniform(*CIRCULAR_LIMITS) base_values = (x, y, yaw) return base_values def uniform_pose_generator(robot, gripper_pose, **kwargs): point = point_from_pose(gripper_pose) while True: base_values = sample_reachable_base(robot, point, **kwargs) if base_values is None: break yield base_values # TODO: modify def custom_limits_from_base_limits(robot, base_limits, yaw_limit=None): # TODO: unify with SS-Replan x_limits, y_limits = zip(*base_limits) try: custom_limits = { joint_from_name(robot, 'joint_x'): x_limits, joint_from_name(robot, 'joint_y'): y_limits, } except: custom_limits = { joint_from_name(robot, 'x'): x_limits, joint_from_name(robot, 'y'): y_limits, } if yaw_limit is not None: try: custom_limits.update({ joint_from_name(robot, 'joint_rz'): yaw_limit, }) except: custom_limits.update({ joint_from_name(robot, 'theta'): yaw_limit, }) return custom_limits ##################################### # Constraints - applies forces when not satisfied def get_constraints(): """ getConstraintUniqueId will take a serial index in range 0..getNumConstraints, and reports the constraint unique id. Note that the constraint unique ids may not be contiguous, since you may remove constraints. """ return [p.getConstraintUniqueId(i, physicsClientId=CLIENT) for i in range(p.getNumConstraints(physicsClientId=CLIENT))] def remove_constraint(constraint): p.removeConstraint(constraint, physicsClientId=CLIENT) ConstraintInfo = namedtuple('ConstraintInfo', ['parentBodyUniqueId', 'parentJointIndex', 'childBodyUniqueId', 'childLinkIndex', 'constraintType', 'jointAxis', 'jointPivotInParent', 'jointPivotInChild', 'jointFrameOrientationParent', 'jointFrameOrientationChild', 'maxAppliedForce']) def get_constraint_info(constraint): # getConstraintState # TODO: four additional arguments return ConstraintInfo(*p.getConstraintInfo(constraint, physicsClientId=CLIENT)[:11]) def get_fixed_constraints(): fixed_constraints = [] for constraint in get_constraints(): constraint_info = get_constraint_info(constraint) if constraint_info.constraintType == p.JOINT_FIXED: fixed_constraints.append(constraint) return fixed_constraints def add_pose_constraint(body, pose=None, max_force=None): link = BASE_LINK if pose is None: pose = get_pose(body) position, quat = pose constraint = p.createConstraint(body, link, -1, -1, jointType=p.JOINT_FIXED, jointAxis=[0, 0, 0], parentFramePosition=unit_point(), childFramePosition=position, parentFrameOrientation=unit_quat(), childFrameOrientation=quat, physicsClientId=CLIENT) if max_force is not None: p.changeConstraint(constraint, maxForce=max_force, physicsClientId=CLIENT) return constraint def add_fixed_constraint(body, robot, robot_link=BASE_LINK, max_force=None): body_link = BASE_LINK body_pose = get_pose(body) # body_pose = get_com_pose(body, link=body_link) # end_effector_pose = get_link_pose(robot, robot_link) end_effector_pose = get_com_pose(robot, robot_link) grasp_pose = multiply(invert(end_effector_pose), body_pose) point, quat = grasp_pose # TODO: can I do this when I'm not adjacent? # joint axis in local frame (ignored for JOINT_FIXED) # return p.createConstraint(robot, robot_link, body, body_link, # p.JOINT_FIXED, jointAxis=unit_point(), # parentFramePosition=unit_point(), # childFramePosition=point, # parentFrameOrientation=unit_quat(), # childFrameOrientation=quat) constraint = p.createConstraint(robot, robot_link, body, body_link, # Both seem to work p.JOINT_FIXED, jointAxis=unit_point(), parentFramePosition=point, childFramePosition=unit_point(), parentFrameOrientation=quat, childFrameOrientation=unit_quat(), physicsClientId=CLIENT) if max_force is not None: p.changeConstraint(constraint, maxForce=max_force, physicsClientId=CLIENT) return constraint def remove_fixed_constraint(body, robot, robot_link): for constraint in get_fixed_constraints(): constraint_info = get_constraint_info(constraint) if (body == constraint_info.childBodyUniqueId) and \ (BASE_LINK == constraint_info.childLinkIndex) and \ (robot == constraint_info.parentBodyUniqueId) and \ (robot_link == constraint_info.parentJointIndex): remove_constraint(constraint) ##################################### # Grasps GraspInfo = namedtuple('GraspInfo', ['get_grasps', 'approach_pose']) class Attachment(object): def __init__(self, parent, parent_link, grasp_pose, child): self.parent = parent # TODO: support no parent self.parent_link = parent_link self.grasp_pose = grasp_pose self.child = child # self.child_link = child_link # child_link=BASE_LINK @property def bodies(self): return flatten_links(self.child) | flatten_links(self.parent, get_link_subtree( self.parent, self.parent_link)) def assign(self): parent_link_pose = get_link_pose(self.parent, self.parent_link) child_pose = body_from_end_effector(parent_link_pose, self.grasp_pose) set_pose(self.child, child_pose) return child_pose def apply_mapping(self, mapping): self.parent = mapping.get(self.parent, self.parent) self.child = mapping.get(self.child, self.child) def __repr__(self): return '{}({},{})'.format(self.__class__.__name__, self.parent, self.child) def create_attachment(parent, parent_link, child): parent_link_pose = get_link_pose(parent, parent_link) child_pose = get_pose(child) grasp_pose = multiply(invert(parent_link_pose), child_pose) return Attachment(parent, parent_link, grasp_pose, child) def body_from_end_effector(end_effector_pose, grasp_pose): """ world_from_parent * parent_from_child = world_from_child """ return multiply(end_effector_pose, grasp_pose) def end_effector_from_body(body_pose, grasp_pose): """ grasp_pose: the body's pose in gripper's frame world_from_child * (parent_from_child)^(-1) = world_from_parent (parent: gripper, child: body to be grasped) Pose_{world,gripper} = Pose_{world,block}*Pose_{block,gripper} = Pose_{world,block}*(Pose_{gripper,block})^{-1} """ return multiply(body_pose, invert(grasp_pose)) def approach_from_grasp(approach_pose, end_effector_pose): return multiply(approach_pose, end_effector_pose) def get_grasp_pose(constraint): """ Grasps are parent_from_child """ constraint_info = get_constraint_info(constraint) assert(constraint_info.constraintType == p.JOINT_FIXED) joint_from_parent = (constraint_info.jointPivotInParent, constraint_info.jointFrameOrientationParent) joint_from_child = (constraint_info.jointPivotInChild, constraint_info.jointFrameOrientationChild) return multiply(invert(joint_from_parent), joint_from_child) ##################################### # Control def control_joint(body, joint, control_mode=None, position=None, velocity=0., position_gain=None, velocity_scale=None, max_force=None): if control_mode is None: control_mode = p.POSITION_CONTROL if position is None: position = get_joint_position(body, joint) kwargs = {} if position_gain is not None: velocity_gain = 0.1*position_gain kwargs.update({ 'positionGain': position_gain, 'velocityGain': velocity_gain, }) if velocity_scale is not None: max_velocity = velocity_scale*get_max_velocity(body, joint) kwargs.update({ 'maxVelocity': max_velocity, }) if max_force is not None: # max_force = get_max_force(body, joint) kwargs.update({ 'force': max_force, }) return p.setJointMotorControl2(bodyIndex=body, # bodyUniqueId jointIndex=joint, controlMode=control_mode, targetPosition=position, targetVelocity=velocity, physicsClientId=CLIENT, **kwargs) def control_joints(body, joints, control_mode=None, positions=None, velocities=None, position_gain=None, velocity_scale=None, max_force=None): if control_mode is None: control_mode = p.POSITION_CONTROL if positions is None: positions = get_joint_positions(body, joints) if velocities is None: velocities = [0.0] * len(joints) if velocity_scale is not None: for i, joint in enumerate(joints): control_joint(body, joint, controlMode=control_mode, position=positions[i], velocity=velocities[i], position_gain=position_gain, velocity_scale=velocity_scale, max_force=max_force) return None kwargs = {} if position_gain is not None: velocity_gain = 0.1*position_gain kwargs.update({ 'positionGains': [position_gain] * len(joints), 'velocityGains': [velocity_gain] * len(joints), }) if max_force is not None: # max_forces = [get_max_force(body, joint) for joint in joints] max_forces = [max_force] * len(joints) # max_forces = [5000]*len(joints) # 20000 # print(max_forces) kwargs.update({ 'forces': max_forces, }) return p.setJointMotorControlArray(bodyUniqueId=body, jointIndices=joints, controlMode=p.POSITION_CONTROL, targetPositions=positions, targetVelocities=velocities, physicsClientId=CLIENT, **kwargs) def control_joints_hold(body, joints, positions=None, **kwargs): configuration = modify_configuration(body, joints, positions) return control_joints(body, get_movable_joints(body), configuration, **kwargs) # TODO: Check def joint_controller(body, joints, target, control_mode=None, tolerance=1e-3, timeout=3, **kwargs): assert(len(joints) == len(target)) dt = get_time_step() time_elapsed = 0. control_joints(body, joints, control_mode, target, **kwargs) positions = get_joint_positions(body, joints) while not np.allclose(positions, target, atol=tolerance, rtol=0) and (time_elapsed < timeout): yield positions time_elapsed += dt positions = get_joint_positions(body, joints) # TODO: return timeout (or throw error) def waypoint_joint_controller(body, joints, target, tolerance=1e-3, time_step=0.1, timeout=INF, **kwargs): # TODO: leading instead of waypoint? assert(len(joints) == len(target)) # TODO: calculateInverseDynamics duration_fn = get_duration_fn(body, joints) dt = get_time_step() # TODO: use dt instead of time_step? time_elapsed = 0. # print(duration_fn(get_joint_positions(body, joints), target)) # TODO: compute waypoint from velocity while time_elapsed < timeout: # TODO: timeout based on the distance positions = get_joint_positions(body, joints) remaining = duration_fn(positions, target) if np.allclose(positions, target, atol=tolerance, rtol=0): break # print(np.divide(get_joint_velocities(body, joints), get_max_velocities(body, joints))) w = min(remaining, time_step) / remaining waypoint = convex_combination(positions, target, w=w) # Important to not include wrap around control_joints(body, joints, waypoint, **kwargs) yield positions time_elapsed += dt def joint_controller_hold(body, joints, target=None, control_mode=None, **kwargs): """ Keeps other joints in place """ configuration = modify_configuration(body, joints, target) return joint_controller(body, get_movable_joints(body), configuration, control_mode, **kwargs) def joint_controller_hold2(body, joints, positions, velocities=None, tolerance=1e-2 * np.pi, position_gain=0.05, velocity_gain=0.01): """ Keeps other joints in place """ # TODO: velocity_gain causes the PR2 to oscillate if velocities is None: velocities = [0.] * len(positions) movable_joints = get_movable_joints(body) target_positions = list(get_joint_positions(body, movable_joints)) # target_velocities = [0.] * len(movable_joints) movable_from_original = {o: m for m, o in enumerate(movable_joints)} # print(list(positions), list(velocities)) for joint, position, velocity in zip(joints, positions, velocities): target_positions[movable_from_original[joint]] = position # target_velocities[movable_from_original[joint]] = velocity # return joint_controller(body, movable_joints, conf) current_conf = get_joint_positions(body, movable_joints) # forces = [get_max_force(body, joint) for joint in movable_joints] while not np.allclose(current_conf, target_positions, atol=tolerance, rtol=0): # TODO: only enforce velocity constraints at end p.setJointMotorControlArray(body, movable_joints, p.POSITION_CONTROL, targetPositions=target_positions, # targetVelocities=target_velocities, positionGains=[position_gain] * len(movable_joints), # velocityGains=[velocity_gain] * len(movable_joints), # maxVelocities=[0.]*len(movable_joints), # TODO: maxVelocity equivalent? # forces=forces, physicsClientId=CLIENT) yield current_conf current_conf = get_joint_positions(body, movable_joints) def trajectory_controller(body, joints, path, **kwargs): for target in path: for positions in joint_controller(body, joints, target, **kwargs): yield positions def simulate_controller(controller, max_time=np.inf): # Allow option to sleep rather than yield? sim_dt = get_time_step() sim_time = 0.0 for _ in controller: if max_time < sim_time: break step_simulation() sim_time += sim_dt yield sim_time def velocity_control_joints(body, joints, velocities): # kv = 0.3 return p.setJointMotorControlArray(body, joints, p.VELOCITY_CONTROL, targetVelocities=velocities, physicsClientId=CLIENT,) # velocityGains=[kv] * len(joints),) # forces=forces) ##################################### def compute_jacobian(robot, link, positions=None): joints = get_movable_joints(robot) if positions is None: positions = get_joint_positions(robot, joints) assert len(joints) == len(positions) velocities = [0.0] * len(positions) accelerations = [0.0] * len(positions) translate, rotate = p.calculateJacobian(robot, link, unit_point(), positions, velocities, accelerations, physicsClientId=CLIENT) # movable_from_joints(robot, joints) return list(zip(*translate)), list(zip(*rotate)) # len(joints) x 3 def compute_joint_weights(robot, num=100): # http://openrave.org/docs/0.6.6/_modules/openravepy/databases/linkstatistics/#LinkStatisticsModel # TODO: use velocities instead start_time = time.time() joints = get_movable_joints(robot) sample_fn = get_sample_fn(robot, joints) weighted_jacobian = np.zeros(len(joints)) links = list(get_links(robot)) # links = {l for j in joints for l in get_link_descendants(self.robot, j)} masses = [get_mass(robot, link) for link in links] # Volume, AABB volume total_mass = sum(masses) for _ in range(num): conf = sample_fn() for mass, link in zip(masses, links): translate, rotate = compute_jacobian(robot, link, conf) weighted_jacobian += np.array([mass * np.linalg.norm(vec) for vec in translate]) / total_mass weighted_jacobian /= num print(list(weighted_jacobian)) print(time.time() - start_time) return weighted_jacobian ##################################### def inverse_kinematics_helper(robot, link, target_pose, use_null_space=True, null_space=None): (target_point, target_quat) = target_pose assert target_point is not None if null_space is not None: assert target_quat is not None lower, upper, ranges, rest = null_space kinematic_conf = p.calculateInverseKinematics(robot, link, target_point, lowerLimits=lower, upperLimits=upper, jointRanges=ranges, restPoses=rest, physicsClientId=CLIENT) elif target_quat is None: kinematic_conf = p.calculateInverseKinematics(robot, link, target_point, # lowerLimits=ll, upperLimits=ul, jointRanges=jr, restPoses=rp, jointDamping=jd, # solver=ikSolver, currentPosition=None, maxNumIterations=20, residualThreshold=-1, physicsClientId=CLIENT) else: kinematic_conf = p.calculateInverseKinematics(robot, link, target_point, target_quat, physicsClientId=CLIENT) if (kinematic_conf is None) or any(map(math.isnan, kinematic_conf)): return None constrain_joints = [2, 4, 5] pos, orn = target_pose[0], target_pose[1] orig_q = [] for i in range(p.getNumJoints(robot)): if p.getJointInfo(robot, i)[2] == 4: continue else: orig_q.append(p.getJointState(robot, i)[0]) lower = [-10.0, -10.0, -10.0, 0.0, -3.84, -1.57, 0.0, -2.62, -2.09, -1.92, -1.92, -0.798, -1.24, -0.798, -1.24] upper = [10.0, 10.0, 10.0, 0.345, 1.75, 0.52, 0.69, 0.0, 3.84, 1.22, 3.67, 1.24, 0.798, 1.24, 0.798] ranges = [20.0, 20.0, 20.0, 0.345, 5.59, 2.09, 0.69, 2.62, 5.93, 3.1399999999999997, 5.59, 2.0380000000000003, 2.0380000000000003, 2.0380000000000003, 2.0380000000000003] lowers, uppers, ranges = list(lower), list(upper), list(ranges) for i in constrain_joints: lowers[i] = orig_q[i] uppers[i] = orig_q[i] if use_null_space: kinematic_conf = p.calculateInverseKinematics(robot, link, targetPosition=pos, targetOrientation=orn, lowerLimits=lowers, upperLimits=uppers, jointRanges=ranges, restPoses=orig_q) else: kinematic_conf = p.calculateInverseKinematics(robot, link, targetPosition=pos, targetOrientation=orn, solver=0, maxNumIterations=1000, residualThreshold=1e-4) return kinematic_conf def is_pose_close(pose, target_pose, pos_tolerance=1e-3, ori_tolerance=1e-3*np.pi): (point, quat) = pose (target_point, target_quat) = target_pose if (target_point is not None) and not np.allclose(point, target_point, atol=pos_tolerance, rtol=0): return False if (target_quat is not None) and not np.allclose(quat, target_quat, atol=ori_tolerance, rtol=0): # TODO: account for quaternion redundancy return False return True def inverse_kinematics(robot, link, target_pose, max_iterations=200, max_time=INF, custom_limits={}, **kwargs): start_time = time.time() movable_joints = get_movable_joints(robot) for iteration in irange(max_iterations): if elapsed_time(start_time) >= max_time: return None kinematic_conf = inverse_kinematics_helper(robot, link, target_pose) if kinematic_conf is None: return None set_joint_positions(robot, movable_joints, kinematic_conf) if is_pose_close(get_link_pose(robot, link), target_pose, **kwargs): break lower_limits, upper_limits = get_custom_limits(robot, movable_joints, custom_limits) if not all_between(lower_limits, kinematic_conf, upper_limits): continue return kinematic_conf ##################################### def get_position_waypoints(start_point, direction, quat, step_size=0.01): distance = get_length(direction) unit_direction = get_unit_vector(direction) for t in np.arange(0, distance, step_size): point = start_point + t*unit_direction yield (point, quat) yield (start_point + direction, quat) def get_quaternion_waypoints(point, start_quat, end_quat, step_size=np.pi/16): angle = quat_angle_between(start_quat, end_quat) for t in np.arange(0, angle, step_size): fraction = t/angle quat = quat_combination(start_quat, end_quat, fraction=fraction) yield (point, quat) yield (point, end_quat) def get_pose_distance(pose1, pose2): pos1, quat1 = pose1 pos2, quat2 = pose2 pos_distance = get_distance(pos1, pos2) ori_distance = quat_angle_between(quat1, quat2) return pos_distance, ori_distance def interpolate_poses(pose1, pose2, pos_step_size=0.01, ori_step_size=np.pi/16): pos1, quat1 = pose1 pos2, quat2 = pose2 num_steps = max(2, int(math.ceil(max( np.divide(get_pose_distance(pose1, pose2), [pos_step_size, ori_step_size]))))) yield pose1 for w in np.linspace(0, 1, num=num_steps, endpoint=True)[1:-1]: pos = convex_combination(pos1, pos2, w=w) quat = quat_combination(quat1, quat2, fraction=w) yield (pos, quat) yield pose2 def interpolate(value1, value2, num_steps=2): num_steps = max(num_steps, 2) yield value1 for w in np.linspace(0, 1, num=num_steps, endpoint=True)[1:-1]: yield convex_combination(value1, value2, w=w) yield value2 def interpolate_waypoints(interpolate_fn, waypoints, returns_first=True): if len(waypoints) <= 1: for waypoint in waypoints: yield waypoint return yield waypoints[0] for waypoint1, waypoint2 in get_pairs(waypoints): for i, value in enumerate(interpolate_fn(waypoint1, waypoint2)): if returns_first and (i == 0): continue yield value # def workspace_trajectory(robot, link, start_point, direction, quat, **kwargs): # # TODO: pushing example # # TODO: just use current configuration? # # TODO: check collisions? # # TODO: lower intermediate tolerance # traj = [] # for pose in get_cartesian_waypoints(start_point, direction, quat): # conf = inverse_kinematics(robot, link, pose, **kwargs) # if conf is None: # return None # traj.append(conf) # return traj ##################################### NullSpace = namedtuple('Nullspace', ['lower', 'upper', 'range', 'rest']) def get_null_space(robot, joints, custom_limits={}): rest_positions = get_joint_positions(robot, joints) lower, upper = get_custom_limits(robot, joints, custom_limits) lower = np.maximum(lower, -10*np.ones(len(joints))) upper = np.minimum(upper, +10*np.ones(len(joints))) joint_ranges = 10*np.ones(len(joints)) return NullSpace(list(lower), list(upper), list(joint_ranges), list(rest_positions)) def create_sub_robot(robot, first_joint, target_link): # TODO: create a class or generator for repeated use selected_links = get_link_subtree(robot, first_joint) # TODO: child_link_from_joint? selected_joints = prune_fixed_joints(robot, selected_links) assert(target_link in selected_links) sub_target_link = selected_links.index(target_link) sub_robot = clone_body(robot, links=selected_links, visual=False, collision=False) # TODO: joint limits assert len(selected_joints) == len(get_movable_joints(sub_robot)) return sub_robot, selected_joints, sub_target_link def multiple_sub_inverse_kinematics(robot, first_joint, target_link, target_pose, max_attempts=1, max_solutions=INF, max_time=INF, custom_limits={}, first_close=True, **kwargs): # TODO: gradient descent using collision_info start_time = time.time() ancestor_joints = prune_fixed_joints(robot, get_ordered_ancestors(robot, target_link)) affected_joints = ancestor_joints[ancestor_joints.index(first_joint):] sub_robot, selected_joints, sub_target_link = create_sub_robot(robot, first_joint, target_link) # sub_joints = get_movable_joints(sub_robot) # sub_from_real = dict(safe_zip(sub_joints, selected_joints)) sub_joints = prune_fixed_joints(sub_robot, get_ordered_ancestors(sub_robot, sub_target_link)) selected_joints = affected_joints # sub_from_real = dict(safe_zip(sub_joints, selected_joints)) # sample_fn = get_sample_fn(sub_robot, sub_joints, custom_limits=custom_limits) # [-PI, PI] sample_fn = get_sample_fn(robot, selected_joints, custom_limits=custom_limits) # lower_limits, upper_limits = get_custom_limits(robot, get_movable_joints(robot), custom_limits) solutions = [] for attempt in irange(max_attempts): if (len(solutions) >= max_solutions) or (elapsed_time(start_time) >= max_time): break if not first_close or (attempt >= 1): # TODO: multiple seed confs sub_conf = sample_fn() set_joint_positions(sub_robot, sub_joints, sub_conf) sub_kinematic_conf = inverse_kinematics(sub_robot, sub_target_link, target_pose, max_time=max_time-elapsed_time(start_time), **kwargs) if sub_kinematic_conf is not None: # set_configuration(sub_robot, sub_kinematic_conf) sub_kinematic_conf = get_joint_positions(sub_robot, sub_joints) set_joint_positions(robot, selected_joints, sub_kinematic_conf) kinematic_conf = get_configuration(robot) # TODO: test on the resulting robot state (e.g. collisions) # if not all_between(lower_limits, kinematic_conf, upper_limits): solutions.append(kinematic_conf) # kinematic_conf | sub_kinematic_conf if solutions: set_configuration(robot, solutions[-1]) # TODO: test for redundant configurations remove_body(sub_robot) return solutions def plan_cartesian_motion(robot, first_joint, target_link, waypoint_poses, max_iterations=200, max_time=INF, custom_limits={}, **kwargs): # TODO: fix stationary joints # TODO: pass in set of movable joints and take least common ancestor # TODO: update with most recent bullet updates # https://github.com/bulletphysics/bullet3/blob/master/examples/pybullet/examples/inverse_kinematics.py # https://github.com/bulletphysics/bullet3/blob/master/examples/pybullet/examples/inverse_kinematics_husky_kuka.py # TODO: plan a path without needing to following intermediate waypoints lower_limits, upper_limits = get_custom_limits(robot, get_movable_joints(robot), custom_limits) sub_robot, selected_joints, sub_target_link = create_sub_robot(robot, first_joint, target_link) sub_joints = get_movable_joints(sub_robot) # null_space = get_null_space(robot, selected_joints, custom_limits=custom_limits) null_space = None solutions = [] for target_pose in waypoint_poses: start_time = time.time() for iteration in irange(max_iterations): if elapsed_time(start_time) >= max_time: remove_body(sub_robot) return None sub_kinematic_conf = inverse_kinematics_helper(sub_robot, sub_target_link, target_pose, null_space=null_space) if sub_kinematic_conf is None: remove_body(sub_robot) return None set_joint_positions(sub_robot, sub_joints, sub_kinematic_conf) if is_pose_close(get_link_pose(sub_robot, sub_target_link), target_pose, **kwargs): set_joint_positions(robot, selected_joints, sub_kinematic_conf) kinematic_conf = get_configuration(robot) if not all_between(lower_limits, kinematic_conf, upper_limits): # movable_joints = get_movable_joints(robot) # print([(get_joint_name(robot, j), l, v, u) for j, l, v, u in # zip(movable_joints, lower_limits, kinematic_conf, upper_limits) if not (l <= v <= u)]) # print("Limits violated") # wait_if_gui() remove_body(sub_robot) return None # print("IK iterations:", iteration) solutions.append(kinematic_conf) break else: remove_body(sub_robot) return None # TODO: finally: remove_body(sub_robot) return solutions def sub_inverse_kinematics(robot, first_joint, target_link, target_pose, **kwargs): solutions = plan_cartesian_motion(robot, first_joint, target_link, [target_pose], **kwargs) if solutions: return solutions[0] return None ##################################### def get_lifetime(lifetime): if lifetime is None: return 0 return lifetime def add_parameter(name, lower=0., upper=1., initial=0.): # TODO: make a slider that controls the step in the trajectory # TODO: could store a list of savers return p.addUserDebugParameter(name, lower, upper, initial, physicsClientId=CLIENT) def add_button(name, initial=False): # If Minimum value > maximum value a button instead of slider will appear # For a button, the value of getUserDebugParameter for a button increases 1 at each button press return add_parameter(name, lower=True, upper=False, initial=initial) def read_parameter(debug): return p.readUserDebugParameter(debug, physicsClientId=CLIENT) def read_counter(debug): return int(read_parameter(debug)) def read_button(debug): return read_counter(debug) % 2 == 1 def add_text(text, position=unit_point(), color=BLACK, lifetime=None, parent=NULL_ID, parent_link=BASE_LINK): return p.addUserDebugText(str(text), textPosition=position, textColorRGB=color[:3], # textSize=1, lifeTime=get_lifetime(lifetime), parentObjectUniqueId=parent, parentLinkIndex=parent_link, physicsClientId=CLIENT) def add_line(start, end, color=BLACK, width=1, lifetime=None, parent=NULL_ID, parent_link=BASE_LINK): assert (len(start) == 3) and (len(end) == 3) return p.addUserDebugLine(start, end, lineColorRGB=color[:3], lineWidth=width, lifeTime=get_lifetime(lifetime), parentObjectUniqueId=parent, parentLinkIndex=parent_link, physicsClientId=CLIENT) def remove_debug(debug): p.removeUserDebugItem(debug, physicsClientId=CLIENT) remove_handle = remove_debug def remove_handles(handles): with LockRenderer(): for handle in handles: remove_debug(handle) handles[:] = [] def remove_all_debug(): p.removeAllUserDebugItems(physicsClientId=CLIENT) def add_body_name(body, name=None, **kwargs): if name is None: name = get_name(body) with PoseSaver(body): set_pose(body, unit_pose()) lower, upper = get_aabb(body) # position = (0, 0, upper[2]) position = upper return add_text(name, position=position, parent=body, **kwargs) # removeUserDebugItem def add_segments(points, closed=False, **kwargs): # TODO: draw_segments lines = [] for v1, v2 in get_pairs(points): lines.append(add_line(v1, v2, **kwargs)) if closed: lines.append(add_line(points[-1], points[0], **kwargs)) return lines def draw_link_name(body, link=BASE_LINK): return add_text(get_link_name(body, link), position=(0, 0.2, 0), parent=body, parent_link=link) def draw_pose(pose, length=0.1, d=3, **kwargs): origin_world = tform_point(pose, np.zeros(3)) handles = [] for k in range(d): axis = np.zeros(3) axis[k] = 1 axis_world = tform_point(pose, length*axis) handles.append(add_line(origin_world, axis_world, color=axis, **kwargs)) return handles def draw_global_system(**kwargs): return draw_pose(Pose(), length=1., **kwargs) def draw_pose2d(pose2d, z=0., d=2, **kwargs): return draw_pose(pose_from_pose2d(pose2d, z), d=d, **kwargs) def draw_base_limits(limits, z=1e-2, **kwargs): lower, upper = limits vertices = [(lower[0], lower[1], z), (lower[0], upper[1], z), (upper[0], upper[1], z), (upper[0], lower[1], z)] return add_segments(vertices, closed=True, **kwargs) def get_circle_vertices(center, radius, n=24): vertices = [] for i in range(n): theta = i*2*math.pi/n unit = unit_from_theta(theta) if len(center) == 3: unit = np.append(unit, [0.]) vertices.append(center + radius*unit) return vertices def draw_circle(center, radius, n=24, **kwargs): return add_segments(get_circle_vertices(center, radius, n=n), closed=True, **kwargs) def draw_aabb(aabb, **kwargs): return [add_line(p1, p2, **kwargs) for p1, p2 in get_aabb_edges(aabb)] def draw_oobb(oobb, origin=False, **kwargs): aabb, pose = oobb handles = [] if origin: handles.extend(draw_pose(pose, **kwargs)) for edge in get_aabb_edges(aabb): p1, p2 = apply_affine(pose, edge) handles.append(add_line(p1, p2, **kwargs)) return handles def draw_point(point, size=0.01, **kwargs): lines = [] for i in range(len(point)): axis = np.zeros(len(point)) axis[i] = 1.0 p1 = np.array(point) - size/2 * axis p2 = np.array(point) + size/2 * axis lines.append(add_line(p1, p2, **kwargs)) return lines def get_face_edges(face): # return list(combinations(face, 2)) return get_wrapped_pairs(face) # TODO: lines versus planes def draw_mesh(mesh, **kwargs): verts, faces = mesh handles = [] with LockRenderer(): for face in faces: for i1, i2 in get_face_edges(face): handles.append(add_line(verts[i1], verts[i2], **kwargs)) return handles def was_ray_hit(ray_result): if ray_result is None: return False return ray_result.objectUniqueId != NULL_ID def get_hit_position(ray, ray_result=None): if was_ray_hit(ray_result): return ray_result.hit_position return ray.end def draw_ray(ray, ray_result=None, visible_color=GREEN, occluded_color=RED, **kwargs): if ray_result is None: return [add_line(ray.start, ray.end, color=visible_color, **kwargs)] hit_position = get_hit_position(ray, ray_result) return [ add_line(ray.start, hit_position, color=visible_color, **kwargs), add_line(hit_position, ray.end, color=occluded_color, **kwargs), ] ##################################### # Polygonal surfaces def create_rectangular_surface(width, length): # TODO: unify with rectangular_mesh extents = np.array([width, length, 0]) / 2. unit_corners = [(-1, -1), (+1, -1), (+1, +1), (-1, +1)] return [np.append(c, 0) * extents for c in unit_corners] def is_point_in_polygon(point, polygon): # TODO: rename polygon to path # TODO: is_point_in_polytope # TODO: aabb_contains_point sign = None for i in range(len(polygon)): v1, v2 = np.array(polygon[i - 1][:2]), np.array(polygon[i][:2]) delta = v2 - v1 normal = np.array([-delta[1], delta[0]]) dist = normal.dot(point[:2] - v1) if i == 0: # TODO: equality? sign = np.sign(dist) elif np.sign(dist) != sign: return False return True def distance_from_segment(x1, y1, x2, y2, x3, y3): # x3, y3 is the point # https://stackoverflow.com/questions/10983872/distance-from-a-point-to-a-polygon # https://stackoverflow.com/questions/849211/shortest-distance-between-a-point-and-a-line-segment px = x2 - x1 py = y2 - y1 norm = px*px + py*py u = ((x3 - x1) * px + (y3 - y1) * py) / float(norm) if u > 1: u = 1 elif u < 0: u = 0 x = x1 + u * px y = y1 + u * py dx = x - x3 dy = y - y3 return math.sqrt(dx*dx + dy*dy) def tform_point(affine, point): return point_from_pose(multiply(affine, Pose(point=point))) def tform_points(affine, points): return [tform_point(affine, p) for p in points] apply_affine = tform_points def is_mesh_on_surface(polygon, world_from_surface, mesh, world_from_mesh, epsilon=1e-2): surface_from_mesh = multiply(invert(world_from_surface), world_from_mesh) points_surface = apply_affine(surface_from_mesh, mesh.vertices) min_z = np.min(points_surface[:, 2]) return (abs(min_z) < epsilon) and all(is_point_in_polygon(point, polygon) for point in points_surface) def is_point_on_surface(polygon, world_from_surface, point_world): [point_surface] = apply_affine(invert(world_from_surface), [point_world]) return is_point_in_polygon(point_surface, polygon[::-1]) def sample_polygon_tform(polygon, points): min_z = np.min(points[:, 2]) aabb_min = np.min(polygon, axis=0) aabb_max = np.max(polygon, axis=0) while True: x = np.random.uniform(aabb_min[0], aabb_max[0]) y = np.random.uniform(aabb_min[1], aabb_max[1]) theta = np.random.uniform(0, 2 * np.pi) point = Point(x, y, -min_z) quat = Euler(yaw=theta) surface_from_origin = Pose(point, quat) yield surface_from_origin # if all(is_point_in_polygon(p, polygon) for p in apply_affine(surface_from_origin, points)): # yield surface_from_origin def sample_surface_pose(polygon, world_from_surface, mesh): for surface_from_origin in sample_polygon_tform(polygon, mesh.vertices): world_from_mesh = multiply(world_from_surface, surface_from_origin) if is_mesh_on_surface(polygon, world_from_surface, mesh, world_from_mesh): yield world_from_mesh ##################################### # Sampling edges def sample_categorical(categories): from bisect import bisect names = categories.keys() cutoffs = np.cumsum([categories[name] for name in names])/sum(categories.values()) return names[bisect(cutoffs, np.random.random())] def sample_edge_point(polygon, radius): edges = get_wrapped_pairs(polygon) edge_weights = {i: max(get_length(v2 - v1) - 2 * radius, 0) for i, (v1, v2) in enumerate(edges)} # TODO: fail if no options while True: index = sample_categorical(edge_weights) v1, v2 = edges[index] t = np.random.uniform(radius, get_length(v2 - v1) - 2 * radius) yield t * get_unit_vector(v2 - v1) + v1 def get_closest_edge_point(polygon, point): # TODO: always pick perpendicular to the edge edges = get_wrapped_pairs(polygon) best = None for v1, v2 in edges: proj = (v2 - v1)[:2].dot((point - v1)[:2]) if proj <= 0: closest = v1 elif get_length((v2 - v1)[:2]) <= proj: closest = v2 else: closest = proj * get_unit_vector((v2 - v1)) if (best is None) or (get_length((point - closest)[:2]) < get_length((point - best)[:2])): best = closest return best def sample_edge_pose(polygon, world_from_surface, mesh): radius = max(get_length(v[:2]) for v in mesh.vertices) origin_from_base = Pose(Point(z=p.min(mesh.vertices[:, 2]))) for point in sample_edge_point(polygon, radius): theta = np.random.uniform(0, 2 * np.pi) surface_from_origin = Pose(point, Euler(yaw=theta)) yield multiply(world_from_surface, surface_from_origin, origin_from_base) ##################################### # Convex Hulls def convex_hull(points): from scipy.spatial import ConvexHull # TODO: cKDTree is faster, but KDTree can do all pairs closest hull = ConvexHull(list(points), incremental=False) new_indices = {i: ni for ni, i in enumerate(hull.vertices)} vertices = hull.points[hull.vertices, :] faces = np.vectorize(lambda i: new_indices[i])(hull.simplices) return Mesh(vertices.tolist(), faces.tolist()) def convex_signed_area(vertices): if len(vertices) < 3: return 0. vertices = [np.array(v[:2]) for v in vertices] segments = get_wrapped_pairs(vertices) return sum(np.cross(v1, v2) for v1, v2 in segments) / 2. def convex_area(vertices): return abs(convex_signed_area(vertices)) def convex_centroid(vertices): # TODO: also applies to non-overlapping polygons vertices = [np.array(v[:2]) for v in vertices] segments = get_wrapped_pairs(vertices) return sum((v1 + v2)*np.cross(v1, v2) for v1, v2 in segments) / (6.*convex_signed_area(vertices)) def get_normal(v1, v2, v3): return get_unit_vector(np.cross(np.array(v3) - v1, np.array(v2) - v1)) def get_rotation(v1, v2, v3): import scipy a1 = np.array(v3) - v1 a2 = np.array(v2) - v1 a3 = np.cross(a2, a1) return scipy.linalg.orth([a1, a2, a3]) def get_mesh_normal(face, interior): assert len(face) == 3 normal = get_normal(*face) if normal.dot(interior) > 0: normal *= -1 return normal def orient_face(vertices, face, point=None): if point is None: point = np.average(vertices, axis=0) v1, v2, v3 = vertices[face] normal = get_normal(v1, v2, v3) if normal.dot(point - v1) < 0: face = face[::-1] return tuple(face) def mesh_from_points(points, under=True): vertices, faces = map(np.array, convex_hull(points)) centroid = np.average(vertices, axis=0) new_faces = [orient_face(vertices, face, point=centroid) for face in faces] if under: new_faces.extend(map(tuple, map(reversed, list(new_faces)))) return Mesh(vertices.tolist(), new_faces) def rectangular_mesh(width, length): # TODO: 2.5d polygon extents = np.array([width, length, 0])/2. unit_corners = [(-1, -1), (+1, -1), (+1, +1), (-1, +1)] vertices = [np.append(c, [0])*extents for c in unit_corners] faces = [(0, 1, 2), (2, 3, 0)] return Mesh(vertices, faces) def tform_mesh(affine, mesh): return Mesh(apply_affine(affine, mesh.vertices), mesh.faces) def grow_polygon(points, radius=0., n=8): points2d = [point[:2] for point in points] if not points2d: return [] vertices = convex_hull(points2d).vertices if radius == 0: return vertices grown_points = [] for vertex in vertices: grown_points.append(vertex) for theta in np.linspace(0, 2*PI, num=n, endpoint=False): grown_points.append(vertex + radius * unit_from_theta(theta)) return convex_hull(grown_points).vertices ##################################### # Mesh & Pointcloud Files def obj_file_from_mesh(mesh, under=True): """ Creates a *.obj mesh string :param mesh: tuple of list of vertices and list of faces :return: *.obj mesh string """ vertices, faces = mesh s = 'g Mesh\n' # TODO: string writer for v in vertices: assert(len(v) == 3) s += '\nv {}'.format(' '.join(map(str, v))) for f in faces: # assert(len(f) == 3) # Not necessarily true f = [i+1 for i in f] # Assumes mesh is indexed from zero s += '\nf {}'.format(' '.join(map(str, f))) if under: s += '\nf {}'.format(' '.join(map(str, reversed(f)))) return s def get_connected_components(vertices, edges): undirected_edges = defaultdict(set) for v1, v2 in edges: undirected_edges[v1].add(v2) undirected_edges[v2].add(v1) clusters = [] processed = set() for v0 in vertices: if v0 in processed: continue processed.add(v0) cluster = {v0} queue = deque([v0]) while queue: v1 = queue.popleft() for v2 in (undirected_edges[v1] - processed): processed.add(v2) cluster.add(v2) queue.append(v2) if cluster: # preserves order clusters.append(frozenset(cluster)) return clusters def read_obj(path, decompose=True): mesh = Mesh([], []) meshes = {} vertices = [] faces = [] for line in read(path).split('\n'): tokens = line.split() if not tokens: continue if tokens[0] == 'o': name = tokens[1] mesh = Mesh([], []) meshes[name] = mesh elif tokens[0] == 'v': vertex = tuple(map(float, tokens[1:4])) vertices.append(vertex) elif tokens[0] in ('vn', 's'): pass elif tokens[0] == 'f': face = tuple(int(token.split('/')[0]) - 1 for token in tokens[1:]) faces.append(face) mesh.faces.append(face) if not decompose: return Mesh(vertices, faces) # TODO: separate into a standalone method # if not meshes: # # TODO: ensure this still works if no objects # meshes[None] = mesh # new_meshes = {} # TODO: make each triangle a separate object for name, mesh in meshes.items(): indices = sorted({i for face in mesh.faces for i in face}) mesh.vertices[:] = [vertices[i] for i in indices] new_index_from_old = {i2: i1 for i1, i2 in enumerate(indices)} mesh.faces[:] = [tuple(new_index_from_old[i1] for i1 in face) for face in mesh.faces] return meshes def read_stl(path, decompose=True): mesh = Mesh([], []) meshes = {} data = trimesh.load_mesh(path, enable_post_processing=True, solid=True) faces = data.faces vertices = data.vertices if not decompose: mesh_data = Mesh(vertices, faces) return mesh_data for name, mesh in meshes.items(): indices = sorted({i for face in mesh.faces for i in face}) mesh.vertices[:] = [vertices[i] for i in indices] new_index_from_old = {i2: i1 for i1, i2 in enumerate(indices)} mesh.faces[:] = [tuple(new_index_from_old[i1] for i1 in face) for face in mesh.faces] return meshes def transform_obj_file(obj_string, transformation): new_lines = [] for line in obj_string.split('\n'): tokens = line.split() if not tokens or (tokens[0] != 'v'): new_lines.append(line) continue vertex = list(map(float, tokens[1:])) transformed_vertex = transformation.dot(vertex) new_lines.append('v {}'.format(' '.join(map(str, transformed_vertex)))) return '\n'.join(new_lines) def read_mesh_off(path, scale=1.0): """ Reads a *.off mesh file :param path: path to the *.off mesh file :return: tuple of list of vertices and list of faces """ with open(path) as f: assert (f.readline().split()[0] == 'OFF'), 'Not OFF file' nv, nf, ne = [int(x) for x in f.readline().split()] verts = [tuple(scale * float(v) for v in f.readline().split()) for _ in range(nv)] faces = [tuple(map(int, f.readline().split()[1:])) for _ in range(nf)] return Mesh(verts, faces) def read_pcd_file(path): """ Reads a *.pcd pointcloud file :param path: path to the *.pcd pointcloud file :return: list of points """ with open(path) as f: data = f.readline().split() num_points = 0 while data[0] != 'DATA': if data[0] == 'POINTS': num_points = int(data[1]) data = f.readline().split() continue return [tuple(map(float, f.readline().split())) for _ in range(num_points)] # TODO: factor out things that don't depend on pybullet ##################################### # https://github.com/kohterai/OBJ-Parser """ def readWrl(filename, name='wrlObj', scale=1.0, color='black'): def readOneObj(): vl = [] while True: line = fl.readline() split = line.split(',') if len(split) != 2: break split = split[0].split() if len(split) == 3: vl.append(np.array([scale*float(x) for x in split]+[1.0])) else: break print ' verts', len(vl), verts = np.vstack(vl).T while line.split()[0] != 'coordIndex': line = fl.readline() line = fl.readline() faces = [] while True: line = fl.readline() split = line.split(',') if len(split) > 3: faces.append(np.array([int(x) for x in split[:3]])) else: break print 'faces', len(faces) return Prim(verts, faces, hu.Pose(0,0,0,0), None, name=name+str(len(prims))) fl = open(filename) assert fl.readline().split()[0] == '#VRML', 'Not VRML file?' prims = [] while True: line = fl.readline() if not line: break split = line.split() if not split or split[0] != 'point': continue else: print 'Object', len(prims) prims.append(readOneObj()) # Have one "part" so that shadows are simpler part = Shape(prims, None, name=name+'_part') # Keep color only in top entry. return Shape([part], None, name=name, color=color) """
181,993
Python
36.278574
174
0.626991
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/pybullet_tools/pr2_never_collisions.py
# TODO: maybe some OpenRAVE links are disabled # http://openrave.org/docs/0.8.2/collada_robot_extensions/ # < extra # type = "collision" > # < technique # profile = "OpenRAVE" # ignore_link_pair NEVER_COLLISIONS = [('base_bellow_link', 'base_footprint'), ('base_bellow_link', 'bl_caster_l_wheel_link'), ('base_bellow_link', 'bl_caster_r_wheel_link'), ('base_bellow_link', 'bl_caster_rotation_link'), ('base_bellow_link', 'br_caster_l_wheel_link'), ('base_bellow_link', 'br_caster_r_wheel_link'), ('base_bellow_link', 'br_caster_rotation_link'), ('base_bellow_link', 'double_stereo_link'), ('base_bellow_link', 'fl_caster_l_wheel_link'), ('base_bellow_link', 'fl_caster_r_wheel_link'), ('base_bellow_link', 'fl_caster_rotation_link'), ('base_bellow_link', 'fr_caster_l_wheel_link'), ('base_bellow_link', 'fr_caster_r_wheel_link'), ('base_bellow_link', 'fr_caster_rotation_link'), ('base_bellow_link', 'head_pan_link'), ('base_bellow_link', 'head_plate_frame'), ('base_bellow_link', 'head_tilt_link'), ('base_bellow_link', 'l_elbow_flex_link'), ('base_bellow_link', 'l_forearm_link'), ('base_bellow_link', 'l_forearm_roll_link'), ('base_bellow_link', 'l_gripper_motor_accelerometer_link'), ('base_bellow_link', 'l_shoulder_lift_link'), ('base_bellow_link', 'l_shoulder_pan_link'), ('base_bellow_link', 'l_upper_arm_link'), ('base_bellow_link', 'l_upper_arm_roll_link'), ('base_bellow_link', 'l_wrist_roll_link'), ('base_bellow_link', 'laser_tilt_mount_link'), ('base_bellow_link', 'r_elbow_flex_link'), ('base_bellow_link', 'r_forearm_link'), ('base_bellow_link', 'r_forearm_roll_link'), ('base_bellow_link', 'r_gripper_motor_accelerometer_link'), ('base_bellow_link', 'r_shoulder_lift_link'), ('base_bellow_link', 'r_shoulder_pan_link'), ('base_bellow_link', 'r_upper_arm_link'), ('base_bellow_link', 'r_upper_arm_roll_link'), ('base_bellow_link', 'r_wrist_flex_link'), ('base_bellow_link', 'r_wrist_roll_link'), ('base_bellow_link', 'sensor_mount_link'), ('base_footprint', 'bl_caster_l_wheel_link'), ('base_footprint', 'bl_caster_r_wheel_link'), ('base_footprint', 'bl_caster_rotation_link'), ('base_footprint', 'br_caster_l_wheel_link'), ('base_footprint', 'br_caster_r_wheel_link'), ('base_footprint', 'br_caster_rotation_link'), ('base_footprint', 'double_stereo_link'), ('base_footprint', 'fl_caster_l_wheel_link'), ('base_footprint', 'fl_caster_r_wheel_link'), ('base_footprint', 'fl_caster_rotation_link'), ('base_footprint', 'fr_caster_l_wheel_link'), ('base_footprint', 'fr_caster_r_wheel_link'), ('base_footprint', 'fr_caster_rotation_link'), ('base_footprint', 'head_pan_link'), ('base_footprint', 'head_plate_frame'), ('base_footprint', 'head_tilt_link'), ('base_footprint', 'l_elbow_flex_link'), ('base_footprint', 'l_forearm_link'), ('base_footprint', 'l_forearm_roll_link'), ('base_footprint', 'l_gripper_l_finger_link'), ('base_footprint', 'l_gripper_l_finger_tip_link'), ('base_footprint', 'l_gripper_motor_accelerometer_link'), ('base_footprint', 'l_gripper_palm_link'), ('base_footprint', 'l_gripper_r_finger_link'), ('base_footprint', 'l_gripper_r_finger_tip_link'), ('base_footprint', 'l_shoulder_lift_link'), ('base_footprint', 'l_shoulder_pan_link'), ('base_footprint', 'l_upper_arm_link'), ('base_footprint', 'l_upper_arm_roll_link'), ('base_footprint', 'l_wrist_flex_link'), ('base_footprint', 'l_wrist_roll_link'), ('base_footprint', 'laser_tilt_mount_link'), ('base_footprint', 'r_elbow_flex_link'), ('base_footprint', 'r_forearm_link'), ('base_footprint', 'r_forearm_roll_link'), ('base_footprint', 'r_gripper_l_finger_link'), ('base_footprint', 'r_gripper_l_finger_tip_link'), ('base_footprint', 'r_gripper_motor_accelerometer_link'), ('base_footprint', 'r_gripper_palm_link'), ('base_footprint', 'r_gripper_r_finger_link'), ('base_footprint', 'r_gripper_r_finger_tip_link'), ('base_footprint', 'r_shoulder_lift_link'), ('base_footprint', 'r_shoulder_pan_link'), ('base_footprint', 'r_upper_arm_link'), ('base_footprint', 'r_upper_arm_roll_link'), ('base_footprint', 'r_wrist_flex_link'), ('base_footprint', 'r_wrist_roll_link'), ('base_footprint', 'sensor_mount_link'), ('base_footprint', 'torso_lift_link'), ('base_link', 'double_stereo_link'), ('base_link', 'head_pan_link'), ('base_link', 'head_plate_frame'), ('base_link', 'head_tilt_link'), ('base_link', 'l_shoulder_lift_link'), ('base_link', 'l_shoulder_pan_link'), ('base_link', 'l_upper_arm_link'), ('base_link', 'l_upper_arm_roll_link'), ('base_link', 'laser_tilt_mount_link'), ('base_link', 'r_shoulder_lift_link'), ('base_link', 'r_shoulder_pan_link'), ('base_link', 'r_upper_arm_link'), ('base_link', 'r_upper_arm_roll_link'), ('base_link', 'sensor_mount_link'), ('bl_caster_l_wheel_link', 'bl_caster_r_wheel_link'), ('bl_caster_l_wheel_link', 'br_caster_l_wheel_link'), ('bl_caster_l_wheel_link', 'br_caster_r_wheel_link'), ('bl_caster_l_wheel_link', 'br_caster_rotation_link'), ('bl_caster_l_wheel_link', 'double_stereo_link'), ('bl_caster_l_wheel_link', 'fl_caster_l_wheel_link'), ('bl_caster_l_wheel_link', 'fl_caster_r_wheel_link'), ('bl_caster_l_wheel_link', 'fl_caster_rotation_link'), ('bl_caster_l_wheel_link', 'fr_caster_l_wheel_link'), ('bl_caster_l_wheel_link', 'fr_caster_r_wheel_link'), ('bl_caster_l_wheel_link', 'fr_caster_rotation_link'), ('bl_caster_l_wheel_link', 'head_pan_link'), ('bl_caster_l_wheel_link', 'head_plate_frame'), ('bl_caster_l_wheel_link', 'head_tilt_link'), ('bl_caster_l_wheel_link', 'l_elbow_flex_link'), ('bl_caster_l_wheel_link', 'l_forearm_link'), ('bl_caster_l_wheel_link', 'l_forearm_roll_link'), ('bl_caster_l_wheel_link', 'l_gripper_motor_accelerometer_link'), ('bl_caster_l_wheel_link', 'l_shoulder_lift_link'), ('bl_caster_l_wheel_link', 'l_shoulder_pan_link'), ('bl_caster_l_wheel_link', 'l_upper_arm_link'), ('bl_caster_l_wheel_link', 'l_upper_arm_roll_link'), ('bl_caster_l_wheel_link', 'l_wrist_roll_link'), ('bl_caster_l_wheel_link', 'laser_tilt_mount_link'), ('bl_caster_l_wheel_link', 'r_elbow_flex_link'), ('bl_caster_l_wheel_link', 'r_forearm_link'), ('bl_caster_l_wheel_link', 'r_forearm_roll_link'), ('bl_caster_l_wheel_link', 'r_gripper_l_finger_link'), ('bl_caster_l_wheel_link', 'r_gripper_l_finger_tip_link'), ('bl_caster_l_wheel_link', 'r_gripper_motor_accelerometer_link'), ('bl_caster_l_wheel_link', 'r_gripper_palm_link'), ('bl_caster_l_wheel_link', 'r_gripper_r_finger_link'), ('bl_caster_l_wheel_link', 'r_gripper_r_finger_tip_link'), ('bl_caster_l_wheel_link', 'r_shoulder_lift_link'), ('bl_caster_l_wheel_link', 'r_shoulder_pan_link'), ('bl_caster_l_wheel_link', 'r_upper_arm_link'), ('bl_caster_l_wheel_link', 'r_upper_arm_roll_link'), ('bl_caster_l_wheel_link', 'r_wrist_flex_link'), ('bl_caster_l_wheel_link', 'r_wrist_roll_link'), ('bl_caster_l_wheel_link', 'sensor_mount_link'), ('bl_caster_l_wheel_link', 'torso_lift_link'), ('bl_caster_r_wheel_link', 'br_caster_l_wheel_link'), ('bl_caster_r_wheel_link', 'br_caster_r_wheel_link'), ('bl_caster_r_wheel_link', 'br_caster_rotation_link'), ('bl_caster_r_wheel_link', 'double_stereo_link'), ('bl_caster_r_wheel_link', 'fl_caster_l_wheel_link'), ('bl_caster_r_wheel_link', 'fl_caster_r_wheel_link'), ('bl_caster_r_wheel_link', 'fl_caster_rotation_link'), ('bl_caster_r_wheel_link', 'fr_caster_l_wheel_link'), ('bl_caster_r_wheel_link', 'fr_caster_r_wheel_link'), ('bl_caster_r_wheel_link', 'fr_caster_rotation_link'), ('bl_caster_r_wheel_link', 'head_pan_link'), ('bl_caster_r_wheel_link', 'head_plate_frame'), ('bl_caster_r_wheel_link', 'head_tilt_link'), ('bl_caster_r_wheel_link', 'l_elbow_flex_link'), ('bl_caster_r_wheel_link', 'l_forearm_roll_link'), ('bl_caster_r_wheel_link', 'l_gripper_motor_accelerometer_link'), ('bl_caster_r_wheel_link', 'l_shoulder_lift_link'), ('bl_caster_r_wheel_link', 'l_shoulder_pan_link'), ('bl_caster_r_wheel_link', 'l_upper_arm_link'), ('bl_caster_r_wheel_link', 'l_upper_arm_roll_link'), ('bl_caster_r_wheel_link', 'laser_tilt_mount_link'), ('bl_caster_r_wheel_link', 'r_elbow_flex_link'), ('bl_caster_r_wheel_link', 'r_forearm_link'), ('bl_caster_r_wheel_link', 'r_forearm_roll_link'), ('bl_caster_r_wheel_link', 'r_gripper_l_finger_link'), ('bl_caster_r_wheel_link', 'r_gripper_l_finger_tip_link'), ('bl_caster_r_wheel_link', 'r_gripper_motor_accelerometer_link'), ('bl_caster_r_wheel_link', 'r_gripper_palm_link'), ('bl_caster_r_wheel_link', 'r_gripper_r_finger_link'), ('bl_caster_r_wheel_link', 'r_gripper_r_finger_tip_link'), ('bl_caster_r_wheel_link', 'r_shoulder_lift_link'), ('bl_caster_r_wheel_link', 'r_shoulder_pan_link'), ('bl_caster_r_wheel_link', 'r_upper_arm_link'), ('bl_caster_r_wheel_link', 'r_upper_arm_roll_link'), ('bl_caster_r_wheel_link', 'r_wrist_flex_link'), ('bl_caster_r_wheel_link', 'r_wrist_roll_link'), ('bl_caster_r_wheel_link', 'sensor_mount_link'), ('bl_caster_r_wheel_link', 'torso_lift_link'), ('bl_caster_rotation_link', 'br_caster_l_wheel_link'), ('bl_caster_rotation_link', 'br_caster_r_wheel_link'), ('bl_caster_rotation_link', 'br_caster_rotation_link'), ('bl_caster_rotation_link', 'double_stereo_link'), ('bl_caster_rotation_link', 'fl_caster_l_wheel_link'), ('bl_caster_rotation_link', 'fl_caster_r_wheel_link'), ('bl_caster_rotation_link', 'fl_caster_rotation_link'), ('bl_caster_rotation_link', 'fr_caster_l_wheel_link'), ('bl_caster_rotation_link', 'fr_caster_r_wheel_link'), ('bl_caster_rotation_link', 'fr_caster_rotation_link'), ('bl_caster_rotation_link', 'head_pan_link'), ('bl_caster_rotation_link', 'head_plate_frame'), ('bl_caster_rotation_link', 'head_tilt_link'), ('bl_caster_rotation_link', 'l_elbow_flex_link'), ('bl_caster_rotation_link', 'l_forearm_roll_link'), ('bl_caster_rotation_link', 'l_shoulder_lift_link'), ('bl_caster_rotation_link', 'l_shoulder_pan_link'), ('bl_caster_rotation_link', 'l_upper_arm_link'), ('bl_caster_rotation_link', 'l_upper_arm_roll_link'), ('bl_caster_rotation_link', 'laser_tilt_mount_link'), ('bl_caster_rotation_link', 'r_elbow_flex_link'), ('bl_caster_rotation_link', 'r_forearm_link'), ('bl_caster_rotation_link', 'r_forearm_roll_link'), ('bl_caster_rotation_link', 'r_gripper_l_finger_link'), ('bl_caster_rotation_link', 'r_gripper_l_finger_tip_link'), ('bl_caster_rotation_link', 'r_gripper_motor_accelerometer_link'), ('bl_caster_rotation_link', 'r_gripper_palm_link'), ('bl_caster_rotation_link', 'r_gripper_r_finger_link'), ('bl_caster_rotation_link', 'r_shoulder_lift_link'), ('bl_caster_rotation_link', 'r_shoulder_pan_link'), ('bl_caster_rotation_link', 'r_upper_arm_link'), ('bl_caster_rotation_link', 'r_upper_arm_roll_link'), ('bl_caster_rotation_link', 'r_wrist_flex_link'), ('bl_caster_rotation_link', 'r_wrist_roll_link'), ('bl_caster_rotation_link', 'sensor_mount_link'), ('bl_caster_rotation_link', 'torso_lift_link'), ('br_caster_l_wheel_link', 'br_caster_r_wheel_link'), ('br_caster_l_wheel_link', 'double_stereo_link'), ('br_caster_l_wheel_link', 'fl_caster_l_wheel_link'), ('br_caster_l_wheel_link', 'fl_caster_r_wheel_link'), ('br_caster_l_wheel_link', 'fl_caster_rotation_link'), ('br_caster_l_wheel_link', 'fr_caster_l_wheel_link'), ('br_caster_l_wheel_link', 'fr_caster_r_wheel_link'), ('br_caster_l_wheel_link', 'fr_caster_rotation_link'), ('br_caster_l_wheel_link', 'head_pan_link'), ('br_caster_l_wheel_link', 'head_plate_frame'), ('br_caster_l_wheel_link', 'head_tilt_link'), ('br_caster_l_wheel_link', 'l_elbow_flex_link'), ('br_caster_l_wheel_link', 'l_forearm_link'), ('br_caster_l_wheel_link', 'l_forearm_roll_link'), ('br_caster_l_wheel_link', 'l_gripper_l_finger_link'), ('br_caster_l_wheel_link', 'l_gripper_l_finger_tip_link'), ('br_caster_l_wheel_link', 'l_gripper_motor_accelerometer_link'), ('br_caster_l_wheel_link', 'l_gripper_palm_link'), ('br_caster_l_wheel_link', 'l_gripper_r_finger_link'), ('br_caster_l_wheel_link', 'l_gripper_r_finger_tip_link'), ('br_caster_l_wheel_link', 'l_shoulder_lift_link'), ('br_caster_l_wheel_link', 'l_shoulder_pan_link'), ('br_caster_l_wheel_link', 'l_upper_arm_link'), ('br_caster_l_wheel_link', 'l_upper_arm_roll_link'), ('br_caster_l_wheel_link', 'l_wrist_flex_link'), ('br_caster_l_wheel_link', 'l_wrist_roll_link'), ('br_caster_l_wheel_link', 'laser_tilt_mount_link'), ('br_caster_l_wheel_link', 'r_elbow_flex_link'), ('br_caster_l_wheel_link', 'r_forearm_roll_link'), ('br_caster_l_wheel_link', 'r_gripper_motor_accelerometer_link'), ('br_caster_l_wheel_link', 'r_shoulder_lift_link'), ('br_caster_l_wheel_link', 'r_shoulder_pan_link'), ('br_caster_l_wheel_link', 'r_upper_arm_link'), ('br_caster_l_wheel_link', 'r_upper_arm_roll_link'), ('br_caster_l_wheel_link', 'sensor_mount_link'), ('br_caster_l_wheel_link', 'torso_lift_link'), ('br_caster_r_wheel_link', 'double_stereo_link'), ('br_caster_r_wheel_link', 'fl_caster_l_wheel_link'), ('br_caster_r_wheel_link', 'fl_caster_r_wheel_link'), ('br_caster_r_wheel_link', 'fl_caster_rotation_link'), ('br_caster_r_wheel_link', 'fr_caster_l_wheel_link'), ('br_caster_r_wheel_link', 'fr_caster_r_wheel_link'), ('br_caster_r_wheel_link', 'fr_caster_rotation_link'), ('br_caster_r_wheel_link', 'head_pan_link'), ('br_caster_r_wheel_link', 'head_plate_frame'), ('br_caster_r_wheel_link', 'head_tilt_link'), ('br_caster_r_wheel_link', 'l_elbow_flex_link'), ('br_caster_r_wheel_link', 'l_forearm_link'), ('br_caster_r_wheel_link', 'l_forearm_roll_link'), ('br_caster_r_wheel_link', 'l_gripper_l_finger_link'), ('br_caster_r_wheel_link', 'l_gripper_l_finger_tip_link'), ('br_caster_r_wheel_link', 'l_gripper_motor_accelerometer_link'), ('br_caster_r_wheel_link', 'l_gripper_palm_link'), ('br_caster_r_wheel_link', 'l_gripper_r_finger_link'), ('br_caster_r_wheel_link', 'l_gripper_r_finger_tip_link'), ('br_caster_r_wheel_link', 'l_shoulder_lift_link'), ('br_caster_r_wheel_link', 'l_shoulder_pan_link'), ('br_caster_r_wheel_link', 'l_upper_arm_link'), ('br_caster_r_wheel_link', 'l_upper_arm_roll_link'), ('br_caster_r_wheel_link', 'l_wrist_flex_link'), ('br_caster_r_wheel_link', 'l_wrist_roll_link'), ('br_caster_r_wheel_link', 'laser_tilt_mount_link'), ('br_caster_r_wheel_link', 'r_elbow_flex_link'), ('br_caster_r_wheel_link', 'r_forearm_roll_link'), ('br_caster_r_wheel_link', 'r_gripper_motor_accelerometer_link'), ('br_caster_r_wheel_link', 'r_shoulder_lift_link'), ('br_caster_r_wheel_link', 'r_shoulder_pan_link'), ('br_caster_r_wheel_link', 'r_upper_arm_link'), ('br_caster_r_wheel_link', 'r_upper_arm_roll_link'), ('br_caster_r_wheel_link', 'sensor_mount_link'), ('br_caster_r_wheel_link', 'torso_lift_link'), ('br_caster_rotation_link', 'double_stereo_link'), ('br_caster_rotation_link', 'fl_caster_l_wheel_link'), ('br_caster_rotation_link', 'fl_caster_r_wheel_link'), ('br_caster_rotation_link', 'fl_caster_rotation_link'), ('br_caster_rotation_link', 'fr_caster_l_wheel_link'), ('br_caster_rotation_link', 'fr_caster_r_wheel_link'), ('br_caster_rotation_link', 'fr_caster_rotation_link'), ('br_caster_rotation_link', 'head_pan_link'), ('br_caster_rotation_link', 'head_plate_frame'), ('br_caster_rotation_link', 'head_tilt_link'), ('br_caster_rotation_link', 'l_elbow_flex_link'), ('br_caster_rotation_link', 'l_forearm_link'), ('br_caster_rotation_link', 'l_forearm_roll_link'), ('br_caster_rotation_link', 'l_gripper_motor_accelerometer_link'), ('br_caster_rotation_link', 'l_gripper_palm_link'), ('br_caster_rotation_link', 'l_gripper_r_finger_link'), ('br_caster_rotation_link', 'l_gripper_r_finger_tip_link'), ('br_caster_rotation_link', 'l_shoulder_lift_link'), ('br_caster_rotation_link', 'l_shoulder_pan_link'), ('br_caster_rotation_link', 'l_upper_arm_link'), ('br_caster_rotation_link', 'l_upper_arm_roll_link'), ('br_caster_rotation_link', 'l_wrist_flex_link'), ('br_caster_rotation_link', 'l_wrist_roll_link'), ('br_caster_rotation_link', 'laser_tilt_mount_link'), ('br_caster_rotation_link', 'r_elbow_flex_link'), ('br_caster_rotation_link', 'r_forearm_roll_link'), ('br_caster_rotation_link', 'r_gripper_motor_accelerometer_link'), ('br_caster_rotation_link', 'r_shoulder_lift_link'), ('br_caster_rotation_link', 'r_shoulder_pan_link'), ('br_caster_rotation_link', 'r_upper_arm_link'), ('br_caster_rotation_link', 'r_upper_arm_roll_link'), ('br_caster_rotation_link', 'sensor_mount_link'), ('br_caster_rotation_link', 'torso_lift_link'), ('double_stereo_link', 'fl_caster_l_wheel_link'), ('double_stereo_link', 'fl_caster_r_wheel_link'), ('double_stereo_link', 'fl_caster_rotation_link'), ('double_stereo_link', 'fr_caster_l_wheel_link'), ('double_stereo_link', 'fr_caster_r_wheel_link'), ('double_stereo_link', 'fr_caster_rotation_link'), ('double_stereo_link', 'l_elbow_flex_link'), ('double_stereo_link', 'l_forearm_link'), ('double_stereo_link', 'l_forearm_roll_link'), ('double_stereo_link', 'l_gripper_l_finger_link'), ('double_stereo_link', 'l_gripper_l_finger_tip_link'), ('double_stereo_link', 'l_gripper_motor_accelerometer_link'), ('double_stereo_link', 'l_shoulder_lift_link'), ('double_stereo_link', 'l_shoulder_pan_link'), ('double_stereo_link', 'l_upper_arm_link'), ('double_stereo_link', 'l_upper_arm_roll_link'), ('double_stereo_link', 'l_wrist_flex_link'), ('double_stereo_link', 'l_wrist_roll_link'), ('double_stereo_link', 'laser_tilt_mount_link'), ('double_stereo_link', 'r_elbow_flex_link'), ('double_stereo_link', 'r_forearm_link'), ('double_stereo_link', 'r_forearm_roll_link'), ('double_stereo_link', 'r_gripper_l_finger_link'), ('double_stereo_link', 'r_gripper_l_finger_tip_link'), ('double_stereo_link', 'r_gripper_motor_accelerometer_link'), ('double_stereo_link', 'r_gripper_palm_link'), ('double_stereo_link', 'r_gripper_r_finger_link'), ('double_stereo_link', 'r_gripper_r_finger_tip_link'), ('double_stereo_link', 'r_shoulder_lift_link'), ('double_stereo_link', 'r_shoulder_pan_link'), ('double_stereo_link', 'r_upper_arm_link'), ('double_stereo_link', 'r_upper_arm_roll_link'), ('double_stereo_link', 'r_wrist_flex_link'), ('double_stereo_link', 'r_wrist_roll_link'), ('double_stereo_link', 'torso_lift_link'), ('fl_caster_l_wheel_link', 'fl_caster_r_wheel_link'), ('fl_caster_l_wheel_link', 'fr_caster_l_wheel_link'), ('fl_caster_l_wheel_link', 'fr_caster_r_wheel_link'), ('fl_caster_l_wheel_link', 'fr_caster_rotation_link'), ('fl_caster_l_wheel_link', 'head_pan_link'), ('fl_caster_l_wheel_link', 'head_plate_frame'), ('fl_caster_l_wheel_link', 'head_tilt_link'), ('fl_caster_l_wheel_link', 'l_elbow_flex_link'), ('fl_caster_l_wheel_link', 'l_forearm_roll_link'), ('fl_caster_l_wheel_link', 'l_shoulder_lift_link'), ('fl_caster_l_wheel_link', 'l_shoulder_pan_link'), ('fl_caster_l_wheel_link', 'l_upper_arm_link'), ('fl_caster_l_wheel_link', 'l_upper_arm_roll_link'), ('fl_caster_l_wheel_link', 'laser_tilt_mount_link'), ('fl_caster_l_wheel_link', 'r_elbow_flex_link'), ('fl_caster_l_wheel_link', 'r_forearm_link'), ('fl_caster_l_wheel_link', 'r_forearm_roll_link'), ('fl_caster_l_wheel_link', 'r_gripper_motor_accelerometer_link'), ('fl_caster_l_wheel_link', 'r_shoulder_lift_link'), ('fl_caster_l_wheel_link', 'r_shoulder_pan_link'), ('fl_caster_l_wheel_link', 'r_upper_arm_link'), ('fl_caster_l_wheel_link', 'r_upper_arm_roll_link'), ('fl_caster_l_wheel_link', 'r_wrist_flex_link'), ('fl_caster_l_wheel_link', 'r_wrist_roll_link'), ('fl_caster_l_wheel_link', 'sensor_mount_link'), ('fl_caster_l_wheel_link', 'torso_lift_link'), ('fl_caster_r_wheel_link', 'fr_caster_l_wheel_link'), ('fl_caster_r_wheel_link', 'fr_caster_r_wheel_link'), ('fl_caster_r_wheel_link', 'fr_caster_rotation_link'), ('fl_caster_r_wheel_link', 'head_pan_link'), ('fl_caster_r_wheel_link', 'head_plate_frame'), ('fl_caster_r_wheel_link', 'head_tilt_link'), ('fl_caster_r_wheel_link', 'l_elbow_flex_link'), ('fl_caster_r_wheel_link', 'l_forearm_roll_link'), ('fl_caster_r_wheel_link', 'l_shoulder_lift_link'), ('fl_caster_r_wheel_link', 'l_shoulder_pan_link'), ('fl_caster_r_wheel_link', 'l_upper_arm_link'), ('fl_caster_r_wheel_link', 'l_upper_arm_roll_link'), ('fl_caster_r_wheel_link', 'laser_tilt_mount_link'), ('fl_caster_r_wheel_link', 'r_elbow_flex_link'), ('fl_caster_r_wheel_link', 'r_forearm_link'), ('fl_caster_r_wheel_link', 'r_forearm_roll_link'), ('fl_caster_r_wheel_link', 'r_gripper_motor_accelerometer_link'), ('fl_caster_r_wheel_link', 'r_shoulder_lift_link'), ('fl_caster_r_wheel_link', 'r_shoulder_pan_link'), ('fl_caster_r_wheel_link', 'r_upper_arm_link'), ('fl_caster_r_wheel_link', 'r_upper_arm_roll_link'), ('fl_caster_r_wheel_link', 'r_wrist_flex_link'), ('fl_caster_r_wheel_link', 'r_wrist_roll_link'), ('fl_caster_r_wheel_link', 'sensor_mount_link'), ('fl_caster_r_wheel_link', 'torso_lift_link'), ('fl_caster_rotation_link', 'fr_caster_l_wheel_link'), ('fl_caster_rotation_link', 'fr_caster_r_wheel_link'), ('fl_caster_rotation_link', 'fr_caster_rotation_link'), ('fl_caster_rotation_link', 'head_pan_link'), ('fl_caster_rotation_link', 'head_plate_frame'), ('fl_caster_rotation_link', 'head_tilt_link'), ('fl_caster_rotation_link', 'l_elbow_flex_link'), ('fl_caster_rotation_link', 'l_forearm_roll_link'), ('fl_caster_rotation_link', 'l_shoulder_lift_link'), ('fl_caster_rotation_link', 'l_shoulder_pan_link'), ('fl_caster_rotation_link', 'l_upper_arm_link'), ('fl_caster_rotation_link', 'l_upper_arm_roll_link'), ('fl_caster_rotation_link', 'laser_tilt_mount_link'), ('fl_caster_rotation_link', 'r_elbow_flex_link'), ('fl_caster_rotation_link', 'r_forearm_roll_link'), ('fl_caster_rotation_link', 'r_gripper_motor_accelerometer_link'), ('fl_caster_rotation_link', 'r_shoulder_lift_link'), ('fl_caster_rotation_link', 'r_shoulder_pan_link'), ('fl_caster_rotation_link', 'r_upper_arm_link'), ('fl_caster_rotation_link', 'r_upper_arm_roll_link'), ('fl_caster_rotation_link', 'sensor_mount_link'), ('fl_caster_rotation_link', 'torso_lift_link'), ('fr_caster_l_wheel_link', 'fr_caster_r_wheel_link'), ('fr_caster_l_wheel_link', 'head_pan_link'), ('fr_caster_l_wheel_link', 'head_plate_frame'), ('fr_caster_l_wheel_link', 'head_tilt_link'), ('fr_caster_l_wheel_link', 'l_elbow_flex_link'), ('fr_caster_l_wheel_link', 'l_forearm_link'), ('fr_caster_l_wheel_link', 'l_forearm_roll_link'), ('fr_caster_l_wheel_link', 'l_gripper_motor_accelerometer_link'), ('fr_caster_l_wheel_link', 'l_shoulder_lift_link'), ('fr_caster_l_wheel_link', 'l_shoulder_pan_link'), ('fr_caster_l_wheel_link', 'l_upper_arm_link'), ('fr_caster_l_wheel_link', 'l_upper_arm_roll_link'), ('fr_caster_l_wheel_link', 'l_wrist_flex_link'), ('fr_caster_l_wheel_link', 'l_wrist_roll_link'), ('fr_caster_l_wheel_link', 'laser_tilt_mount_link'), ('fr_caster_l_wheel_link', 'r_elbow_flex_link'), ('fr_caster_l_wheel_link', 'r_forearm_roll_link'), ('fr_caster_l_wheel_link', 'r_shoulder_lift_link'), ('fr_caster_l_wheel_link', 'r_shoulder_pan_link'), ('fr_caster_l_wheel_link', 'r_upper_arm_link'), ('fr_caster_l_wheel_link', 'r_upper_arm_roll_link'), ('fr_caster_l_wheel_link', 'sensor_mount_link'), ('fr_caster_l_wheel_link', 'torso_lift_link'), ('fr_caster_r_wheel_link', 'head_pan_link'), ('fr_caster_r_wheel_link', 'head_plate_frame'), ('fr_caster_r_wheel_link', 'head_tilt_link'), ('fr_caster_r_wheel_link', 'l_elbow_flex_link'), ('fr_caster_r_wheel_link', 'l_forearm_link'), ('fr_caster_r_wheel_link', 'l_forearm_roll_link'), ('fr_caster_r_wheel_link', 'l_gripper_motor_accelerometer_link'), ('fr_caster_r_wheel_link', 'l_shoulder_lift_link'), ('fr_caster_r_wheel_link', 'l_shoulder_pan_link'), ('fr_caster_r_wheel_link', 'l_upper_arm_link'), ('fr_caster_r_wheel_link', 'l_upper_arm_roll_link'), ('fr_caster_r_wheel_link', 'l_wrist_flex_link'), ('fr_caster_r_wheel_link', 'l_wrist_roll_link'), ('fr_caster_r_wheel_link', 'laser_tilt_mount_link'), ('fr_caster_r_wheel_link', 'r_elbow_flex_link'), ('fr_caster_r_wheel_link', 'r_forearm_roll_link'), ('fr_caster_r_wheel_link', 'r_shoulder_lift_link'), ('fr_caster_r_wheel_link', 'r_shoulder_pan_link'), ('fr_caster_r_wheel_link', 'r_upper_arm_link'), ('fr_caster_r_wheel_link', 'r_upper_arm_roll_link'), ('fr_caster_r_wheel_link', 'sensor_mount_link'), ('fr_caster_r_wheel_link', 'torso_lift_link'), ('fr_caster_rotation_link', 'head_pan_link'), ('fr_caster_rotation_link', 'head_plate_frame'), ('fr_caster_rotation_link', 'head_tilt_link'), ('fr_caster_rotation_link', 'l_elbow_flex_link'), ('fr_caster_rotation_link', 'l_forearm_roll_link'), ('fr_caster_rotation_link', 'l_gripper_motor_accelerometer_link'), ('fr_caster_rotation_link', 'l_shoulder_lift_link'), ('fr_caster_rotation_link', 'l_shoulder_pan_link'), ('fr_caster_rotation_link', 'l_upper_arm_link'), ('fr_caster_rotation_link', 'l_upper_arm_roll_link'), ('fr_caster_rotation_link', 'laser_tilt_mount_link'), ('fr_caster_rotation_link', 'r_elbow_flex_link'), ('fr_caster_rotation_link', 'r_forearm_roll_link'), ('fr_caster_rotation_link', 'r_shoulder_lift_link'), ('fr_caster_rotation_link', 'r_shoulder_pan_link'), ('fr_caster_rotation_link', 'r_upper_arm_link'), ('fr_caster_rotation_link', 'r_upper_arm_roll_link'), ('fr_caster_rotation_link', 'sensor_mount_link'), ('fr_caster_rotation_link', 'torso_lift_link'), ('head_pan_link', 'l_elbow_flex_link'), ('head_pan_link', 'l_forearm_roll_link'), ('head_pan_link', 'l_gripper_motor_accelerometer_link'), ('head_pan_link', 'l_shoulder_lift_link'), ('head_pan_link', 'l_shoulder_pan_link'), ('head_pan_link', 'l_upper_arm_link'), ('head_pan_link', 'l_upper_arm_roll_link'), ('head_pan_link', 'laser_tilt_mount_link'), ('head_pan_link', 'r_elbow_flex_link'), ('head_pan_link', 'r_forearm_roll_link'), ('head_pan_link', 'r_gripper_motor_accelerometer_link'), ('head_pan_link', 'r_shoulder_lift_link'), ('head_pan_link', 'r_shoulder_pan_link'), ('head_pan_link', 'r_upper_arm_link'), ('head_pan_link', 'r_upper_arm_roll_link'), ('head_pan_link', 'r_wrist_roll_link'), ('head_plate_frame', 'l_elbow_flex_link'), ('head_plate_frame', 'l_forearm_link'), ('head_plate_frame', 'l_forearm_roll_link'), ('head_plate_frame', 'l_gripper_l_finger_link'), ('head_plate_frame', 'l_gripper_l_finger_tip_link'), ('head_plate_frame', 'l_gripper_motor_accelerometer_link'), ('head_plate_frame', 'l_gripper_palm_link'), ('head_plate_frame', 'l_gripper_r_finger_link'), ('head_plate_frame', 'l_gripper_r_finger_tip_link'), ('head_plate_frame', 'l_shoulder_lift_link'), ('head_plate_frame', 'l_shoulder_pan_link'), ('head_plate_frame', 'l_upper_arm_link'), ('head_plate_frame', 'l_upper_arm_roll_link'), ('head_plate_frame', 'l_wrist_flex_link'), ('head_plate_frame', 'l_wrist_roll_link'), ('head_plate_frame', 'laser_tilt_mount_link'), ('head_plate_frame', 'r_elbow_flex_link'), ('head_plate_frame', 'r_forearm_link'), ('head_plate_frame', 'r_forearm_roll_link'), ('head_plate_frame', 'r_gripper_l_finger_link'), ('head_plate_frame', 'r_gripper_l_finger_tip_link'), ('head_plate_frame', 'r_gripper_motor_accelerometer_link'), ('head_plate_frame', 'r_gripper_palm_link'), ('head_plate_frame', 'r_gripper_r_finger_link'), ('head_plate_frame', 'r_gripper_r_finger_tip_link'), ('head_plate_frame', 'r_shoulder_lift_link'), ('head_plate_frame', 'r_shoulder_pan_link'), ('head_plate_frame', 'r_upper_arm_link'), ('head_plate_frame', 'r_upper_arm_roll_link'), ('head_plate_frame', 'r_wrist_flex_link'), ('head_plate_frame', 'r_wrist_roll_link'), ('head_plate_frame', 'torso_lift_link'), ('head_tilt_link', 'l_elbow_flex_link'), ('head_tilt_link', 'l_forearm_roll_link'), ('head_tilt_link', 'l_gripper_motor_accelerometer_link'), ('head_tilt_link', 'l_shoulder_lift_link'), ('head_tilt_link', 'l_shoulder_pan_link'), ('head_tilt_link', 'l_upper_arm_link'), ('head_tilt_link', 'l_upper_arm_roll_link'), ('head_tilt_link', 'laser_tilt_mount_link'), ('head_tilt_link', 'r_elbow_flex_link'), ('head_tilt_link', 'r_forearm_roll_link'), ('head_tilt_link', 'r_gripper_motor_accelerometer_link'), ('head_tilt_link', 'r_shoulder_lift_link'), ('head_tilt_link', 'r_shoulder_pan_link'), ('head_tilt_link', 'r_upper_arm_link'), ('head_tilt_link', 'r_upper_arm_roll_link'), ('head_tilt_link', 'r_wrist_roll_link'), ('head_tilt_link', 'torso_lift_link'), ('l_elbow_flex_link', 'l_forearm_link'), ('l_elbow_flex_link', 'l_gripper_l_finger_link'), ('l_elbow_flex_link', 'l_gripper_l_finger_tip_link'), ('l_elbow_flex_link', 'l_gripper_motor_accelerometer_link'), ('l_elbow_flex_link', 'l_gripper_palm_link'), ('l_elbow_flex_link', 'l_gripper_r_finger_link'), ('l_elbow_flex_link', 'l_gripper_r_finger_tip_link'), ('l_elbow_flex_link', 'l_shoulder_lift_link'), ('l_elbow_flex_link', 'l_shoulder_pan_link'), ('l_elbow_flex_link', 'l_upper_arm_roll_link'), ('l_elbow_flex_link', 'l_wrist_flex_link'), ('l_elbow_flex_link', 'l_wrist_roll_link'), ('l_elbow_flex_link', 'laser_tilt_mount_link'), ('l_elbow_flex_link', 'r_shoulder_lift_link'), ('l_elbow_flex_link', 'r_shoulder_pan_link'), ('l_elbow_flex_link', 'r_upper_arm_roll_link'), ('l_elbow_flex_link', 'sensor_mount_link'), ('l_elbow_flex_link', 'torso_lift_link'), ('l_forearm_link', 'l_gripper_l_finger_link'), ('l_forearm_link', 'l_gripper_l_finger_tip_link'), ('l_forearm_link', 'l_gripper_motor_accelerometer_link'), ('l_forearm_link', 'l_gripper_palm_link'), ('l_forearm_link', 'l_gripper_r_finger_link'), ('l_forearm_link', 'l_gripper_r_finger_tip_link'), ('l_forearm_link', 'l_shoulder_lift_link'), ('l_forearm_link', 'l_upper_arm_link'), ('l_forearm_link', 'l_upper_arm_roll_link'), ('l_forearm_link', 'l_wrist_roll_link'), ('l_forearm_link', 'sensor_mount_link'), ('l_forearm_roll_link', 'l_gripper_l_finger_link'), ('l_forearm_roll_link', 'l_gripper_l_finger_tip_link'), ('l_forearm_roll_link', 'l_gripper_motor_accelerometer_link'), ('l_forearm_roll_link', 'l_gripper_palm_link'), ('l_forearm_roll_link', 'l_gripper_r_finger_link'), ('l_forearm_roll_link', 'l_gripper_r_finger_tip_link'), ('l_forearm_roll_link', 'l_shoulder_lift_link'), ('l_forearm_roll_link', 'l_shoulder_pan_link'), ('l_forearm_roll_link', 'l_upper_arm_link'), ('l_forearm_roll_link', 'l_upper_arm_roll_link'), ('l_forearm_roll_link', 'l_wrist_flex_link'), ('l_forearm_roll_link', 'l_wrist_roll_link'), ('l_forearm_roll_link', 'laser_tilt_mount_link'), ('l_forearm_roll_link', 'r_shoulder_lift_link'), ('l_forearm_roll_link', 'r_shoulder_pan_link'), ('l_forearm_roll_link', 'r_upper_arm_roll_link'), ('l_forearm_roll_link', 'sensor_mount_link'), ('l_forearm_roll_link', 'torso_lift_link'), ('l_gripper_l_finger_link', 'l_gripper_motor_accelerometer_link'), ('l_gripper_l_finger_link', 'l_gripper_r_finger_link'), ('l_gripper_l_finger_link', 'l_gripper_r_finger_tip_link'), ('l_gripper_l_finger_link', 'l_shoulder_lift_link'), ('l_gripper_l_finger_link', 'l_upper_arm_link'), ('l_gripper_l_finger_link', 'l_upper_arm_roll_link'), ('l_gripper_l_finger_link', 'l_wrist_flex_link'), ('l_gripper_l_finger_link', 'l_wrist_roll_link'), ('l_gripper_l_finger_link', 'sensor_mount_link'), ('l_gripper_l_finger_tip_link', 'l_gripper_motor_accelerometer_link'), ('l_gripper_l_finger_tip_link', 'l_gripper_palm_link'), ('l_gripper_l_finger_tip_link', 'l_gripper_r_finger_link'), ('l_gripper_l_finger_tip_link', 'l_shoulder_lift_link'), ('l_gripper_l_finger_tip_link', 'l_upper_arm_link'), ('l_gripper_l_finger_tip_link', 'l_upper_arm_roll_link'), ('l_gripper_l_finger_tip_link', 'l_wrist_flex_link'), ('l_gripper_l_finger_tip_link', 'l_wrist_roll_link'), ('l_gripper_l_finger_tip_link', 'sensor_mount_link'), ('l_gripper_motor_accelerometer_link', 'l_gripper_r_finger_link'), ('l_gripper_motor_accelerometer_link', 'l_gripper_r_finger_tip_link'), ('l_gripper_motor_accelerometer_link', 'l_shoulder_lift_link'), ('l_gripper_motor_accelerometer_link', 'l_upper_arm_link'), ('l_gripper_motor_accelerometer_link', 'l_upper_arm_roll_link'), ('l_gripper_motor_accelerometer_link', 'l_wrist_flex_link'), ('l_gripper_motor_accelerometer_link', 'l_wrist_roll_link'), ('l_gripper_motor_accelerometer_link', 'laser_tilt_mount_link'), ('l_gripper_motor_accelerometer_link', 'r_gripper_l_finger_tip_link'), ('l_gripper_motor_accelerometer_link', 'r_gripper_motor_accelerometer_link'), ('l_gripper_motor_accelerometer_link', 'r_gripper_r_finger_tip_link'), ('l_gripper_motor_accelerometer_link', 'r_wrist_flex_link'), ('l_gripper_motor_accelerometer_link', 'r_wrist_roll_link'), ('l_gripper_motor_accelerometer_link', 'sensor_mount_link'), ('l_gripper_palm_link', 'l_gripper_r_finger_tip_link'), ('l_gripper_palm_link', 'l_shoulder_lift_link'), ('l_gripper_palm_link', 'l_upper_arm_link'), ('l_gripper_palm_link', 'l_upper_arm_roll_link'), ('l_gripper_palm_link', 'l_wrist_flex_link'), ('l_gripper_palm_link', 'sensor_mount_link'), ('l_gripper_r_finger_link', 'l_shoulder_lift_link'), ('l_gripper_r_finger_link', 'l_upper_arm_link'), ('l_gripper_r_finger_link', 'l_upper_arm_roll_link'), ('l_gripper_r_finger_link', 'l_wrist_flex_link'), ('l_gripper_r_finger_link', 'l_wrist_roll_link'), ('l_gripper_r_finger_link', 'sensor_mount_link'), ('l_gripper_r_finger_tip_link', 'l_shoulder_lift_link'), ('l_gripper_r_finger_tip_link', 'l_upper_arm_link'), ('l_gripper_r_finger_tip_link', 'l_upper_arm_roll_link'), ('l_gripper_r_finger_tip_link', 'l_wrist_flex_link'), ('l_gripper_r_finger_tip_link', 'l_wrist_roll_link'), ('l_gripper_r_finger_tip_link', 'r_gripper_motor_accelerometer_link'), ('l_gripper_r_finger_tip_link', 'sensor_mount_link'), ('l_shoulder_lift_link', 'l_upper_arm_link'), ('l_shoulder_lift_link', 'l_wrist_flex_link'), ('l_shoulder_lift_link', 'l_wrist_roll_link'), ('l_shoulder_lift_link', 'laser_tilt_mount_link'), ('l_shoulder_lift_link', 'r_elbow_flex_link'), ('l_shoulder_lift_link', 'r_forearm_roll_link'), ('l_shoulder_lift_link', 'r_shoulder_lift_link'), ('l_shoulder_lift_link', 'r_upper_arm_link'), ('l_shoulder_lift_link', 'r_upper_arm_roll_link'), ('l_shoulder_lift_link', 'sensor_mount_link'), ('l_shoulder_lift_link', 'torso_lift_link'), ('l_shoulder_pan_link', 'l_upper_arm_roll_link'), ('l_shoulder_pan_link', 'laser_tilt_mount_link'), ('l_shoulder_pan_link', 'r_elbow_flex_link'), ('l_shoulder_pan_link', 'r_forearm_roll_link'), ('l_shoulder_pan_link', 'sensor_mount_link'), ('l_upper_arm_link', 'l_wrist_flex_link'), ('l_upper_arm_link', 'l_wrist_roll_link'), ('l_upper_arm_link', 'laser_tilt_mount_link'), ('l_upper_arm_link', 'r_shoulder_lift_link'), ('l_upper_arm_link', 'sensor_mount_link'), ('l_upper_arm_link', 'torso_lift_link'), ('l_upper_arm_roll_link', 'l_wrist_flex_link'), ('l_upper_arm_roll_link', 'l_wrist_roll_link'), ('l_upper_arm_roll_link', 'laser_tilt_mount_link'), ('l_upper_arm_roll_link', 'r_elbow_flex_link'), ('l_upper_arm_roll_link', 'r_forearm_roll_link'), ('l_upper_arm_roll_link', 'r_gripper_motor_accelerometer_link'), ('l_upper_arm_roll_link', 'r_shoulder_lift_link'), ('l_upper_arm_roll_link', 'r_upper_arm_link'), ('l_upper_arm_roll_link', 'r_upper_arm_roll_link'), ('l_upper_arm_roll_link', 'sensor_mount_link'), ('l_upper_arm_roll_link', 'torso_lift_link'), ('l_wrist_flex_link', 'sensor_mount_link'), ('l_wrist_roll_link', 'laser_tilt_mount_link'), ('l_wrist_roll_link', 'sensor_mount_link'), ('laser_tilt_mount_link', 'r_elbow_flex_link'), ('laser_tilt_mount_link', 'r_forearm_roll_link'), ('laser_tilt_mount_link', 'r_gripper_motor_accelerometer_link'), ('laser_tilt_mount_link', 'r_shoulder_lift_link'), ('laser_tilt_mount_link', 'r_shoulder_pan_link'), ('laser_tilt_mount_link', 'r_upper_arm_link'), ('laser_tilt_mount_link', 'r_upper_arm_roll_link'), ('laser_tilt_mount_link', 'r_wrist_roll_link'), ('laser_tilt_mount_link', 'sensor_mount_link'), ('r_elbow_flex_link', 'r_forearm_link'), ('r_elbow_flex_link', 'r_gripper_l_finger_link'), ('r_elbow_flex_link', 'r_gripper_l_finger_tip_link'), ('r_elbow_flex_link', 'r_gripper_motor_accelerometer_link'), ('r_elbow_flex_link', 'r_gripper_palm_link'), ('r_elbow_flex_link', 'r_gripper_r_finger_link'), ('r_elbow_flex_link', 'r_gripper_r_finger_tip_link'), ('r_elbow_flex_link', 'r_shoulder_lift_link'), ('r_elbow_flex_link', 'r_shoulder_pan_link'), ('r_elbow_flex_link', 'r_upper_arm_roll_link'), ('r_elbow_flex_link', 'r_wrist_flex_link'), ('r_elbow_flex_link', 'r_wrist_roll_link'), ('r_elbow_flex_link', 'sensor_mount_link'), ('r_elbow_flex_link', 'torso_lift_link'), ('r_forearm_link', 'r_gripper_l_finger_link'), ('r_forearm_link', 'r_gripper_l_finger_tip_link'), ('r_forearm_link', 'r_gripper_motor_accelerometer_link'), ('r_forearm_link', 'r_gripper_palm_link'), ('r_forearm_link', 'r_gripper_r_finger_link'), ('r_forearm_link', 'r_gripper_r_finger_tip_link'), ('r_forearm_link', 'r_shoulder_lift_link'), ('r_forearm_link', 'r_upper_arm_link'), ('r_forearm_link', 'r_upper_arm_roll_link'), ('r_forearm_link', 'r_wrist_roll_link'), ('r_forearm_link', 'sensor_mount_link'), ('r_forearm_roll_link', 'r_gripper_l_finger_link'), ('r_forearm_roll_link', 'r_gripper_l_finger_tip_link'), ('r_forearm_roll_link', 'r_gripper_motor_accelerometer_link'), ('r_forearm_roll_link', 'r_gripper_palm_link'), ('r_forearm_roll_link', 'r_gripper_r_finger_link'), ('r_forearm_roll_link', 'r_gripper_r_finger_tip_link'), ('r_forearm_roll_link', 'r_shoulder_lift_link'), ('r_forearm_roll_link', 'r_shoulder_pan_link'), ('r_forearm_roll_link', 'r_upper_arm_link'), ('r_forearm_roll_link', 'r_upper_arm_roll_link'), ('r_forearm_roll_link', 'r_wrist_flex_link'), ('r_forearm_roll_link', 'r_wrist_roll_link'), ('r_forearm_roll_link', 'sensor_mount_link'), ('r_forearm_roll_link', 'torso_lift_link'), ('r_gripper_l_finger_link', 'r_gripper_motor_accelerometer_link'), ('r_gripper_l_finger_link', 'r_gripper_r_finger_link'), ('r_gripper_l_finger_link', 'r_gripper_r_finger_tip_link'), ('r_gripper_l_finger_link', 'r_shoulder_lift_link'), ('r_gripper_l_finger_link', 'r_upper_arm_link'), ('r_gripper_l_finger_link', 'r_upper_arm_roll_link'), ('r_gripper_l_finger_link', 'r_wrist_flex_link'), ('r_gripper_l_finger_link', 'r_wrist_roll_link'), ('r_gripper_l_finger_link', 'sensor_mount_link'), ('r_gripper_l_finger_tip_link', 'r_gripper_motor_accelerometer_link'), ('r_gripper_l_finger_tip_link', 'r_gripper_palm_link'), ('r_gripper_l_finger_tip_link', 'r_gripper_r_finger_link'), ('r_gripper_l_finger_tip_link', 'r_shoulder_lift_link'), ('r_gripper_l_finger_tip_link', 'r_upper_arm_link'), ('r_gripper_l_finger_tip_link', 'r_upper_arm_roll_link'), ('r_gripper_l_finger_tip_link', 'r_wrist_flex_link'), ('r_gripper_l_finger_tip_link', 'r_wrist_roll_link'), ('r_gripper_l_finger_tip_link', 'sensor_mount_link'), ('r_gripper_motor_accelerometer_link', 'r_gripper_r_finger_link'), ('r_gripper_motor_accelerometer_link', 'r_gripper_r_finger_tip_link'), ('r_gripper_motor_accelerometer_link', 'r_shoulder_lift_link'), ('r_gripper_motor_accelerometer_link', 'r_upper_arm_link'), ('r_gripper_motor_accelerometer_link', 'r_upper_arm_roll_link'), ('r_gripper_motor_accelerometer_link', 'r_wrist_flex_link'), ('r_gripper_motor_accelerometer_link', 'r_wrist_roll_link'), ('r_gripper_motor_accelerometer_link', 'sensor_mount_link'), ('r_gripper_palm_link', 'r_gripper_r_finger_tip_link'), ('r_gripper_palm_link', 'r_shoulder_lift_link'), ('r_gripper_palm_link', 'r_upper_arm_link'), ('r_gripper_palm_link', 'r_upper_arm_roll_link'), ('r_gripper_palm_link', 'r_wrist_flex_link'), ('r_gripper_palm_link', 'sensor_mount_link'), ('r_gripper_r_finger_link', 'r_shoulder_lift_link'), ('r_gripper_r_finger_link', 'r_upper_arm_link'), ('r_gripper_r_finger_link', 'r_upper_arm_roll_link'), ('r_gripper_r_finger_link', 'r_wrist_flex_link'), ('r_gripper_r_finger_link', 'r_wrist_roll_link'), ('r_gripper_r_finger_link', 'sensor_mount_link'), ('r_gripper_r_finger_tip_link', 'r_shoulder_lift_link'), ('r_gripper_r_finger_tip_link', 'r_upper_arm_link'), ('r_gripper_r_finger_tip_link', 'r_upper_arm_roll_link'), ('r_gripper_r_finger_tip_link', 'r_wrist_flex_link'), ('r_gripper_r_finger_tip_link', 'r_wrist_roll_link'), ('r_gripper_r_finger_tip_link', 'sensor_mount_link'), ('r_shoulder_lift_link', 'r_upper_arm_link'), ('r_shoulder_lift_link', 'r_wrist_flex_link'), ('r_shoulder_lift_link', 'r_wrist_roll_link'), ('r_shoulder_lift_link', 'sensor_mount_link'), ('r_shoulder_lift_link', 'torso_lift_link'), ('r_shoulder_pan_link', 'r_upper_arm_roll_link'), ('r_shoulder_pan_link', 'sensor_mount_link'), ('r_upper_arm_link', 'r_wrist_flex_link'), ('r_upper_arm_link', 'r_wrist_roll_link'), ('r_upper_arm_link', 'sensor_mount_link'), ('r_upper_arm_link', 'torso_lift_link'), ('r_upper_arm_roll_link', 'r_wrist_flex_link'), ('r_upper_arm_roll_link', 'r_wrist_roll_link'), ('r_upper_arm_roll_link', 'sensor_mount_link'), ('r_upper_arm_roll_link', 'torso_lift_link'), ('r_wrist_flex_link', 'sensor_mount_link'), ('r_wrist_roll_link', 'sensor_mount_link'), ('sensor_mount_link', 'torso_lift_link') ] + [ ('l_upper_arm_link', 'l_shoulder_pan_link'), ('r_upper_arm_link', 'r_shoulder_pan_link'), ]
51,193
Python
91.575045
120
0.532104
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/pybullet_tools/transformations.py
# -*- coding: utf-8 -*- # transformations.py # Copyright (c) 2006, Christoph Gohlke # Copyright (c) 2006-2009, The Regents of the University of California # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # * Neither the name of the copyright holders nor the names of any # contributors may be used to endorse or promote products derived # from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. """Homogeneous Transformation Matrices and Quaternions. A library for calculating 4x4 matrices for translating, rotating, reflecting, scaling, shearing, projecting, orthogonalizing, and superimposing arrays of 3D homogeneous coordinates as well as for converting between rotation matrices, Euler angles, and quaternions. Also includes an Arcball control object and functions to decompose transformation matrices. :Authors: `Christoph Gohlke <http://www.lfd.uci.edu/~gohlke/>`__, Laboratory for Fluorescence Dynamics, University of California, Irvine :Version: 20090418 Requirements ------------ * `Python 2.6 <http://www.python.org>`__ * `Numpy 1.3 <http://numpy.scipy.org>`__ * `transformations.c 20090418 <http://www.lfd.uci.edu/~gohlke/>`__ (optional implementation of some functions in C) Notes ----- Matrices (M) can be inverted using numpy.linalg.inv(M), concatenated using numpy.dot(M0, M1), or used to transform homogeneous coordinates (v) using numpy.dot(M, v) for shape (4, \*) "point of arrays", respectively numpy.dot(v, M.T) for shape (\*, 4) "array of points". Calculations are carried out with numpy.float64 precision. This Python implementation is not optimized for speed. Vector, point, quaternion, and matrix function arguments are expected to be "array like", i.e. tuple, list, or numpy arrays. Return types are numpy arrays unless specified otherwise. Angles are in radians unless specified otherwise. Quaternions ix+jy+kz+w are represented as [x, y, z, w]. Use the transpose of transformation matrices for OpenGL glMultMatrixd(). A triple of Euler angles can be applied/interpreted in 24 ways, which can be specified using a 4 character string or encoded 4-tuple: *Axes 4-string*: e.g. 'sxyz' or 'ryxy' - first character : rotations are applied to 's'tatic or 'r'otating frame - remaining characters : successive rotation axis 'x', 'y', or 'z' *Axes 4-tuple*: e.g. (0, 0, 0, 0) or (1, 1, 1, 1) - inner axis: code of axis ('x':0, 'y':1, 'z':2) of rightmost matrix. - parity : even (0) if inner axis 'x' is followed by 'y', 'y' is followed by 'z', or 'z' is followed by 'x'. Otherwise odd (1). - repetition : first and last axis are same (1) or different (0). - frame : rotations are applied to static (0) or rotating (1) frame. References ---------- (1) Matrices and transformations. Ronald Goldman. In "Graphics Gems I", pp 472-475. Morgan Kaufmann, 1990. (2) More matrices and transformations: shear and pseudo-perspective. Ronald Goldman. In "Graphics Gems II", pp 320-323. Morgan Kaufmann, 1991. (3) Decomposing a matrix into simple transformations. Spencer Thomas. In "Graphics Gems II", pp 320-323. Morgan Kaufmann, 1991. (4) Recovering the data from the transformation matrix. Ronald Goldman. In "Graphics Gems II", pp 324-331. Morgan Kaufmann, 1991. (5) Euler angle conversion. Ken Shoemake. In "Graphics Gems IV", pp 222-229. Morgan Kaufmann, 1994. (6) Arcball rotation control. Ken Shoemake. In "Graphics Gems IV", pp 175-192. Morgan Kaufmann, 1994. (7) Representing attitude: Euler angles, unit quaternions, and rotation vectors. James Diebel. 2006. (8) A discussion of the solution for the best rotation to relate two sets of vectors. W Kabsch. Acta Cryst. 1978. A34, 827-828. (9) Closed-form solution of absolute orientation using unit quaternions. BKP Horn. J Opt Soc Am A. 1987. 4(4), 629-642. (10) Quaternions. Ken Shoemake. http://www.sfu.ca/~jwa3/cmpt461/files/quatut.pdf (11) From quaternion to matrix and back. JMP van Waveren. 2005. http://www.intel.com/cd/ids/developer/asmo-na/eng/293748.htm (12) Uniform random rotations. Ken Shoemake. In "Graphics Gems III", pp 124-132. Morgan Kaufmann, 1992. Examples -------- >>> alpha, beta, gamma = 0.123, -1.234, 2.345 >>> origin, xaxis, yaxis, zaxis = (0, 0, 0), (1, 0, 0), (0, 1, 0), (0, 0, 1) >>> I = identity_matrix() >>> Rx = rotation_matrix(alpha, xaxis) >>> Ry = rotation_matrix(beta, yaxis) >>> Rz = rotation_matrix(gamma, zaxis) >>> R = concatenate_matrices(Rx, Ry, Rz) >>> euler = euler_from_matrix(R, 'rxyz') >>> numpy.allclose([alpha, beta, gamma], euler) True >>> Re = euler_matrix(alpha, beta, gamma, 'rxyz') >>> is_same_transform(R, Re) True >>> al, be, ga = euler_from_matrix(Re, 'rxyz') >>> is_same_transform(Re, euler_matrix(al, be, ga, 'rxyz')) True >>> qx = quaternion_about_axis(alpha, xaxis) >>> qy = quaternion_about_axis(beta, yaxis) >>> qz = quaternion_about_axis(gamma, zaxis) >>> q = quaternion_multiply(qx, qy) >>> q = quaternion_multiply(q, qz) >>> Rq = quaternion_matrix(q) >>> is_same_transform(R, Rq) True >>> S = scale_matrix(1.23, origin) >>> T = translation_matrix((1, 2, 3)) >>> Z = shear_matrix(beta, xaxis, origin, zaxis) >>> R = random_rotation_matrix(numpy.random.rand(3)) >>> M = concatenate_matrices(T, R, Z, S) >>> scale, shear, angles, trans, persp = decompose_matrix(M) >>> numpy.allclose(scale, 1.23) True >>> numpy.allclose(trans, (1, 2, 3)) True >>> numpy.allclose(shear, (0, math.tan(beta), 0)) True >>> is_same_transform(R, euler_matrix(axes='sxyz', *angles)) True >>> M1 = compose_matrix(scale, shear, angles, trans, persp) >>> is_same_transform(M, M1) True """ from __future__ import division import warnings import math import numpy # Documentation in HTML format can be generated with Epydoc __docformat__ = "restructuredtext en" def identity_matrix(): """Return 4x4 identity/unit matrix. >>> I = identity_matrix() >>> numpy.allclose(I, numpy.dot(I, I)) True >>> numpy.sum(I), numpy.trace(I) (4.0, 4.0) >>> numpy.allclose(I, numpy.identity(4, dtype=numpy.float64)) True """ return numpy.identity(4, dtype=numpy.float64) def translation_matrix(direction): """Return matrix to translate by direction vector. >>> v = numpy.random.random(3) - 0.5 >>> numpy.allclose(v, translation_matrix(v)[:3, 3]) True """ M = numpy.identity(4) M[:3, 3] = direction[:3] return M def translation_from_matrix(matrix): """Return translation vector from translation matrix. >>> v0 = numpy.random.random(3) - 0.5 >>> v1 = translation_from_matrix(translation_matrix(v0)) >>> numpy.allclose(v0, v1) True """ return numpy.array(matrix, copy=False)[:3, 3].copy() def reflection_matrix(point, normal): """Return matrix to mirror at plane defined by point and normal vector. >>> v0 = numpy.random.random(4) - 0.5 >>> v0[3] = 1.0 >>> v1 = numpy.random.random(3) - 0.5 >>> R = reflection_matrix(v0, v1) >>> numpy.allclose(2., numpy.trace(R)) True >>> numpy.allclose(v0, numpy.dot(R, v0)) True >>> v2 = v0.copy() >>> v2[:3] += v1 >>> v3 = v0.copy() >>> v2[:3] -= v1 >>> numpy.allclose(v2, numpy.dot(R, v3)) True """ normal = unit_vector(normal[:3]) M = numpy.identity(4) M[:3, :3] -= 2.0 * numpy.outer(normal, normal) M[:3, 3] = (2.0 * numpy.dot(point[:3], normal)) * normal return M def reflection_from_matrix(matrix): """Return mirror plane point and normal vector from reflection matrix. >>> v0 = numpy.random.random(3) - 0.5 >>> v1 = numpy.random.random(3) - 0.5 >>> M0 = reflection_matrix(v0, v1) >>> point, normal = reflection_from_matrix(M0) >>> M1 = reflection_matrix(point, normal) >>> is_same_transform(M0, M1) True """ M = numpy.array(matrix, dtype=numpy.float64, copy=False) # normal: unit eigenvector corresponding to eigenvalue -1 l, V = numpy.linalg.eig(M[:3, :3]) i = numpy.where(abs(numpy.real(l) + 1.0) < 1e-8)[0] if not len(i): raise ValueError("no unit eigenvector corresponding to eigenvalue -1") normal = numpy.real(V[:, i[0]]).squeeze() # point: any unit eigenvector corresponding to eigenvalue 1 l, V = numpy.linalg.eig(M) i = numpy.where(abs(numpy.real(l) - 1.0) < 1e-8)[0] if not len(i): raise ValueError("no unit eigenvector corresponding to eigenvalue 1") point = numpy.real(V[:, i[-1]]).squeeze() point /= point[3] return point, normal def rotation_matrix(angle, direction, point=None): """Return matrix to rotate about axis defined by point and direction. >>> angle = (random.random() - 0.5) * (2*math.pi) >>> direc = numpy.random.random(3) - 0.5 >>> point = numpy.random.random(3) - 0.5 >>> R0 = rotation_matrix(angle, direc, point) >>> R1 = rotation_matrix(angle-2*math.pi, direc, point) >>> is_same_transform(R0, R1) True >>> R0 = rotation_matrix(angle, direc, point) >>> R1 = rotation_matrix(-angle, -direc, point) >>> is_same_transform(R0, R1) True >>> I = numpy.identity(4, numpy.float64) >>> numpy.allclose(I, rotation_matrix(math.pi*2, direc)) True >>> numpy.allclose(2., numpy.trace(rotation_matrix(math.pi/2, ... direc, point))) True """ sina = math.sin(angle) cosa = math.cos(angle) direction = unit_vector(direction[:3]) # rotation matrix around unit vector R = numpy.array(((cosa, 0.0, 0.0), (0.0, cosa, 0.0), (0.0, 0.0, cosa)), dtype=numpy.float64) R += numpy.outer(direction, direction) * (1.0 - cosa) direction *= sina R += numpy.array((( 0.0, -direction[2], direction[1]), ( direction[2], 0.0, -direction[0]), (-direction[1], direction[0], 0.0)), dtype=numpy.float64) M = numpy.identity(4) M[:3, :3] = R if point is not None: # rotation not around origin point = numpy.array(point[:3], dtype=numpy.float64, copy=False) M[:3, 3] = point - numpy.dot(R, point) return M def rotation_from_matrix(matrix): """Return rotation angle and axis from rotation matrix. >>> angle = (random.random() - 0.5) * (2*math.pi) >>> direc = numpy.random.random(3) - 0.5 >>> point = numpy.random.random(3) - 0.5 >>> R0 = rotation_matrix(angle, direc, point) >>> angle, direc, point = rotation_from_matrix(R0) >>> R1 = rotation_matrix(angle, direc, point) >>> is_same_transform(R0, R1) True """ R = numpy.array(matrix, dtype=numpy.float64, copy=False) R33 = R[:3, :3] # direction: unit eigenvector of R33 corresponding to eigenvalue of 1 l, W = numpy.linalg.eig(R33.T) i = numpy.where(abs(numpy.real(l) - 1.0) < 1e-8)[0] if not len(i): raise ValueError("no unit eigenvector corresponding to eigenvalue 1") direction = numpy.real(W[:, i[-1]]).squeeze() # point: unit eigenvector of R33 corresponding to eigenvalue of 1 l, Q = numpy.linalg.eig(R) i = numpy.where(abs(numpy.real(l) - 1.0) < 1e-8)[0] if not len(i): raise ValueError("no unit eigenvector corresponding to eigenvalue 1") point = numpy.real(Q[:, i[-1]]).squeeze() point /= point[3] # rotation angle depending on direction cosa = (numpy.trace(R33) - 1.0) / 2.0 if abs(direction[2]) > 1e-8: sina = (R[1, 0] + (cosa-1.0)*direction[0]*direction[1]) / direction[2] elif abs(direction[1]) > 1e-8: sina = (R[0, 2] + (cosa-1.0)*direction[0]*direction[2]) / direction[1] else: sina = (R[2, 1] + (cosa-1.0)*direction[1]*direction[2]) / direction[0] angle = math.atan2(sina, cosa) return angle, direction, point def scale_matrix(factor, origin=None, direction=None): """Return matrix to scale by factor around origin in direction. Use factor -1 for point symmetry. >>> v = (numpy.random.rand(4, 5) - 0.5) * 20.0 >>> v[3] = 1.0 >>> S = scale_matrix(-1.234) >>> numpy.allclose(numpy.dot(S, v)[:3], -1.234*v[:3]) True >>> factor = random.random() * 10 - 5 >>> origin = numpy.random.random(3) - 0.5 >>> direct = numpy.random.random(3) - 0.5 >>> S = scale_matrix(factor, origin) >>> S = scale_matrix(factor, origin, direct) """ if direction is None: # uniform scaling M = numpy.array(((factor, 0.0, 0.0, 0.0), (0.0, factor, 0.0, 0.0), (0.0, 0.0, factor, 0.0), (0.0, 0.0, 0.0, 1.0)), dtype=numpy.float64) if origin is not None: M[:3, 3] = origin[:3] M[:3, 3] *= 1.0 - factor else: # nonuniform scaling direction = unit_vector(direction[:3]) factor = 1.0 - factor M = numpy.identity(4) M[:3, :3] -= factor * numpy.outer(direction, direction) if origin is not None: M[:3, 3] = (factor * numpy.dot(origin[:3], direction)) * direction return M def scale_from_matrix(matrix): """Return scaling factor, origin and direction from scaling matrix. >>> factor = random.random() * 10 - 5 >>> origin = numpy.random.random(3) - 0.5 >>> direct = numpy.random.random(3) - 0.5 >>> S0 = scale_matrix(factor, origin) >>> factor, origin, direction = scale_from_matrix(S0) >>> S1 = scale_matrix(factor, origin, direction) >>> is_same_transform(S0, S1) True >>> S0 = scale_matrix(factor, origin, direct) >>> factor, origin, direction = scale_from_matrix(S0) >>> S1 = scale_matrix(factor, origin, direction) >>> is_same_transform(S0, S1) True """ M = numpy.array(matrix, dtype=numpy.float64, copy=False) M33 = M[:3, :3] factor = numpy.trace(M33) - 2.0 try: # direction: unit eigenvector corresponding to eigenvalue factor l, V = numpy.linalg.eig(M33) i = numpy.where(abs(numpy.real(l) - factor) < 1e-8)[0][0] direction = numpy.real(V[:, i]).squeeze() direction /= vector_norm(direction) except IndexError: # uniform scaling factor = (factor + 2.0) / 3.0 direction = None # origin: any eigenvector corresponding to eigenvalue 1 l, V = numpy.linalg.eig(M) i = numpy.where(abs(numpy.real(l) - 1.0) < 1e-8)[0] if not len(i): raise ValueError("no eigenvector corresponding to eigenvalue 1") origin = numpy.real(V[:, i[-1]]).squeeze() origin /= origin[3] return factor, origin, direction def projection_matrix(point, normal, direction=None, perspective=None, pseudo=False): """Return matrix to project onto plane defined by point and normal. Using either perspective point, projection direction, or none of both. If pseudo is True, perspective projections will preserve relative depth such that Perspective = dot(Orthogonal, PseudoPerspective). >>> P = projection_matrix((0, 0, 0), (1, 0, 0)) >>> numpy.allclose(P[1:, 1:], numpy.identity(4)[1:, 1:]) True >>> point = numpy.random.random(3) - 0.5 >>> normal = numpy.random.random(3) - 0.5 >>> direct = numpy.random.random(3) - 0.5 >>> persp = numpy.random.random(3) - 0.5 >>> P0 = projection_matrix(point, normal) >>> P1 = projection_matrix(point, normal, direction=direct) >>> P2 = projection_matrix(point, normal, perspective=persp) >>> P3 = projection_matrix(point, normal, perspective=persp, pseudo=True) >>> is_same_transform(P2, numpy.dot(P0, P3)) True >>> P = projection_matrix((3, 0, 0), (1, 1, 0), (1, 0, 0)) >>> v0 = (numpy.random.rand(4, 5) - 0.5) * 20.0 >>> v0[3] = 1.0 >>> v1 = numpy.dot(P, v0) >>> numpy.allclose(v1[1], v0[1]) True >>> numpy.allclose(v1[0], 3.0-v1[1]) True """ M = numpy.identity(4) point = numpy.array(point[:3], dtype=numpy.float64, copy=False) normal = unit_vector(normal[:3]) if perspective is not None: # perspective projection perspective = numpy.array(perspective[:3], dtype=numpy.float64, copy=False) M[0, 0] = M[1, 1] = M[2, 2] = numpy.dot(perspective-point, normal) M[:3, :3] -= numpy.outer(perspective, normal) if pseudo: # preserve relative depth M[:3, :3] -= numpy.outer(normal, normal) M[:3, 3] = numpy.dot(point, normal) * (perspective+normal) else: M[:3, 3] = numpy.dot(point, normal) * perspective M[3, :3] = -normal M[3, 3] = numpy.dot(perspective, normal) elif direction is not None: # parallel projection direction = numpy.array(direction[:3], dtype=numpy.float64, copy=False) scale = numpy.dot(direction, normal) M[:3, :3] -= numpy.outer(direction, normal) / scale M[:3, 3] = direction * (numpy.dot(point, normal) / scale) else: # orthogonal projection M[:3, :3] -= numpy.outer(normal, normal) M[:3, 3] = numpy.dot(point, normal) * normal return M def projection_from_matrix(matrix, pseudo=False): """Return projection plane and perspective point from projection matrix. Return values are same as arguments for projection_matrix function: point, normal, direction, perspective, and pseudo. >>> point = numpy.random.random(3) - 0.5 >>> normal = numpy.random.random(3) - 0.5 >>> direct = numpy.random.random(3) - 0.5 >>> persp = numpy.random.random(3) - 0.5 >>> P0 = projection_matrix(point, normal) >>> result = projection_from_matrix(P0) >>> P1 = projection_matrix(*result) >>> is_same_transform(P0, P1) True >>> P0 = projection_matrix(point, normal, direct) >>> result = projection_from_matrix(P0) >>> P1 = projection_matrix(*result) >>> is_same_transform(P0, P1) True >>> P0 = projection_matrix(point, normal, perspective=persp, pseudo=False) >>> result = projection_from_matrix(P0, pseudo=False) >>> P1 = projection_matrix(*result) >>> is_same_transform(P0, P1) True >>> P0 = projection_matrix(point, normal, perspective=persp, pseudo=True) >>> result = projection_from_matrix(P0, pseudo=True) >>> P1 = projection_matrix(*result) >>> is_same_transform(P0, P1) True """ M = numpy.array(matrix, dtype=numpy.float64, copy=False) M33 = M[:3, :3] l, V = numpy.linalg.eig(M) i = numpy.where(abs(numpy.real(l) - 1.0) < 1e-8)[0] if not pseudo and len(i): # point: any eigenvector corresponding to eigenvalue 1 point = numpy.real(V[:, i[-1]]).squeeze() point /= point[3] # direction: unit eigenvector corresponding to eigenvalue 0 l, V = numpy.linalg.eig(M33) i = numpy.where(abs(numpy.real(l)) < 1e-8)[0] if not len(i): raise ValueError("no eigenvector corresponding to eigenvalue 0") direction = numpy.real(V[:, i[0]]).squeeze() direction /= vector_norm(direction) # normal: unit eigenvector of M33.T corresponding to eigenvalue 0 l, V = numpy.linalg.eig(M33.T) i = numpy.where(abs(numpy.real(l)) < 1e-8)[0] if len(i): # parallel projection normal = numpy.real(V[:, i[0]]).squeeze() normal /= vector_norm(normal) return point, normal, direction, None, False else: # orthogonal projection, where normal equals direction vector return point, direction, None, None, False else: # perspective projection i = numpy.where(abs(numpy.real(l)) > 1e-8)[0] if not len(i): raise ValueError( "no eigenvector not corresponding to eigenvalue 0") point = numpy.real(V[:, i[-1]]).squeeze() point /= point[3] normal = - M[3, :3] perspective = M[:3, 3] / numpy.dot(point[:3], normal) if pseudo: perspective -= normal return point, normal, None, perspective, pseudo def clip_matrix(left, right, bottom, top, near, far, perspective=False): """Return matrix to obtain normalized device coordinates from frustrum. The frustrum bounds are axis-aligned along x (left, right), y (bottom, top) and z (near, far). Normalized device coordinates are in range [-1, 1] if coordinates are inside the frustrum. If perspective is True the frustrum is a truncated pyramid with the perspective point at origin and direction along z axis, otherwise an orthographic canonical view volume (a box). Homogeneous coordinates transformed by the perspective clip matrix need to be dehomogenized (devided by w coordinate). >>> frustrum = numpy.random.rand(6) >>> frustrum[1] += frustrum[0] >>> frustrum[3] += frustrum[2] >>> frustrum[5] += frustrum[4] >>> M = clip_matrix(*frustrum, perspective=False) >>> numpy.dot(M, [frustrum[0], frustrum[2], frustrum[4], 1.0]) array([-1., -1., -1., 1.]) >>> numpy.dot(M, [frustrum[1], frustrum[3], frustrum[5], 1.0]) array([ 1., 1., 1., 1.]) >>> M = clip_matrix(*frustrum, perspective=True) >>> v = numpy.dot(M, [frustrum[0], frustrum[2], frustrum[4], 1.0]) >>> v / v[3] array([-1., -1., -1., 1.]) >>> v = numpy.dot(M, [frustrum[1], frustrum[3], frustrum[4], 1.0]) >>> v / v[3] array([ 1., 1., -1., 1.]) """ if left >= right or bottom >= top or near >= far: raise ValueError("invalid frustrum") if perspective: if near <= _EPS: raise ValueError("invalid frustrum: near <= 0") t = 2.0 * near M = ((-t/(right-left), 0.0, (right+left)/(right-left), 0.0), (0.0, -t/(top-bottom), (top+bottom)/(top-bottom), 0.0), (0.0, 0.0, -(far+near)/(far-near), t*far/(far-near)), (0.0, 0.0, -1.0, 0.0)) else: M = ((2.0/(right-left), 0.0, 0.0, (right+left)/(left-right)), (0.0, 2.0/(top-bottom), 0.0, (top+bottom)/(bottom-top)), (0.0, 0.0, 2.0/(far-near), (far+near)/(near-far)), (0.0, 0.0, 0.0, 1.0)) return numpy.array(M, dtype=numpy.float64) def shear_matrix(angle, direction, point, normal): """Return matrix to shear by angle along direction vector on shear plane. The shear plane is defined by a point and normal vector. The direction vector must be orthogonal to the plane's normal vector. A point P is transformed by the shear matrix into P" such that the vector P-P" is parallel to the direction vector and its extent is given by the angle of P-P'-P", where P' is the orthogonal projection of P onto the shear plane. >>> angle = (random.random() - 0.5) * 4*math.pi >>> direct = numpy.random.random(3) - 0.5 >>> point = numpy.random.random(3) - 0.5 >>> normal = numpy.cross(direct, numpy.random.random(3)) >>> S = shear_matrix(angle, direct, point, normal) >>> numpy.allclose(1.0, numpy.linalg.det(S)) True """ normal = unit_vector(normal[:3]) direction = unit_vector(direction[:3]) if abs(numpy.dot(normal, direction)) > 1e-6: raise ValueError("direction and normal vectors are not orthogonal") angle = math.tan(angle) M = numpy.identity(4) M[:3, :3] += angle * numpy.outer(direction, normal) M[:3, 3] = -angle * numpy.dot(point[:3], normal) * direction return M def shear_from_matrix(matrix): """Return shear angle, direction and plane from shear matrix. >>> angle = (random.random() - 0.5) * 4*math.pi >>> direct = numpy.random.random(3) - 0.5 >>> point = numpy.random.random(3) - 0.5 >>> normal = numpy.cross(direct, numpy.random.random(3)) >>> S0 = shear_matrix(angle, direct, point, normal) >>> angle, direct, point, normal = shear_from_matrix(S0) >>> S1 = shear_matrix(angle, direct, point, normal) >>> is_same_transform(S0, S1) True """ M = numpy.array(matrix, dtype=numpy.float64, copy=False) M33 = M[:3, :3] # normal: cross independent eigenvectors corresponding to the eigenvalue 1 l, V = numpy.linalg.eig(M33) i = numpy.where(abs(numpy.real(l) - 1.0) < 1e-4)[0] if len(i) < 2: raise ValueError("No two linear independent eigenvectors found %s" % l) V = numpy.real(V[:, i]).squeeze().T lenorm = -1.0 for i0, i1 in ((0, 1), (0, 2), (1, 2)): n = numpy.cross(V[i0], V[i1]) l = vector_norm(n) if l > lenorm: lenorm = l normal = n normal /= lenorm # direction and angle direction = numpy.dot(M33 - numpy.identity(3), normal) angle = vector_norm(direction) direction /= angle angle = math.atan(angle) # point: eigenvector corresponding to eigenvalue 1 l, V = numpy.linalg.eig(M) i = numpy.where(abs(numpy.real(l) - 1.0) < 1e-8)[0] if not len(i): raise ValueError("no eigenvector corresponding to eigenvalue 1") point = numpy.real(V[:, i[-1]]).squeeze() point /= point[3] return angle, direction, point, normal def decompose_matrix(matrix): """Return sequence of transformations from transformation matrix. matrix : array_like Non-degenerative homogeneous transformation matrix Return tuple of: scale : vector of 3 scaling factors shear : list of shear factors for x-y, x-z, y-z axes angles : list of Euler angles about static x, y, z axes translate : translation vector along x, y, z axes perspective : perspective partition of matrix Raise ValueError if matrix is of wrong type or degenerative. >>> T0 = translation_matrix((1, 2, 3)) >>> scale, shear, angles, trans, persp = decompose_matrix(T0) >>> T1 = translation_matrix(trans) >>> numpy.allclose(T0, T1) True >>> S = scale_matrix(0.123) >>> scale, shear, angles, trans, persp = decompose_matrix(S) >>> scale[0] 0.123 >>> R0 = euler_matrix(1, 2, 3) >>> scale, shear, angles, trans, persp = decompose_matrix(R0) >>> R1 = euler_matrix(*angles) >>> numpy.allclose(R0, R1) True """ M = numpy.array(matrix, dtype=numpy.float64, copy=True).T if abs(M[3, 3]) < _EPS: raise ValueError("M[3, 3] is zero") M /= M[3, 3] P = M.copy() P[:, 3] = 0, 0, 0, 1 if not numpy.linalg.det(P): raise ValueError("Matrix is singular") scale = numpy.zeros((3, ), dtype=numpy.float64) shear = [0, 0, 0] angles = [0, 0, 0] if any(abs(M[:3, 3]) > _EPS): perspective = numpy.dot(M[:, 3], numpy.linalg.inv(P.T)) M[:, 3] = 0, 0, 0, 1 else: perspective = numpy.array((0, 0, 0, 1), dtype=numpy.float64) translate = M[3, :3].copy() M[3, :3] = 0 row = M[:3, :3].copy() scale[0] = vector_norm(row[0]) row[0] /= scale[0] shear[0] = numpy.dot(row[0], row[1]) row[1] -= row[0] * shear[0] scale[1] = vector_norm(row[1]) row[1] /= scale[1] shear[0] /= scale[1] shear[1] = numpy.dot(row[0], row[2]) row[2] -= row[0] * shear[1] shear[2] = numpy.dot(row[1], row[2]) row[2] -= row[1] * shear[2] scale[2] = vector_norm(row[2]) row[2] /= scale[2] shear[1:] /= scale[2] if numpy.dot(row[0], numpy.cross(row[1], row[2])) < 0: scale *= -1 row *= -1 angles[1] = math.asin(-row[0, 2]) if math.cos(angles[1]): angles[0] = math.atan2(row[1, 2], row[2, 2]) angles[2] = math.atan2(row[0, 1], row[0, 0]) else: #angles[0] = math.atan2(row[1, 0], row[1, 1]) angles[0] = math.atan2(-row[2, 1], row[1, 1]) angles[2] = 0.0 return scale, shear, angles, translate, perspective def compose_matrix(scale=None, shear=None, angles=None, translate=None, perspective=None): """Return transformation matrix from sequence of transformations. This is the inverse of the decompose_matrix function. Sequence of transformations: scale : vector of 3 scaling factors shear : list of shear factors for x-y, x-z, y-z axes angles : list of Euler angles about static x, y, z axes translate : translation vector along x, y, z axes perspective : perspective partition of matrix >>> scale = numpy.random.random(3) - 0.5 >>> shear = numpy.random.random(3) - 0.5 >>> angles = (numpy.random.random(3) - 0.5) * (2*math.pi) >>> trans = numpy.random.random(3) - 0.5 >>> persp = numpy.random.random(4) - 0.5 >>> M0 = compose_matrix(scale, shear, angles, trans, persp) >>> result = decompose_matrix(M0) >>> M1 = compose_matrix(*result) >>> is_same_transform(M0, M1) True """ M = numpy.identity(4) if perspective is not None: P = numpy.identity(4) P[3, :] = perspective[:4] M = numpy.dot(M, P) if translate is not None: T = numpy.identity(4) T[:3, 3] = translate[:3] M = numpy.dot(M, T) if angles is not None: R = euler_matrix(angles[0], angles[1], angles[2], 'sxyz') M = numpy.dot(M, R) if shear is not None: Z = numpy.identity(4) Z[1, 2] = shear[2] Z[0, 2] = shear[1] Z[0, 1] = shear[0] M = numpy.dot(M, Z) if scale is not None: S = numpy.identity(4) S[0, 0] = scale[0] S[1, 1] = scale[1] S[2, 2] = scale[2] M = numpy.dot(M, S) M /= M[3, 3] return M def orthogonalization_matrix(lengths, angles): """Return orthogonalization matrix for crystallographic cell coordinates. Angles are expected in degrees. The de-orthogonalization matrix is the inverse. >>> O = orthogonalization_matrix((10., 10., 10.), (90., 90., 90.)) >>> numpy.allclose(O[:3, :3], numpy.identity(3, float) * 10) True >>> O = orthogonalization_matrix([9.8, 12.0, 15.5], [87.2, 80.7, 69.7]) >>> numpy.allclose(numpy.sum(O), 43.063229) True """ a, b, c = lengths angles = numpy.radians(angles) sina, sinb, _ = numpy.sin(angles) cosa, cosb, cosg = numpy.cos(angles) co = (cosa * cosb - cosg) / (sina * sinb) return numpy.array(( ( a*sinb*math.sqrt(1.0-co*co), 0.0, 0.0, 0.0), (-a*sinb*co, b*sina, 0.0, 0.0), ( a*cosb, b*cosa, c, 0.0), ( 0.0, 0.0, 0.0, 1.0)), dtype=numpy.float64) def superimposition_matrix(v0, v1, scaling=False, usesvd=True): """Return matrix to transform given vector set into second vector set. v0 and v1 are shape (3, \*) or (4, \*) arrays of at least 3 vectors. If usesvd is True, the weighted sum of squared deviations (RMSD) is minimized according to the algorithm by W. Kabsch [8]. Otherwise the quaternion based algorithm by B. Horn [9] is used (slower when using this Python implementation). The returned matrix performs rotation, translation and uniform scaling (if specified). >>> v0 = numpy.random.rand(3, 10) >>> M = superimposition_matrix(v0, v0) >>> numpy.allclose(M, numpy.identity(4)) True >>> R = random_rotation_matrix(numpy.random.random(3)) >>> v0 = ((1,0,0), (0,1,0), (0,0,1), (1,1,1)) >>> v1 = numpy.dot(R, v0) >>> M = superimposition_matrix(v0, v1) >>> numpy.allclose(v1, numpy.dot(M, v0)) True >>> v0 = (numpy.random.rand(4, 100) - 0.5) * 20.0 >>> v0[3] = 1.0 >>> v1 = numpy.dot(R, v0) >>> M = superimposition_matrix(v0, v1) >>> numpy.allclose(v1, numpy.dot(M, v0)) True >>> S = scale_matrix(random.random()) >>> T = translation_matrix(numpy.random.random(3)-0.5) >>> M = concatenate_matrices(T, R, S) >>> v1 = numpy.dot(M, v0) >>> v0[:3] += numpy.random.normal(0.0, 1e-9, 300).reshape(3, -1) >>> M = superimposition_matrix(v0, v1, scaling=True) >>> numpy.allclose(v1, numpy.dot(M, v0)) True >>> M = superimposition_matrix(v0, v1, scaling=True, usesvd=False) >>> numpy.allclose(v1, numpy.dot(M, v0)) True >>> v = numpy.empty((4, 100, 3), dtype=numpy.float64) >>> v[:, :, 0] = v0 >>> M = superimposition_matrix(v0, v1, scaling=True, usesvd=False) >>> numpy.allclose(v1, numpy.dot(M, v[:, :, 0])) True """ v0 = numpy.array(v0, dtype=numpy.float64, copy=False)[:3] v1 = numpy.array(v1, dtype=numpy.float64, copy=False)[:3] if v0.shape != v1.shape or v0.shape[1] < 3: raise ValueError("Vector sets are of wrong shape or type.") # move centroids to origin t0 = numpy.mean(v0, axis=1) t1 = numpy.mean(v1, axis=1) v0 = v0 - t0.reshape(3, 1) v1 = v1 - t1.reshape(3, 1) if usesvd: # Singular Value Decomposition of covariance matrix u, s, vh = numpy.linalg.svd(numpy.dot(v1, v0.T)) # rotation matrix from SVD orthonormal bases R = numpy.dot(u, vh) if numpy.linalg.det(R) < 0.0: # R does not constitute right handed system R -= numpy.outer(u[:, 2], vh[2, :]*2.0) s[-1] *= -1.0 # homogeneous transformation matrix M = numpy.identity(4) M[:3, :3] = R else: # compute symmetric matrix N xx, yy, zz = numpy.sum(v0 * v1, axis=1) xy, yz, zx = numpy.sum(v0 * numpy.roll(v1, -1, axis=0), axis=1) xz, yx, zy = numpy.sum(v0 * numpy.roll(v1, -2, axis=0), axis=1) N = ((xx+yy+zz, yz-zy, zx-xz, xy-yx), (yz-zy, xx-yy-zz, xy+yx, zx+xz), (zx-xz, xy+yx, -xx+yy-zz, yz+zy), (xy-yx, zx+xz, yz+zy, -xx-yy+zz)) # quaternion: eigenvector corresponding to most positive eigenvalue l, V = numpy.linalg.eig(N) q = V[:, numpy.argmax(l)] q /= vector_norm(q) # unit quaternion q = numpy.roll(q, -1) # move w component to end # homogeneous transformation matrix M = quaternion_matrix(q) # scale: ratio of rms deviations from centroid if scaling: v0 *= v0 v1 *= v1 M[:3, :3] *= math.sqrt(numpy.sum(v1) / numpy.sum(v0)) # translation M[:3, 3] = t1 T = numpy.identity(4) T[:3, 3] = -t0 M = numpy.dot(M, T) return M def euler_matrix(ai, aj, ak, axes='sxyz'): """Return homogeneous rotation matrix from Euler angles and axis sequence. ai, aj, ak : Euler's roll, pitch and yaw angles axes : One of 24 axis sequences as string or encoded tuple >>> R = euler_matrix(1, 2, 3, 'syxz') >>> numpy.allclose(numpy.sum(R[0]), -1.34786452) True >>> R = euler_matrix(1, 2, 3, (0, 1, 0, 1)) >>> numpy.allclose(numpy.sum(R[0]), -0.383436184) True >>> ai, aj, ak = (4.0*math.pi) * (numpy.random.random(3) - 0.5) >>> for axes in _AXES2TUPLE.keys(): ... R = euler_matrix(ai, aj, ak, axes) >>> for axes in _TUPLE2AXES.keys(): ... R = euler_matrix(ai, aj, ak, axes) """ try: firstaxis, parity, repetition, frame = _AXES2TUPLE[axes] except (AttributeError, KeyError): _ = _TUPLE2AXES[axes] firstaxis, parity, repetition, frame = axes i = firstaxis j = _NEXT_AXIS[i+parity] k = _NEXT_AXIS[i-parity+1] if frame: ai, ak = ak, ai if parity: ai, aj, ak = -ai, -aj, -ak si, sj, sk = math.sin(ai), math.sin(aj), math.sin(ak) ci, cj, ck = math.cos(ai), math.cos(aj), math.cos(ak) cc, cs = ci*ck, ci*sk sc, ss = si*ck, si*sk M = numpy.identity(4) if repetition: M[i, i] = cj M[i, j] = sj*si M[i, k] = sj*ci M[j, i] = sj*sk M[j, j] = -cj*ss+cc M[j, k] = -cj*cs-sc M[k, i] = -sj*ck M[k, j] = cj*sc+cs M[k, k] = cj*cc-ss else: M[i, i] = cj*ck M[i, j] = sj*sc-cs M[i, k] = sj*cc+ss M[j, i] = cj*sk M[j, j] = sj*ss+cc M[j, k] = sj*cs-sc M[k, i] = -sj M[k, j] = cj*si M[k, k] = cj*ci return M def euler_from_matrix(matrix, axes='sxyz'): """Return Euler angles from rotation matrix for specified axis sequence. axes : One of 24 axis sequences as string or encoded tuple Note that many Euler angle triplets can describe one matrix. >>> R0 = euler_matrix(1, 2, 3, 'syxz') >>> al, be, ga = euler_from_matrix(R0, 'syxz') >>> R1 = euler_matrix(al, be, ga, 'syxz') >>> numpy.allclose(R0, R1) True >>> angles = (4.0*math.pi) * (numpy.random.random(3) - 0.5) >>> for axes in _AXES2TUPLE.keys(): ... R0 = euler_matrix(axes=axes, *angles) ... R1 = euler_matrix(axes=axes, *euler_from_matrix(R0, axes)) ... if not numpy.allclose(R0, R1): print axes, "failed" """ try: firstaxis, parity, repetition, frame = _AXES2TUPLE[axes.lower()] except (AttributeError, KeyError): _ = _TUPLE2AXES[axes] firstaxis, parity, repetition, frame = axes i = firstaxis j = _NEXT_AXIS[i+parity] k = _NEXT_AXIS[i-parity+1] M = numpy.array(matrix, dtype=numpy.float64, copy=False)[:3, :3] if repetition: sy = math.sqrt(M[i, j]*M[i, j] + M[i, k]*M[i, k]) if sy > _EPS: ax = math.atan2( M[i, j], M[i, k]) ay = math.atan2( sy, M[i, i]) az = math.atan2( M[j, i], -M[k, i]) else: ax = math.atan2(-M[j, k], M[j, j]) ay = math.atan2( sy, M[i, i]) az = 0.0 else: cy = math.sqrt(M[i, i]*M[i, i] + M[j, i]*M[j, i]) if cy > _EPS: ax = math.atan2( M[k, j], M[k, k]) ay = math.atan2(-M[k, i], cy) az = math.atan2( M[j, i], M[i, i]) else: ax = math.atan2(-M[j, k], M[j, j]) ay = math.atan2(-M[k, i], cy) az = 0.0 if parity: ax, ay, az = -ax, -ay, -az if frame: ax, az = az, ax return ax, ay, az def euler_from_quaternion(quaternion, axes='sxyz'): """Return Euler angles from quaternion for specified axis sequence. >>> angles = euler_from_quaternion([0.06146124, 0, 0, 0.99810947]) >>> numpy.allclose(angles, [0.123, 0, 0]) True """ return euler_from_matrix(quaternion_matrix(quaternion), axes) def quaternion_from_euler(ai, aj, ak, axes='sxyz'): """Return quaternion from Euler angles and axis sequence. ai, aj, ak : Euler's roll, pitch and yaw angles axes : One of 24 axis sequences as string or encoded tuple >>> q = quaternion_from_euler(1, 2, 3, 'ryxz') >>> numpy.allclose(q, [0.310622, -0.718287, 0.444435, 0.435953]) True """ try: firstaxis, parity, repetition, frame = _AXES2TUPLE[axes.lower()] except (AttributeError, KeyError): _ = _TUPLE2AXES[axes] firstaxis, parity, repetition, frame = axes i = firstaxis j = _NEXT_AXIS[i+parity] k = _NEXT_AXIS[i-parity+1] if frame: ai, ak = ak, ai if parity: aj = -aj ai /= 2.0 aj /= 2.0 ak /= 2.0 ci = math.cos(ai) si = math.sin(ai) cj = math.cos(aj) sj = math.sin(aj) ck = math.cos(ak) sk = math.sin(ak) cc = ci*ck cs = ci*sk sc = si*ck ss = si*sk quaternion = numpy.empty((4, ), dtype=numpy.float64) if repetition: quaternion[i] = cj*(cs + sc) quaternion[j] = sj*(cc + ss) quaternion[k] = sj*(cs - sc) quaternion[3] = cj*(cc - ss) else: quaternion[i] = cj*sc - sj*cs quaternion[j] = cj*ss + sj*cc quaternion[k] = cj*cs - sj*sc quaternion[3] = cj*cc + sj*ss if parity: quaternion[j] *= -1 return quaternion def quaternion_about_axis(angle, axis): """Return quaternion for rotation about axis. >>> q = quaternion_about_axis(0.123, (1, 0, 0)) >>> numpy.allclose(q, [0.06146124, 0, 0, 0.99810947]) True """ quaternion = numpy.zeros((4, ), dtype=numpy.float64) quaternion[:3] = axis[:3] qlen = vector_norm(quaternion) if qlen > _EPS: quaternion *= math.sin(angle/2.0) / qlen quaternion[3] = math.cos(angle/2.0) return quaternion def quaternion_matrix(quaternion): """Return homogeneous rotation matrix from quaternion. >>> R = quaternion_matrix([0.06146124, 0, 0, 0.99810947]) >>> numpy.allclose(R, rotation_matrix(0.123, (1, 0, 0))) True """ q = numpy.array(quaternion[:4], dtype=numpy.float64, copy=True) nq = numpy.dot(q, q) if nq < _EPS: return numpy.identity(4) q *= math.sqrt(2.0 / nq) q = numpy.outer(q, q) return numpy.array(( (1.0-q[1, 1]-q[2, 2], q[0, 1]-q[2, 3], q[0, 2]+q[1, 3], 0.0), ( q[0, 1]+q[2, 3], 1.0-q[0, 0]-q[2, 2], q[1, 2]-q[0, 3], 0.0), ( q[0, 2]-q[1, 3], q[1, 2]+q[0, 3], 1.0-q[0, 0]-q[1, 1], 0.0), ( 0.0, 0.0, 0.0, 1.0) ), dtype=numpy.float64) def quaternion_from_matrix(matrix): """Return quaternion from rotation matrix. >>> R = rotation_matrix(0.123, (1, 2, 3)) >>> q = quaternion_from_matrix(R) >>> numpy.allclose(q, [0.0164262, 0.0328524, 0.0492786, 0.9981095]) True """ q = numpy.empty((4, ), dtype=numpy.float64) M = numpy.array(matrix, dtype=numpy.float64, copy=False)[:4, :4] t = numpy.trace(M) if t > M[3, 3]: q[3] = t q[2] = M[1, 0] - M[0, 1] q[1] = M[0, 2] - M[2, 0] q[0] = M[2, 1] - M[1, 2] else: i, j, k = 0, 1, 2 if M[1, 1] > M[0, 0]: i, j, k = 1, 2, 0 if M[2, 2] > M[i, i]: i, j, k = 2, 0, 1 t = M[i, i] - (M[j, j] + M[k, k]) + M[3, 3] q[i] = t q[j] = M[i, j] + M[j, i] q[k] = M[k, i] + M[i, k] q[3] = M[k, j] - M[j, k] q *= 0.5 / math.sqrt(t * M[3, 3]) return q def quaternion_multiply(quaternion1, quaternion0): """Return multiplication of two quaternions. >>> q = quaternion_multiply([1, -2, 3, 4], [-5, 6, 7, 8]) >>> numpy.allclose(q, [-44, -14, 48, 28]) True """ x0, y0, z0, w0 = quaternion0 x1, y1, z1, w1 = quaternion1 return numpy.array(( x1*w0 + y1*z0 - z1*y0 + w1*x0, -x1*z0 + y1*w0 + z1*x0 + w1*y0, x1*y0 - y1*x0 + z1*w0 + w1*z0, -x1*x0 - y1*y0 - z1*z0 + w1*w0), dtype=numpy.float64) def quaternion_conjugate(quaternion): """Return conjugate of quaternion. >>> q0 = random_quaternion() >>> q1 = quaternion_conjugate(q0) >>> q1[3] == q0[3] and all(q1[:3] == -q0[:3]) True """ return numpy.array((-quaternion[0], -quaternion[1], -quaternion[2], quaternion[3]), dtype=numpy.float64) def quaternion_inverse(quaternion): """Return inverse of quaternion. >>> q0 = random_quaternion() >>> q1 = quaternion_inverse(q0) >>> numpy.allclose(quaternion_multiply(q0, q1), [0, 0, 0, 1]) True """ return quaternion_conjugate(quaternion) / numpy.dot(quaternion, quaternion) def quaternion_slerp(quat0, quat1, fraction, spin=0, shortestpath=True): """Return spherical linear interpolation between two quaternions. >>> q0 = random_quaternion() >>> q1 = random_quaternion() >>> q = quaternion_slerp(q0, q1, 0.0) >>> numpy.allclose(q, q0) True >>> q = quaternion_slerp(q0, q1, 1.0, 1) >>> numpy.allclose(q, q1) True >>> q = quaternion_slerp(q0, q1, 0.5) >>> angle = math.acos(numpy.dot(q0, q)) >>> numpy.allclose(2.0, math.acos(numpy.dot(q0, q1)) / angle) or \ numpy.allclose(2.0, math.acos(-numpy.dot(q0, q1)) / angle) True """ q0 = unit_vector(quat0[:4]) q1 = unit_vector(quat1[:4]) if fraction == 0.0: return q0 elif fraction == 1.0: return q1 d = numpy.dot(q0, q1) if abs(abs(d) - 1.0) < _EPS: return q0 if shortestpath and d < 0.0: # invert rotation d = -d q1 *= -1.0 angle = math.acos(d) + spin * math.pi if abs(angle) < _EPS: return q0 isin = 1.0 / math.sin(angle) q0 *= math.sin((1.0 - fraction) * angle) * isin q1 *= math.sin(fraction * angle) * isin q0 += q1 return q0 def random_quaternion(rand=None): """Return uniform random unit quaternion. rand: array like or None Three independent random variables that are uniformly distributed between 0 and 1. >>> q = random_quaternion() >>> numpy.allclose(1.0, vector_norm(q)) True >>> q = random_quaternion(numpy.random.random(3)) >>> q.shape (4,) """ if rand is None: rand = numpy.random.rand(3) else: assert len(rand) == 3 r1 = numpy.sqrt(1.0 - rand[0]) r2 = numpy.sqrt(rand[0]) pi2 = math.pi * 2.0 t1 = pi2 * rand[1] t2 = pi2 * rand[2] return numpy.array((numpy.sin(t1)*r1, numpy.cos(t1)*r1, numpy.sin(t2)*r2, numpy.cos(t2)*r2), dtype=numpy.float64) def random_rotation_matrix(rand=None): """Return uniform random rotation matrix. rnd: array like Three independent random variables that are uniformly distributed between 0 and 1 for each returned quaternion. >>> R = random_rotation_matrix() >>> numpy.allclose(numpy.dot(R.T, R), numpy.identity(4)) True """ return quaternion_matrix(random_quaternion(rand)) class Arcball(object): """Virtual Trackball Control. >>> ball = Arcball() >>> ball = Arcball(initial=numpy.identity(4)) >>> ball.place([320, 320], 320) >>> ball.down([500, 250]) >>> ball.drag([475, 275]) >>> R = ball.matrix() >>> numpy.allclose(numpy.sum(R), 3.90583455) True >>> ball = Arcball(initial=[0, 0, 0, 1]) >>> ball.place([320, 320], 320) >>> ball.setaxes([1,1,0], [-1, 1, 0]) >>> ball.setconstrain(True) >>> ball.down([400, 200]) >>> ball.drag([200, 400]) >>> R = ball.matrix() >>> numpy.allclose(numpy.sum(R), 0.2055924) True >>> ball.next() """ def __init__(self, initial=None): """Initialize virtual trackball control. initial : quaternion or rotation matrix """ self._axis = None self._axes = None self._radius = 1.0 self._center = [0.0, 0.0] self._vdown = numpy.array([0, 0, 1], dtype=numpy.float64) self._constrain = False if initial is None: self._qdown = numpy.array([0, 0, 0, 1], dtype=numpy.float64) else: initial = numpy.array(initial, dtype=numpy.float64) if initial.shape == (4, 4): self._qdown = quaternion_from_matrix(initial) elif initial.shape == (4, ): initial /= vector_norm(initial) self._qdown = initial else: raise ValueError("initial not a quaternion or matrix.") self._qnow = self._qpre = self._qdown def place(self, center, radius): """Place Arcball, e.g. when window size changes. center : sequence[2] Window coordinates of trackball center. radius : float Radius of trackball in window coordinates. """ self._radius = float(radius) self._center[0] = center[0] self._center[1] = center[1] def setaxes(self, *axes): """Set axes to constrain rotations.""" if axes is None: self._axes = None else: self._axes = [unit_vector(axis) for axis in axes] def setconstrain(self, constrain): """Set state of constrain to axis mode.""" self._constrain = constrain == True def getconstrain(self): """Return state of constrain to axis mode.""" return self._constrain def down(self, point): """Set initial cursor window coordinates and pick constrain-axis.""" self._vdown = arcball_map_to_sphere(point, self._center, self._radius) self._qdown = self._qpre = self._qnow if self._constrain and self._axes is not None: self._axis = arcball_nearest_axis(self._vdown, self._axes) self._vdown = arcball_constrain_to_axis(self._vdown, self._axis) else: self._axis = None def drag(self, point): """Update current cursor window coordinates.""" vnow = arcball_map_to_sphere(point, self._center, self._radius) if self._axis is not None: vnow = arcball_constrain_to_axis(vnow, self._axis) self._qpre = self._qnow t = numpy.cross(self._vdown, vnow) if numpy.dot(t, t) < _EPS: self._qnow = self._qdown else: q = [t[0], t[1], t[2], numpy.dot(self._vdown, vnow)] self._qnow = quaternion_multiply(q, self._qdown) def next(self, acceleration=0.0): """Continue rotation in direction of last drag.""" q = quaternion_slerp(self._qpre, self._qnow, 2.0+acceleration, False) self._qpre, self._qnow = self._qnow, q def matrix(self): """Return homogeneous rotation matrix.""" return quaternion_matrix(self._qnow) def arcball_map_to_sphere(point, center, radius): """Return unit sphere coordinates from window coordinates.""" v = numpy.array(((point[0] - center[0]) / radius, (center[1] - point[1]) / radius, 0.0), dtype=numpy.float64) n = v[0]*v[0] + v[1]*v[1] if n > 1.0: v /= math.sqrt(n) # position outside of sphere else: v[2] = math.sqrt(1.0 - n) return v def arcball_constrain_to_axis(point, axis): """Return sphere point perpendicular to axis.""" v = numpy.array(point, dtype=numpy.float64, copy=True) a = numpy.array(axis, dtype=numpy.float64, copy=True) v -= a * numpy.dot(a, v) # on plane n = vector_norm(v) if n > _EPS: if v[2] < 0.0: v *= -1.0 v /= n return v if a[2] == 1.0: return numpy.array([1, 0, 0], dtype=numpy.float64) return unit_vector([-a[1], a[0], 0]) def arcball_nearest_axis(point, axes): """Return axis, which arc is nearest to point.""" point = numpy.array(point, dtype=numpy.float64, copy=False) nearest = None mx = -1.0 for axis in axes: t = numpy.dot(arcball_constrain_to_axis(point, axis), point) if t > mx: nearest = axis mx = t return nearest # epsilon for testing whether a number is close to zero _EPS = numpy.finfo(float).eps * 4.0 # axis sequences for Euler angles _NEXT_AXIS = [1, 2, 0, 1] # map axes strings to/from tuples of inner axis, parity, repetition, frame _AXES2TUPLE = { 'sxyz': (0, 0, 0, 0), 'sxyx': (0, 0, 1, 0), 'sxzy': (0, 1, 0, 0), 'sxzx': (0, 1, 1, 0), 'syzx': (1, 0, 0, 0), 'syzy': (1, 0, 1, 0), 'syxz': (1, 1, 0, 0), 'syxy': (1, 1, 1, 0), 'szxy': (2, 0, 0, 0), 'szxz': (2, 0, 1, 0), 'szyx': (2, 1, 0, 0), 'szyz': (2, 1, 1, 0), 'rzyx': (0, 0, 0, 1), 'rxyx': (0, 0, 1, 1), 'ryzx': (0, 1, 0, 1), 'rxzx': (0, 1, 1, 1), 'rxzy': (1, 0, 0, 1), 'ryzy': (1, 0, 1, 1), 'rzxy': (1, 1, 0, 1), 'ryxy': (1, 1, 1, 1), 'ryxz': (2, 0, 0, 1), 'rzxz': (2, 0, 1, 1), 'rxyz': (2, 1, 0, 1), 'rzyz': (2, 1, 1, 1)} _TUPLE2AXES = dict((v, k) for k, v in _AXES2TUPLE.items()) # helper functions def vector_norm(data, axis=None, out=None): """Return length, i.e. eucledian norm, of ndarray along axis. >>> v = numpy.random.random(3) >>> n = vector_norm(v) >>> numpy.allclose(n, numpy.linalg.norm(v)) True >>> v = numpy.random.rand(6, 5, 3) >>> n = vector_norm(v, axis=-1) >>> numpy.allclose(n, numpy.sqrt(numpy.sum(v*v, axis=2))) True >>> n = vector_norm(v, axis=1) >>> numpy.allclose(n, numpy.sqrt(numpy.sum(v*v, axis=1))) True >>> v = numpy.random.rand(5, 4, 3) >>> n = numpy.empty((5, 3), dtype=numpy.float64) >>> vector_norm(v, axis=1, out=n) >>> numpy.allclose(n, numpy.sqrt(numpy.sum(v*v, axis=1))) True >>> vector_norm([]) 0.0 >>> vector_norm([1.0]) 1.0 """ data = numpy.array(data, dtype=numpy.float64, copy=True) if out is None: if data.ndim == 1: return math.sqrt(numpy.dot(data, data)) data *= data out = numpy.atleast_1d(numpy.sum(data, axis=axis)) numpy.sqrt(out, out) return out else: data *= data numpy.sum(data, axis=axis, out=out) numpy.sqrt(out, out) def unit_vector(data, axis=None, out=None): """Return ndarray normalized by length, i.e. eucledian norm, along axis. >>> v0 = numpy.random.random(3) >>> v1 = unit_vector(v0) >>> numpy.allclose(v1, v0 / numpy.linalg.norm(v0)) True >>> v0 = numpy.random.rand(5, 4, 3) >>> v1 = unit_vector(v0, axis=-1) >>> v2 = v0 / numpy.expand_dims(numpy.sqrt(numpy.sum(v0*v0, axis=2)), 2) >>> numpy.allclose(v1, v2) True >>> v1 = unit_vector(v0, axis=1) >>> v2 = v0 / numpy.expand_dims(numpy.sqrt(numpy.sum(v0*v0, axis=1)), 1) >>> numpy.allclose(v1, v2) True >>> v1 = numpy.empty((5, 4, 3), dtype=numpy.float64) >>> unit_vector(v0, axis=1, out=v1) >>> numpy.allclose(v1, v2) True >>> list(unit_vector([])) [] >>> list(unit_vector([1.0])) [1.0] """ if out is None: data = numpy.array(data, dtype=numpy.float64, copy=True) if data.ndim == 1: data /= math.sqrt(numpy.dot(data, data)) return data else: if out is not data: out[:] = numpy.array(data, copy=False) data = out length = numpy.atleast_1d(numpy.sum(data*data, axis)) numpy.sqrt(length, length) if axis is not None: length = numpy.expand_dims(length, axis) data /= length if out is None: return data def random_vector(size): """Return array of random doubles in the half-open interval [0.0, 1.0). >>> v = random_vector(10000) >>> numpy.all(v >= 0.0) and numpy.all(v < 1.0) True >>> v0 = random_vector(10) >>> v1 = random_vector(10) >>> numpy.any(v0 == v1) False """ return numpy.random.random(size) def inverse_matrix(matrix): """Return inverse of square transformation matrix. >>> M0 = random_rotation_matrix() >>> M1 = inverse_matrix(M0.T) >>> numpy.allclose(M1, numpy.linalg.inv(M0.T)) True >>> for size in range(1, 7): ... M0 = numpy.random.rand(size, size) ... M1 = inverse_matrix(M0) ... if not numpy.allclose(M1, numpy.linalg.inv(M0)): print size """ return numpy.linalg.inv(matrix) def concatenate_matrices(*matrices): """Return concatenation of series of transformation matrices. >>> M = numpy.random.rand(16).reshape((4, 4)) - 0.5 >>> numpy.allclose(M, concatenate_matrices(M)) True >>> numpy.allclose(numpy.dot(M, M.T), concatenate_matrices(M, M.T)) True """ M = numpy.identity(4) for i in matrices: M = numpy.dot(M, i) return M def is_same_transform(matrix0, matrix1): """Return True if two matrices perform same transformation. >>> is_same_transform(numpy.identity(4), numpy.identity(4)) True >>> is_same_transform(numpy.identity(4), random_rotation_matrix()) False """ matrix0 = numpy.array(matrix0, dtype=numpy.float64, copy=True) matrix0 /= matrix0[3, 3] matrix1 = numpy.array(matrix1, dtype=numpy.float64, copy=True) matrix1 /= matrix1[3, 3] return numpy.allclose(matrix0, matrix1) def _import_module(module_name, warn=True, prefix='_py_', ignore='_'): """Try import all public attributes from module into global namespace. Existing attributes with name clashes are renamed with prefix. Attributes starting with underscore are ignored by default. Return True on successful import. """ try: module = __import__(module_name) except ImportError: if warn: warnings.warn("Failed to import module " + module_name) else: for attr in dir(module): if ignore and attr.startswith(ignore): continue if prefix: if attr in globals(): globals()[prefix + attr] = globals()[attr] elif warn: warnings.warn("No Python implementation of " + attr) globals()[attr] = getattr(module, attr) return True # https://github.com/ros/geometry/blob/hydro-devel/tf/src/tf/transformations.py
57,638
Python
35.619441
79
0.581665
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/pybullet_tools/voxels.py
import os import pybullet as p import numpy as np import time from itertools import product from .utils import unit_pose, safe_zip, multiply, Pose, AABB, create_box, set_pose, get_all_links, LockRenderer, \ get_aabb, pairwise_link_collision, remove_body, draw_aabb, get_box_geometry, create_shape, create_body, STATIC_MASS, \ unit_quat, unit_point, CLIENT, create_shape_array, set_color, get_point, clip, load_model, TEMP_DIR, NULL_ID, \ elapsed_time, draw_point, invert, tform_point, draw_pose, get_aabb_edges, add_line, \ get_pose, PoseSaver, get_aabb_vertices, aabb_from_points, apply_affine, OOBB, draw_oobb, get_aabb_center MAX_TEXTURE_WIDTH = 418 # max square dimension MAX_PIXEL_VALUE = 2**8 - 1 MAX_LINKS = 125 # Max links seems to be 126 ################################################################################ # TODO: different extensions class VoxelGrid(object): # https://github.mit.edu/caelan/ROS/blob/master/sparse_voxel_grid.py # https://github.mit.edu/caelan/ROS/blob/master/base_navigation.py # https://github.mit.edu/caelan/ROS/blob/master/utils.py # https://github.mit.edu/caelan/ROS/blob/master/voxel_detection.py # TODO: can always display the grid in RVIZ after filtering # TODO: compute the maximum sized cuboid (rectangle) in a grid (matrix) def __init__(self, resolutions, default=bool, world_from_grid=unit_pose(), aabb=None, color=(1, 0, 0, 0.5),): #def __init__(self, sizes, centers, pose=unit_pose()): # TODO: defaultdict #assert len(sizes) == len(centers) assert callable(default) self.resolutions = resolutions self.default = default self.value_from_voxel = {} self.world_from_grid = world_from_grid self.aabb = aabb # TODO: apply self.color = color #self.bodies = None # TODO: store voxels more intelligently spatially @property def occupied(self): # TODO: get_occupied return sorted(self.value_from_voxel) def __iter__(self): return iter(self.value_from_voxel) def __len__(self): return len(self.value_from_voxel) def copy(self): # TODO: deepcopy new_grid = VoxelGrid(self.resolutions, self.default, self.world_from_grid, self.aabb, self.color) new_grid.value_from_voxel = dict(self.value_from_voxel) return new_grid def to_grid(self, point_world): return tform_point(invert(self.world_from_grid), point_world) def to_world(self, point_grid): return tform_point(self.world_from_grid, point_grid) def voxel_from_point(self, point): point_grid = self.to_grid(point) return tuple(np.floor(np.divide(point_grid, self.resolutions)).astype(int)) #def voxels_from_aabb_grid(self, aabb): # voxel_lower, voxel_upper = map(self.voxel_from_point, aabb) # return map(tuple, product(*[range(l, u + 1) for l, u in safe_zip(voxel_lower, voxel_upper)])) def voxels_from_aabb(self, aabb): voxel_lower, voxel_upper = aabb_from_points([ self.voxel_from_point(point) for point in get_aabb_vertices(aabb)]) return map(tuple, product(*[range(l, u + 1) for l, u in safe_zip(voxel_lower, voxel_upper)])) # Grid coordinate frame def lower_from_voxel(self, voxel): return np.multiply(voxel, self.resolutions) # self.to_world( def center_from_voxel(self, voxel): return self.lower_from_voxel(np.array(voxel) + 0.5) def upper_from_voxel(self, voxel): return self.lower_from_voxel(np.array(voxel) + 1.0) def aabb_from_voxel(self, voxel): return AABB(self.lower_from_voxel(voxel), self.upper_from_voxel(voxel)) def ray_trace(self, start_cell, goal_point): # TODO: finish adapting if self.is_occupied(start_cell): return [], False goal_cell = self.get_index(goal_point) start_point = self.get_center(start_cell) unit = goal_point - start_point unit /= np.linalg.norm(unit) direction = (unit / np.abs(unit)).astype(int) path = [] current_point = start_point current_cell = start_cell while current_cell != goal_cell: path.append(current_cell) min_k, min_t = None, float('inf') for k, sign in enumerate(direction): next_point = self.get_min(current_cell) if sign < 0 else self.get_max(current_cell) t = ((next_point - current_point)/direction)[k] assert(t > 0) if (t != 0) and (t < min_t): min_k, min_t = k, t assert(min_k is not None) current_point += min_t*unit current_cell = np.array(current_cell, dtype=int) current_cell[min_k] += direction[min_k] current_cell = tuple(current_cell) if self.is_occupied(current_cell): return path, False return path, True # World coordinate frame def pose_from_voxel(self, voxel): pose_grid = Pose(self.center_from_voxel(voxel)) return multiply(self.world_from_grid, pose_grid) def vertices_from_voxel(self, voxel): return list(map(self.to_world, get_aabb_vertices(self.aabb_from_voxel(voxel)))) def contains(self, voxel): # TODO: operator versions return voxel in self.value_from_voxel def get_value(self, voxel): assert self.contains(voxel) return self.value_from_voxel[voxel] def set_value(self, voxel, value): # TODO: remove if value == default self.value_from_voxel[voxel] = value def remove_value(self, voxel): if self.contains(voxel): self.value_from_voxel.pop(voxel) # TODO: return instead? is_occupied = contains def set_occupied(self, voxel): if self.is_occupied(voxel): return False self.set_value(voxel, value=self.default()) return True def set_free(self, voxel): if not self.is_occupied(voxel): return False self.remove_value(voxel) return True def get_neighbors(self, index): for i in range(len(index)): direction = np.zeros(len(index), dtype=int) for n in (-1, +1): direction[i] = n yield tuple(np.array(index) + direction) def get_clusters(self, voxels=None): if voxels is None: voxels = self.occupied clusters = [] assigned = set() def dfs(current): if (current in assigned) or (not self.is_occupied(current)): return [] cluster = [current] assigned.add(current) for neighbor in self.get_neighbors(current): cluster.extend(dfs(neighbor)) return cluster for voxel in voxels: cluster = dfs(voxel) if cluster: clusters.append(cluster) return clusters # TODO: implicitly check collisions def create_box(self): color = (0, 0, 0, 0) #color = None box = create_box(*self.resolutions, color=color) #set_color(box, color=color) set_pose(box, self.world_from_grid) # Set to (0, 0, 0) instead? return box def get_affected(self, bodies, occupied): #assert self.world_from_grid == unit_pose() check_voxels = {} for body in bodies: # TODO: compute AABB in grid frame # pose_world = get_pose(body) # pose_grid = multiply(invert(self.world_from_grid), pose_world) # with PoseSaver(body): # set_pose(body, pose_grid) for link in get_all_links(body): aabb = get_aabb(body, link) # TODO: pad using threshold for voxel in self.voxels_from_aabb(aabb): if self.is_occupied(voxel) == occupied: check_voxels.setdefault(voxel, []).append((body, link)) return check_voxels def check_collision(self, box, voxel, pairs, threshold=0.): box_pairs = [(box, link) for link in get_all_links(box)] set_pose(box, self.pose_from_voxel(voxel)) return any(pairwise_link_collision(body1, link1, body2, link2, max_distance=threshold) for (body1, link1), (body2, link2) in product(pairs, box_pairs)) def add_point(self, point): self.set_occupied(self.voxel_from_point(point)) def add_aabb(self, aabb): for voxel in self.voxels_from_aabb(aabb): self.set_occupied(voxel) def add_body(self, body, **kwargs): self.add_bodies([body], **kwargs) def add_bodies(self, bodies, threshold=0.): # Otherwise, need to transform bodies check_voxels = self.get_affected(bodies, occupied=False) box = self.create_box() for voxel, pairs in check_voxels.items(): # pairs typically only has one element if self.check_collision(box, voxel, pairs, threshold=threshold): self.set_occupied(voxel) remove_body(box) def remove_body(self, body, **kwargs): self.remove_bodies([body], **kwargs) def remove_bodies(self, bodies, **kwargs): # TODO: could also just iterate over the voxels directly check_voxels = self.get_affected(bodies, occupied=True) box = self.create_box() for voxel, pairs in check_voxels.items(): if self.check_collision(box, voxel, pairs, **kwargs): self.set_free(voxel) remove_body(box) def draw_origin(self, scale=1, **kwargs): size = scale*np.min(self.resolutions) return draw_pose(self.world_from_grid, length=size, **kwargs) def draw_voxel(self, voxel, color=None): if color is None: color = self.color aabb = self.aabb_from_voxel(voxel) return draw_oobb(OOBB(aabb, self.world_from_grid), color=color[:3]) # handles.extend(draw_aabb(aabb, color=self.color[:3])) def draw_voxel_boxes(self, voxels=None, **kwargs): if voxels is None: voxels = self.occupied with LockRenderer(): handles = [] for voxel in voxels: handles.extend(self.draw_voxel(voxel, **kwargs)) return handles def draw_voxel_centers(self, voxels=None, color=None): # TODO: could align with grid orientation if voxels is None: voxels = self.occupied if color is None: color = self.color with LockRenderer(): size = np.min(self.resolutions) / 2 handles = [] for voxel in voxels: point_world = self.to_world(self.center_from_voxel(voxel)) handles.extend(draw_point(point_world, size=size, color=color[:3])) return handles def create_voxel_bodies1(self): start_time = time.time() geometry = get_box_geometry(*self.resolutions) collision_id, visual_id = create_shape(geometry, color=self.color) bodies = [] for voxel in self.occupied: body = create_body(collision_id, visual_id) #scale = self.resolutions[0] #body = load_model('models/voxel.urdf', fixed_base=True, scale=scale) set_pose(body, self.pose_from_voxel(voxel)) bodies.append(body) # 0.0462474774444 / voxel print(elapsed_time(start_time)) return bodies def create_voxel_bodies2(self): geometry = get_box_geometry(*self.resolutions) collision_id, visual_id = create_shape(geometry, color=self.color) ordered_voxels = self.occupied bodies = [] for start in range(0, len(ordered_voxels), MAX_LINKS): voxels = ordered_voxels[start:start + MAX_LINKS] body = p.createMultiBody(#baseMass=STATIC_MASS, #baseCollisionShapeIndex=-1, #baseVisualShapeIndex=-1, #basePosition=unit_point(), #baseOrientation=unit_quat(), #baseInertialFramePosition=unit_point(), #baseInertialFrameOrientation=unit_quat(), linkMasses=len(voxels)*[STATIC_MASS], linkCollisionShapeIndices=len(voxels)*[collision_id], linkVisualShapeIndices=len(voxels)*[visual_id], linkPositions=list(map(self.center_from_voxel, voxels)), linkOrientations=len(voxels)*[unit_quat()], linkInertialFramePositions=len(voxels)*[unit_point()], linkInertialFrameOrientations=len(voxels)*[unit_quat()], linkParentIndices=len(voxels)*[0], linkJointTypes=len(voxels)*[p.JOINT_FIXED], linkJointAxis=len(voxels)*[unit_point()], physicsClientId=CLIENT) set_pose(body, self.world_from_grid) bodies.append(body) # 0.0163199263677 / voxel return bodies def create_voxel_bodies3(self): ordered_voxels = self.occupied geoms = [get_box_geometry(*self.resolutions) for _ in ordered_voxels] poses = list(map(self.pose_from_voxel, ordered_voxels)) #colors = [list(self.color) for _ in self.voxels] # TODO: colors don't work colors = None collision_id, visual_id = create_shape_array(geoms, poses, colors) body = create_body(collision_id, visual_id) # Max seems to be 16 #dump_body(body) set_color(body, self.color) return [body] def create_voxel_bodies(self): with LockRenderer(): return self.create_voxel_bodies1() #return self.create_voxel_bodies2() #return self.create_voxel_bodies3() def create_intervals(self): voxel_heights = {} for i, j, k in self.occupied: voxel_heights.setdefault((i, j), set()).add(k) voxel_intervals = [] for i, j in voxel_heights: heights = sorted(voxel_heights[i, j]) start = last = heights[0] for k in heights[1:]: if k == last + 1: last = k else: interval = (start, last) voxel_intervals.append((i, j, interval)) start = last = k interval = (start, last) voxel_intervals.append((i, j, interval)) return voxel_intervals def draw_intervals(self): with LockRenderer(): handles = [] for (i, j, (k1, k2)) in self.create_intervals(): voxels = [(i, j, k1), (i, j, k2)] aabb = aabb_from_points([extrema for voxel in voxels for extrema in self.aabb_from_voxel(voxel)]) handles.extend(draw_oobb(OOBB(aabb, self.world_from_grid), color=self.color[:3])) return handles def draw_vertical_lines(self): with LockRenderer(): handles = [] for (i, j, (k1, k2)) in self.create_intervals(): voxels = [(i, j, k1), (i, j, k2)] aabb = aabb_from_points([extrema for voxel in voxels for extrema in self.aabb_from_voxel(voxel)]) center = get_aabb_center(aabb) p1 = self.to_world(np.append(center[:2], [aabb[0][2]])) p2 = self.to_world(np.append(center[:2], [aabb[1][2]])) handles.append(add_line(p1, p2, color=self.color[:3])) return handles def project2d(self): # TODO: combine adjacent voxels into larger lines # TODO: greedy algorithm that combines lines/boxes # TODO: combine intervals tallest_voxel = {} for i, j, k in self.occupied: tallest_voxel[i, j] = max(k, tallest_voxel.get((i, j), k)) return {(i, j, k) for (i, j), k in tallest_voxel.items()} def create_height_map(self, plane, plane_size, width=MAX_TEXTURE_WIDTH, height=MAX_TEXTURE_WIDTH): min_z, max_z = 0., 2. plane_extent = plane_size*np.array([1, 1, 0]) plane_lower = get_point(plane) - plane_extent/2. #plane_aabb = (plane_lower, plane_lower + plane_extent) #plane_aabb = get_aabb(plane) # TODO: bounding box is effectively empty #plane_lower, plane_upper = plane_aabb #plane_extent = (plane_upper - plane_lower) image_size = np.array([width, height]) # TODO: fix width/height order pixel_from_point = lambda point: np.floor( image_size * (point - plane_lower)[:2] / plane_extent[:2]).astype(int) # TODO: last row/col doesn't seem to be filled height_map = np.zeros(image_size) for voxel in self.project2d(): voxel_aabb = self.aabb_from_voxel(voxel) #if not aabb_contains_aabb(aabb2d_from_aabb(voxel_aabb), aabb2d_from_aabb(plane_aabb)): # continue (x1, y1), (x2, y2) = map(pixel_from_point, voxel_aabb) if (x1 < 0) or (width <= x2) or (y1 < 0) or (height <= y2): continue scaled_z = (clip(voxel_aabb[1][2], min_z, max_z) - min_z) / max_z for c in range(x1, x2+1): for y in range(y1, y2+1): r = height - y - 1 # TODO: can also just set in bulk if using height_map height_map[r, c] = max(height_map[r, c], scaled_z) return height_map ################################################################################ def create_textured_square(size, color=None, width=MAX_TEXTURE_WIDTH, height=MAX_TEXTURE_WIDTH): body = load_model('models/square.urdf', scale=size) if color is not None: set_color(body, color) path = os.path.join(TEMP_DIR, 'texture.png') image = MAX_PIXEL_VALUE*np.ones((width, height, 3), dtype=np.uint8) import scipy.misc scipy.misc.imsave(path, image) texture = p.loadTexture(path) p.changeVisualShape(body, NULL_ID, textureUniqueId=texture, physicsClientId=CLIENT) return body, texture def set_texture(texture, image): # Alias/WaveFront Material (.mtl) File Format # https://people.cs.clemson.edu/~dhouse/courses/405/docs/brief-mtl-file-format.html #print(get_visual_data(body)) width, height, channels = image.shape pixels = image.flatten().tolist() assert len(pixels) <= 524288 # b3Printf: uploadBulletFileToSharedMemory 747003 exceeds max size 524288 p.changeTexture(texture, pixels, width, height, physicsClientId=CLIENT) # TODO: it's important that width and height are the same as the original def rgb_interpolate(grey_image, min_color, max_color): width, height = grey_image.shape channels = 3 rgb_image = np.zeros((width, height, channels), dtype=np.uint8) for k in range(channels): rgb_image[..., k] = MAX_PIXEL_VALUE*(min_color[k]*(1-grey_image) + max_color[k]*grey_image) return rgb_image
19,254
Python
44.736342
122
0.580814
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/pybullet_tools/pr2_problems.py
import os import numpy as np from itertools import product from .pr2_utils import set_arm_conf, REST_LEFT_ARM, open_arm, \ close_arm, get_carry_conf, arm_conf, get_other_arm, set_group_conf, PR2_URDF, DRAKE_PR2_URDF, create_gripper from .utils import create_box, set_base_values, set_point, set_pose, get_pose, \ get_bodies, z_rotation, load_model, load_pybullet, HideOutput, create_body, \ get_box_geometry, get_cylinder_geometry, create_shape_array, unit_pose, Pose, \ Point, LockRenderer, FLOOR_URDF, TABLE_URDF, add_data_path, TAN, set_color, BASE_LINK, remove_body LIGHT_GREY = (0.7, 0.7, 0.7, 1.) class Problem(object): def __init__(self, robot, arms=tuple(), movable=tuple(), grasp_types=tuple(), surfaces=tuple(), sinks=tuple(), stoves=tuple(), buttons=tuple(), goal_conf=None, goal_holding=tuple(), goal_on=tuple(), goal_cleaned=tuple(), goal_cooked=tuple(), costs=False, body_names={}, body_types=[], base_limits=None): self.robot = robot self.arms = arms self.movable = movable self.grasp_types = grasp_types self.surfaces = surfaces self.sinks = sinks self.stoves = stoves self.buttons = buttons self.goal_conf = goal_conf self.goal_holding = goal_holding self.goal_on = goal_on self.goal_cleaned = goal_cleaned self.goal_cooked = goal_cooked self.costs = costs self.body_names = body_names self.body_types = body_types self.base_limits = base_limits all_movable = [self.robot] + list(self.movable) self.fixed = list(filter(lambda b: b not in all_movable, get_bodies())) self.gripper = None def get_gripper(self, arm='left', visual=True): # upper = get_max_limit(problem.robot, get_gripper_joints(problem.robot, 'left')[0]) # set_configuration(gripper, [0]*4) # dump_body(gripper) if self.gripper is None: self.gripper = create_gripper(self.robot, arm=arm, visual=visual) return self.gripper def remove_gripper(self): if self.gripper is not None: remove_body(self.gripper) self.gripper = None def __repr__(self): return repr(self.__dict__) ####################################################### def get_fixed_bodies(problem): # TODO: move to problem? return problem.fixed def create_pr2(use_drake=True, fixed_base=True, torso=0.2): pr2_path = DRAKE_PR2_URDF if use_drake else PR2_URDF with LockRenderer(): with HideOutput(): pr2 = load_model(pr2_path, fixed_base=fixed_base) set_group_conf(pr2, 'torso', [torso]) return pr2 def create_floor(**kwargs): directory = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'models') add_data_path(directory) return load_pybullet(FLOOR_URDF, **kwargs) def create_table(width=0.6, length=1.2, height=0.73, thickness=0.03, radius=0.015, top_color=LIGHT_GREY, leg_color=TAN, cylinder=True, **kwargs): # TODO: table URDF surface = get_box_geometry(width, length, thickness) surface_pose = Pose(Point(z=height - thickness/2.)) leg_height = height-thickness if cylinder: leg_geometry = get_cylinder_geometry(radius, leg_height) else: leg_geometry = get_box_geometry(width=2*radius, length=2*radius, height=leg_height) legs = [leg_geometry for _ in range(4)] leg_center = np.array([width, length])/2. - radius*np.ones(2) leg_xys = [np.multiply(leg_center, np.array(signs)) for signs in product([-1, +1], repeat=len(leg_center))] leg_poses = [Pose(point=[x, y, leg_height/2.]) for x, y in leg_xys] geoms = [surface] + legs poses = [surface_pose] + leg_poses colors = [top_color] + len(legs)*[leg_color] collision_id, visual_id = create_shape_array(geoms, poses, colors) body = create_body(collision_id, visual_id, **kwargs) # TODO: unable to use several colors #for idx, color in enumerate(geoms): # set_color(body, shape_index=idx, color=color) return body def create_door(): return load_pybullet("data/door.urdf") ####################################################### # https://github.com/bulletphysics/bullet3/search?l=XML&q=.urdf&type=&utf8=%E2%9C%93 TABLE_MAX_Z = 0.6265 # TODO: the table legs don't seem to be included for collisions? def holding_problem(arm='left', grasp_type='side'): other_arm = get_other_arm(arm) initial_conf = get_carry_conf(arm, grasp_type) pr2 = create_pr2() set_base_values(pr2, (0, -2, 0)) set_arm_conf(pr2, arm, initial_conf) open_arm(pr2, arm) set_arm_conf(pr2, other_arm, arm_conf(other_arm, REST_LEFT_ARM)) close_arm(pr2, other_arm) plane = create_floor() table = load_pybullet(TABLE_URDF) #table = load_pybullet("table_square/table_square.urdf") box = create_box(.07, .05, .15) set_point(box, (0, 0, TABLE_MAX_Z + .15/2)) return Problem(robot=pr2, movable=[box], arms=[arm], grasp_types=[grasp_type], surfaces=[table], goal_conf=get_pose(pr2), goal_holding=[(arm, box)]) def stacking_problem(arm='left', grasp_type='top'): other_arm = get_other_arm(arm) initial_conf = get_carry_conf(arm, grasp_type) pr2 = create_pr2() set_base_values(pr2, (0, 0, 0)) set_arm_conf(pr2, arm, initial_conf) open_arm(pr2, arm) set_arm_conf(pr2, other_arm, arm_conf(other_arm, REST_LEFT_ARM)) close_arm(pr2, other_arm) plane = create_floor() block = create_box(.07, .05, .15) set_point(block, (1.0, 0.5, 0.775)) table1 = create_box(0.5, 0.5, 0.7, color=(.25, .25, .75, 1)) set_point(table1, (1.0, 0.5, 0.35)) table2 = create_box(0.5, 0.5, 0.7, color=(.75, .25, .25, 1)) set_point(table2, (1.0, -0.5, 0.35)) return Problem(robot=pr2, movable=[block], arms=[arm], grasp_types=[grasp_type], surfaces=[table1, table2], goal_on=[(block, table2)]) ####################################################### def create_kitchen(w=.5, h=.7): floor = create_floor() table = create_box(w, w, h, color=(.75, .75, .75, 1)) set_point(table, (2, 0, h/2)) mass = 1 #mass = 0.01 #mass = 1e-6 cabbage = create_box(.07, .07, .1, mass=mass, color=(0, 1, 0, 1)) #cabbage = load_model(BLOCK_URDF, fixed_base=False) set_point(cabbage, (2, 0, h + .1/2)) sink = create_box(w, w, h, color=(.25, .25, .75, 1)) set_point(sink, (0, 2, h/2)) stove = create_box(w, w, h, color=(.75, .25, .25, 1)) set_point(stove, (0, -2, h/2)) return table, cabbage, sink, stove ####################################################### def cleaning_problem(arm='left', grasp_type='top'): other_arm = get_other_arm(arm) initial_conf = get_carry_conf(arm, grasp_type) pr2 = create_pr2() set_arm_conf(pr2, arm, initial_conf) open_arm(pr2, arm) set_arm_conf(pr2, other_arm, arm_conf(other_arm, REST_LEFT_ARM)) close_arm(pr2, other_arm) table, cabbage, sink, stove = create_kitchen() #door = create_door() #set_point(door, (2, 0, 0)) return Problem(robot=pr2, movable=[cabbage], arms=[arm], grasp_types=[grasp_type], surfaces=[table, sink, stove], sinks=[sink], stoves=[stove], goal_cleaned=[cabbage]) def cooking_problem(arm='left', grasp_type='top'): other_arm = get_other_arm(arm) initial_conf = get_carry_conf(arm, grasp_type) pr2 = create_pr2() set_arm_conf(pr2, arm, initial_conf) open_arm(pr2, arm) set_arm_conf(pr2, other_arm, arm_conf(other_arm, REST_LEFT_ARM)) close_arm(pr2, other_arm) table, cabbage, sink, stove = create_kitchen() return Problem(robot=pr2, movable=[cabbage], arms=[arm], grasp_types=[grasp_type], surfaces=[table, sink, stove], sinks=[sink], stoves=[stove], goal_cooked=[cabbage]) def cleaning_button_problem(arm='left', grasp_type='top'): other_arm = get_other_arm(arm) initial_conf = get_carry_conf(arm, grasp_type) pr2 = create_pr2() set_arm_conf(pr2, arm, initial_conf) open_arm(pr2, arm) set_arm_conf(pr2, other_arm, arm_conf(other_arm, REST_LEFT_ARM)) close_arm(pr2, other_arm) table, cabbage, sink, stove = create_kitchen() d = 0.1 sink_button = create_box(d, d, d, color=(0, 0, 0, 1)) set_pose(sink_button, ((0, 2-(.5+d)/2, .7-d/2), z_rotation(np.pi/2))) stove_button = create_box(d, d, d, color=(0, 0, 0, 1)) set_pose(stove_button, ((0, -2+(.5+d)/2, .7-d/2), z_rotation(-np.pi/2))) return Problem(robot=pr2, movable=[cabbage], arms=[arm], grasp_types=[grasp_type], surfaces=[table, sink, stove], sinks=[sink], stoves=[stove], buttons=[(sink_button, sink), (stove_button, stove)], goal_conf=get_pose(pr2), goal_holding=[(arm, cabbage)], goal_cleaned=[cabbage]) def cooking_button_problem(arm='left', grasp_type='top'): other_arm = get_other_arm(arm) initial_conf = get_carry_conf(arm, grasp_type) pr2 = create_pr2() set_arm_conf(pr2, arm, initial_conf) open_arm(pr2, arm) set_arm_conf(pr2, other_arm, arm_conf(other_arm, REST_LEFT_ARM)) close_arm(pr2, other_arm) table, cabbage, sink, stove = create_kitchen() d = 0.1 sink_button = create_box(d, d, d, color=(0, 0, 0, 1)) set_pose(sink_button, ((0, 2-(.5+d)/2, .7-d/2), z_rotation(np.pi/2))) stove_button = create_box(d, d, d, color=(0, 0, 0, 1)) set_pose(stove_button, ((0, -2+(.5+d)/2, .7-d/2), z_rotation(-np.pi/2))) return Problem(robot=pr2, movable=[cabbage], arms=[arm], grasp_types=[grasp_type], surfaces=[table, sink, stove], sinks=[sink], stoves=[stove], buttons=[(sink_button, sink), (stove_button, stove)], goal_conf=get_pose(pr2), goal_holding=[(arm, cabbage)], goal_cooked=[cabbage]) PROBLEMS = [ holding_problem, stacking_problem, cleaning_problem, cooking_problem, cleaning_button_problem, cooking_button_problem, ]
10,187
Python
36.455882
112
0.598802
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/pybullet_tools/retime.py
import math import numpy as np from pybullet_tools.utils import clip, INF, \ waypoints_from_path, adjust_path, get_difference, get_pairs, get_max_velocities, get_duration_fn, wait_if_gui #ARM_SPEED = 0.15*np.pi # radians / sec ARM_SPEED = 0.2 # percent DEFAULT_SPEED_FRACTION = 0.3 ################################################################################ def ensure_increasing(path, time_from_starts): assert len(path) == len(time_from_starts) for i in reversed(range(1, len(path))): if time_from_starts[i-1] == time_from_starts[i]: path.pop(i) time_from_starts.pop(i) def decompose_into_paths(joints, path): current_path = [] joint_sequence = [] path_sequence = [] for q1, q2 in get_pairs(path): # Zero velocities aren't enforced otherwise indices, = np.nonzero(get_difference(q1, q2)) current_joints = tuple(joints[j] for j in indices) if not joint_sequence or (current_joints != joint_sequence[-1]): if current_path: path_sequence.append(current_path) joint_sequence.append(current_joints) current_path = [tuple(q1[j] for j in indices)] current_path.append(tuple(q2[j] for j in indices)) if current_path: path_sequence.append(current_path) return zip(joint_sequence, path_sequence) ################################################################################ # TODO: retain based on the end effector velocity def instantaneous_retime_path(robot, joints, path, speed=ARM_SPEED): duration_fn = get_duration_fn(robot, joints) # get_distance_fn mid_durations = [duration_fn(*pair) for pair in get_pairs(path)] durations = [0.] + mid_durations time_from_starts = np.cumsum(durations) / speed return time_from_starts def slow_trajectory(robot, joints, path, min_fraction=0.1, ramp_duration=1.0, **kwargs): """ :param robot: :param joints: :param path: :param min_fraction: percentage :param ramp_duration: seconds :param kwargs: :return: """ time_from_starts = instantaneous_retime_path(robot, joints, path, **kwargs) mid_times = [np.average(pair) for pair in get_pairs(time_from_starts)] mid_durations = [t2 - t1 for t1, t2 in get_pairs(time_from_starts)] new_time_from_starts = [0.] for mid_time, mid_duration in zip(mid_times, mid_durations): time_from_start = mid_time - time_from_starts[0] up_fraction = clip(time_from_start / ramp_duration, min_value=min_fraction, max_value=1.) time_from_end = time_from_starts[-1] - mid_time down_fraction = clip(time_from_end / ramp_duration, min_value=min_fraction, max_value=1.) new_fraction = min(up_fraction, down_fraction) new_duration = mid_duration / new_fraction #print(new_time_from_starts[-1], up_fraction, down_fraction, new_duration) new_time_from_starts.append(new_time_from_starts[-1] + new_duration) # print(time_from_starts) # print(new_time_from_starts) # wait_if_gui('Continue?) # time_from_starts = new_time_from_starts return new_time_from_starts #def acceleration_limits(robot, joints, path, speed=ARM_SPEED, **kwargs): # # TODO: multiple bodies (such as drawer) # # The drawers do actually have velocity limits # fraction = 0.25 # duration_fn = get_duration_fn(robot, joints) # max_velocities = speed * np.array(get_max_velocities(robot, joints)) # max_accelerations = 2*fraction*max_velocities # TODO: fraction # difference_fn = get_difference_fn(robot, joints) # differences1 = [difference_fn(q2, q1) for q1, q2 in zip(path[:-1], path[1:])] # differences2 = [np.array(d2) - np.array(d1) for d1, d2 in zip(differences1[:-1], differences1[1:])] # TODO: circular case ################################################################################ def compute_ramp_duration(distance, acceleration, duration): discriminant = max(0, math.pow(duration * acceleration, 2) - 4 * distance * acceleration) velocity = 0.5 * (duration * acceleration - math.sqrt(discriminant)) # +/- #assert velocity <= max_velocity ramp_time = velocity / acceleration predicted_distance = velocity * (duration - 2 * ramp_time) + acceleration * math.pow(ramp_time, 2) assert abs(distance - predicted_distance) < 1e-6 return ramp_time def compute_position(ramp_time, max_duration, acceleration, t): velocity = acceleration * ramp_time max_time = max_duration - 2 * ramp_time t1 = clip(t, 0, ramp_time) t2 = clip(t - ramp_time, 0, max_time) t3 = clip(t - ramp_time - max_time, 0, ramp_time) #assert t1 + t2 + t3 == t return 0.5 * acceleration * math.pow(t1, 2) + velocity * t2 + \ velocity * t3 - 0.5 * acceleration * math.pow(t3, 2) def add_ramp_waypoints(differences, accelerations, q1, duration, sample_step, waypoints, time_from_starts): dim = len(q1) distances = np.abs(differences) time_from_start = time_from_starts[-1] ramp_durations = [compute_ramp_duration(distances[idx], accelerations[idx], duration) for idx in range(dim)] directions = np.sign(differences) for t in np.arange(sample_step, duration, sample_step): positions = [] for idx in range(dim): distance = compute_position(ramp_durations[idx], duration, accelerations[idx], t) positions.append(q1[idx] + directions[idx] * distance) waypoints.append(positions) time_from_starts.append(time_from_start + t) return waypoints, time_from_starts ################################################################################ def compute_min_duration(distance, max_velocity, acceleration): if distance == 0: return 0 max_ramp_duration = max_velocity / acceleration if acceleration == INF: #return distance / max_velocity ramp_distance = 0. else: ramp_distance = 0.5 * acceleration * math.pow(max_ramp_duration, 2) remaining_distance = distance - 2 * ramp_distance if 0 <= remaining_distance: # zero acceleration remaining_time = remaining_distance / max_velocity total_time = 2 * max_ramp_duration + remaining_time else: half_time = np.sqrt(distance / acceleration) total_time = 2 * half_time return total_time def ramp_retime_path(path, max_velocities, acceleration_fraction=INF, sample_step=None): """ :param path: :param max_velocities: :param acceleration_fraction: fraction of velocity_fraction*max_velocity per second :param sample_step: :return: """ assert np.all(max_velocities) accelerations = max_velocities * acceleration_fraction dim = len(max_velocities) #difference_fn = get_difference_fn(robot, joints) # TODO: more fine grain when moving longer distances # Assuming instant changes in accelerations waypoints = [path[0]] time_from_starts = [0.] for q1, q2 in get_pairs(path): differences = get_difference(q1, q2) # assumes not circular anymore #differences = difference_fn(q1, q2) distances = np.abs(differences) duration = max([compute_min_duration(distances[idx], max_velocities[idx], accelerations[idx]) for idx in range(dim)] + [0.]) time_from_start = time_from_starts[-1] if sample_step is not None: waypoints, time_from_starts = add_ramp_waypoints(differences, accelerations, q1, duration, sample_step, waypoints, time_from_starts) waypoints.append(q2) time_from_starts.append(time_from_start + duration) return waypoints, time_from_starts def retime_trajectory(robot, joints, path, only_waypoints=False, velocity_fraction=DEFAULT_SPEED_FRACTION, **kwargs): """ :param robot: :param joints: :param path: :param velocity_fraction: fraction of max_velocity :return: """ path = adjust_path(robot, joints, path) if only_waypoints: path = waypoints_from_path(path) max_velocities = velocity_fraction * np.array(get_max_velocities(robot, joints)) return ramp_retime_path(path, max_velocities, **kwargs) ################################################################################ def approximate_spline(time_from_starts, path, k=3, approx=INF): from scipy.interpolate import make_interp_spline, make_lsq_spline x = time_from_starts if approx == INF: positions = make_interp_spline(time_from_starts, path, k=k, t=None, bc_type='clamped') positions.x = positions.t[positions.k:-positions.k] else: # TODO: approximation near the endpoints # approx = min(approx, len(x) - 2*k) assert approx <= len(x) - 2 * k t = np.r_[(x[0],) * (k + 1), # np.linspace(x[0]+1e-3, x[-1]-1e-3, num=approx, endpoint=True), np.linspace(x[0], x[-1], num=2 + approx, endpoint=True)[1:-1], (x[-1],) * (k + 1)] # t = positions.t # Need to slice # w = np.zeros(...) w = None positions = make_lsq_spline(x, path, t, k=k, w=w) positions.x = positions.t[positions.k:-positions.k] return positions def interpolate_path(robot, joints, path, velocity_fraction=DEFAULT_SPEED_FRACTION, k=1, bspline=False, dump=False, **kwargs): from scipy.interpolate import CubicSpline, interp1d #from scipy.interpolate import CubicHermiteSpline, KroghInterpolator # https://scikit-learn.org/stable/auto_examples/linear_model/plot_polynomial_interpolation.html # TODO: local search to retime by adding or removing waypoints # TODO: iteratively increase spacing until velocity / accelerations meets limits # https://docs.scipy.org/doc/scipy/reference/tutorial/interpolate.html # Waypoints are followed perfectly, twice continuously differentiable # TODO: https://pythonrobotics.readthedocs.io/en/latest/modules/path_tracking.html#mpc-modeling path, time_from_starts = retime_trajectory(robot, joints, path, velocity_fraction=velocity_fraction, sample_step=None) if k == 3: if bspline: positions = approximate_spline(time_from_starts, path, k=k, **kwargs) else: # bc_type= clamped | natural | ((1, 0), (1, 0)) positions = CubicSpline(time_from_starts, path, bc_type='clamped', extrapolate=False) else: kinds = {1: 'linear', 2: 'quadratic', 3: 'cubic'} # slinear positions = interp1d(time_from_starts, path, kind=kinds[k], axis=0, assume_sorted=True) if not dump: return positions # TODO: only if CubicSpline velocities = positions.derivative() accelerations = positions.derivative() for i, t in enumerate(positions.x): print(i, round(t, 3), positions(t), velocities(t), accelerations(t)) # TODO: compose piecewise functions # TODO: ramp up and ramp down path # TODO: quadratic interpolation between endpoints return positions def sample_curve(positions_curve, time_step=1e-2): start_time = positions_curve.x[0] end_time = positions_curve.x[-1] times = np.append(np.arange(start_time, end_time, step=time_step), [end_time]) for t in times: q = positions_curve(t) yield t, q
11,377
Python
43.272373
126
0.627494
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/pybullet_tools/parse_json.py
import numpy as np from .pr2_utils import DRAKE_PR2_URDF, set_group_conf, REST_LEFT_ARM, rightarm_from_leftarm from .utils import HideOutput, load_model, base_values_from_pose, has_joint, set_joint_position, \ joint_from_name, get_box_geometry, create_shape, Pose, Point, STATIC_MASS, NULL_ID, CLIENT, set_pose, \ get_cylinder_geometry, get_sphere_geometry, create_shape_array, create_body def parse_point(point_json): return tuple(point_json[key] for key in ['x', 'y', 'z']) def parse_quat(quat_json): return tuple(quat_json[key] for key in ['x', 'y', 'z', 'w']) def parse_pose(pose_json): return parse_point(pose_json['point']), parse_quat(pose_json['quat']) def parse_color(color_json): return tuple(color_json[key] for key in ['r', 'g', 'b', 'a']) def parse_robot(robot_json): pose = parse_pose(robot_json) if robot_json['name'] == 'pr2': with HideOutput(): robot_id = load_model(DRAKE_PR2_URDF, fixed_base=True) set_group_conf(robot_id, 'base', base_values_from_pose(pose)) else: # TODO: set the z? #set_pose(robot_id, pose) raise NotImplementedError(robot_json['name']) for joint, values in robot_json['conf'].items(): [value] = values if has_joint(robot_id, joint): set_joint_position(robot_id, joint_from_name(robot_id, joint), value) else: print('Robot {} lacks joint {}'.format(robot_json['name'], joint)) if robot_json['name'] == 'pr2': set_group_conf(robot_id, 'torso', [0.2]) set_group_conf(robot_id, 'left_arm', REST_LEFT_ARM) set_group_conf(robot_id, 'right_arm', rightarm_from_leftarm(REST_LEFT_ARM)) return robot_id def parse_region(region): lower = np.min(region['hull'], axis=0) upper = np.max(region['hull'], axis=0) x, y = (lower + upper) / 2. w, h = (upper - lower) # / 2. geom = get_box_geometry(w, h, 1e-3) collision_id, visual_id = create_shape(geom, pose=Pose(Point(x, y)), color=parse_color(region['color'])) #region_id = create_body(NULL_ID, visual_id) region_id = create_body(collision_id, visual_id) set_pose(region_id, parse_pose(region)) return region_id def parse_geometry(geometry): # TODO: can also just make fixed links geom = None if geometry['type'] == 'box': geom = get_box_geometry(*2 * np.array(geometry['extents'])) elif geometry['type'] == 'cylinder': geom = get_cylinder_geometry(geometry['radius'], geometry['height']) elif geometry['type'] == 'sphere': # TODO: does sphere not work? geom = get_sphere_geometry(geometry['radius']) elif geometry['type'] == 'trimesh': pass else: raise NotImplementedError(geometry['type']) pose = parse_pose(geometry) color = parse_color(geometry['color']) # specular=geometry['specular']) return geom, pose, color def parse_body(body, important=False): [link] = body['links'] # for geometry in link['geometries']: geoms = [] poses = [] colors = [] skipped = False for geometry in link: geom, pose, color = parse_geometry(geometry) if geom == None: skipped = True else: geoms.append(geom) poses.append(pose) colors.append(color) if skipped: if important: center = body['aabb']['center'] extents = 2*np.array(body['aabb']['extents']) geoms = [get_box_geometry(*extents)] poses = [Pose(center)] colors = [(.5, .5, .5, 1)] else: return None if not geoms: return None if len(geoms) == 1: collision_id, visual_id = create_shape(geoms[0], pose=poses[0], color=colors[0]) else: collision_id, visual_id = create_shape_array(geoms, poses, colors) body_id = create_body(collision_id, visual_id) set_pose(body_id, parse_pose(body)) return body_id
3,974
Python
33.868421
108
0.603926
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/pybullet_tools/create_never_collision.py
import numpy as np import itertools link_name = ['base_footprint', 'base_link', 'base_roll_link', 'base_r_drive_wheel_link', 'base_l_drive_wheel_link', 'base_r_passive_wheel_x_frame', 'base_r_passive_wheel_y_frame', 'base_r_passive_wheel_z_link', 'base_l_passive_wheel_x_frame', 'base_l_passive_wheel_y_frame', 'base_l_passive_wheel_z_link', 'base_range_sensor_link', 'base_imu_frame', 'base_f_bumper_link', 'base_b_bumper_link', 'torso_lift_link', 'head_pan_link', 'head_tilt_link', 'head_l_stereo_camera_link', 'head_l_stereo_camera_gazebo_frame', 'head_r_stereo_camera_link', 'head_r_stereo_camera_gazebo_frame', 'head_center_camera_frame', 'head_center_camera_gazebo_frame', 'head_rgbd_sensor_link', 'head_rgbd_sensor_gazebo_frame', 'arm_lift_link', 'arm_flex_link', 'arm_roll_link', 'wrist_flex_link', 'wrist_ft_sensor_mount_link', 'wrist_ft_sensor_frame', 'wrist_roll_link', 'hand_palm_link', 'hand_motor_dummy_link', 'hand_l_proximal_link', 'hand_l_spring_proximal_link', 'hand_l_mimic_distal_link', 'hand_l_distal_link', 'hand_l_finger_tip_frame', 'hand_l_finger_vacuum_frame', 'hand_r_proximal_link', 'hand_r_spring_proximal_link', 'hand_r_mimic_distal_link', 'hand_r_distal_link', 'hand_r_finger_tip_frame', 'hand_camera_frame', 'hand_camera_gazebo_frame'] def create_never_collision(link_name): results = [] for pair in itertools.combinations(link_name, 2): results.append(tuple(pair)) return results if __name__ == '__main__': results = create_never_collision(link_name) print('results: ', results)
1,731
Python
26.492063
53
0.625072
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/pybullet_tools/kuka_primitives.py
import time from itertools import count from .pr2_utils import get_top_grasps from .utils import get_pose, set_pose, get_movable_joints, \ set_joint_positions, add_fixed_constraint, enable_real_time, disable_real_time, joint_controller, \ enable_gravity, get_refine_fn, wait_for_duration, link_from_name, get_body_name, sample_placement, \ end_effector_from_body, approach_from_grasp, plan_joint_motion, GraspInfo, Pose, INF, Point, \ inverse_kinematics, pairwise_collision, remove_fixed_constraint, Attachment, get_sample_fn, \ step_simulation, refine_path, plan_direct_joint_motion, get_joint_positions, dump_world, wait_if_gui, flatten # TODO: deprecate GRASP_INFO = { 'top': GraspInfo(lambda body: get_top_grasps(body, under=True, tool_pose=Pose(), max_width=INF, grasp_length=0), approach_pose=Pose(0.1*Point(z=1))), } TOOL_FRAMES = { 'iiwa14': 'iiwa_link_ee_kuka', # iiwa_link_ee | iiwa_link_ee_kuka } DEBUG_FAILURE = False ################################################## class BodyPose(object): num = count() def __init__(self, body, pose=None): if pose is None: pose = get_pose(body) self.body = body self.pose = pose self.index = next(self.num) @property def value(self): return self.pose def assign(self): set_pose(self.body, self.pose) return self.pose def __repr__(self): index = self.index #index = id(self) % 1000 return 'p{}'.format(index) class BodyGrasp(object): num = count() def __init__(self, body, grasp_pose, approach_pose, robot, link): self.body = body self.grasp_pose = grasp_pose self.approach_pose = approach_pose self.robot = robot self.link = link self.index = next(self.num) @property def value(self): return self.grasp_pose @property def approach(self): return self.approach_pose #def constraint(self): # grasp_constraint() def attachment(self): return Attachment(self.robot, self.link, self.grasp_pose, self.body) def assign(self): return self.attachment().assign() def __repr__(self): index = self.index #index = id(self) % 1000 return 'g{}'.format(index) class BodyConf(object): num = count() def __init__(self, body, configuration=None, joints=None): if joints is None: joints = get_movable_joints(body) if configuration is None: configuration = get_joint_positions(body, joints) self.body = body self.joints = joints self.configuration = configuration self.index = next(self.num) @property def values(self): return self.configuration def assign(self): set_joint_positions(self.body, self.joints, self.configuration) return self.configuration def __repr__(self): index = self.index #index = id(self) % 1000 return 'q{}'.format(index) class BodyPath(object): def __init__(self, body, path, joints=None, attachments=[]): if joints is None: joints = get_movable_joints(body) self.body = body self.path = path self.joints = joints self.attachments = attachments def bodies(self): return set([self.body] + [attachment.body for attachment in self.attachments]) def iterator(self): # TODO: compute and cache these # TODO: compute bounding boxes as well for i, configuration in enumerate(self.path): set_joint_positions(self.body, self.joints, configuration) for grasp in self.attachments: grasp.assign() yield i def control(self, real_time=False, dt=0): # TODO: just waypoints if real_time: enable_real_time() else: disable_real_time() for values in self.path: for _ in joint_controller(self.body, self.joints, values): enable_gravity() if not real_time: step_simulation() time.sleep(dt) # def full_path(self, q0=None): # # TODO: could produce sequence of savers def refine(self, num_steps=0): return self.__class__(self.body, refine_path(self.body, self.joints, self.path, num_steps), self.joints, self.attachments) def reverse(self): return self.__class__(self.body, self.path[::-1], self.joints, self.attachments) def __repr__(self): return '{}({},{},{},{})'.format(self.__class__.__name__, self.body, len(self.joints), len(self.path), len(self.attachments)) ################################################## class ApplyForce(object): def __init__(self, body, robot, link): self.body = body self.robot = robot self.link = link def bodies(self): return {self.body, self.robot} def iterator(self, **kwargs): return [] def refine(self, **kwargs): return self def __repr__(self): return '{}({},{})'.format(self.__class__.__name__, self.robot, self.body) class Attach(ApplyForce): def control(self, **kwargs): # TODO: store the constraint_id? add_fixed_constraint(self.body, self.robot, self.link) def reverse(self): return Detach(self.body, self.robot, self.link) class Detach(ApplyForce): def control(self, **kwargs): remove_fixed_constraint(self.body, self.robot, self.link) def reverse(self): return Attach(self.body, self.robot, self.link) class Command(object): num = count() def __init__(self, body_paths): self.body_paths = body_paths self.index = next(self.num) def bodies(self): return set(flatten(path.bodies() for path in self.body_paths)) # def full_path(self, q0=None): # if q0 is None: # q0 = Conf(self.tree) # new_path = [q0] # for partial_path in self.body_paths: # new_path += partial_path.full_path(new_path[-1])[1:] # return new_path def step(self): for i, body_path in enumerate(self.body_paths): for j in body_path.iterator(): msg = '{},{}) step?'.format(i, j) wait_if_gui(msg) #print(msg) def execute(self, time_step=0.05): for i, body_path in enumerate(self.body_paths): for j in body_path.iterator(): #time.sleep(time_step) wait_for_duration(time_step) def control(self, real_time=False, dt=0): # TODO: real_time for body_path in self.body_paths: body_path.control(real_time=real_time, dt=dt) def refine(self, **kwargs): return self.__class__([body_path.refine(**kwargs) for body_path in self.body_paths]) def reverse(self): return self.__class__([body_path.reverse() for body_path in reversed(self.body_paths)]) def __repr__(self): index = self.index #index = id(self) % 1000 return 'c{}'.format(index) ####################################################### def get_tool_link(robot): return link_from_name(robot, TOOL_FRAMES[get_body_name(robot)]) def get_grasp_gen(robot, grasp_name='top'): grasp_info = GRASP_INFO[grasp_name] tool_link = get_tool_link(robot) def gen(body): grasp_poses = grasp_info.get_grasps(body) # TODO: continuous set of grasps for grasp_pose in grasp_poses: body_grasp = BodyGrasp(body, grasp_pose, grasp_info.approach_pose, robot, tool_link) yield (body_grasp,) return gen def get_stable_gen(fixed=[]): def gen(body, surface): while True: pose = sample_placement(body, surface) if (pose is None) or any(pairwise_collision(body, b) for b in fixed): continue body_pose = BodyPose(body, pose) yield (body_pose,) return gen def get_ik_fn(robot, fixed=[], teleport=False, num_attempts=10): movable_joints = get_movable_joints(robot) sample_fn = get_sample_fn(robot, movable_joints) def fn(body, pose, grasp): obstacles = [body] + fixed gripper_pose = end_effector_from_body(pose.pose, grasp.grasp_pose) approach_pose = approach_from_grasp(grasp.approach_pose, gripper_pose) for _ in range(num_attempts): set_joint_positions(robot, movable_joints, sample_fn()) # Random seed # TODO: multiple attempts? q_approach = inverse_kinematics(robot, grasp.link, approach_pose) if (q_approach is None) or any(pairwise_collision(robot, b) for b in obstacles): continue conf = BodyConf(robot, q_approach) q_grasp = inverse_kinematics(robot, grasp.link, gripper_pose) if (q_grasp is None) or any(pairwise_collision(robot, b) for b in obstacles): continue if teleport: path = [q_approach, q_grasp] else: conf.assign() #direction, _ = grasp.approach_pose #path = workspace_trajectory(robot, grasp.link, point_from_pose(approach_pose), -direction, # quat_from_pose(approach_pose)) path = plan_direct_joint_motion(robot, conf.joints, q_grasp, obstacles=obstacles) if path is None: if DEBUG_FAILURE: wait_if_gui('Approach motion failed') continue command = Command([BodyPath(robot, path), Attach(body, robot, grasp.link), BodyPath(robot, path[::-1], attachments=[grasp])]) return (conf, command) # TODO: holding collisions return None return fn ################################################## def assign_fluent_state(fluents): obstacles = [] for fluent in fluents: name, args = fluent[0], fluent[1:] if name == 'atpose': o, p = args obstacles.append(o) p.assign() else: raise ValueError(name) return obstacles def get_free_motion_gen(robot, fixed=[], teleport=False, self_collisions=True): def fn(conf1, conf2, fluents=[]): assert ((conf1.body == conf2.body) and (conf1.joints == conf2.joints)) if teleport: path = [conf1.configuration, conf2.configuration] else: conf1.assign() obstacles = fixed + assign_fluent_state(fluents) path = plan_joint_motion(robot, conf2.joints, conf2.configuration, obstacles=obstacles, self_collisions=self_collisions) if path is None: if DEBUG_FAILURE: wait_if_gui('Free motion failed') return None command = Command([BodyPath(robot, path, joints=conf2.joints)]) return (command,) return fn def get_holding_motion_gen(robot, fixed=[], teleport=False, self_collisions=True): def fn(conf1, conf2, body, grasp, fluents=[]): assert ((conf1.body == conf2.body) and (conf1.joints == conf2.joints)) if teleport: path = [conf1.configuration, conf2.configuration] else: conf1.assign() obstacles = fixed + assign_fluent_state(fluents) path = plan_joint_motion(robot, conf2.joints, conf2.configuration, obstacles=obstacles, attachments=[grasp.attachment()], self_collisions=self_collisions) if path is None: if DEBUG_FAILURE: wait_if_gui('Holding motion failed') return None command = Command([BodyPath(robot, path, joints=conf2.joints, attachments=[grasp])]) return (command,) return fn ################################################## def get_movable_collision_test(): def test(command, body, pose): if body in command.bodies(): return False pose.assign() for path in command.body_paths: moving = path.bodies() if body in moving: # TODO: cannot collide with itself continue for _ in path.iterator(): # TODO: could shuffle this if any(pairwise_collision(mov, body) for mov in moving): if DEBUG_FAILURE: wait_if_gui('Movable collision') return True return False return test
12,539
Python
36.657658
132
0.574767
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/pybullet_tools/ikfast/utils.py
import random import numpy as np from collections import namedtuple from ..utils import matrix_from_quat, point_from_pose, quat_from_pose, quat_from_matrix, \ get_joint_limits, get_joint_position, get_joint_positions, get_distance IKFastInfo = namedtuple('IKFastInfo', ['module_name', 'base_link', 'ee_link', 'free_joints']) USE_ALL = False USE_CURRENT = None def compute_forward_kinematics(fk_fn, conf): pose = fk_fn(list(conf)) pos, rot = pose quat = quat_from_matrix(np.array(rot)) # [X,Y,Z,W] return pos, quat def compute_inverse_kinematics(ik_fn, pose, sampled=[]): pos = point_from_pose(pose) rot = matrix_from_quat(quat_from_pose(pose)).tolist() if len(sampled) == 0: solutions = ik_fn(list(rot), list(pos)) else: solutions = ik_fn(list(rot), list(pos), list(sampled)) if solutions is None: return [] return solutions def get_ik_limits(robot, joint, limits=USE_ALL): if limits is USE_ALL: return get_joint_limits(robot, joint) elif limits is USE_CURRENT: value = get_joint_position(robot, joint) return value, value return limits def select_solution(body, joints, solutions, nearby_conf=USE_CURRENT, **kwargs): if not solutions: return None if nearby_conf is USE_ALL: return random.choice(solutions) if nearby_conf is USE_CURRENT: nearby_conf = get_joint_positions(body, joints) return min(solutions, key=lambda conf: get_distance(nearby_conf, conf, **kwargs))
1,529
Python
26.321428
93
0.666449
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/pybullet_tools/ikfast/ikfast.py
from __future__ import print_function import os import sys import time import importlib import numpy as np PARENT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) sys.path.append(PARENT_DIR) from itertools import islice, chain from .utils import compute_inverse_kinematics, compute_forward_kinematics from ..utils import get_link_pose, link_from_name, multiply, invert, parent_joint_from_link, parent_link_from_joint, \ prune_fixed_joints, joints_from_names, INF, get_difference_fn, \ get_joint_positions, get_min_limits, get_max_limits, interval_generator, elapsed_time, randomize, violates_limits, \ get_length, get_relative_pose, set_joint_positions, get_pose_distance, ConfSaver, \ sub_inverse_kinematics, set_configuration, wait_for_user, multiple_sub_inverse_kinematics, get_ordered_ancestors SETUP_FILENAME = 'setup.py' def get_module_name(ikfast_info): return 'ikfast.{}'.format(ikfast_info.module_name) def import_ikfast(ikfast_info): # https://stackoverflow.com/questions/67631/how-to-import-a-module-given-the-full-path return importlib.import_module(get_module_name(ikfast_info), package=None) def is_ik_compiled(ikfast_info): try: import_ikfast(ikfast_info) return True except ImportError: return False def check_ik_solver(ikfast_info): print(ikfast_info) try: import_ikfast(ikfast_info) print('Using IKFast for inverse kinematics') except ImportError as e: print(e) module_name = get_module_name(ikfast_info) ik_path = os.path.join(PARENT_DIR, '/'.join(module_name.split('.')[:-1])) build_path = os.path.join(ik_path, SETUP_FILENAME) print('Could not import IKFast module {}, please compile {} to use IKFast.'.format( module_name, build_path)) print('$ (cd {}; ./{})'.format(ik_path, SETUP_FILENAME)) print('Using PyBullet for inverse kinematics') return True else: return False ################################################## def get_base_from_ee(robot, ikfast_info, tool_link, world_from_target): ee_link = link_from_name(robot, ikfast_info.ee_link) tool_from_ee = get_relative_pose(robot, ee_link, tool_link) world_from_base = get_link_pose(robot, link_from_name(robot, ikfast_info.base_link)) return multiply(invert(world_from_base), world_from_target, tool_from_ee) def get_ik_joints(robot, ikfast_info, tool_link): # Get joints between base and ee # Ensure no joints between ee and tool base_link = link_from_name(robot, ikfast_info.base_link) ee_link = link_from_name(robot, ikfast_info.ee_link) ee_ancestors = get_ordered_ancestors(robot, ee_link) tool_ancestors = get_ordered_ancestors(robot, tool_link) [first_joint] = [parent_joint_from_link(link) for link in tool_ancestors if parent_link_from_joint(robot, parent_joint_from_link(link)) == base_link] assert prune_fixed_joints(robot, ee_ancestors) == prune_fixed_joints(robot, tool_ancestors) ik_joints = prune_fixed_joints(robot, ee_ancestors[ee_ancestors.index(first_joint):]) free_joints = joints_from_names(robot, ikfast_info.free_joints) assert set(free_joints) <= set(ik_joints) assert len(ik_joints) == 6 + len(free_joints) return ik_joints ################################################## def check_solution(robot, joints, conf, tool_link, target_pose, tolerance=1e-6): with ConfSaver(robot, joints=joints): set_joint_positions(robot, joints, conf) actual_pose = get_link_pose(robot, tool_link) pos_distance, ori_distance = get_pose_distance(target_pose, actual_pose) valid = (pos_distance <= tolerance) and (ori_distance <= tolerance) if not valid: print('IKFast warning! | Valid: {} | Position error: {:.3e} | Orientation error: {:.3e}'.format( valid, pos_distance, ori_distance)) return valid def ikfast_forward_kinematics(robot, ikfast_info, tool_link, conf=None, use_ikfast=True): ik_joints = get_ik_joints(robot, ikfast_info, tool_link) if conf is None: conf = get_joint_positions(robot, ik_joints) if not use_ikfast: set_joint_positions(robot, ik_joints, conf) world_from_tool = get_link_pose(robot, tool_link) check_solution(robot, ik_joints, conf, tool_link, world_from_tool) return world_from_tool ikfast = import_ikfast(ikfast_info) base_from_ee = compute_forward_kinematics(ikfast.get_fk, conf) world_from_base = get_link_pose(robot, link_from_name(robot, ikfast_info.base_link)) tool_from_ee = get_relative_pose(robot, link_from_name(robot, ikfast_info.ee_link), tool_link) world_from_tool = multiply(world_from_base, base_from_ee, invert(tool_from_ee)) check_solution(robot, ik_joints, conf, tool_link, world_from_tool) return world_from_tool ################################################## def ikfast_inverse_kinematics(robot, ikfast_info, tool_link, world_from_target, fixed_joints=[], max_attempts=INF, max_time=INF, norm=INF, max_distance=INF, **kwargs): assert (max_attempts < INF) or (max_time < INF) if max_distance is None: max_distance = INF ikfast = import_ikfast(ikfast_info) ik_joints = get_ik_joints(robot, ikfast_info, tool_link) free_joints = joints_from_names(robot, ikfast_info.free_joints) base_from_ee = get_base_from_ee(robot, ikfast_info, tool_link, world_from_target) difference_fn = get_difference_fn(robot, ik_joints) current_conf = get_joint_positions(robot, ik_joints) current_positions = get_joint_positions(robot, free_joints) free_deltas = np.array([0. if joint in fixed_joints else max_distance for joint in free_joints]) lower_limits = np.maximum(get_min_limits(robot, free_joints), current_positions - free_deltas) upper_limits = np.minimum(get_max_limits(robot, free_joints), current_positions + free_deltas) generator = chain([current_positions], interval_generator(lower_limits, upper_limits)) if max_attempts < INF: generator = islice(generator, max_attempts) start_time = time.time() for free_positions in generator: if max_time < elapsed_time(start_time): break for conf in randomize(compute_inverse_kinematics(ikfast.get_ik, base_from_ee, free_positions)): difference = difference_fn(current_conf, conf) if not violates_limits(robot, ik_joints, conf) and (get_length(difference, norm=norm) <= max_distance): yield conf def closest_inverse_kinematics(robot, ikfast_info, tool_link, world_from_target, max_candidates=INF, norm=INF, verbose=True, **kwargs): start_time = time.time() ik_joints = get_ik_joints(robot, ikfast_info, tool_link) current_conf = get_joint_positions(robot, ik_joints) generator = ikfast_inverse_kinematics(robot, ikfast_info, tool_link, world_from_target, norm=norm, **kwargs) if max_candidates < INF: generator = islice(generator, max_candidates) solutions = list(generator) difference_fn = get_difference_fn(robot, ik_joints) solutions = sorted(solutions, key=lambda q: get_length(difference_fn(q, current_conf), norm=norm)) if verbose: min_distance = min([INF] + [get_length(difference_fn(q, current_conf), norm=norm) for q in solutions]) print('Identified {} IK solutions with minimum distance of {:.3f} in {:.3f} seconds'.format( len(solutions), min_distance, elapsed_time(start_time))) return iter(solutions) ################################################## def pybullet_inverse_kinematics(robot, ikfast_info, tool_link, world_from_target, fixed_joints=[], **kwargs): ik_joints = get_ik_joints(robot, ikfast_info, tool_link) free_joints = [joint for joint in ik_joints if joint not in fixed_joints] assert free_joints first_joint = free_joints[0] solutions = multiple_sub_inverse_kinematics(robot, first_joint, tool_link, world_from_target, max_attempts=1, first_close=True, **kwargs) for solution in solutions: set_configuration(robot, solution) yield get_joint_positions(robot, ik_joints) def either_inverse_kinematics(robot, ikfast_info, tool_link, world_from_target, fixed_joints=[], use_pybullet=False, **kwargs): if not use_pybullet and is_ik_compiled(ikfast_info): return closest_inverse_kinematics(robot, ikfast_info, tool_link, world_from_target, fixed_joints=fixed_joints, **kwargs) return pybullet_inverse_kinematics(robot, ikfast_info, tool_link, world_from_target, fixed_joints=[])
8,822
Python
42.895522
128
0.662888
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/pybullet_tools/ikfast/compile.py
import fnmatch import importlib import os import shutil from distutils.core import setup from distutils.dir_util import copy_tree from distutils.extension import Extension # Build C++ extension by running: 'python setup.py build' # see: https://docs.python.org/3/extending/building.html # http://openrave.org/docs/0.8.2/openravepy/ikfast/ # https://github.com/rdiankov/openrave/blob/master/python/ikfast.py#L92 # http://wiki.ros.org/Industrial/Tutorials/Create_a_Fast_IK_Solution # Yijiang # https://github.com/yijiangh/ikfast_pybind # https://github.com/yijiangh/conrob_pybullet/tree/master/utils/ikfast # https://github.com/yijiangh/choreo/blob/bc777069b8eb7283c74af26e5461532aec3d9e8a/framefab_robot/abb/framefab_irb6600/framefab_irb6600_support/doc/ikfast_tutorial.rst def compile_ikfast(module_name, cpp_filename, remove_build=False): ikfast_module = Extension(module_name, sources=[cpp_filename]) setup(name=module_name, version='1.0', description="ikfast module {}".format(module_name), ext_modules=[ikfast_module]) build_lib_path = None for root, dirnames, filenames in os.walk(os.getcwd()): if fnmatch.fnmatch(root, os.path.join(os.getcwd(), "*build", "lib*")): build_lib_path = root break assert build_lib_path copy_tree(build_lib_path, os.getcwd()) if remove_build: shutil.rmtree(os.path.join(os.getcwd(), 'build')) try: importlib.import_module(module_name) print('\nikfast module {} imported successful'.format(module_name)) except ImportError as e: print('\nikfast module {} imported failed'.format(module_name)) raise e return True
1,696
Python
35.106382
167
0.708726
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/pybullet_tools/ikfast/franka_panda/ik.py
from ..utils import IKFastInfo from ..ikfast import * # For legacy purposes # TODO: deprecate this file #FRANKA_URDF = "models/franka_description/robots/panda_arm.urdf" #FRANKA_URDF = "models/franka_description/robots/hand.urdf" FRANKA_URDF = "models/franka_description/robots/panda_arm_hand.urdf" PANDA_INFO = IKFastInfo(module_name='franka_panda.ikfast_panda_arm', base_link='panda_link0', ee_link='panda_link8', free_joints=['panda_joint7'])
471
Python
41.909087
93
0.723992
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/pybullet_tools/ikfast/franka_panda/ikfast_panda_arm.cpp
/// autogenerated analytical inverse kinematics code from ikfast program part of OpenRAVE /// \author Rosen Diankov /// /// Licensed under the Apache License, Version 2.0 (the "License"); /// you may not use this file except in compliance with the License. /// You may obtain a copy of the License at /// http://www.apache.org/licenses/LICENSE-2.0 /// /// Unless required by applicable law or agreed to in writing, software /// distributed under the License is distributed on an "AS IS" BASIS, /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. /// See the License for the specific language governing permissions and /// limitations under the License. /// /// ikfast version 0x10000049 generated on 2019-09-26 13:20:29.249476 /// To compile with gcc: /// gcc -lstdc++ ik.cpp /// To compile without any main function as a shared object (might need -llapack): /// gcc -fPIC -lstdc++ -DIKFAST_NO_MAIN -DIKFAST_CLIBRARY -shared -Wl,-soname,libik.so -o libik.so ik.cpp //// START //// Make sure the version number matches. //// You might need to install the dev version to get the header files. //// sudo apt-get install python3.4-dev #include "Python.h" //// END #define IKFAST_HAS_LIBRARY #include "ikfast.h" // found inside share/openrave-X.Y/python/ikfast.h using namespace ikfast; // check if the included ikfast version matches what this file was compiled with #define IKFAST_COMPILE_ASSERT(x) extern int __dummy[(int)x] IKFAST_COMPILE_ASSERT(IKFAST_VERSION==0x10000049); #include <cmath> #include <vector> #include <limits> #include <algorithm> #include <complex> #ifndef IKFAST_ASSERT #include <stdexcept> #include <sstream> #include <iostream> #ifdef _MSC_VER #ifndef __PRETTY_FUNCTION__ #define __PRETTY_FUNCTION__ __FUNCDNAME__ #endif #endif #ifndef __PRETTY_FUNCTION__ #define __PRETTY_FUNCTION__ __func__ #endif #define IKFAST_ASSERT(b) { if( !(b) ) { std::stringstream ss; ss << "ikfast exception: " << __FILE__ << ":" << __LINE__ << ": " <<__PRETTY_FUNCTION__ << ": Assertion '" << #b << "' failed"; throw std::runtime_error(ss.str()); } } #endif #if defined(_MSC_VER) #define IKFAST_ALIGNED16(x) __declspec(align(16)) x #else #define IKFAST_ALIGNED16(x) x __attribute((aligned(16))) #endif #define IK2PI ((IkReal)6.28318530717959) #define IKPI ((IkReal)3.14159265358979) #define IKPI_2 ((IkReal)1.57079632679490) #ifdef _MSC_VER #ifndef isnan #define isnan _isnan #endif #ifndef isinf #define isinf _isinf #endif //#ifndef isfinite //#define isfinite _isfinite //#endif #endif // _MSC_VER // lapack routines extern "C" { void dgetrf_ (const int* m, const int* n, double* a, const int* lda, int* ipiv, int* info); void zgetrf_ (const int* m, const int* n, std::complex<double>* a, const int* lda, int* ipiv, int* info); void dgetri_(const int* n, const double* a, const int* lda, int* ipiv, double* work, const int* lwork, int* info); void dgesv_ (const int* n, const int* nrhs, double* a, const int* lda, int* ipiv, double* b, const int* ldb, int* info); void dgetrs_(const char *trans, const int *n, const int *nrhs, double *a, const int *lda, int *ipiv, double *b, const int *ldb, int *info); void dgeev_(const char *jobvl, const char *jobvr, const int *n, double *a, const int *lda, double *wr, double *wi,double *vl, const int *ldvl, double *vr, const int *ldvr, double *work, const int *lwork, int *info); } using namespace std; // necessary to get std math routines #ifdef IKFAST_NAMESPACE namespace IKFAST_NAMESPACE { #endif inline float IKabs(float f) { return fabsf(f); } inline double IKabs(double f) { return fabs(f); } inline float IKsqr(float f) { return f*f; } inline double IKsqr(double f) { return f*f; } inline float IKlog(float f) { return logf(f); } inline double IKlog(double f) { return log(f); } // allows asin and acos to exceed 1. has to be smaller than thresholds used for branch conds and evaluation #ifndef IKFAST_SINCOS_THRESH #define IKFAST_SINCOS_THRESH ((IkReal)1e-7) #endif // used to check input to atan2 for degenerate cases. has to be smaller than thresholds used for branch conds and evaluation #ifndef IKFAST_ATAN2_MAGTHRESH #define IKFAST_ATAN2_MAGTHRESH ((IkReal)1e-7) #endif // minimum distance of separate solutions #ifndef IKFAST_SOLUTION_THRESH #define IKFAST_SOLUTION_THRESH ((IkReal)1e-6) #endif // there are checkpoints in ikfast that are evaluated to make sure they are 0. This threshold speicfies by how much they can deviate #ifndef IKFAST_EVALCOND_THRESH #define IKFAST_EVALCOND_THRESH ((IkReal)0.00001) #endif inline float IKasin(float f) { IKFAST_ASSERT( f > -1-IKFAST_SINCOS_THRESH && f < 1+IKFAST_SINCOS_THRESH ); // any more error implies something is wrong with the solver if( f <= -1 ) return float(-IKPI_2); else if( f >= 1 ) return float(IKPI_2); return asinf(f); } inline double IKasin(double f) { IKFAST_ASSERT( f > -1-IKFAST_SINCOS_THRESH && f < 1+IKFAST_SINCOS_THRESH ); // any more error implies something is wrong with the solver if( f <= -1 ) return -IKPI_2; else if( f >= 1 ) return IKPI_2; return asin(f); } // return positive value in [0,y) inline float IKfmod(float x, float y) { while(x < 0) { x += y; } return fmodf(x,y); } // return positive value in [0,y) inline double IKfmod(double x, double y) { while(x < 0) { x += y; } return fmod(x,y); } inline float IKacos(float f) { IKFAST_ASSERT( f > -1-IKFAST_SINCOS_THRESH && f < 1+IKFAST_SINCOS_THRESH ); // any more error implies something is wrong with the solver if( f <= -1 ) return float(IKPI); else if( f >= 1 ) return float(0); return acosf(f); } inline double IKacos(double f) { IKFAST_ASSERT( f > -1-IKFAST_SINCOS_THRESH && f < 1+IKFAST_SINCOS_THRESH ); // any more error implies something is wrong with the solver if( f <= -1 ) return IKPI; else if( f >= 1 ) return 0; return acos(f); } inline float IKsin(float f) { return sinf(f); } inline double IKsin(double f) { return sin(f); } inline float IKcos(float f) { return cosf(f); } inline double IKcos(double f) { return cos(f); } inline float IKtan(float f) { return tanf(f); } inline double IKtan(double f) { return tan(f); } inline float IKsqrt(float f) { if( f <= 0.0f ) return 0.0f; return sqrtf(f); } inline double IKsqrt(double f) { if( f <= 0.0 ) return 0.0; return sqrt(f); } inline float IKatan2Simple(float fy, float fx) { return atan2f(fy,fx); } inline float IKatan2(float fy, float fx) { if( isnan(fy) ) { IKFAST_ASSERT(!isnan(fx)); // if both are nan, probably wrong value will be returned return float(IKPI_2); } else if( isnan(fx) ) { return 0; } return atan2f(fy,fx); } inline double IKatan2Simple(double fy, double fx) { return atan2(fy,fx); } inline double IKatan2(double fy, double fx) { if( isnan(fy) ) { IKFAST_ASSERT(!isnan(fx)); // if both are nan, probably wrong value will be returned return IKPI_2; } else if( isnan(fx) ) { return 0; } return atan2(fy,fx); } template <typename T> struct CheckValue { T value; bool valid; }; template <typename T> inline CheckValue<T> IKatan2WithCheck(T fy, T fx, T epsilon) { CheckValue<T> ret; ret.valid = false; ret.value = 0; if( !isnan(fy) && !isnan(fx) ) { if( IKabs(fy) >= IKFAST_ATAN2_MAGTHRESH || IKabs(fx) > IKFAST_ATAN2_MAGTHRESH ) { ret.value = IKatan2Simple(fy,fx); ret.valid = true; } } return ret; } inline float IKsign(float f) { if( f > 0 ) { return float(1); } else if( f < 0 ) { return float(-1); } return 0; } inline double IKsign(double f) { if( f > 0 ) { return 1.0; } else if( f < 0 ) { return -1.0; } return 0; } template <typename T> inline CheckValue<T> IKPowWithIntegerCheck(T f, int n) { CheckValue<T> ret; ret.valid = true; if( n == 0 ) { ret.value = 1.0; return ret; } else if( n == 1 ) { ret.value = f; return ret; } else if( n < 0 ) { if( f == 0 ) { ret.valid = false; ret.value = (T)1.0e30; return ret; } if( n == -1 ) { ret.value = T(1.0)/f; return ret; } } int num = n > 0 ? n : -n; if( num == 2 ) { ret.value = f*f; } else if( num == 3 ) { ret.value = f*f*f; } else { ret.value = 1.0; while(num>0) { if( num & 1 ) { ret.value *= f; } num >>= 1; f *= f; } } if( n < 0 ) { ret.value = T(1.0)/ret.value; } return ret; } /// solves the forward kinematics equations. /// \param pfree is an array specifying the free joints of the chain. IKFAST_API void ComputeFk(const IkReal* j, IkReal* eetrans, IkReal* eerot) { IkReal x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,x17,x18,x19,x20,x21,x22,x23,x24,x25,x26,x27,x28,x29,x30,x31,x32,x33,x34,x35,x36,x37,x38,x39,x40,x41,x42,x43,x44,x45,x46,x47,x48,x49,x50,x51,x52,x53,x54,x55,x56,x57,x58,x59,x60,x61,x62,x63,x64,x65,x66,x67,x68,x69,x70; x0=IKcos(j[0]); x1=IKcos(j[1]); x2=IKsin(j[2]); x3=IKcos(j[2]); x4=IKsin(j[0]); x5=IKcos(j[3]); x6=IKsin(j[1]); x7=IKsin(j[3]); x8=IKsin(j[4]); x9=IKcos(j[4]); x10=IKcos(j[6]); x11=IKsin(j[6]); x12=IKsin(j[5]); x13=IKcos(j[5]); x14=((0.088)*x8); x15=((0.0825)*x3); x16=((1.0)*x13); x17=((1.0)*x7); x18=((1.0)*x4); x19=((0.0825)*x4); x20=((0.107)*x7); x21=((0.384)*x3); x22=((0.088)*x7); x23=((0.384)*x4); x24=((1.0)*x3); x25=((0.088)*x9); x26=((0.316)*x6); x27=((0.107)*x9); x28=((0.107)*x8); x29=((1.0)*x12); x30=(x5*x6); x31=(x6*x7); x32=(x0*x1); x33=(x0*x2); x34=(x1*x5); x35=(x1*x3); x36=(x0*x3); x37=(x1*x7); x38=(x2*x6); x39=(x18*x2); x40=(x19*x2); x41=((0.0825)*x33); x42=(x38*x8); x43=(x15*x32); x44=(x1*x39); x45=(x1*x15*x4); x46=((((-1.0)*x44))+x36); x47=(x37+(((-1.0)*x24*x30))); x48=(((x3*x31))+x34); x49=(x39+(((-1.0)*x24*x32))); x50=(((x18*x3))+(((1.0)*x2*x32))); x51=((-1.0)*x50); x52=((((-1.0)*x33))+(((-1.0)*x18*x35))); x53=(x45+x41); x54=(x12*x48); x55=(x46*x8); x56=(x52*x7); x57=(x51*x8); x58=(((x5*(((((-1.0)*x39))+((x3*x32))))))+((x0*x31))); x59=(((x31*x4))+((x5*((((x35*x4))+x33))))); x60=(((x47*x9))+x42); x61=(((x49*x7))+((x0*x30))); x62=(((x47*x8))+(((-1.0)*x38*x9))); x63=(((x30*x4))+x56); x64=(x58*x9); x65=(x59*x9); x66=(x12*x61); x67=(x55+x65); x68=(((x59*x8))+((x9*(((((-1.0)*x0*x24))+x44))))); x69=(((x50*x9))+((x58*x8))); x70=(x57+x64); eerot[0]=(((x10*((x66+((x13*x70))))))+((x11*x69))); eerot[1]=(((x10*x69))+((x11*(((((-1.0)*x29*x61))+(((-1.0)*x16*x70))))))); eerot[2]=(((x13*(((((-1.0)*x0*x30))+(((-1.0)*x17*x49))))))+((x12*x70))); IkReal x71=(x0*x30); eetrans[0]=((((-1.0)*x40))+((x12*((((x27*x58))+((x28*x51))))))+((x0*x26))+((x13*((((x14*x51))+((x25*x58))))))+((x13*(((((-1.0)*x20*x49))+(((-0.107)*x71))))))+(((-0.0825)*x0*x31))+((x7*((((x2*x23))+(((-1.0)*x21*x32))))))+((x12*(((((0.088)*x71))+((x22*x49))))))+x43+(((0.384)*x71))+((x5*(((((-1.0)*x43))+x40))))); eerot[3]=(((x11*x68))+((x10*((((x12*x63))+((x13*x67))))))); eerot[4]=(((x11*(((((-1.0)*x29*x63))+(((-1.0)*x16*x67))))))+((x10*x68))); eerot[5]=(((x12*x67))+((x13*(((((-1.0)*x18*x30))+(((-1.0)*x17*x52))))))); IkReal x72=(x30*x4); eetrans[1]=((((-1.0)*x5*x53))+((x23*x30))+((x12*(((((0.088)*x72))+((x22*x52))))))+((x7*(((((-1.0)*x1*x21*x4))+(((-0.384)*x33))))))+((x12*((((x27*x59))+((x28*x46))))))+((x13*(((((-1.0)*x20*x52))+(((-0.107)*x72))))))+((x13*((((x14*x46))+((x25*x59))))))+(((-1.0)*x19*x31))+x53+((x26*x4))); eerot[6]=(((x10*((((x13*x60))+x54))))+((x11*x62))); eerot[7]=(((x10*x62))+((x11*(((((-1.0)*x29*x48))+(((-1.0)*x16*x60))))))); eerot[8]=(((x12*x60))+((x13*(((((-1.0)*x34))+(((-1.0)*x17*x3*x6))))))); IkReal x73=(x3*x6); eetrans[2]=((0.333)+((x12*(((((0.088)*x34))+((x22*x73))))))+((x13*((((x14*x38))+((x25*x47))))))+((x21*x31))+((x12*((((x27*x47))+((x28*x38))))))+((x15*x30))+((x13*(((((-1.0)*x20*x73))+(((-0.107)*x34))))))+(((0.384)*x34))+(((-0.0825)*x37))+(((0.316)*x1))+(((-1.0)*x15*x6))); } IKFAST_API int GetNumFreeParameters() { return 1; } IKFAST_API int* GetFreeParameters() { static int freeparams[] = {6}; return freeparams; } IKFAST_API int GetNumJoints() { return 7; } IKFAST_API int GetIkRealSize() { return sizeof(IkReal); } IKFAST_API int GetIkType() { return 0x67000001; } class IKSolver { public: IkReal j0,cj0,sj0,htj0,j0mul,j1,cj1,sj1,htj1,j1mul,j2,cj2,sj2,htj2,j2mul,j3,cj3,sj3,htj3,j3mul,j4,cj4,sj4,htj4,j4mul,j5,cj5,sj5,htj5,j5mul,j6,cj6,sj6,htj6,new_r00,r00,rxp0_0,new_r01,r01,rxp0_1,new_r02,r02,rxp0_2,new_r10,r10,rxp1_0,new_r11,r11,rxp1_1,new_r12,r12,rxp1_2,new_r20,r20,rxp2_0,new_r21,r21,rxp2_1,new_r22,r22,rxp2_2,new_px,px,npx,new_py,py,npy,new_pz,pz,npz,pp; unsigned char _ij0[2], _nj0,_ij1[2], _nj1,_ij2[2], _nj2,_ij3[2], _nj3,_ij4[2], _nj4,_ij5[2], _nj5,_ij6[2], _nj6; IkReal j100, cj100, sj100; unsigned char _ij100[2], _nj100; bool ComputeIk(const IkReal* eetrans, const IkReal* eerot, const IkReal* pfree, IkSolutionListBase<IkReal>& solutions) { j0=numeric_limits<IkReal>::quiet_NaN(); _ij0[0] = -1; _ij0[1] = -1; _nj0 = -1; j1=numeric_limits<IkReal>::quiet_NaN(); _ij1[0] = -1; _ij1[1] = -1; _nj1 = -1; j2=numeric_limits<IkReal>::quiet_NaN(); _ij2[0] = -1; _ij2[1] = -1; _nj2 = -1; j3=numeric_limits<IkReal>::quiet_NaN(); _ij3[0] = -1; _ij3[1] = -1; _nj3 = -1; j4=numeric_limits<IkReal>::quiet_NaN(); _ij4[0] = -1; _ij4[1] = -1; _nj4 = -1; j5=numeric_limits<IkReal>::quiet_NaN(); _ij5[0] = -1; _ij5[1] = -1; _nj5 = -1; _ij6[0] = -1; _ij6[1] = -1; _nj6 = 0; for(int dummyiter = 0; dummyiter < 1; ++dummyiter) { solutions.Clear(); j6=pfree[0]; cj6=cos(pfree[0]); sj6=sin(pfree[0]), htj6=tan(pfree[0]*0.5); r00 = eerot[0*3+0]; r01 = eerot[0*3+1]; r02 = eerot[0*3+2]; r10 = eerot[1*3+0]; r11 = eerot[1*3+1]; r12 = eerot[1*3+2]; r20 = eerot[2*3+0]; r21 = eerot[2*3+1]; r22 = eerot[2*3+2]; px = eetrans[0]; py = eetrans[1]; pz = eetrans[2]; new_r00=r00; new_r01=r01; new_r02=r02; new_px=(px+(((-0.107)*r02))); new_r10=r10; new_r11=r11; new_r12=r12; new_py=((((-0.107)*r12))+py); new_r20=r20; new_r21=r21; new_r22=r22; new_pz=((-0.333)+pz+(((-0.107)*r22))); r00 = new_r00; r01 = new_r01; r02 = new_r02; r10 = new_r10; r11 = new_r11; r12 = new_r12; r20 = new_r20; r21 = new_r21; r22 = new_r22; px = new_px; py = new_py; pz = new_pz; IkReal x74=((1.0)*px); IkReal x75=((1.0)*pz); IkReal x76=((1.0)*py); pp=((px*px)+(py*py)+(pz*pz)); npx=(((px*r00))+((py*r10))+((pz*r20))); npy=(((px*r01))+((py*r11))+((pz*r21))); npz=(((px*r02))+((py*r12))+((pz*r22))); rxp0_0=((((-1.0)*r20*x76))+((pz*r10))); rxp0_1=(((px*r20))+(((-1.0)*r00*x75))); rxp0_2=((((-1.0)*r10*x74))+((py*r00))); rxp1_0=((((-1.0)*r21*x76))+((pz*r11))); rxp1_1=(((px*r21))+(((-1.0)*r01*x75))); rxp1_2=(((py*r01))+(((-1.0)*r11*x74))); rxp2_0=((((-1.0)*r22*x76))+((pz*r12))); rxp2_1=(((px*r22))+(((-1.0)*r02*x75))); rxp2_2=(((py*r02))+(((-1.0)*r12*x74))); { IkReal j3array[2], cj3array[2], sj3array[2]; bool j3valid[2]={false}; _nj3 = 2; if( (((0.986881610513004)+(((-3.89793688895078)*pp))+(((0.686036892455338)*cj6*npx))+(((-0.686036892455338)*npy*sj6)))) < -1-IKFAST_SINCOS_THRESH || (((0.986881610513004)+(((-3.89793688895078)*pp))+(((0.686036892455338)*cj6*npx))+(((-0.686036892455338)*npy*sj6)))) > 1+IKFAST_SINCOS_THRESH ) continue; IkReal x77=IKasin(((0.986881610513004)+(((-3.89793688895078)*pp))+(((0.686036892455338)*cj6*npx))+(((-0.686036892455338)*npy*sj6)))); j3array[0]=((1.10379390314189)+(((1.0)*x77))); sj3array[0]=IKsin(j3array[0]); cj3array[0]=IKcos(j3array[0]); j3array[1]=((4.24538655673168)+(((-1.0)*x77))); sj3array[1]=IKsin(j3array[1]); cj3array[1]=IKcos(j3array[1]); if( j3array[0] > IKPI ) { j3array[0]-=IK2PI; } else if( j3array[0] < -IKPI ) { j3array[0]+=IK2PI; } j3valid[0] = true; if( j3array[1] > IKPI ) { j3array[1]-=IK2PI; } else if( j3array[1] < -IKPI ) { j3array[1]+=IK2PI; } j3valid[1] = true; for(int ij3 = 0; ij3 < 2; ++ij3) { if( !j3valid[ij3] ) { continue; } _ij3[0] = ij3; _ij3[1] = -1; for(int iij3 = ij3+1; iij3 < 2; ++iij3) { if( j3valid[iij3] && IKabs(cj3array[ij3]-cj3array[iij3]) < IKFAST_SOLUTION_THRESH && IKabs(sj3array[ij3]-sj3array[iij3]) < IKFAST_SOLUTION_THRESH ) { j3valid[iij3]=false; _ij3[1] = iij3; break; } } j3 = j3array[ij3]; cj3 = cj3array[ij3]; sj3 = sj3array[ij3]; { IkReal j5eval[2]; IkReal x78=(cj6*npx); IkReal x79=(npy*sj6); j5eval[0]=((1.0)+(((129.132231404959)*(x78*x78)))+(((22.7272727272727)*x79))+(((129.132231404959)*(x79*x79)))+(((-258.264462809917)*x78*x79))+(((129.132231404959)*(npz*npz)))+(((-22.7272727272727)*x78))); j5eval[1]=((IKabs(((0.088)+x79+(((-1.0)*x78)))))+(IKabs(npz))); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 ) { { IkReal j4eval[1]; j4eval[0]=((-1.0)+cj3+(((3.83030303030303)*sj3))); if( IKabs(j4eval[0]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-2.63084142381503)+j3)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j4array[2], cj4array[2], sj4array[2]; bool j4valid[2]={false}; _nj4 = 2; sj4array[0]=((((-2597402597.4026)*npx*sj6))+(((-2597402597.4026)*cj6*npy))); if( sj4array[0] >= -1-IKFAST_SINCOS_THRESH && sj4array[0] <= 1+IKFAST_SINCOS_THRESH ) { j4valid[0] = j4valid[1] = true; j4array[0] = IKasin(sj4array[0]); cj4array[0] = IKcos(j4array[0]); sj4array[1] = sj4array[0]; j4array[1] = j4array[0] > 0 ? (IKPI-j4array[0]) : (-IKPI-j4array[0]); cj4array[1] = -cj4array[0]; } else if( isnan(sj4array[0]) ) { // probably any value will work j4valid[0] = true; cj4array[0] = 1; sj4array[0] = 0; j4array[0] = 0; } for(int ij4 = 0; ij4 < 2; ++ij4) { if( !j4valid[ij4] ) { continue; } _ij4[0] = ij4; _ij4[1] = -1; for(int iij4 = ij4+1; iij4 < 2; ++iij4) { if( j4valid[iij4] && IKabs(cj4array[ij4]-cj4array[iij4]) < IKFAST_SOLUTION_THRESH && IKabs(sj4array[ij4]-sj4array[iij4]) < IKFAST_SOLUTION_THRESH ) { j4valid[iij4]=false; _ij4[1] = iij4; break; } } j4 = j4array[ij4]; cj4 = cj4array[ij4]; sj4 = sj4array[ij4]; { IkReal j5eval[3]; sj3=0.48883274; cj3=-0.87237753; j3=2.63084416569479; IkReal x80=npz*npz; IkReal x81=pp*pp; j5eval[0]=((-1.0)+(((161.707637091607)*pp))+(((-202.500643017207)*x80))+(((-6537.33997343774)*x81))); j5eval[1]=IKsign(((-987651184.806386)+(((-6456611570247.93)*x81))+(((-200000000000.0)*x80))+(((159710739365.767)*pp)))); j5eval[2]=((IKabs(((955709056.915841)+(((-77272726670.4545)*pp))+(((77.0)*cj4*npz)))))+(IKabs(((((437.5)*cj4*pp))+(((13599999894.0)*npz))+(((-5.41099984971219)*cj4)))))); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 || IKabs(j5eval[2]) < 0.0000010000000000 ) { { IkReal j5eval[3]; sj3=0.48883274; cj3=-0.87237753; j3=2.63084416569479; IkReal x82=npz*npz; IkReal x83=(npx*sj6); IkReal x84=(cj6*npy); IkReal x85=(pp*sj4); IkReal x86=((7027272532.09375)*cj4); IkReal x87=((568181818181.818)*cj4*pp); IkReal x88=(cj6*npx*sj4); IkReal x89=(npy*sj4*sj6); IkReal x90=(sj4*x82); IkReal x91=((100000000000.0)*cj4*npz); IkReal x92=(npy*sj6*x85); j5eval[0]=((((11.3636363636364)*x89))+(((161.707637091607)*x90))+sj4+(((918.793392565951)*cj6*npx*x85))+(((-11.3636363636364)*x88))+(((-918.793392565951)*x92))+(((-80.8538185458036)*x85))); j5eval[1]=IKsign(((((-568181818181.818)*x92))+(((568181818181.818)*cj6*npx*x85))+(((618399982.82425)*sj4))+(((7027272532.09375)*x89))+(((-7027272532.09375)*x88))+(((-50000000000.0)*x85))+(((100000000000.0)*x90)))); j5eval[2]=((IKabs(((((-6799999947.0)*x89))+(((6799999947.0)*x88))+(((-598399995.336)*sj4))+((x83*x91))+((x84*x91)))))+(IKabs((((x84*x87))+(((-1.0)*x83*x86))+(((-6799999947.0)*npz*sj4))+(((-1.0)*x84*x86))+((x83*x87)))))); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 || IKabs(j5eval[2]) < 0.0000010000000000 ) { { IkReal j5eval[2]; sj3=0.48883274; cj3=-0.87237753; j3=2.63084416569479; IkReal x93=npz*npz; IkReal x94=((568181818181.818)*pp); IkReal x95=(cj4*pp); IkReal x96=((918.793392565951)*pp); IkReal x97=(cj4*npy*sj6); IkReal x98=(cj4*cj6*npx); IkReal x99=(cj4*x93); j5eval[0]=((((-80.8538185458036)*x95))+(((-918.793392565951)*npy*sj6*x95))+(((161.707637091607)*x99))+cj4+(((918.793392565951)*cj6*npx*x95))+(((-11.3636363636364)*x98))+(((11.3636363636364)*x97))); j5eval[1]=IKsign(((((-1.0)*x94*x97))+(((618399982.82425)*cj4))+(((7027272532.09375)*x97))+(((-7027272532.09375)*x98))+(((-50000000000.0)*x95))+((x94*x98))+(((100000000000.0)*x99)))); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j4)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5eval[3]; sj3=0.48883274; cj3=-0.87237753; j3=2.63084416569479; sj4=1.0; cj4=0; j4=1.5707963267949; IkReal x100=npz*npz; IkReal x101=pp*pp; j5eval[0]=((-1.0)+(((-202.500643017207)*x100))+(((161.707637091607)*pp))+(((-6537.33997343774)*x101))); j5eval[1]=IKsign(((-493825592.403193)+(((-100000000000.0)*x100))+(((-3228305785123.97)*x101))+(((79855369682.8835)*pp)))); j5eval[2]=((IKabs(npz))+(((1.47058824675606e-10)*(IKabs(((477854528.457921)+(((-38636363335.2273)*pp)))))))); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 || IKabs(j5eval[2]) < 0.0000010000000000 ) { { IkReal j5eval[3]; sj3=0.48883274; cj3=-0.87237753; j3=2.63084416569479; sj4=1.0; cj4=0; j4=1.5707963267949; IkReal x102=npz*npz; IkReal x103=(cj6*npx); IkReal x104=(npy*sj6); IkReal x105=(pp*x104); j5eval[0]=((-1.0)+(((-11.3636363636364)*x104))+(((918.793392565951)*x105))+(((-918.793392565951)*pp*x103))+(((11.3636363636364)*x103))+(((-161.707637091607)*x102))+(((80.8538185458036)*pp))); j5eval[1]=IKsign(((-618399982.82425)+(((568181818181.818)*x105))+(((-100000000000.0)*x102))+(((50000000000.0)*pp))+(((7027272532.09375)*x103))+(((-7027272532.09375)*x104))+(((-568181818181.818)*pp*x103)))); j5eval[2]=((IKabs(npz))+(((1.47058824675606e-10)*(IKabs(((598399995.336)+(((-6799999947.0)*x103))+(((6799999947.0)*x104)))))))); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 || IKabs(j5eval[2]) < 0.0000010000000000 ) { continue; // no branches [j5] } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; IkReal x106=(cj6*npx); IkReal x107=(npy*sj6); IkReal x108=((568181818181.818)*pp); CheckValue<IkReal> x109 = IKatan2WithCheck(IkReal(((598399995.336)+(((-6799999947.0)*x106))+(((6799999947.0)*x107)))),IkReal(((6799999947.0)*npz)),IKFAST_ATAN2_MAGTHRESH); if(!x109.valid){ continue; } CheckValue<IkReal> x110=IKPowWithIntegerCheck(IKsign(((-618399982.82425)+((x107*x108))+(((50000000000.0)*pp))+(((7027272532.09375)*x106))+(((-1.0)*x106*x108))+(((-7027272532.09375)*x107))+(((-100000000000.0)*(npz*npz))))),-1); if(!x110.valid){ continue; } j5array[0]=((-1.5707963267949)+(x109.value)+(((1.5707963267949)*(x110.value)))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[3]; IkReal x111=IKsin(j5); IkReal x112=IKcos(j5); IkReal x113=((5.68181818181818)*pp); IkReal x114=((1.0)*npz*x111); evalcond[0]=((0.06799999947)+(((-1.0)*x111*x113))+(((0.0702727253209375)*x111))+((npz*x112))); evalcond[1]=((((0.0702727253209375)*x112))+(((-1.0)*x112*x113))+(((-1.0)*x114))); evalcond[2]=((((-1.0)*cj6*npx*x112))+(((-1.0)*x114))+(((0.088)*x112))+((npy*sj6*x112))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x654 = IKatan2WithCheck(IkReal(((477854528.457921)+(((-38636363335.2273)*pp)))),IkReal(((6799999947.0)*npz)),IKFAST_ATAN2_MAGTHRESH); if(!x654.valid){ continue; } CheckValue<IkReal> x655=IKPowWithIntegerCheck(IKsign(((-493825592.403193)+(((79855369682.8835)*pp))+(((-3228305785123.97)*(pp*pp)))+(((-100000000000.0)*(npz*npz))))),-1); if(!x655.valid){ continue; } j5array[0]=((-1.5707963267949)+(x654.value)+(((1.5707963267949)*(x655.value)))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[3]; IkReal x656=IKsin(j5); IkReal x657=IKcos(j5); IkReal x658=((5.68181818181818)*pp); IkReal x659=((1.0)*npz*x656); evalcond[0]=((0.06799999947)+((npz*x657))+(((0.0702727253209375)*x656))+(((-1.0)*x656*x658))); evalcond[1]=((((0.0702727253209375)*x657))+(((-1.0)*x657*x658))+(((-1.0)*x659))); evalcond[2]=(((npy*sj6*x657))+(((0.088)*x657))+(((-1.0)*cj6*npx*x657))+(((-1.0)*x659))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j4)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5eval[3]; sj3=0.48883274; cj3=-0.87237753; j3=2.63084416569479; sj4=-1.0; cj4=0; j4=-1.5707963267949; IkReal x660=npz*npz; IkReal x661=pp*pp; j5eval[0]=((-1.0)+(((161.707637091607)*pp))+(((-202.500643017207)*x660))+(((-6537.33997343774)*x661))); j5eval[1]=IKsign(((-493825592.403193)+(((79855369682.8835)*pp))+(((-100000000000.0)*x660))+(((-3228305785123.97)*x661)))); j5eval[2]=((IKabs(npz))+(((1.47058824675606e-10)*(IKabs(((477854528.457921)+(((-38636363335.2273)*pp)))))))); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 || IKabs(j5eval[2]) < 0.0000010000000000 ) { { IkReal j5eval[3]; sj3=0.48883274; cj3=-0.87237753; j3=2.63084416569479; sj4=-1.0; cj4=0; j4=-1.5707963267949; IkReal x662=npz*npz; IkReal x663=(cj6*npx); IkReal x664=(npy*sj6); IkReal x665=(pp*x664); j5eval[0]=((1.0)+(((-918.793392565951)*x665))+(((918.793392565951)*pp*x663))+(((11.3636363636364)*x664))+(((161.707637091607)*x662))+(((-80.8538185458036)*pp))+(((-11.3636363636364)*x663))); j5eval[1]=IKsign(((618399982.82425)+(((-7027272532.09375)*x663))+(((568181818181.818)*pp*x663))+(((100000000000.0)*x662))+(((-50000000000.0)*pp))+(((-568181818181.818)*x665))+(((7027272532.09375)*x664)))); j5eval[2]=((IKabs(npz))+(((1.47058824675606e-10)*(IKabs(((-598399995.336)+(((-6799999947.0)*x664))+(((6799999947.0)*x663)))))))); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 || IKabs(j5eval[2]) < 0.0000010000000000 ) { continue; // no branches [j5] } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; IkReal x666=(npy*sj6); IkReal x667=(cj6*npx); IkReal x668=((568181818181.818)*pp); CheckValue<IkReal> x669 = IKatan2WithCheck(IkReal(((-598399995.336)+(((-6799999947.0)*x666))+(((6799999947.0)*x667)))),IkReal(((-6799999947.0)*npz)),IKFAST_ATAN2_MAGTHRESH); if(!x669.valid){ continue; } CheckValue<IkReal> x670=IKPowWithIntegerCheck(IKsign(((618399982.82425)+((x667*x668))+(((-7027272532.09375)*x667))+(((-50000000000.0)*pp))+(((100000000000.0)*(npz*npz)))+(((-1.0)*x666*x668))+(((7027272532.09375)*x666)))),-1); if(!x670.valid){ continue; } j5array[0]=((-1.5707963267949)+(x669.value)+(((1.5707963267949)*(x670.value)))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[3]; IkReal x671=IKsin(j5); IkReal x672=IKcos(j5); IkReal x673=((5.68181818181818)*pp); IkReal x674=(npz*x671); evalcond[0]=((0.06799999947)+(((0.0702727253209375)*x671))+(((-1.0)*x671*x673))+((npz*x672))); evalcond[1]=((((0.0702727253209375)*x672))+(((-1.0)*x674))+(((-1.0)*x672*x673))); evalcond[2]=((((-0.088)*x672))+((cj6*npx*x672))+x674+(((-1.0)*npy*sj6*x672))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x675 = IKatan2WithCheck(IkReal(((477854528.457921)+(((-38636363335.2273)*pp)))),IkReal(((6799999947.0)*npz)),IKFAST_ATAN2_MAGTHRESH); if(!x675.valid){ continue; } CheckValue<IkReal> x676=IKPowWithIntegerCheck(IKsign(((-493825592.403193)+(((79855369682.8835)*pp))+(((-3228305785123.97)*(pp*pp)))+(((-100000000000.0)*(npz*npz))))),-1); if(!x676.valid){ continue; } j5array[0]=((-1.5707963267949)+(x675.value)+(((1.5707963267949)*(x676.value)))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[3]; IkReal x677=IKsin(j5); IkReal x678=IKcos(j5); IkReal x679=((5.68181818181818)*pp); IkReal x680=(npz*x677); evalcond[0]=((0.06799999947)+(((0.0702727253209375)*x677))+((npz*x678))+(((-1.0)*x677*x679))); evalcond[1]=((((-1.0)*x678*x679))+(((0.0702727253209375)*x678))+(((-1.0)*x680))); evalcond[2]=((((-0.088)*x678))+((cj6*npx*x678))+x680+(((-1.0)*npy*sj6*x678))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j4))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5eval[2]; sj3=0.48883274; cj3=-0.87237753; j3=2.63084416569479; sj4=0; cj4=1.0; j4=0; IkReal x681=npz*npz; IkReal x682=pp*pp; j5eval[0]=((-1.0)+(((161.707637091607)*pp))+(((-6537.33997343774)*x682))+(((-202.500643017207)*x681))); j5eval[1]=IKsign(((-987651184.806386)+(((-200000000000.0)*x681))+(((-6456611570247.93)*x682))+(((159710739365.767)*pp)))); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 ) { { IkReal j5eval[3]; sj3=0.48883274; cj3=-0.87237753; j3=2.63084416569479; sj4=0; cj4=1.0; j4=0; IkReal x683=npz*npz; IkReal x684=(npy*sj6); IkReal x685=(cj6*npx); IkReal x686=((918.793392565951)*pp); IkReal x687=((1136363636363.64)*pp); j5eval[0]=((-1.0)+(((-1.0)*x685*x686))+(((-161.707637091607)*x683))+(((11.3636363636364)*x685))+(((-11.3636363636364)*x684))+((x684*x686))+(((80.8538185458036)*pp))); j5eval[1]=IKsign(((-1236799965.6485)+(((-200000000000.0)*x683))+(((-1.0)*x685*x687))+(((100000000000.0)*pp))+(((-14054545064.1875)*x684))+(((14054545064.1875)*x685))+((x684*x687)))); j5eval[2]=((IKabs(((-5.41099984971219)+(((13599999894.0)*npz))+(((437.5)*pp)))))+(IKabs(((1196799990.672)+(((13599999894.0)*x684))+(((77.0)*npz))+(((-13599999894.0)*x685)))))); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 || IKabs(j5eval[2]) < 0.0000010000000000 ) { continue; // no branches [j5] } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; IkReal x688=(npy*sj6); IkReal x689=((1136363636363.64)*pp); IkReal x690=(cj6*npx); CheckValue<IkReal> x691=IKPowWithIntegerCheck(IKsign(((-1236799965.6485)+((x688*x689))+(((100000000000.0)*pp))+(((-14054545064.1875)*x688))+(((-200000000000.0)*(npz*npz)))+(((-1.0)*x689*x690))+(((14054545064.1875)*x690)))),-1); if(!x691.valid){ continue; } CheckValue<IkReal> x692 = IKatan2WithCheck(IkReal(((1196799990.672)+(((13599999894.0)*x688))+(((77.0)*npz))+(((-13599999894.0)*x690)))),IkReal(((-5.41099984971219)+(((13599999894.0)*npz))+(((437.5)*pp)))),IKFAST_ATAN2_MAGTHRESH); if(!x692.valid){ continue; } j5array[0]=((-1.5707963267949)+(((1.5707963267949)*(x691.value)))+(x692.value)); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[3]; IkReal x693=IKsin(j5); IkReal x694=IKcos(j5); IkReal x695=((5.68181818181818)*pp); IkReal x696=((1.0)*npz*x693); evalcond[0]=((0.06799999947)+((npz*x694))+(((-1.0)*x693*x695))+(((0.0702727253209375)*x693))); evalcond[1]=((-3.85e-10)+(((-1.0)*x696))+(((-1.0)*x694*x695))+(((0.0702727253209375)*x694))); evalcond[2]=((-3.85e-10)+(((0.088)*x694))+(((-1.0)*x696))+((npy*sj6*x694))+(((-1.0)*cj6*npx*x694))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x697 = IKatan2WithCheck(IkReal(((955709056.915841)+(((77.0)*npz))+(((-77272726670.4545)*pp)))),IkReal(((-5.41099984971219)+(((13599999894.0)*npz))+(((437.5)*pp)))),IKFAST_ATAN2_MAGTHRESH); if(!x697.valid){ continue; } CheckValue<IkReal> x698=IKPowWithIntegerCheck(IKsign(((-987651184.806386)+(((-6456611570247.93)*(pp*pp)))+(((-200000000000.0)*(npz*npz)))+(((159710739365.767)*pp)))),-1); if(!x698.valid){ continue; } j5array[0]=((-1.5707963267949)+(x697.value)+(((1.5707963267949)*(x698.value)))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[3]; IkReal x699=IKsin(j5); IkReal x700=IKcos(j5); IkReal x701=((5.68181818181818)*pp); IkReal x702=((1.0)*npz*x699); evalcond[0]=((0.06799999947)+((npz*x700))+(((-1.0)*x699*x701))+(((0.0702727253209375)*x699))); evalcond[1]=((-3.85e-10)+(((-1.0)*x702))+(((0.0702727253209375)*x700))+(((-1.0)*x700*x701))); evalcond[2]=((-3.85e-10)+(((-1.0)*cj6*npx*x700))+(((-1.0)*x702))+(((0.088)*x700))+((npy*sj6*x700))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j4)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5eval[2]; sj3=0.48883274; cj3=-0.87237753; j3=2.63084416569479; sj4=0; cj4=-1.0; j4=3.14159265358979; IkReal x703=npz*npz; IkReal x704=pp*pp; j5eval[0]=((1.0)+(((6537.33997343774)*x704))+(((202.500643017207)*x703))+(((-161.707637091607)*pp))); j5eval[1]=IKsign(((987651184.806386)+(((6456611570247.93)*x704))+(((200000000000.0)*x703))+(((-159710739365.767)*pp)))); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 ) { { IkReal j5eval[3]; sj3=0.48883274; cj3=-0.87237753; j3=2.63084416569479; sj4=0; cj4=-1.0; j4=3.14159265358979; IkReal x705=npz*npz; IkReal x706=(cj6*npx); IkReal x707=(npy*sj6); IkReal x708=((918.793392565951)*pp); IkReal x709=((1136363636363.64)*pp); j5eval[0]=((1.0)+(((-1.0)*x707*x708))+(((-11.3636363636364)*x706))+(((11.3636363636364)*x707))+((x706*x708))+(((161.707637091607)*x705))+(((-80.8538185458036)*pp))); j5eval[1]=((IKabs(((-1196799990.672)+(((77.0)*npz))+(((-13599999894.0)*x707))+(((13599999894.0)*x706)))))+(IKabs(((-5.41099984971219)+(((-13599999894.0)*npz))+(((437.5)*pp)))))); j5eval[2]=IKsign(((1236799965.6485)+(((-14054545064.1875)*x706))+(((-1.0)*x707*x709))+((x706*x709))+(((-100000000000.0)*pp))+(((200000000000.0)*x705))+(((14054545064.1875)*x707)))); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 || IKabs(j5eval[2]) < 0.0000010000000000 ) { continue; // no branches [j5] } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; IkReal x710=(npy*sj6); IkReal x711=((1136363636363.64)*pp); IkReal x712=(cj6*npx); CheckValue<IkReal> x713 = IKatan2WithCheck(IkReal(((-1196799990.672)+(((-13599999894.0)*x710))+(((77.0)*npz))+(((13599999894.0)*x712)))),IkReal(((-5.41099984971219)+(((-13599999894.0)*npz))+(((437.5)*pp)))),IKFAST_ATAN2_MAGTHRESH); if(!x713.valid){ continue; } CheckValue<IkReal> x714=IKPowWithIntegerCheck(IKsign(((1236799965.6485)+(((200000000000.0)*(npz*npz)))+(((-1.0)*x710*x711))+((x711*x712))+(((-100000000000.0)*pp))+(((14054545064.1875)*x710))+(((-14054545064.1875)*x712)))),-1); if(!x714.valid){ continue; } j5array[0]=((-1.5707963267949)+(x713.value)+(((1.5707963267949)*(x714.value)))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[3]; IkReal x715=IKsin(j5); IkReal x716=IKcos(j5); IkReal x717=((5.68181818181818)*pp); IkReal x718=(npz*x715); evalcond[0]=((0.06799999947)+((npz*x716))+(((0.0702727253209375)*x715))+(((-1.0)*x715*x717))); evalcond[1]=((3.85e-10)+(((-1.0)*x718))+(((-1.0)*x716*x717))+(((0.0702727253209375)*x716))); evalcond[2]=((-3.85e-10)+((cj6*npx*x716))+(((-1.0)*npy*sj6*x716))+x718+(((-0.088)*x716))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x719=IKPowWithIntegerCheck(IKsign(((987651184.806386)+(((200000000000.0)*(npz*npz)))+(((6456611570247.93)*(pp*pp)))+(((-159710739365.767)*pp)))),-1); if(!x719.valid){ continue; } CheckValue<IkReal> x720 = IKatan2WithCheck(IkReal(((-955709056.915841)+(((77272726670.4545)*pp))+(((77.0)*npz)))),IkReal(((-5.41099984971219)+(((-13599999894.0)*npz))+(((437.5)*pp)))),IKFAST_ATAN2_MAGTHRESH); if(!x720.valid){ continue; } j5array[0]=((-1.5707963267949)+(((1.5707963267949)*(x719.value)))+(x720.value)); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[3]; IkReal x721=IKsin(j5); IkReal x722=IKcos(j5); IkReal x723=((5.68181818181818)*pp); IkReal x724=(npz*x721); evalcond[0]=((0.06799999947)+((npz*x722))+(((-1.0)*x721*x723))+(((0.0702727253209375)*x721))); evalcond[1]=((3.85e-10)+(((-1.0)*x722*x723))+(((-1.0)*x724))+(((0.0702727253209375)*x722))); evalcond[2]=((-3.85e-10)+((cj6*npx*x722))+(((-1.0)*npy*sj6*x722))+x724+(((-0.088)*x722))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j5] } } while(0); if( bgotonextstatement ) { } } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; IkReal x725=((568181818181.818)*pp); IkReal x726=((6799999947.0)*cj4); IkReal x727=((100000000000.0)*npz); IkReal x728=(cj6*npy*sj4); IkReal x729=(cj4*cj6*npx); IkReal x730=(npx*sj4*sj6); IkReal x731=(cj4*npy*sj6); CheckValue<IkReal> x732 = IKatan2WithCheck(IkReal(((((-1.0)*x727*x728))+(((-1.0)*x727*x730))+((cj6*npx*x726))+(((-1.0)*npy*sj6*x726))+(((-598399995.336)*cj4))+(((-38.5)*npz)))),IkReal(((2.70549992485609)+(((-1.0)*npz*x726))+(((-218.75)*pp))+(((-1.0)*x725*x730))+(((-1.0)*x725*x728))+(((7027272532.09375)*x730))+(((7027272532.09375)*x728)))),IKFAST_ATAN2_MAGTHRESH); if(!x732.valid){ continue; } CheckValue<IkReal> x733=IKPowWithIntegerCheck(IKsign(((((-50000000000.0)*cj4*pp))+(((618399982.82425)*cj4))+(((-7027272532.09375)*x729))+(((-1.0)*x725*x731))+((cj4*npz*x727))+(((7027272532.09375)*x731))+((x725*x729)))),-1); if(!x733.valid){ continue; } j5array[0]=((-1.5707963267949)+(x732.value)+(((1.5707963267949)*(x733.value)))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[4]; IkReal x734=IKsin(j5); IkReal x735=IKcos(j5); IkReal x736=(npy*sj4); IkReal x737=((1.0)*cj6); IkReal x738=((5.68181818181818)*pp); IkReal x739=(cj4*npy); IkReal x740=(npx*sj6); IkReal x741=(sj6*x735); IkReal x742=(cj4*x735); IkReal x743=(sj4*x735); IkReal x744=((1.0)*npz*x734); evalcond[0]=((0.06799999947)+((npz*x735))+(((-1.0)*x734*x738))+(((0.0702727253209375)*x734))); evalcond[1]=((((-1.0)*x735*x738))+(((-3.85e-10)*cj4))+(((-1.0)*x744))+(((0.0702727253209375)*x735))); evalcond[2]=((((-1.0)*sj4*x744))+(((-1.0)*npx*x737*x743))+(((0.088)*x743))+((cj6*x739))+((cj4*x740))+((x736*x741))); evalcond[3]=((-3.85e-10)+(((-1.0)*x736*x737))+(((-1.0)*sj4*x740))+(((-1.0)*npx*x737*x742))+(((0.088)*x742))+((x739*x741))+(((-1.0)*cj4*x744))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; IkReal x745=((6799999947.0)*sj4); IkReal x746=(cj6*npx); IkReal x747=(cj4*npx); IkReal x748=(npy*sj4); IkReal x749=((7027272532.09375)*sj6); IkReal x750=((568181818181.818)*pp); IkReal x751=((100000000000.0)*npz); IkReal x752=(sj6*x750); IkReal x753=(cj4*cj6*npy); CheckValue<IkReal> x754 = IKatan2WithCheck(IkReal((((x745*x746))+(((-1.0)*npy*sj6*x745))+((x751*x753))+(((-598399995.336)*sj4))+((sj6*x747*x751)))),IkReal((((x747*x752))+(((-1.0)*x747*x749))+((x750*x753))+(((-1.0)*npz*x745))+(((-7027272532.09375)*x753)))),IKFAST_ATAN2_MAGTHRESH); if(!x754.valid){ continue; } CheckValue<IkReal> x755=IKPowWithIntegerCheck(IKsign(((((-7027272532.09375)*sj4*x746))+(((-50000000000.0)*pp*sj4))+(((618399982.82425)*sj4))+((sj4*x746*x750))+((npz*sj4*x751))+(((-1.0)*x748*x752))+((x748*x749)))),-1); if(!x755.valid){ continue; } j5array[0]=((-1.5707963267949)+(x754.value)+(((1.5707963267949)*(x755.value)))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[4]; IkReal x756=IKsin(j5); IkReal x757=IKcos(j5); IkReal x758=(npy*sj4); IkReal x759=((1.0)*cj6); IkReal x760=((5.68181818181818)*pp); IkReal x761=(cj4*npy); IkReal x762=(npx*sj6); IkReal x763=(sj6*x757); IkReal x764=(cj4*x757); IkReal x765=(sj4*x757); IkReal x766=((1.0)*npz*x756); evalcond[0]=((0.06799999947)+((npz*x757))+(((-1.0)*x756*x760))+(((0.0702727253209375)*x756))); evalcond[1]=((((-1.0)*x766))+(((0.0702727253209375)*x757))+(((-1.0)*x757*x760))+(((-3.85e-10)*cj4))); evalcond[2]=((((-1.0)*npx*x759*x765))+(((0.088)*x765))+((x758*x763))+((cj4*x762))+((cj6*x761))+(((-1.0)*sj4*x766))); evalcond[3]=((-3.85e-10)+(((-1.0)*npx*x759*x764))+((x761*x763))+(((0.088)*x764))+(((-1.0)*x758*x759))+(((-1.0)*cj4*x766))+(((-1.0)*sj4*x762))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x767 = IKatan2WithCheck(IkReal(((955709056.915841)+(((-77272726670.4545)*pp))+(((77.0)*cj4*npz)))),IkReal(((((437.5)*cj4*pp))+(((13599999894.0)*npz))+(((-5.41099984971219)*cj4)))),IKFAST_ATAN2_MAGTHRESH); if(!x767.valid){ continue; } CheckValue<IkReal> x768=IKPowWithIntegerCheck(IKsign(((-987651184.806386)+(((-6456611570247.93)*(pp*pp)))+(((-200000000000.0)*(npz*npz)))+(((159710739365.767)*pp)))),-1); if(!x768.valid){ continue; } j5array[0]=((-1.5707963267949)+(x767.value)+(((1.5707963267949)*(x768.value)))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[4]; IkReal x769=IKsin(j5); IkReal x770=IKcos(j5); IkReal x771=(npy*sj4); IkReal x772=((1.0)*cj6); IkReal x773=((5.68181818181818)*pp); IkReal x774=(cj4*npy); IkReal x775=(npx*sj6); IkReal x776=(sj6*x770); IkReal x777=(cj4*x770); IkReal x778=(sj4*x770); IkReal x779=((1.0)*npz*x769); evalcond[0]=((0.06799999947)+(((0.0702727253209375)*x769))+(((-1.0)*x769*x773))+((npz*x770))); evalcond[1]=((((0.0702727253209375)*x770))+(((-1.0)*x779))+(((-3.85e-10)*cj4))+(((-1.0)*x770*x773))); evalcond[2]=((((-1.0)*sj4*x779))+((x771*x776))+(((0.088)*x778))+(((-1.0)*npx*x772*x778))+((cj6*x774))+((cj4*x775))); evalcond[3]=((-3.85e-10)+((x774*x776))+(((-1.0)*cj4*x779))+(((-1.0)*sj4*x775))+(((0.088)*x777))+(((-1.0)*npx*x772*x777))+(((-1.0)*x771*x772))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j4, j5] } } while(0); if( bgotonextstatement ) { } } } } else { { IkReal j4array[2], cj4array[2], sj4array[2]; bool j4valid[2]={false}; _nj4 = 2; CheckValue<IkReal> x780=IKPowWithIntegerCheck(((-0.0825)+(((0.0825)*cj3))+(((0.316)*sj3))),-1); if(!x780.valid){ continue; } sj4array[0]=((-1.0)*(x780.value)*(((((-1.0)*cj6*npy))+(((-1.0)*npx*sj6))))); if( sj4array[0] >= -1-IKFAST_SINCOS_THRESH && sj4array[0] <= 1+IKFAST_SINCOS_THRESH ) { j4valid[0] = j4valid[1] = true; j4array[0] = IKasin(sj4array[0]); cj4array[0] = IKcos(j4array[0]); sj4array[1] = sj4array[0]; j4array[1] = j4array[0] > 0 ? (IKPI-j4array[0]) : (-IKPI-j4array[0]); cj4array[1] = -cj4array[0]; } else if( isnan(sj4array[0]) ) { // probably any value will work j4valid[0] = true; cj4array[0] = 1; sj4array[0] = 0; j4array[0] = 0; } for(int ij4 = 0; ij4 < 2; ++ij4) { if( !j4valid[ij4] ) { continue; } _ij4[0] = ij4; _ij4[1] = -1; for(int iij4 = ij4+1; iij4 < 2; ++iij4) { if( j4valid[iij4] && IKabs(cj4array[ij4]-cj4array[iij4]) < IKFAST_SOLUTION_THRESH && IKabs(sj4array[ij4]-sj4array[iij4]) < IKFAST_SOLUTION_THRESH ) { j4valid[iij4]=false; _ij4[1] = iij4; break; } } j4 = j4array[ij4]; cj4 = cj4array[ij4]; sj4 = sj4array[ij4]; { IkReal j5eval[2]; IkReal x781=cj6*cj6; IkReal x782=npy*npy; IkReal x783=npx*npx; IkReal x784=npz*npz; IkReal x785=(npy*sj6); IkReal x786=(cj6*npx); IkReal x787=((129.132231404959)*x782); IkReal x788=(x781*x783); j5eval[0]=((1.0)+(((-22.7272727272727)*x786))+(((129.132231404959)*x788))+(((129.132231404959)*x784))+(((22.7272727272727)*x785))+(((-1.0)*x781*x787))+(((-258.264462809917)*x785*x786))+x787); j5eval[1]=IKsign(((0.007744)+(((-2.0)*x785*x786))+(((-0.176)*x786))+(((0.176)*x785))+(((-1.0)*x781*x782))+x782+x784+x788)); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 ) { { IkReal j5eval[2]; IkReal x789=cj6*cj6; IkReal x790=npy*npy; IkReal x791=npz*npz; IkReal x792=npx*npx; IkReal x793=((129.132231404959)*sj4); IkReal x794=(npy*sj6); IkReal x795=(sj4*x789); IkReal x796=(cj6*npx*sj4); j5eval[0]=(sj4+(((-22.7272727272727)*x796))+((x790*x793))+((x789*x792*x793))+(((-1.0)*x789*x790*x793))+(((-258.264462809917)*x794*x796))+(((22.7272727272727)*sj4*x794))+((x791*x793))); j5eval[1]=IKsign(((((-0.176)*x796))+(((0.007744)*sj4))+(((-2.0)*x794*x796))+((sj4*x790))+((sj4*x791))+((x792*x795))+(((-1.0)*x790*x795))+(((0.176)*sj4*x794)))); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 ) { { IkReal j5eval[2]; IkReal x797=cj6*cj6; IkReal x798=npy*npy; IkReal x799=npz*npz; IkReal x800=npx*npx; IkReal x801=(cj6*npx); IkReal x802=(cj4*x798); IkReal x803=((129.132231404959)*x797); IkReal x804=(cj4*x799); IkReal x805=(cj4*x800); IkReal x806=(cj4*npy*sj6); j5eval[0]=((((22.7272727272727)*x806))+cj4+((x803*x805))+(((-22.7272727272727)*cj4*x801))+(((129.132231404959)*x802))+(((129.132231404959)*x804))+(((-258.264462809917)*x801*x806))+(((-1.0)*x802*x803))); j5eval[1]=IKsign(((((0.176)*x806))+(((-2.0)*x801*x806))+((x797*x805))+(((-1.0)*x797*x802))+(((-0.176)*cj4*x801))+x804+x802+(((0.007744)*cj4)))); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j4)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5eval[2]; sj4=1.0; cj4=0; j4=1.5707963267949; IkReal x807=cj6*cj6; IkReal x808=npy*npy; IkReal x809=npz*npz; IkReal x810=npx*npx; IkReal x811=(npy*sj6); IkReal x812=(cj6*npx); IkReal x813=((129.132231404959)*x808); IkReal x814=(x807*x810); j5eval[0]=((-1.0)+(((258.264462809917)*x811*x812))+(((-1.0)*x813))+(((-129.132231404959)*x814))+((x807*x813))+(((22.7272727272727)*x812))+(((-22.7272727272727)*x811))+(((-129.132231404959)*x809))); j5eval[1]=IKsign(((-0.007744)+(((-1.0)*x808))+(((-1.0)*x809))+(((-0.176)*x811))+(((0.176)*x812))+(((-1.0)*x814))+(((2.0)*x811*x812))+((x807*x808)))); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 ) { continue; // no branches [j5] } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; IkReal x815=cj6*cj6; IkReal x816=npy*npy; IkReal x817=(npy*sj6); IkReal x818=(cj6*npx); IkReal x819=((0.316)*cj3); IkReal x820=((0.0825)*sj3); CheckValue<IkReal> x821 = IKatan2WithCheck(IkReal(((0.033792)+(((0.027808)*cj3))+(((-1.0)*x818*x819))+(((-1.0)*x817*x820))+((x817*x819))+((x818*x820))+(((-0.384)*x818))+(((-0.00726)*sj3))+(((0.384)*x817)))),IkReal(((((-1.0)*npz*x820))+((npz*x819))+(((0.384)*npz)))),IKFAST_ATAN2_MAGTHRESH); if(!x821.valid){ continue; } CheckValue<IkReal> x822=IKPowWithIntegerCheck(IKsign(((-0.007744)+((x815*x816))+(((2.0)*x817*x818))+(((-1.0)*(npz*npz)))+(((-0.176)*x817))+(((0.176)*x818))+(((-1.0)*x816))+(((-1.0)*x815*(npx*npx))))),-1); if(!x822.valid){ continue; } j5array[0]=((-1.5707963267949)+(x821.value)+(((1.5707963267949)*(x822.value)))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[2]; IkReal x823=IKcos(j5); IkReal x824=IKsin(j5); IkReal x825=(npy*sj6); IkReal x826=(cj6*npx); IkReal x827=((1.0)*x824); evalcond[0]=((((0.088)*x823))+(((-1.0)*x823*x826))+(((-1.0)*npz*x827))+((x823*x825))); evalcond[1]=((0.384)+(((0.088)*x824))+(((-0.0825)*sj3))+((x824*x825))+(((0.316)*cj3))+(((-1.0)*x826*x827))+((npz*x823))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j4)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5eval[2]; sj4=-1.0; cj4=0; j4=-1.5707963267949; IkReal x828=cj6*cj6; IkReal x829=npy*npy; IkReal x830=npz*npz; IkReal x831=npx*npx; IkReal x832=(npy*sj6); IkReal x833=(cj6*npx); IkReal x834=((129.132231404959)*x829); IkReal x835=(x828*x831); j5eval[0]=((-1.0)+(((-129.132231404959)*x830))+(((-129.132231404959)*x835))+(((22.7272727272727)*x833))+(((258.264462809917)*x832*x833))+(((-1.0)*x834))+((x828*x834))+(((-22.7272727272727)*x832))); j5eval[1]=IKsign(((-0.007744)+(((0.176)*x833))+(((2.0)*x832*x833))+(((-1.0)*x829))+(((-1.0)*x835))+(((-1.0)*x830))+((x828*x829))+(((-0.176)*x832)))); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 ) { continue; // no branches [j5] } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; IkReal x836=cj6*cj6; IkReal x837=npy*npy; IkReal x838=(npy*sj6); IkReal x839=(cj6*npx); IkReal x840=((0.316)*cj3); IkReal x841=((0.0825)*sj3); CheckValue<IkReal> x842 = IKatan2WithCheck(IkReal(((0.033792)+(((0.027808)*cj3))+((x838*x840))+((x839*x841))+(((0.384)*x838))+(((-0.384)*x839))+(((-0.00726)*sj3))+(((-1.0)*x839*x840))+(((-1.0)*x838*x841)))),IkReal(((((-1.0)*npz*x841))+((npz*x840))+(((0.384)*npz)))),IKFAST_ATAN2_MAGTHRESH); if(!x842.valid){ continue; } CheckValue<IkReal> x843=IKPowWithIntegerCheck(IKsign(((-0.007744)+(((2.0)*x838*x839))+(((-1.0)*(npz*npz)))+(((0.176)*x839))+((x836*x837))+(((-1.0)*x837))+(((-1.0)*x836*(npx*npx)))+(((-0.176)*x838)))),-1); if(!x843.valid){ continue; } j5array[0]=((-1.5707963267949)+(x842.value)+(((1.5707963267949)*(x843.value)))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[2]; IkReal x844=IKcos(j5); IkReal x845=IKsin(j5); IkReal x846=(npy*sj6); IkReal x847=(cj6*npx); IkReal x848=((1.0)*x845); evalcond[0]=((((0.088)*x844))+(((-1.0)*npz*x848))+(((-1.0)*x844*x847))+((x844*x846))); evalcond[1]=((0.384)+(((-1.0)*x847*x848))+(((-0.0825)*sj3))+(((0.088)*x845))+(((0.316)*cj3))+((npz*x844))+((x845*x846))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j4))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5eval[2]; sj4=0; cj4=1.0; j4=0; IkReal x849=cj6*cj6; IkReal x850=npy*npy; IkReal x851=npx*npx; IkReal x852=npz*npz; IkReal x853=(npy*sj6); IkReal x854=(cj6*npx); IkReal x855=((129.132231404959)*x850); IkReal x856=(x849*x851); j5eval[0]=((1.0)+(((-1.0)*x849*x855))+(((-258.264462809917)*x853*x854))+(((129.132231404959)*x856))+(((129.132231404959)*x852))+(((-22.7272727272727)*x854))+x855+(((22.7272727272727)*x853))); j5eval[1]=IKsign(((0.007744)+(((-2.0)*x853*x854))+(((-1.0)*x849*x850))+(((-0.176)*x854))+(((0.176)*x853))+x852+x850+x856)); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 ) { continue; // no branches [j5] } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; IkReal x857=cj6*cj6; IkReal x858=npy*npy; IkReal x859=(cj6*npx); IkReal x860=((0.316)*cj3); IkReal x861=(npy*sj6); IkReal x862=((0.0825)*npz); IkReal x863=((0.316)*sj3); IkReal x864=((0.0825)*sj3); IkReal x865=((0.0825)*cj3); CheckValue<IkReal> x866 = IKatan2WithCheck(IkReal(((-0.033792)+(((0.384)*x859))+(((-1.0)*x862))+(((-0.384)*x861))+((cj3*x862))+(((-1.0)*x860*x861))+(((-0.027808)*cj3))+(((0.00726)*sj3))+((x859*x860))+((x861*x864))+(((-1.0)*x859*x864))+((npz*x863)))),IkReal(((0.00726)+(((-0.0825)*x859))+((sj3*x862))+(((-0.027808)*sj3))+(((-1.0)*x861*x863))+(((-1.0)*x861*x865))+(((0.0825)*x861))+(((-1.0)*npz*x860))+(((-0.384)*npz))+((x859*x865))+((x859*x863))+(((-0.00726)*cj3)))),IKFAST_ATAN2_MAGTHRESH); if(!x866.valid){ continue; } CheckValue<IkReal> x867=IKPowWithIntegerCheck(IKsign(((0.007744)+(((-2.0)*x859*x861))+(((-1.0)*x857*x858))+(((-0.176)*x859))+x858+(npz*npz)+(((0.176)*x861))+((x857*(npx*npx))))),-1); if(!x867.valid){ continue; } j5array[0]=((-1.5707963267949)+(x866.value)+(((1.5707963267949)*(x867.value)))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[2]; IkReal x868=IKsin(j5); IkReal x869=IKcos(j5); IkReal x870=(npy*sj6); IkReal x871=(cj6*npx); IkReal x872=((1.0)*x868); evalcond[0]=((0.384)+((x868*x870))+(((-1.0)*x871*x872))+(((-0.0825)*sj3))+(((0.316)*cj3))+((npz*x869))+(((0.088)*x868))); evalcond[1]=((-0.0825)+(((-1.0)*x869*x871))+(((-1.0)*npz*x872))+((x869*x870))+(((0.0825)*cj3))+(((0.316)*sj3))+(((0.088)*x869))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j4)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5eval[2]; sj4=0; cj4=-1.0; j4=3.14159265358979; IkReal x873=cj6*cj6; IkReal x874=npy*npy; IkReal x875=npx*npx; IkReal x876=npz*npz; IkReal x877=(npy*sj6); IkReal x878=(cj6*npx); IkReal x879=((129.132231404959)*x874); IkReal x880=(x873*x875); j5eval[0]=((1.0)+(((22.7272727272727)*x877))+(((129.132231404959)*x880))+(((-258.264462809917)*x877*x878))+(((-1.0)*x873*x879))+(((129.132231404959)*x876))+(((-22.7272727272727)*x878))+x879); j5eval[1]=IKsign(((0.007744)+(((-2.0)*x877*x878))+(((-1.0)*x873*x874))+(((-0.176)*x878))+x874+x876+x880+(((0.176)*x877)))); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 ) { continue; // no branches [j5] } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; IkReal x881=cj6*cj6; IkReal x882=npy*npy; IkReal x883=(cj6*npx); IkReal x884=((0.316)*cj3); IkReal x885=(npy*sj6); IkReal x886=((0.0825)*npz); IkReal x887=((0.316)*sj3); IkReal x888=((0.0825)*sj3); IkReal x889=((0.0825)*cj3); CheckValue<IkReal> x890=IKPowWithIntegerCheck(IKsign(((0.007744)+(((-1.0)*x881*x882))+(((-0.176)*x883))+((x881*(npx*npx)))+(((0.176)*x885))+x882+(npz*npz)+(((-2.0)*x883*x885)))),-1); if(!x890.valid){ continue; } CheckValue<IkReal> x891 = IKatan2WithCheck(IkReal(((-0.033792)+(((-1.0)*cj3*x886))+(((-1.0)*x883*x888))+((x883*x884))+(((-1.0)*npz*x887))+(((-0.027808)*cj3))+(((0.00726)*sj3))+(((0.384)*x883))+(((-0.384)*x885))+x886+((x885*x888))+(((-1.0)*x884*x885)))),IkReal(((-0.00726)+(((-1.0)*x883*x889))+(((-1.0)*x883*x887))+(((0.027808)*sj3))+(((-1.0)*npz*x884))+(((-0.0825)*x885))+((sj3*x886))+(((-0.384)*npz))+(((0.00726)*cj3))+((x885*x887))+((x885*x889))+(((0.0825)*x883)))),IKFAST_ATAN2_MAGTHRESH); if(!x891.valid){ continue; } j5array[0]=((-1.5707963267949)+(((1.5707963267949)*(x890.value)))+(x891.value)); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[2]; IkReal x892=IKsin(j5); IkReal x893=IKcos(j5); IkReal x894=(npy*sj6); IkReal x895=(cj6*npx); IkReal x896=((1.0)*x892); evalcond[0]=((0.384)+(((0.088)*x892))+(((-0.0825)*sj3))+(((-1.0)*x895*x896))+(((0.316)*cj3))+((x892*x894))+((npz*x893))); evalcond[1]=((0.0825)+(((0.088)*x893))+(((-0.0825)*cj3))+(((-1.0)*npz*x896))+((x893*x894))+(((-1.0)*x893*x895))+(((-0.316)*sj3))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j5] } } while(0); if( bgotonextstatement ) { } } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; IkReal x897=cj6*cj6; IkReal x898=npy*npy; IkReal x899=npx*npx; IkReal x900=((1.0)*npz); IkReal x901=(cj6*npx); IkReal x902=(cj4*sj3); IkReal x903=((0.0825)*cj3); IkReal x904=(npy*sj6); IkReal x905=(cj6*sj4); IkReal x906=((0.0825)*npz); IkReal x907=((0.384)*cj4); IkReal x908=((0.316)*sj3); IkReal x909=((0.176)*cj4); IkReal x910=(npx*sj4*sj6); IkReal x911=((0.316)*cj3*cj4); IkReal x912=(cj4*x897); IkReal x913=(npx*npy*sj4); CheckValue<IkReal> x914=IKPowWithIntegerCheck(IKsign(((((-1.0)*x898*x912))+(((-2.0)*cj4*x901*x904))+((cj4*(npz*npz)))+((cj4*x898))+((x899*x912))+(((-1.0)*x901*x909))+(((0.007744)*cj4))+((x904*x909)))),-1); if(!x914.valid){ continue; } CheckValue<IkReal> x915 = IKatan2WithCheck(IkReal((((x901*x911))+(((0.00726)*x902))+((x901*x907))+(((-1.0)*x906))+(((0.0825)*x902*x904))+((npz*x903))+((npz*x908))+(((-0.0825)*x901*x902))+(((-1.0)*x904*x911))+(((-1.0)*x900*x910))+(((-0.033792)*cj4))+(((-1.0)*x904*x907))+(((-0.027808)*cj3*cj4))+(((-1.0)*npy*x900*x905)))),IkReal(((0.00726)+(((-1.0)*x903*x904))+(((0.088)*npy*x905))+(((-0.027808)*sj3))+((x901*x908))+((x901*x903))+(((0.088)*x910))+((x902*x906))+(((0.0825)*x904))+((sj6*x898*x905))+(((-1.0)*npz*x907))+(((-1.0)*sj6*x899*x905))+(((-0.00726)*cj3))+(((-2.0)*x897*x913))+(((-1.0)*x904*x908))+(((-1.0)*npz*x911))+x913+(((-0.0825)*x901)))),IKFAST_ATAN2_MAGTHRESH); if(!x915.valid){ continue; } j5array[0]=((-1.5707963267949)+(((1.5707963267949)*(x914.value)))+(x915.value)); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[4]; IkReal x916=IKsin(j5); IkReal x917=IKcos(j5); IkReal x918=(cj6*npy); IkReal x919=((1.0)*sj4); IkReal x920=((0.0825)*cj4); IkReal x921=((0.316)*sj3); IkReal x922=(npx*sj6); IkReal x923=((0.088)*x917); IkReal x924=(npy*sj6*x917); IkReal x925=((1.0)*npz*x916); IkReal x926=(cj6*npx*x917); evalcond[0]=((0.384)+(((-1.0)*cj6*npx*x916))+(((-0.0825)*sj3))+(((0.088)*x916))+(((0.316)*cj3))+((npy*sj6*x916))+((npz*x917))); evalcond[1]=((((-1.0)*x920))+(((-1.0)*x925))+(((-1.0)*x926))+((cj3*x920))+((cj4*x921))+x924+x923); evalcond[2]=((((-1.0)*npz*x916*x919))+((sj4*x924))+((sj4*x923))+(((-1.0)*x919*x926))+((cj4*x918))+((cj4*x922))); evalcond[3]=((-0.0825)+(((-1.0)*x918*x919))+(((-1.0)*cj4*x926))+(((0.0825)*cj3))+(((-1.0)*x919*x922))+(((-1.0)*cj4*x925))+((cj4*x923))+((cj4*x924))+x921); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; IkReal x927=cj6*cj6; IkReal x928=npy*npy; IkReal x929=npx*npx; IkReal x930=((0.0825)*sj3); IkReal x931=(npz*sj4); IkReal x932=(cj4*npx); IkReal x933=((0.316)*cj3); IkReal x934=((2.0)*npy); IkReal x935=(cj4*cj6); IkReal x936=(cj6*npx*sj4); IkReal x937=(sj4*x928); IkReal x938=(npy*sj4*sj6); CheckValue<IkReal> x939=IKPowWithIntegerCheck(IKsign((((npz*x931))+(((0.007744)*sj4))+(((-0.176)*x936))+((sj4*x927*x929))+(((-1.0)*sj6*x934*x936))+(((0.176)*x938))+x937+(((-1.0)*x927*x937)))),-1); if(!x939.valid){ continue; } CheckValue<IkReal> x940 = IKatan2WithCheck(IkReal(((((-1.0)*x930*x936))+(((-0.384)*x938))+(((-0.027808)*cj3*sj4))+((x930*x938))+(((0.384)*x936))+(((-0.033792)*sj4))+(((-1.0)*x933*x938))+(((0.00726)*sj3*sj4))+((npz*sj6*x932))+((npy*npz*x935))+((x933*x936)))),IkReal(((((-0.088)*npy*x935))+(((-0.088)*sj6*x932))+(((-1.0)*x931*x933))+(((-0.384)*x931))+(((-1.0)*npy*x932))+((x930*x931))+((x927*x932*x934))+(((-1.0)*sj6*x928*x935))+((sj6*x929*x935)))),IKFAST_ATAN2_MAGTHRESH); if(!x940.valid){ continue; } j5array[0]=((-1.5707963267949)+(((1.5707963267949)*(x939.value)))+(x940.value)); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[4]; IkReal x941=IKsin(j5); IkReal x942=IKcos(j5); IkReal x943=(cj6*npy); IkReal x944=((1.0)*sj4); IkReal x945=((0.0825)*cj4); IkReal x946=((0.316)*sj3); IkReal x947=(npx*sj6); IkReal x948=((0.088)*x942); IkReal x949=(npy*sj6*x942); IkReal x950=((1.0)*npz*x941); IkReal x951=(cj6*npx*x942); evalcond[0]=((0.384)+((npz*x942))+(((-0.0825)*sj3))+((npy*sj6*x941))+(((0.316)*cj3))+(((-1.0)*cj6*npx*x941))+(((0.088)*x941))); evalcond[1]=((((-1.0)*x945))+(((-1.0)*x951))+((cj3*x945))+(((-1.0)*x950))+x948+x949+((cj4*x946))); evalcond[2]=((((-1.0)*x944*x951))+(((-1.0)*npz*x941*x944))+((sj4*x949))+((sj4*x948))+((cj4*x943))+((cj4*x947))); evalcond[3]=((-0.0825)+(((-1.0)*cj4*x951))+(((-1.0)*x944*x947))+(((-1.0)*x943*x944))+(((0.0825)*cj3))+(((-1.0)*cj4*x950))+x946+((cj4*x949))+((cj4*x948))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; IkReal x952=cj6*cj6; IkReal x953=npy*npy; IkReal x954=((0.0825)*cj4); IkReal x955=(npy*sj6); IkReal x956=(cj4*sj3); IkReal x957=(cj3*npz); IkReal x958=(cj6*npx); IkReal x959=((0.00726)*cj4); IkReal x960=((0.0825)*sj3); IkReal x961=((0.316)*cj3); CheckValue<IkReal> x962=IKPowWithIntegerCheck(IKsign(((0.007744)+(((0.176)*x955))+((x952*(npx*npx)))+(((-2.0)*x955*x958))+(((-0.176)*x958))+(((-1.0)*x952*x953))+(npz*npz)+x953)),-1); if(!x962.valid){ continue; } CheckValue<IkReal> x963 = IKatan2WithCheck(IkReal(((-0.033792)+(((0.316)*npz*x956))+(((-1.0)*npz*x954))+(((-0.384)*x955))+(((-0.027808)*cj3))+(((0.00726)*sj3))+(((-1.0)*x958*x960))+((x958*x961))+(((-1.0)*x955*x961))+(((0.384)*x958))+((x955*x960))+((x954*x957)))),IkReal((((cj3*x954*x958))+((npz*x960))+(((-0.027808)*x956))+(((-1.0)*cj3*x954*x955))+(((-1.0)*cj3*x959))+(((0.316)*x956*x958))+(((-0.384)*npz))+(((-0.316)*x955*x956))+(((-1.0)*x954*x958))+x959+(((-0.316)*x957))+((x954*x955)))),IKFAST_ATAN2_MAGTHRESH); if(!x963.valid){ continue; } j5array[0]=((-1.5707963267949)+(((1.5707963267949)*(x962.value)))+(x963.value)); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[4]; IkReal x964=IKsin(j5); IkReal x965=IKcos(j5); IkReal x966=(cj6*npy); IkReal x967=((1.0)*sj4); IkReal x968=((0.0825)*cj4); IkReal x969=((0.316)*sj3); IkReal x970=(npx*sj6); IkReal x971=((0.088)*x965); IkReal x972=(npy*sj6*x965); IkReal x973=((1.0)*npz*x964); IkReal x974=(cj6*npx*x965); evalcond[0]=((0.384)+((npz*x965))+(((-1.0)*cj6*npx*x964))+(((-0.0825)*sj3))+(((0.316)*cj3))+((npy*sj6*x964))+(((0.088)*x964))); evalcond[1]=((((-1.0)*x974))+((cj3*x968))+x971+x972+(((-1.0)*x968))+(((-1.0)*x973))+((cj4*x969))); evalcond[2]=(((cj4*x970))+((sj4*x971))+((sj4*x972))+(((-1.0)*x967*x974))+(((-1.0)*npz*x964*x967))+((cj4*x966))); evalcond[3]=((-0.0825)+((cj4*x971))+((cj4*x972))+(((-1.0)*x966*x967))+(((-1.0)*x967*x970))+(((-1.0)*cj4*x974))+(((0.0825)*cj3))+x969+(((-1.0)*cj4*x973))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } } } } else { { IkReal j5array[2], cj5array[2], sj5array[2]; bool j5valid[2]={false}; _nj5 = 2; IkReal x975=((0.088)+(((-1.0)*cj6*npx))+((npy*sj6))); CheckValue<IkReal> x978 = IKatan2WithCheck(IkReal(npz),IkReal(x975),IKFAST_ATAN2_MAGTHRESH); if(!x978.valid){ continue; } IkReal x976=((1.0)*(x978.value)); if((((x975*x975)+(npz*npz))) < -0.00001) continue; CheckValue<IkReal> x979=IKPowWithIntegerCheck(IKabs(IKsqrt(((x975*x975)+(npz*npz)))),-1); if(!x979.valid){ continue; } if( (((x979.value)*(((0.384)+(((-0.0825)*sj3))+(((0.316)*cj3)))))) < -1-IKFAST_SINCOS_THRESH || (((x979.value)*(((0.384)+(((-0.0825)*sj3))+(((0.316)*cj3)))))) > 1+IKFAST_SINCOS_THRESH ) continue; IkReal x977=IKasin(((x979.value)*(((0.384)+(((-0.0825)*sj3))+(((0.316)*cj3)))))); j5array[0]=((((-1.0)*x977))+(((-1.0)*x976))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); j5array[1]=((3.14159265358979)+x977+(((-1.0)*x976))); sj5array[1]=IKsin(j5array[1]); cj5array[1]=IKcos(j5array[1]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; if( j5array[1] > IKPI ) { j5array[1]-=IK2PI; } else if( j5array[1] < -IKPI ) { j5array[1]+=IK2PI; } j5valid[1] = true; for(int ij5 = 0; ij5 < 2; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 2; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal j4eval[3]; j4eval[0]=((-1.0)+cj3+(((3.83030303030303)*sj3))); j4eval[1]=((IKabs((((cj6*npy))+((npx*sj6)))))+(IKabs(((((-0.088)*cj5))+(((-1.0)*cj5*npy*sj6))+((npz*sj5))+((cj5*cj6*npx)))))); j4eval[2]=IKsign(((-0.0825)+(((0.0825)*cj3))+(((0.316)*sj3)))); if( IKabs(j4eval[0]) < 0.0000010000000000 || IKabs(j4eval[1]) < 0.0000010000000000 || IKabs(j4eval[2]) < 0.0000010000000000 ) { { IkReal j4eval[2]; IkReal x980=(cj6*npy); IkReal x981=(npx*sj6); IkReal x982=((3.83030303030303)*sj3); j4eval[0]=((-1.0)+cj3+x982); j4eval[1]=(((x981*x982))+(((-1.0)*x980))+(((-1.0)*x981))+((cj3*x980))+((cj3*x981))+((x980*x982))); if( IKabs(j4eval[0]) < 0.0000010000000000 || IKabs(j4eval[1]) < 0.0000010000000000 ) { { IkReal j4eval[2]; IkReal x983=((43.5261707988981)*sj3); IkReal x984=(cj3*cj5); IkReal x985=((3.83030303030303)*sj3); IkReal x986=(cj5*cj6*npx); IkReal x987=((11.3636363636364)*npz*sj5); IkReal x988=(cj5*npy*sj6); j4eval[0]=((-1.0)+cj3+x985); j4eval[1]=(((x983*x988))+(((-11.3636363636364)*x988))+(((-1.0)*npz*sj5*x983))+((cj5*x985))+(((11.3636363636364)*npy*sj6*x984))+(((-1.0)*cj3*x987))+(((11.3636363636364)*x986))+(((-11.3636363636364)*cj6*npx*x984))+x984+x987+(((-1.0)*cj5))+(((-1.0)*x983*x986))); if( IKabs(j4eval[0]) < 0.0000010000000000 || IKabs(j4eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j3))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j4eval[1]; sj3=0; cj3=1.0; j3=0; j4eval[0]=((IKabs((((cj6*npy))+((npx*sj6)))))+(IKabs(((((-1.0)*npz*sj5))+((cj5*npy*sj6))+(((0.088)*cj5))+(((-1.0)*cj5*cj6*npx)))))); if( IKabs(j4eval[0]) < 0.0000010000000000 ) { { IkReal j4eval[1]; sj3=0; cj3=1.0; j3=0; IkReal x989=((1.0)*cj6); j4eval[0]=((IKabs(((((-1.0)*npz*sj5))+(((-1.0)*cj5*npx*x989))+((cj5*npy*sj6))+(((0.088)*cj5)))))+(IKabs(((((-1.0)*npy*x989))+(((-1.0)*npx*sj6)))))); if( IKabs(j4eval[0]) < 0.0000010000000000 ) { continue; // no branches [j4] } else { { IkReal j4array[2], cj4array[2], sj4array[2]; bool j4valid[2]={false}; _nj4 = 2; IkReal x990=((1.0)*cj6); CheckValue<IkReal> x992 = IKatan2WithCheck(IkReal(((((-1.0)*cj5*npx*x990))+(((-1.0)*npz*sj5))+((cj5*npy*sj6))+(((0.088)*cj5)))),IkReal(((((-1.0)*npx*sj6))+(((-1.0)*npy*x990)))),IKFAST_ATAN2_MAGTHRESH); if(!x992.valid){ continue; } IkReal x991=x992.value; j4array[0]=((-1.0)*x991); sj4array[0]=IKsin(j4array[0]); cj4array[0]=IKcos(j4array[0]); j4array[1]=((3.14159265358979)+(((-1.0)*x991))); sj4array[1]=IKsin(j4array[1]); cj4array[1]=IKcos(j4array[1]); if( j4array[0] > IKPI ) { j4array[0]-=IK2PI; } else if( j4array[0] < -IKPI ) { j4array[0]+=IK2PI; } j4valid[0] = true; if( j4array[1] > IKPI ) { j4array[1]-=IK2PI; } else if( j4array[1] < -IKPI ) { j4array[1]+=IK2PI; } j4valid[1] = true; for(int ij4 = 0; ij4 < 2; ++ij4) { if( !j4valid[ij4] ) { continue; } _ij4[0] = ij4; _ij4[1] = -1; for(int iij4 = ij4+1; iij4 < 2; ++iij4) { if( j4valid[iij4] && IKabs(cj4array[ij4]-cj4array[iij4]) < IKFAST_SOLUTION_THRESH && IKabs(sj4array[ij4]-sj4array[iij4]) < IKFAST_SOLUTION_THRESH ) { j4valid[iij4]=false; _ij4[1] = iij4; break; } } j4 = j4array[ij4]; cj4 = cj4array[ij4]; sj4 = sj4array[ij4]; { IkReal evalcond[1]; IkReal x993=IKcos(j4); IkReal x994=IKsin(j4); IkReal x995=((1.0)*x994); IkReal x996=(cj5*x994); evalcond[0]=(((npx*sj6*x993))+(((0.088)*x996))+(((-1.0)*npz*sj5*x995))+(((-1.0)*cj5*cj6*npx*x995))+((cj6*npy*x993))+((npy*sj6*x996))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j4array[2], cj4array[2], sj4array[2]; bool j4valid[2]={false}; _nj4 = 2; CheckValue<IkReal> x998 = IKatan2WithCheck(IkReal((((cj6*npy))+((npx*sj6)))),IkReal(((((-1.0)*npz*sj5))+((cj5*npy*sj6))+(((0.088)*cj5))+(((-1.0)*cj5*cj6*npx)))),IKFAST_ATAN2_MAGTHRESH); if(!x998.valid){ continue; } IkReal x997=x998.value; j4array[0]=((-1.0)*x997); sj4array[0]=IKsin(j4array[0]); cj4array[0]=IKcos(j4array[0]); j4array[1]=((3.14159265358979)+(((-1.0)*x997))); sj4array[1]=IKsin(j4array[1]); cj4array[1]=IKcos(j4array[1]); if( j4array[0] > IKPI ) { j4array[0]-=IK2PI; } else if( j4array[0] < -IKPI ) { j4array[0]+=IK2PI; } j4valid[0] = true; if( j4array[1] > IKPI ) { j4array[1]-=IK2PI; } else if( j4array[1] < -IKPI ) { j4array[1]+=IK2PI; } j4valid[1] = true; for(int ij4 = 0; ij4 < 2; ++ij4) { if( !j4valid[ij4] ) { continue; } _ij4[0] = ij4; _ij4[1] = -1; for(int iij4 = ij4+1; iij4 < 2; ++iij4) { if( j4valid[iij4] && IKabs(cj4array[ij4]-cj4array[iij4]) < IKFAST_SOLUTION_THRESH && IKabs(sj4array[ij4]-sj4array[iij4]) < IKFAST_SOLUTION_THRESH ) { j4valid[iij4]=false; _ij4[1] = iij4; break; } } j4 = j4array[ij4]; cj4 = cj4array[ij4]; sj4 = sj4array[ij4]; { IkReal evalcond[1]; IkReal x999=IKcos(j4); IkReal x1000=IKsin(j4); IkReal x1001=((1.0)*cj6); IkReal x1002=(cj5*x999); evalcond[0]=((((-1.0)*npz*sj5*x999))+(((-1.0)*npx*x1001*x1002))+((npy*sj6*x1002))+(((0.088)*x1002))+(((-1.0)*npx*sj6*x1000))+(((-1.0)*npy*x1000*x1001))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((7.39491075446515e-18)+j3)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j4eval[1]; sj3=0; cj3=1.0; j3=-2.7408962440214e-6; j4eval[0]=((IKabs((((cj6*npy))+((npx*sj6)))))+(IKabs(((((-1.0)*npz*sj5))+((cj5*npy*sj6))+(((0.088)*cj5))+(((-1.0)*cj5*cj6*npx)))))); if( IKabs(j4eval[0]) < 0.0000010000000000 ) { { IkReal j4eval[1]; sj3=0; cj3=1.0; j3=-2.7408962440214e-6; IkReal x1003=((1.0)*cj6); j4eval[0]=((IKabs(((((-1.0)*npz*sj5))+((cj5*npy*sj6))+(((-1.0)*cj5*npx*x1003))+(((0.088)*cj5)))))+(IKabs(((((-1.0)*npx*sj6))+(((-1.0)*npy*x1003)))))); if( IKabs(j4eval[0]) < 0.0000010000000000 ) { continue; // no branches [j4] } else { { IkReal j4array[2], cj4array[2], sj4array[2]; bool j4valid[2]={false}; _nj4 = 2; IkReal x1004=((1.0)*cj6); CheckValue<IkReal> x1006 = IKatan2WithCheck(IkReal(((((-1.0)*npz*sj5))+((cj5*npy*sj6))+(((-1.0)*cj5*npx*x1004))+(((0.088)*cj5)))),IkReal(((((-1.0)*npx*sj6))+(((-1.0)*npy*x1004)))),IKFAST_ATAN2_MAGTHRESH); if(!x1006.valid){ continue; } IkReal x1005=x1006.value; j4array[0]=((-1.0)*x1005); sj4array[0]=IKsin(j4array[0]); cj4array[0]=IKcos(j4array[0]); j4array[1]=((3.14159265358979)+(((-1.0)*x1005))); sj4array[1]=IKsin(j4array[1]); cj4array[1]=IKcos(j4array[1]); if( j4array[0] > IKPI ) { j4array[0]-=IK2PI; } else if( j4array[0] < -IKPI ) { j4array[0]+=IK2PI; } j4valid[0] = true; if( j4array[1] > IKPI ) { j4array[1]-=IK2PI; } else if( j4array[1] < -IKPI ) { j4array[1]+=IK2PI; } j4valid[1] = true; for(int ij4 = 0; ij4 < 2; ++ij4) { if( !j4valid[ij4] ) { continue; } _ij4[0] = ij4; _ij4[1] = -1; for(int iij4 = ij4+1; iij4 < 2; ++iij4) { if( j4valid[iij4] && IKabs(cj4array[ij4]-cj4array[iij4]) < IKFAST_SOLUTION_THRESH && IKabs(sj4array[ij4]-sj4array[iij4]) < IKFAST_SOLUTION_THRESH ) { j4valid[iij4]=false; _ij4[1] = iij4; break; } } j4 = j4array[ij4]; cj4 = cj4array[ij4]; sj4 = sj4array[ij4]; { IkReal evalcond[1]; IkReal x1007=IKcos(j4); IkReal x1008=IKsin(j4); IkReal x1009=((1.0)*x1008); IkReal x1010=(cj5*x1008); evalcond[0]=(((npx*sj6*x1007))+((cj6*npy*x1007))+((npy*sj6*x1010))+(((0.088)*x1010))+(((-1.0)*cj5*cj6*npx*x1009))+(((-1.0)*npz*sj5*x1009))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j4array[2], cj4array[2], sj4array[2]; bool j4valid[2]={false}; _nj4 = 2; CheckValue<IkReal> x1012 = IKatan2WithCheck(IkReal((((cj6*npy))+((npx*sj6)))),IkReal(((((-1.0)*npz*sj5))+((cj5*npy*sj6))+(((0.088)*cj5))+(((-1.0)*cj5*cj6*npx)))),IKFAST_ATAN2_MAGTHRESH); if(!x1012.valid){ continue; } IkReal x1011=x1012.value; j4array[0]=((-1.0)*x1011); sj4array[0]=IKsin(j4array[0]); cj4array[0]=IKcos(j4array[0]); j4array[1]=((3.14159265358979)+(((-1.0)*x1011))); sj4array[1]=IKsin(j4array[1]); cj4array[1]=IKcos(j4array[1]); if( j4array[0] > IKPI ) { j4array[0]-=IK2PI; } else if( j4array[0] < -IKPI ) { j4array[0]+=IK2PI; } j4valid[0] = true; if( j4array[1] > IKPI ) { j4array[1]-=IK2PI; } else if( j4array[1] < -IKPI ) { j4array[1]+=IK2PI; } j4valid[1] = true; for(int ij4 = 0; ij4 < 2; ++ij4) { if( !j4valid[ij4] ) { continue; } _ij4[0] = ij4; _ij4[1] = -1; for(int iij4 = ij4+1; iij4 < 2; ++iij4) { if( j4valid[iij4] && IKabs(cj4array[ij4]-cj4array[iij4]) < IKFAST_SOLUTION_THRESH && IKabs(sj4array[ij4]-sj4array[iij4]) < IKFAST_SOLUTION_THRESH ) { j4valid[iij4]=false; _ij4[1] = iij4; break; } } j4 = j4array[ij4]; cj4 = cj4array[ij4]; sj4 = sj4array[ij4]; { IkReal evalcond[1]; IkReal x1013=IKcos(j4); IkReal x1014=IKsin(j4); IkReal x1015=((1.0)*cj6); IkReal x1016=(cj5*x1013); evalcond[0]=((((-1.0)*npy*x1014*x1015))+((npy*sj6*x1016))+(((0.088)*x1016))+(((-1.0)*npz*sj5*x1013))+(((-1.0)*npx*x1015*x1016))+(((-1.0)*npx*sj6*x1014))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-2.63084142381503)+j3)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j4array[1], cj4array[1], sj4array[1]; bool j4valid[1]={false}; _nj4 = 1; IkReal x1017=((2597402597.4026)*sj6); IkReal x1018=((2597402597.4026)*cj6); if( IKabs(((((-1.0)*npy*x1018))+(((-1.0)*npx*x1017)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((((228571428.571429)*cj5))+(((-1.0)*cj5*npx*x1018))+(((-2597402597.4026)*npz*sj5))+((cj5*npy*x1017)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*npy*x1018))+(((-1.0)*npx*x1017))))+IKsqr(((((228571428.571429)*cj5))+(((-1.0)*cj5*npx*x1018))+(((-2597402597.4026)*npz*sj5))+((cj5*npy*x1017))))-1) <= IKFAST_SINCOS_THRESH ) continue; j4array[0]=IKatan2(((((-1.0)*npy*x1018))+(((-1.0)*npx*x1017))), ((((228571428.571429)*cj5))+(((-1.0)*cj5*npx*x1018))+(((-2597402597.4026)*npz*sj5))+((cj5*npy*x1017)))); sj4array[0]=IKsin(j4array[0]); cj4array[0]=IKcos(j4array[0]); if( j4array[0] > IKPI ) { j4array[0]-=IK2PI; } else if( j4array[0] < -IKPI ) { j4array[0]+=IK2PI; } j4valid[0] = true; for(int ij4 = 0; ij4 < 1; ++ij4) { if( !j4valid[ij4] ) { continue; } _ij4[0] = ij4; _ij4[1] = -1; for(int iij4 = ij4+1; iij4 < 1; ++iij4) { if( j4valid[iij4] && IKabs(cj4array[ij4]-cj4array[iij4]) < IKFAST_SOLUTION_THRESH && IKabs(sj4array[ij4]-sj4array[iij4]) < IKFAST_SOLUTION_THRESH ) { j4valid[iij4]=false; _ij4[1] = iij4; break; } } j4 = j4array[ij4]; cj4 = cj4array[ij4]; sj4 = sj4array[ij4]; { IkReal evalcond[4]; IkReal x1019=IKcos(j4); IkReal x1020=IKsin(j4); IkReal x1021=((1.0)*cj6); IkReal x1022=(npx*sj6); IkReal x1023=(cj5*sj6); IkReal x1024=((0.088)*cj5); IkReal x1025=((1.0)*npz*sj5); IkReal x1026=(npx*x1020); IkReal x1027=(npy*x1019); IkReal x1028=(cj5*x1019); IkReal x1029=(npy*x1020); evalcond[0]=((((-1.0)*x1022))+(((-3.85e-10)*x1020))+(((-1.0)*npy*x1021))); evalcond[1]=((((-3.85e-10)*x1019))+x1024+((npy*x1023))+(((-1.0)*x1025))+(((-1.0)*cj5*npx*x1021))); evalcond[2]=((((-1.0)*cj5*x1021*x1026))+(((-1.0)*x1020*x1025))+((x1023*x1029))+((x1019*x1022))+((x1020*x1024))+((cj6*x1027))); evalcond[3]=((-3.85e-10)+(((-1.0)*x1019*x1025))+(((-1.0)*x1021*x1029))+((x1023*x1027))+((x1019*x1024))+(((-1.0)*npx*x1021*x1028))+(((-1.0)*x1020*x1022))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j4] } } while(0); if( bgotonextstatement ) { } } } } } } else { { IkReal j4array[1], cj4array[1], sj4array[1]; bool j4valid[1]={false}; _nj4 = 1; IkReal x1030=cj6*cj6; IkReal x1031=npx*npx; IkReal x1032=((0.0825)*cj3); IkReal x1033=((0.05214)*sj3); IkReal x1034=((0.00726)*cj5); IkReal x1035=(npx*sj6); IkReal x1036=((0.316)*sj3); IkReal x1037=(npz*sj5); IkReal x1038=(cj6*npy); IkReal x1039=(cj5*npy*sj6); IkReal x1040=(cj5*cj6*npx); CheckValue<IkReal> x1041=IKPowWithIntegerCheck(((-0.0825)+x1032+x1036),-1); if(!x1041.valid){ continue; } CheckValue<IkReal> x1042=IKPowWithIntegerCheck(((((-1.0)*x1032*x1040))+((x1036*x1039))+(((-1.0)*x1034))+((cj3*x1034))+(((-1.0)*x1032*x1037))+(((-1.0)*x1036*x1037))+(((0.0825)*x1037))+(((0.027808)*cj5*sj3))+(((0.0825)*x1040))+(((-0.0825)*x1039))+(((-1.0)*x1036*x1040))+((x1032*x1039))),-1); if(!x1042.valid){ continue; } if( IKabs(((x1041.value)*((x1038+x1035)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((x1042.value)*(((-0.10666225)+x1033+x1031+((x1030*(npy*npy)))+(((2.0)*x1035*x1038))+(((-1.0)*cj3*x1033))+(((0.0136125)*cj3))+(((0.09304975)*(cj3*cj3)))+(((-1.0)*x1030*x1031)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((x1041.value)*((x1038+x1035))))+IKsqr(((x1042.value)*(((-0.10666225)+x1033+x1031+((x1030*(npy*npy)))+(((2.0)*x1035*x1038))+(((-1.0)*cj3*x1033))+(((0.0136125)*cj3))+(((0.09304975)*(cj3*cj3)))+(((-1.0)*x1030*x1031))))))-1) <= IKFAST_SINCOS_THRESH ) continue; j4array[0]=IKatan2(((x1041.value)*((x1038+x1035))), ((x1042.value)*(((-0.10666225)+x1033+x1031+((x1030*(npy*npy)))+(((2.0)*x1035*x1038))+(((-1.0)*cj3*x1033))+(((0.0136125)*cj3))+(((0.09304975)*(cj3*cj3)))+(((-1.0)*x1030*x1031)))))); sj4array[0]=IKsin(j4array[0]); cj4array[0]=IKcos(j4array[0]); if( j4array[0] > IKPI ) { j4array[0]-=IK2PI; } else if( j4array[0] < -IKPI ) { j4array[0]+=IK2PI; } j4valid[0] = true; for(int ij4 = 0; ij4 < 1; ++ij4) { if( !j4valid[ij4] ) { continue; } _ij4[0] = ij4; _ij4[1] = -1; for(int iij4 = ij4+1; iij4 < 1; ++iij4) { if( j4valid[iij4] && IKabs(cj4array[ij4]-cj4array[iij4]) < IKFAST_SOLUTION_THRESH && IKabs(sj4array[ij4]-sj4array[iij4]) < IKFAST_SOLUTION_THRESH ) { j4valid[iij4]=false; _ij4[1] = iij4; break; } } j4 = j4array[ij4]; cj4 = cj4array[ij4]; sj4 = sj4array[ij4]; { IkReal evalcond[4]; IkReal x1043=IKsin(j4); IkReal x1044=IKcos(j4); IkReal x1045=(npx*sj6); IkReal x1046=((0.316)*sj3); IkReal x1047=((0.0825)*cj3); IkReal x1048=(npy*sj6); IkReal x1049=((0.088)*cj5); IkReal x1050=((1.0)*npy); IkReal x1051=((0.0825)*x1043); IkReal x1052=(cj6*x1044); IkReal x1053=((1.0)*npz*sj5); IkReal x1054=((1.0)*cj5*npx); IkReal x1055=(cj5*x1043); IkReal x1056=(cj6*x1043); evalcond[0]=((((-1.0)*x1051))+((x1043*x1046))+((x1043*x1047))+(((-1.0)*x1045))+(((-1.0)*cj6*x1050))); evalcond[1]=((((-1.0)*x1053))+x1049+(((-0.0825)*x1044))+((cj5*x1048))+(((-1.0)*cj6*x1054))+((x1044*x1047))+((x1044*x1046))); evalcond[2]=(((x1043*x1049))+(((-1.0)*x1043*x1053))+((x1048*x1055))+(((-1.0)*x1054*x1056))+((npy*x1052))+((x1044*x1045))); evalcond[3]=((-0.0825)+(((-1.0)*x1052*x1054))+x1047+x1046+(((-1.0)*x1044*x1053))+(((-1.0)*x1043*x1045))+((cj5*x1044*x1048))+(((-1.0)*x1050*x1056))+((x1044*x1049))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j4array[1], cj4array[1], sj4array[1]; bool j4valid[1]={false}; _nj4 = 1; IkReal x1057=(cj5*npx); IkReal x1058=(cj6*npy); IkReal x1059=((0.316)*sj3); IkReal x1060=((0.0825)*cj3); IkReal x1061=(npx*sj6); IkReal x1062=(npz*sj5); IkReal x1063=(cj5*cj6*sj6); CheckValue<IkReal> x1064=IKPowWithIntegerCheck(((-0.0825)+x1059+x1060),-1); if(!x1064.valid){ continue; } CheckValue<IkReal> x1065=IKPowWithIntegerCheck((((x1060*x1061))+(((-0.0825)*x1061))+(((-0.0825)*x1058))+((x1059*x1061))+((x1058*x1059))+((x1058*x1060))),-1); if(!x1065.valid){ continue; } if( IKabs(((x1064.value)*((x1058+x1061)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((x1065.value)*(((((-0.088)*cj5*x1058))+(((2.0)*cj6*x1057*x1058))+((x1061*x1062))+(((-1.0)*npy*x1057))+((cj6*x1057*x1061))+(((-0.088)*sj6*x1057))+(((-1.0)*cj5*npy*sj6*x1058))+((x1058*x1062)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((x1064.value)*((x1058+x1061))))+IKsqr(((x1065.value)*(((((-0.088)*cj5*x1058))+(((2.0)*cj6*x1057*x1058))+((x1061*x1062))+(((-1.0)*npy*x1057))+((cj6*x1057*x1061))+(((-0.088)*sj6*x1057))+(((-1.0)*cj5*npy*sj6*x1058))+((x1058*x1062))))))-1) <= IKFAST_SINCOS_THRESH ) continue; j4array[0]=IKatan2(((x1064.value)*((x1058+x1061))), ((x1065.value)*(((((-0.088)*cj5*x1058))+(((2.0)*cj6*x1057*x1058))+((x1061*x1062))+(((-1.0)*npy*x1057))+((cj6*x1057*x1061))+(((-0.088)*sj6*x1057))+(((-1.0)*cj5*npy*sj6*x1058))+((x1058*x1062)))))); sj4array[0]=IKsin(j4array[0]); cj4array[0]=IKcos(j4array[0]); if( j4array[0] > IKPI ) { j4array[0]-=IK2PI; } else if( j4array[0] < -IKPI ) { j4array[0]+=IK2PI; } j4valid[0] = true; for(int ij4 = 0; ij4 < 1; ++ij4) { if( !j4valid[ij4] ) { continue; } _ij4[0] = ij4; _ij4[1] = -1; for(int iij4 = ij4+1; iij4 < 1; ++iij4) { if( j4valid[iij4] && IKabs(cj4array[ij4]-cj4array[iij4]) < IKFAST_SOLUTION_THRESH && IKabs(sj4array[ij4]-sj4array[iij4]) < IKFAST_SOLUTION_THRESH ) { j4valid[iij4]=false; _ij4[1] = iij4; break; } } j4 = j4array[ij4]; cj4 = cj4array[ij4]; sj4 = sj4array[ij4]; { IkReal evalcond[4]; IkReal x1066=IKsin(j4); IkReal x1067=IKcos(j4); IkReal x1068=(npx*sj6); IkReal x1069=((0.316)*sj3); IkReal x1070=((0.0825)*cj3); IkReal x1071=(npy*sj6); IkReal x1072=((0.088)*cj5); IkReal x1073=((1.0)*npy); IkReal x1074=((0.0825)*x1066); IkReal x1075=(cj6*x1067); IkReal x1076=((1.0)*npz*sj5); IkReal x1077=((1.0)*cj5*npx); IkReal x1078=(cj5*x1066); IkReal x1079=(cj6*x1066); evalcond[0]=((((-1.0)*cj6*x1073))+((x1066*x1069))+((x1066*x1070))+(((-1.0)*x1068))+(((-1.0)*x1074))); evalcond[1]=((((-1.0)*cj6*x1077))+x1072+((x1067*x1070))+((x1067*x1069))+(((-0.0825)*x1067))+((cj5*x1071))+(((-1.0)*x1076))); evalcond[2]=((((-1.0)*x1077*x1079))+((x1071*x1078))+((x1066*x1072))+((x1067*x1068))+(((-1.0)*x1066*x1076))+((npy*x1075))); evalcond[3]=((-0.0825)+(((-1.0)*x1075*x1077))+x1070+x1069+(((-1.0)*x1073*x1079))+((x1067*x1072))+(((-1.0)*x1066*x1068))+(((-1.0)*x1067*x1076))+((cj5*x1067*x1071))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j4array[1], cj4array[1], sj4array[1]; bool j4valid[1]={false}; _nj4 = 1; CheckValue<IkReal> x1080 = IKatan2WithCheck(IkReal((((cj6*npy))+((npx*sj6)))),IkReal(((((-0.088)*cj5))+(((-1.0)*cj5*npy*sj6))+((npz*sj5))+((cj5*cj6*npx)))),IKFAST_ATAN2_MAGTHRESH); if(!x1080.valid){ continue; } CheckValue<IkReal> x1081=IKPowWithIntegerCheck(IKsign(((-0.0825)+(((0.0825)*cj3))+(((0.316)*sj3)))),-1); if(!x1081.valid){ continue; } j4array[0]=((-1.5707963267949)+(x1080.value)+(((1.5707963267949)*(x1081.value)))); sj4array[0]=IKsin(j4array[0]); cj4array[0]=IKcos(j4array[0]); if( j4array[0] > IKPI ) { j4array[0]-=IK2PI; } else if( j4array[0] < -IKPI ) { j4array[0]+=IK2PI; } j4valid[0] = true; for(int ij4 = 0; ij4 < 1; ++ij4) { if( !j4valid[ij4] ) { continue; } _ij4[0] = ij4; _ij4[1] = -1; for(int iij4 = ij4+1; iij4 < 1; ++iij4) { if( j4valid[iij4] && IKabs(cj4array[ij4]-cj4array[iij4]) < IKFAST_SOLUTION_THRESH && IKabs(sj4array[ij4]-sj4array[iij4]) < IKFAST_SOLUTION_THRESH ) { j4valid[iij4]=false; _ij4[1] = iij4; break; } } j4 = j4array[ij4]; cj4 = cj4array[ij4]; sj4 = sj4array[ij4]; { IkReal evalcond[4]; IkReal x1082=IKsin(j4); IkReal x1083=IKcos(j4); IkReal x1084=(npx*sj6); IkReal x1085=((0.316)*sj3); IkReal x1086=((0.0825)*cj3); IkReal x1087=(npy*sj6); IkReal x1088=((0.088)*cj5); IkReal x1089=((1.0)*npy); IkReal x1090=((0.0825)*x1082); IkReal x1091=(cj6*x1083); IkReal x1092=((1.0)*npz*sj5); IkReal x1093=((1.0)*cj5*npx); IkReal x1094=(cj5*x1082); IkReal x1095=(cj6*x1082); evalcond[0]=(((x1082*x1086))+((x1082*x1085))+(((-1.0)*x1090))+(((-1.0)*x1084))+(((-1.0)*cj6*x1089))); evalcond[1]=(((cj5*x1087))+x1088+(((-1.0)*cj6*x1093))+(((-1.0)*x1092))+(((-0.0825)*x1083))+((x1083*x1086))+((x1083*x1085))); evalcond[2]=(((x1082*x1088))+((x1087*x1094))+((npy*x1091))+(((-1.0)*x1093*x1095))+(((-1.0)*x1082*x1092))+((x1083*x1084))); evalcond[3]=((-0.0825)+(((-1.0)*x1082*x1084))+x1086+x1085+(((-1.0)*x1091*x1093))+(((-1.0)*x1083*x1092))+(((-1.0)*x1089*x1095))+((cj5*x1083*x1087))+((x1083*x1088))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } } } } } } return solutions.GetNumSolutions()>0; } inline void rotationfunction0(IkSolutionListBase<IkReal>& solutions) { for(int rotationiter = 0; rotationiter < 1; ++rotationiter) { IkReal x115=((1.0)*sj6); IkReal x116=((1.0)*sj3); IkReal x117=((1.0)*cj5); IkReal x118=((1.0)*sj4); IkReal x119=((1.0)*cj6); IkReal x120=((-1.0)*sj4); IkReal x121=((-1.0)*cj5); IkReal x122=((((-1.0)*r01*x115))+((cj6*r00))); IkReal x123=((((-1.0)*r11*x115))+((cj6*r10))); IkReal x124=((((-1.0)*r21*x115))+((cj6*r20))); IkReal x125=(sj5*x122); IkReal x126=((((-1.0)*r00*x115))+(((-1.0)*r01*x119))); IkReal x127=((((-1.0)*r11*x119))+(((-1.0)*r10*x115))); IkReal x128=((((-1.0)*r20*x115))+(((-1.0)*r21*x119))); IkReal x129=(((r02*sj5))+((cj5*x122))); IkReal x130=(((r12*sj5))+((cj5*x123))); IkReal x131=(((r22*sj5))+((cj5*x124))); IkReal x132=(((sj5*x124))+(((-1.0)*r22*x117))); IkReal x133=(cj4*x129); IkReal x134=(((sj5*x123))+((r12*x121))); IkReal x135=((((-1.0)*x118*x127))+((cj4*x130))); IkReal x136=(((x120*x128))+((cj4*x131))); new_r00=(((cj3*((x133+((x120*x126))))))+(((-1.0)*x116*((x125+(((-1.0)*r02*x117))))))); new_r01=(((sj4*x129))+((cj4*x126))); new_r02=(((cj3*((((r02*x121))+x125))))+((sj3*(((((-1.0)*x118*x126))+x133))))); new_r10=(((cj3*x135))+(((-1.0)*x116*x134))); new_r11=(((sj4*x130))+((cj4*x127))); new_r12=(((cj3*x134))+((sj3*x135))); new_r20=(((cj3*x136))+(((-1.0)*x116*x132))); new_r21=(((sj4*x131))+((cj4*x128))); new_r22=(((cj3*x132))+((sj3*x136))); { IkReal j1array[2], cj1array[2], sj1array[2]; bool j1valid[2]={false}; _nj1 = 2; cj1array[0]=new_r22; if( cj1array[0] >= -1-IKFAST_SINCOS_THRESH && cj1array[0] <= 1+IKFAST_SINCOS_THRESH ) { j1valid[0] = j1valid[1] = true; j1array[0] = IKacos(cj1array[0]); sj1array[0] = IKsin(j1array[0]); cj1array[1] = cj1array[0]; j1array[1] = -j1array[0]; sj1array[1] = -sj1array[0]; } else if( isnan(cj1array[0]) ) { // probably any value will work j1valid[0] = true; cj1array[0] = 1; sj1array[0] = 0; j1array[0] = 0; } for(int ij1 = 0; ij1 < 2; ++ij1) { if( !j1valid[ij1] ) { continue; } _ij1[0] = ij1; _ij1[1] = -1; for(int iij1 = ij1+1; iij1 < 2; ++iij1) { if( j1valid[iij1] && IKabs(cj1array[ij1]-cj1array[iij1]) < IKFAST_SOLUTION_THRESH && IKabs(sj1array[ij1]-sj1array[iij1]) < IKFAST_SOLUTION_THRESH ) { j1valid[iij1]=false; _ij1[1] = iij1; break; } } j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1]; { IkReal j0eval[3]; j0eval[0]=sj1; j0eval[1]=((IKabs(new_r12))+(IKabs(new_r02))); j0eval[2]=IKsign(sj1); if( IKabs(j0eval[0]) < 0.0000010000000000 || IKabs(j0eval[1]) < 0.0000010000000000 || IKabs(j0eval[2]) < 0.0000010000000000 ) { { IkReal j2eval[3]; j2eval[0]=sj1; j2eval[1]=IKsign(sj1); j2eval[2]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(j2eval[0]) < 0.0000010000000000 || IKabs(j2eval[1]) < 0.0000010000000000 || IKabs(j2eval[2]) < 0.0000010000000000 ) { { IkReal j0eval[2]; j0eval[0]=new_r12; j0eval[1]=sj1; if( IKabs(j0eval[0]) < 0.0000010000000000 || IKabs(j0eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[5]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j1))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r12; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; IkReal j2mul = 1; j2=0; j0mul=-1.0; if( IKabs(((-1.0)*new_r01)) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r00) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r01))+IKsqr(new_r00)-1) <= IKFAST_SINCOS_THRESH ) continue; j0=IKatan2(((-1.0)*new_r01), new_r00); { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].fmul = j0mul; vinfos[0].freeind = 0; vinfos[0].maxsolutions = 0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].fmul = j2mul; vinfos[2].freeind = 0; vinfos[2].maxsolutions = 0; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(1); vfree[0] = 2; solutions.AddSolution(vinfos,vfree); } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j1)))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r12; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; IkReal j2mul = 1; j2=0; j0mul=1.0; if( IKabs(((-1.0)*new_r01)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r00)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r01))+IKsqr(((-1.0)*new_r00))-1) <= IKFAST_SINCOS_THRESH ) continue; j0=IKatan2(((-1.0)*new_r01), ((-1.0)*new_r00)); { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].fmul = j0mul; vinfos[0].freeind = 0; vinfos[0].maxsolutions = 0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].fmul = j2mul; vinfos[2].freeind = 0; vinfos[2].maxsolutions = 0; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(1); vfree[0] = 2; solutions.AddSolution(vinfos,vfree); } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r12))+(IKabs(new_r02))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j0eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; IkReal x137=new_r22*new_r22; IkReal x138=((16.0)*new_r10); IkReal x139=((16.0)*new_r01); IkReal x140=((16.0)*new_r22); IkReal x141=((8.0)*new_r11); IkReal x142=((8.0)*new_r00); IkReal x143=(x137*x138); IkReal x144=(x137*x139); j0eval[0]=((IKabs((((new_r11*x140))+(((16.0)*new_r00))+(((-32.0)*new_r00*x137)))))+(IKabs((((x137*x141))+(((-1.0)*new_r22*x142)))))+(IKabs(((((-1.0)*x143))+x138)))+(IKabs(((((32.0)*new_r11))+(((-16.0)*new_r11*x137))+(((-1.0)*new_r00*x140)))))+(IKabs((x143+(((-1.0)*x138)))))+(IKabs(((((-1.0)*x144))+x139)))+(IKabs(((((-1.0)*x142))+((new_r22*x141)))))+(IKabs((x144+(((-1.0)*x139)))))); if( IKabs(j0eval[0]) < 0.0000000010000000 ) { continue; // no branches [j0, j2] } else { IkReal op[4+1], zeror[4]; int numroots; IkReal j0evalpoly[1]; IkReal x145=new_r22*new_r22; IkReal x146=((16.0)*new_r10); IkReal x147=(new_r11*new_r22); IkReal x148=(x145*x146); IkReal x149=((((8.0)*x147))+(((-8.0)*new_r00))); op[0]=x149; op[1]=((((-1.0)*x148))+x146); op[2]=((((16.0)*new_r00))+(((16.0)*x147))+(((-32.0)*new_r00*x145))); op[3]=((((-1.0)*x146))+x148); op[4]=x149; polyroots4(op,zeror,numroots); IkReal j0array[4], cj0array[4], sj0array[4], tempj0array[1]; int numsolutions = 0; for(int ij0 = 0; ij0 < numroots; ++ij0) { IkReal htj0 = zeror[ij0]; tempj0array[0]=((2.0)*(atan(htj0))); for(int kj0 = 0; kj0 < 1; ++kj0) { j0array[numsolutions] = tempj0array[kj0]; if( j0array[numsolutions] > IKPI ) { j0array[numsolutions]-=IK2PI; } else if( j0array[numsolutions] < -IKPI ) { j0array[numsolutions]+=IK2PI; } sj0array[numsolutions] = IKsin(j0array[numsolutions]); cj0array[numsolutions] = IKcos(j0array[numsolutions]); numsolutions++; } } bool j0valid[4]={true,true,true,true}; _nj0 = 4; for(int ij0 = 0; ij0 < numsolutions; ++ij0) { if( !j0valid[ij0] ) { continue; } j0 = j0array[ij0]; cj0 = cj0array[ij0]; sj0 = sj0array[ij0]; htj0 = IKtan(j0/2); IkReal x150=((16.0)*new_r01); IkReal x151=new_r22*new_r22; IkReal x152=(new_r00*new_r22); IkReal x153=((8.0)*x152); IkReal x154=(new_r11*x151); IkReal x155=(x150*x151); IkReal x156=((8.0)*x154); j0evalpoly[0]=((((-1.0)*x153))+((htj0*(((((-1.0)*x155))+x150))))+x156+(((htj0*htj0)*(((((32.0)*new_r11))+(((-16.0)*x152))+(((-16.0)*x154))))))+(((htj0*htj0*htj0)*(((((-1.0)*x150))+x155))))+(((htj0*htj0*htj0*htj0)*(((((-1.0)*x153))+x156))))); if( IKabs(j0evalpoly[0]) > 0.0000000010000000 ) { continue; } _ij0[0] = ij0; _ij0[1] = -1; for(int iij0 = ij0+1; iij0 < numsolutions; ++iij0) { if( j0valid[iij0] && IKabs(cj0array[ij0]-cj0array[iij0]) < IKFAST_SOLUTION_THRESH && IKabs(sj0array[ij0]-sj0array[iij0]) < IKFAST_SOLUTION_THRESH ) { j0valid[iij0]=false; _ij0[1] = iij0; break; } } { IkReal j2eval[3]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; IkReal x157=cj0*cj0; IkReal x158=(cj0*new_r22); IkReal x159=((-1.0)+x157+(((-1.0)*x157*(new_r22*new_r22)))); j2eval[0]=x159; j2eval[1]=IKsign(x159); j2eval[2]=((IKabs((((new_r01*sj0))+(((-1.0)*new_r00*x158)))))+(IKabs((((new_r01*x158))+((new_r00*sj0)))))); if( IKabs(j2eval[0]) < 0.0000010000000000 || IKabs(j2eval[1]) < 0.0000010000000000 || IKabs(j2eval[2]) < 0.0000010000000000 ) { { IkReal j2eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; j2eval[0]=new_r22; if( IKabs(j2eval[0]) < 0.0000010000000000 ) { { IkReal j2eval[2]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; IkReal x160=new_r22*new_r22; j2eval[0]=(((cj0*x160))+(((-1.0)*cj0))); j2eval[1]=((((-1.0)*sj0))+((sj0*x160))); if( IKabs(j2eval[0]) < 0.0000010000000000 || IKabs(j2eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j0)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(((-1.0)*new_r00)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r01)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r00))+IKsqr(((-1.0)*new_r01))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(((-1.0)*new_r00), ((-1.0)*new_r01)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[4]; IkReal x161=IKsin(j2); IkReal x162=IKcos(j2); evalcond[0]=x161; evalcond[1]=((-1.0)*x162); evalcond[2]=((((-1.0)*x161))+(((-1.0)*new_r00))); evalcond[3]=((((-1.0)*x162))+(((-1.0)*new_r01))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j0)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(new_r00) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r01) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r00)+IKsqr(new_r01)-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(new_r00, new_r01); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[4]; IkReal x163=IKsin(j2); IkReal x164=IKcos(j2); evalcond[0]=x163; evalcond[1]=((-1.0)*x164); evalcond[2]=((((-1.0)*x163))+new_r00); evalcond[3]=((((-1.0)*x164))+new_r01); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j0))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(new_r10) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r11) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r10)+IKsqr(new_r11)-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(new_r10, new_r11); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[4]; IkReal x165=IKsin(j2); IkReal x166=IKcos(j2); evalcond[0]=x165; evalcond[1]=((-1.0)*x166); evalcond[2]=((((-1.0)*x165))+new_r10); evalcond[3]=((((-1.0)*x166))+new_r11); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j0)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(((-1.0)*new_r10)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r11)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r10))+IKsqr(((-1.0)*new_r11))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(((-1.0)*new_r10), ((-1.0)*new_r11)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[4]; IkReal x167=IKsin(j2); IkReal x168=IKcos(j2); evalcond[0]=x167; evalcond[1]=((-1.0)*x168); evalcond[2]=((((-1.0)*x167))+(((-1.0)*new_r10))); evalcond[3]=((((-1.0)*x168))+(((-1.0)*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { CheckValue<IkReal> x169=IKPowWithIntegerCheck(((1.0)+(((-1.0)*(new_r22*new_r22)))),-1); if(!x169.valid){ continue; } if((x169.value) < -0.00001) continue; IkReal gconst0=((-1.0)*(IKsqrt(x169.value))); evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs((cj0+(((-1.0)*gconst0)))))+(IKabs(((-1.0)+(IKsign(sj0)))))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; if((((1.0)+(((-1.0)*(gconst0*gconst0))))) < -0.00001) continue; sj0=IKsqrt(((1.0)+(((-1.0)*(gconst0*gconst0))))); cj0=gconst0; if( (gconst0) < -1-IKFAST_SINCOS_THRESH || (gconst0) > 1+IKFAST_SINCOS_THRESH ) continue; j0=IKacos(gconst0); CheckValue<IkReal> x170=IKPowWithIntegerCheck(((1.0)+(((-1.0)*(new_r22*new_r22)))),-1); if(!x170.valid){ continue; } if((x170.value) < -0.00001) continue; IkReal gconst0=((-1.0)*(IKsqrt(x170.value))); j2eval[0]=((IKabs(new_r11))+(IKabs(new_r10))); if( IKabs(j2eval[0]) < 0.0000010000000000 ) { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if((((1.0)+(((-1.0)*(gconst0*gconst0))))) < -0.00001) continue; CheckValue<IkReal> x171=IKPowWithIntegerCheck(gconst0,-1); if(!x171.valid){ continue; } if( IKabs(((((-1.0)*new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst0*gconst0))))))))+((gconst0*new_r10)))) < IKFAST_ATAN2_MAGTHRESH && IKabs((new_r11*(x171.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst0*gconst0))))))))+((gconst0*new_r10))))+IKsqr((new_r11*(x171.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(((((-1.0)*new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst0*gconst0))))))))+((gconst0*new_r10))), (new_r11*(x171.value))); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x172=IKcos(j2); IkReal x173=IKsin(j2); IkReal x174=((1.0)*gconst0); if((((1.0)+(((-1.0)*gconst0*x174)))) < -0.00001) continue; IkReal x175=IKsqrt(((1.0)+(((-1.0)*gconst0*x174)))); IkReal x176=((1.0)*x175); evalcond[0]=x173; evalcond[1]=((-1.0)*x172); evalcond[2]=(new_r11+(((-1.0)*x172*x174))); evalcond[3]=(new_r10+(((-1.0)*x173*x174))); evalcond[4]=(((x172*x175))+new_r01); evalcond[5]=(((x173*x175))+new_r00); evalcond[6]=((((-1.0)*x173))+((gconst0*new_r10))+(((-1.0)*new_r00*x176))); evalcond[7]=((((-1.0)*x172))+((gconst0*new_r11))+(((-1.0)*new_r01*x176))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; CheckValue<IkReal> x177=IKPowWithIntegerCheck(IKsign(gconst0),-1); if(!x177.valid){ continue; } CheckValue<IkReal> x178 = IKatan2WithCheck(IkReal(new_r10),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x178.valid){ continue; } j2array[0]=((-1.5707963267949)+(((1.5707963267949)*(x177.value)))+(x178.value)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x179=IKcos(j2); IkReal x180=IKsin(j2); IkReal x181=((1.0)*gconst0); if((((1.0)+(((-1.0)*gconst0*x181)))) < -0.00001) continue; IkReal x182=IKsqrt(((1.0)+(((-1.0)*gconst0*x181)))); IkReal x183=((1.0)*x182); evalcond[0]=x180; evalcond[1]=((-1.0)*x179); evalcond[2]=(new_r11+(((-1.0)*x179*x181))); evalcond[3]=((((-1.0)*x180*x181))+new_r10); evalcond[4]=(((x179*x182))+new_r01); evalcond[5]=(((x180*x182))+new_r00); evalcond[6]=((((-1.0)*x180))+((gconst0*new_r10))+(((-1.0)*new_r00*x183))); evalcond[7]=((((-1.0)*x179))+(((-1.0)*new_r01*x183))+((gconst0*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { CheckValue<IkReal> x184=IKPowWithIntegerCheck(((1.0)+(((-1.0)*(new_r22*new_r22)))),-1); if(!x184.valid){ continue; } if((x184.value) < -0.00001) continue; IkReal gconst0=((-1.0)*(IKsqrt(x184.value))); evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.0)+(IKsign(sj0)))))+(IKabs((cj0+(((-1.0)*gconst0)))))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; if((((1.0)+(((-1.0)*(gconst0*gconst0))))) < -0.00001) continue; sj0=((-1.0)*(IKsqrt(((1.0)+(((-1.0)*(gconst0*gconst0))))))); cj0=gconst0; if( (gconst0) < -1-IKFAST_SINCOS_THRESH || (gconst0) > 1+IKFAST_SINCOS_THRESH ) continue; j0=((-1.0)*(IKacos(gconst0))); CheckValue<IkReal> x185=IKPowWithIntegerCheck(((1.0)+(((-1.0)*(new_r22*new_r22)))),-1); if(!x185.valid){ continue; } if((x185.value) < -0.00001) continue; IkReal gconst0=((-1.0)*(IKsqrt(x185.value))); j2eval[0]=((IKabs(new_r11))+(IKabs(new_r10))); if( IKabs(j2eval[0]) < 0.0000010000000000 ) { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if((((1.0)+(((-1.0)*(gconst0*gconst0))))) < -0.00001) continue; CheckValue<IkReal> x186=IKPowWithIntegerCheck(gconst0,-1); if(!x186.valid){ continue; } if( IKabs((((new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst0*gconst0))))))))+((gconst0*new_r10)))) < IKFAST_ATAN2_MAGTHRESH && IKabs((new_r11*(x186.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((((new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst0*gconst0))))))))+((gconst0*new_r10))))+IKsqr((new_r11*(x186.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2((((new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst0*gconst0))))))))+((gconst0*new_r10))), (new_r11*(x186.value))); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x187=IKcos(j2); IkReal x188=IKsin(j2); IkReal x189=((1.0)*x188); IkReal x190=((1.0)*x187); if((((1.0)+(((-1.0)*(gconst0*gconst0))))) < -0.00001) continue; IkReal x191=IKsqrt(((1.0)+(((-1.0)*(gconst0*gconst0))))); evalcond[0]=x188; evalcond[1]=((-1.0)*x187); evalcond[2]=((((-1.0)*gconst0*x190))+new_r11); evalcond[3]=(new_r10+(((-1.0)*gconst0*x189))); evalcond[4]=((((-1.0)*x190*x191))+new_r01); evalcond[5]=((((-1.0)*x189*x191))+new_r00); evalcond[6]=(((new_r00*x191))+(((-1.0)*x189))+((gconst0*new_r10))); evalcond[7]=(((new_r01*x191))+(((-1.0)*x190))+((gconst0*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; CheckValue<IkReal> x192=IKPowWithIntegerCheck(IKsign(gconst0),-1); if(!x192.valid){ continue; } CheckValue<IkReal> x193 = IKatan2WithCheck(IkReal(new_r10),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x193.valid){ continue; } j2array[0]=((-1.5707963267949)+(((1.5707963267949)*(x192.value)))+(x193.value)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x194=IKcos(j2); IkReal x195=IKsin(j2); IkReal x196=((1.0)*x195); IkReal x197=((1.0)*x194); if((((1.0)+(((-1.0)*(gconst0*gconst0))))) < -0.00001) continue; IkReal x198=IKsqrt(((1.0)+(((-1.0)*(gconst0*gconst0))))); evalcond[0]=x195; evalcond[1]=((-1.0)*x194); evalcond[2]=((((-1.0)*gconst0*x197))+new_r11); evalcond[3]=((((-1.0)*gconst0*x196))+new_r10); evalcond[4]=((((-1.0)*x197*x198))+new_r01); evalcond[5]=((((-1.0)*x196*x198))+new_r00); evalcond[6]=(((new_r00*x198))+(((-1.0)*x196))+((gconst0*new_r10))); evalcond[7]=(((new_r01*x198))+(((-1.0)*x197))+((gconst0*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { CheckValue<IkReal> x199=IKPowWithIntegerCheck(((1.0)+(((-1.0)*(new_r22*new_r22)))),-1); if(!x199.valid){ continue; } if((x199.value) < -0.00001) continue; IkReal gconst1=IKsqrt(x199.value); evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs((cj0+(((-1.0)*gconst1)))))+(IKabs(((-1.0)+(IKsign(sj0)))))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; if((((1.0)+(((-1.0)*(gconst1*gconst1))))) < -0.00001) continue; sj0=IKsqrt(((1.0)+(((-1.0)*(gconst1*gconst1))))); cj0=gconst1; if( (gconst1) < -1-IKFAST_SINCOS_THRESH || (gconst1) > 1+IKFAST_SINCOS_THRESH ) continue; j0=IKacos(gconst1); CheckValue<IkReal> x200=IKPowWithIntegerCheck(((1.0)+(((-1.0)*(new_r22*new_r22)))),-1); if(!x200.valid){ continue; } if((x200.value) < -0.00001) continue; IkReal gconst1=IKsqrt(x200.value); j2eval[0]=((IKabs(new_r11))+(IKabs(new_r10))); if( IKabs(j2eval[0]) < 0.0000010000000000 ) { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if((((1.0)+(((-1.0)*(gconst1*gconst1))))) < -0.00001) continue; CheckValue<IkReal> x201=IKPowWithIntegerCheck(gconst1,-1); if(!x201.valid){ continue; } if( IKabs((((gconst1*new_r10))+(((-1.0)*new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst1*gconst1)))))))))) < IKFAST_ATAN2_MAGTHRESH && IKabs((new_r11*(x201.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((((gconst1*new_r10))+(((-1.0)*new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst1*gconst1))))))))))+IKsqr((new_r11*(x201.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2((((gconst1*new_r10))+(((-1.0)*new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst1*gconst1))))))))), (new_r11*(x201.value))); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x202=IKcos(j2); IkReal x203=IKsin(j2); IkReal x204=((1.0)*gconst1); if((((1.0)+(((-1.0)*gconst1*x204)))) < -0.00001) continue; IkReal x205=IKsqrt(((1.0)+(((-1.0)*gconst1*x204)))); IkReal x206=((1.0)*x205); evalcond[0]=x203; evalcond[1]=((-1.0)*x202); evalcond[2]=((((-1.0)*x202*x204))+new_r11); evalcond[3]=((((-1.0)*x203*x204))+new_r10); evalcond[4]=(((x202*x205))+new_r01); evalcond[5]=(((x203*x205))+new_r00); evalcond[6]=((((-1.0)*new_r00*x206))+((gconst1*new_r10))+(((-1.0)*x203))); evalcond[7]=(((gconst1*new_r11))+(((-1.0)*x202))+(((-1.0)*new_r01*x206))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; CheckValue<IkReal> x207=IKPowWithIntegerCheck(IKsign(gconst1),-1); if(!x207.valid){ continue; } CheckValue<IkReal> x208 = IKatan2WithCheck(IkReal(new_r10),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x208.valid){ continue; } j2array[0]=((-1.5707963267949)+(((1.5707963267949)*(x207.value)))+(x208.value)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x209=IKcos(j2); IkReal x210=IKsin(j2); IkReal x211=((1.0)*gconst1); if((((1.0)+(((-1.0)*gconst1*x211)))) < -0.00001) continue; IkReal x212=IKsqrt(((1.0)+(((-1.0)*gconst1*x211)))); IkReal x213=((1.0)*x212); evalcond[0]=x210; evalcond[1]=((-1.0)*x209); evalcond[2]=(new_r11+(((-1.0)*x209*x211))); evalcond[3]=((((-1.0)*x210*x211))+new_r10); evalcond[4]=(((x209*x212))+new_r01); evalcond[5]=(((x210*x212))+new_r00); evalcond[6]=(((gconst1*new_r10))+(((-1.0)*x210))+(((-1.0)*new_r00*x213))); evalcond[7]=(((gconst1*new_r11))+(((-1.0)*new_r01*x213))+(((-1.0)*x209))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { CheckValue<IkReal> x214=IKPowWithIntegerCheck(((1.0)+(((-1.0)*(new_r22*new_r22)))),-1); if(!x214.valid){ continue; } if((x214.value) < -0.00001) continue; IkReal gconst1=IKsqrt(x214.value); evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.0)+(IKsign(sj0)))))+(IKabs((cj0+(((-1.0)*gconst1)))))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; if((((1.0)+(((-1.0)*(gconst1*gconst1))))) < -0.00001) continue; sj0=((-1.0)*(IKsqrt(((1.0)+(((-1.0)*(gconst1*gconst1))))))); cj0=gconst1; if( (gconst1) < -1-IKFAST_SINCOS_THRESH || (gconst1) > 1+IKFAST_SINCOS_THRESH ) continue; j0=((-1.0)*(IKacos(gconst1))); CheckValue<IkReal> x215=IKPowWithIntegerCheck(((1.0)+(((-1.0)*(new_r22*new_r22)))),-1); if(!x215.valid){ continue; } if((x215.value) < -0.00001) continue; IkReal gconst1=IKsqrt(x215.value); j2eval[0]=((IKabs(new_r11))+(IKabs(new_r10))); if( IKabs(j2eval[0]) < 0.0000010000000000 ) { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if((((1.0)+(((-1.0)*(gconst1*gconst1))))) < -0.00001) continue; CheckValue<IkReal> x216=IKPowWithIntegerCheck(gconst1,-1); if(!x216.valid){ continue; } if( IKabs((((gconst1*new_r10))+((new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst1*gconst1)))))))))) < IKFAST_ATAN2_MAGTHRESH && IKabs((new_r11*(x216.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((((gconst1*new_r10))+((new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst1*gconst1))))))))))+IKsqr((new_r11*(x216.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2((((gconst1*new_r10))+((new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst1*gconst1))))))))), (new_r11*(x216.value))); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x217=IKcos(j2); IkReal x218=IKsin(j2); IkReal x219=((1.0)*x217); IkReal x220=((1.0)*x218); if((((1.0)+(((-1.0)*(gconst1*gconst1))))) < -0.00001) continue; IkReal x221=IKsqrt(((1.0)+(((-1.0)*(gconst1*gconst1))))); evalcond[0]=x218; evalcond[1]=((-1.0)*x217); evalcond[2]=((((-1.0)*gconst1*x219))+new_r11); evalcond[3]=((((-1.0)*gconst1*x220))+new_r10); evalcond[4]=((((-1.0)*x219*x221))+new_r01); evalcond[5]=((((-1.0)*x220*x221))+new_r00); evalcond[6]=(((new_r00*x221))+((gconst1*new_r10))+(((-1.0)*x220))); evalcond[7]=(((new_r01*x221))+((gconst1*new_r11))+(((-1.0)*x219))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; CheckValue<IkReal> x222=IKPowWithIntegerCheck(IKsign(gconst1),-1); if(!x222.valid){ continue; } CheckValue<IkReal> x223 = IKatan2WithCheck(IkReal(new_r10),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x223.valid){ continue; } j2array[0]=((-1.5707963267949)+(((1.5707963267949)*(x222.value)))+(x223.value)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x224=IKcos(j2); IkReal x225=IKsin(j2); IkReal x226=((1.0)*x224); IkReal x227=((1.0)*x225); if((((1.0)+(((-1.0)*(gconst1*gconst1))))) < -0.00001) continue; IkReal x228=IKsqrt(((1.0)+(((-1.0)*(gconst1*gconst1))))); evalcond[0]=x225; evalcond[1]=((-1.0)*x224); evalcond[2]=((((-1.0)*gconst1*x226))+new_r11); evalcond[3]=((((-1.0)*gconst1*x227))+new_r10); evalcond[4]=(new_r01+(((-1.0)*x226*x228))); evalcond[5]=((((-1.0)*x227*x228))+new_r00); evalcond[6]=(((new_r00*x228))+((gconst1*new_r10))+(((-1.0)*x227))); evalcond[7]=(((new_r01*x228))+((gconst1*new_r11))+(((-1.0)*x226))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j2] } } while(0); if( bgotonextstatement ) { } } } } } } } } } } } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; IkReal x229=new_r22*new_r22; CheckValue<IkReal> x230=IKPowWithIntegerCheck((((cj0*x229))+(((-1.0)*cj0))),-1); if(!x230.valid){ continue; } CheckValue<IkReal> x231=IKPowWithIntegerCheck(((((-1.0)*sj0))+((sj0*x229))),-1); if(!x231.valid){ continue; } if( IKabs(((x230.value)*(((((-1.0)*new_r01*new_r22))+(((-1.0)*new_r10)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((x231.value)*((((new_r10*new_r22))+new_r01)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((x230.value)*(((((-1.0)*new_r01*new_r22))+(((-1.0)*new_r10))))))+IKsqr(((x231.value)*((((new_r10*new_r22))+new_r01))))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(((x230.value)*(((((-1.0)*new_r01*new_r22))+(((-1.0)*new_r10))))), ((x231.value)*((((new_r10*new_r22))+new_r01)))); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[10]; IkReal x232=IKsin(j2); IkReal x233=IKcos(j2); IkReal x234=(cj0*new_r22); IkReal x235=(new_r22*sj0); IkReal x236=((1.0)*sj0); IkReal x237=((1.0)*x233); IkReal x238=((1.0)*x232); evalcond[0]=(((new_r11*sj0))+((new_r22*x232))+((cj0*new_r01))); evalcond[1]=(((new_r11*x235))+((new_r01*x234))+x232); evalcond[2]=((((-1.0)*x238))+((cj0*new_r10))+(((-1.0)*new_r00*x236))); evalcond[3]=((((-1.0)*x237))+(((-1.0)*new_r01*x236))+((cj0*new_r11))); evalcond[4]=(((sj0*x233))+((x232*x234))+new_r01); evalcond[5]=((((-1.0)*new_r22*x237))+((new_r10*sj0))+((cj0*new_r00))); evalcond[6]=(((sj0*x232))+new_r00+(((-1.0)*x234*x237))); evalcond[7]=(((x232*x235))+(((-1.0)*cj0*x237))+new_r11); evalcond[8]=(((new_r10*x235))+((new_r00*x234))+(((-1.0)*x237))); evalcond[9]=((((-1.0)*x235*x237))+(((-1.0)*cj0*x238))+new_r10); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; IkReal x239=((1.0)*new_r01); CheckValue<IkReal> x240=IKPowWithIntegerCheck(new_r22,-1); if(!x240.valid){ continue; } if( IKabs(((x240.value)*(((((-1.0)*cj0*x239))+(((-1.0)*new_r11*sj0)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs((((cj0*new_r11))+(((-1.0)*sj0*x239)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((x240.value)*(((((-1.0)*cj0*x239))+(((-1.0)*new_r11*sj0))))))+IKsqr((((cj0*new_r11))+(((-1.0)*sj0*x239))))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(((x240.value)*(((((-1.0)*cj0*x239))+(((-1.0)*new_r11*sj0))))), (((cj0*new_r11))+(((-1.0)*sj0*x239)))); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[10]; IkReal x241=IKsin(j2); IkReal x242=IKcos(j2); IkReal x243=(cj0*new_r22); IkReal x244=(new_r22*sj0); IkReal x245=((1.0)*sj0); IkReal x246=((1.0)*x242); IkReal x247=((1.0)*x241); evalcond[0]=(((new_r11*sj0))+((new_r22*x241))+((cj0*new_r01))); evalcond[1]=(x241+((new_r01*x243))+((new_r11*x244))); evalcond[2]=((((-1.0)*new_r00*x245))+(((-1.0)*x247))+((cj0*new_r10))); evalcond[3]=((((-1.0)*new_r01*x245))+(((-1.0)*x246))+((cj0*new_r11))); evalcond[4]=(((x241*x243))+new_r01+((sj0*x242))); evalcond[5]=(((new_r10*sj0))+(((-1.0)*new_r22*x246))+((cj0*new_r00))); evalcond[6]=((((-1.0)*x243*x246))+new_r00+((sj0*x241))); evalcond[7]=(((x241*x244))+(((-1.0)*cj0*x246))+new_r11); evalcond[8]=(((new_r00*x243))+(((-1.0)*x246))+((new_r10*x244))); evalcond[9]=((((-1.0)*cj0*x247))+new_r10+(((-1.0)*x244*x246))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; IkReal x248=cj0*cj0; IkReal x249=(cj0*new_r22); CheckValue<IkReal> x250 = IKatan2WithCheck(IkReal((((new_r00*sj0))+((new_r01*x249)))),IkReal(((((-1.0)*new_r00*x249))+((new_r01*sj0)))),IKFAST_ATAN2_MAGTHRESH); if(!x250.valid){ continue; } CheckValue<IkReal> x251=IKPowWithIntegerCheck(IKsign(((-1.0)+x248+(((-1.0)*x248*(new_r22*new_r22))))),-1); if(!x251.valid){ continue; } j2array[0]=((-1.5707963267949)+(x250.value)+(((1.5707963267949)*(x251.value)))); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[10]; IkReal x252=IKsin(j2); IkReal x253=IKcos(j2); IkReal x254=(cj0*new_r22); IkReal x255=(new_r22*sj0); IkReal x256=((1.0)*sj0); IkReal x257=((1.0)*x253); IkReal x258=((1.0)*x252); evalcond[0]=(((new_r11*sj0))+((new_r22*x252))+((cj0*new_r01))); evalcond[1]=(((new_r01*x254))+x252+((new_r11*x255))); evalcond[2]=(((cj0*new_r10))+(((-1.0)*new_r00*x256))+(((-1.0)*x258))); evalcond[3]=((((-1.0)*new_r01*x256))+((cj0*new_r11))+(((-1.0)*x257))); evalcond[4]=(((sj0*x253))+((x252*x254))+new_r01); evalcond[5]=(((new_r10*sj0))+((cj0*new_r00))+(((-1.0)*new_r22*x257))); evalcond[6]=(((sj0*x252))+(((-1.0)*x254*x257))+new_r00); evalcond[7]=((((-1.0)*cj0*x257))+((x252*x255))+new_r11); evalcond[8]=(((new_r00*x254))+((new_r10*x255))+(((-1.0)*x257))); evalcond[9]=((((-1.0)*cj0*x258))+(((-1.0)*x255*x257))+new_r10); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j0, j2] } } while(0); if( bgotonextstatement ) { } } } } } } else { { IkReal j0array[1], cj0array[1], sj0array[1]; bool j0valid[1]={false}; _nj0 = 1; CheckValue<IkReal> x260=IKPowWithIntegerCheck(sj1,-1); if(!x260.valid){ continue; } IkReal x259=x260.value; CheckValue<IkReal> x261=IKPowWithIntegerCheck(new_r12,-1); if(!x261.valid){ continue; } if( IKabs((x259*(x261.value)*(((1.0)+(((-1.0)*(new_r02*new_r02)))+(((-1.0)*(cj1*cj1))))))) < IKFAST_ATAN2_MAGTHRESH && IKabs((new_r02*x259)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((x259*(x261.value)*(((1.0)+(((-1.0)*(new_r02*new_r02)))+(((-1.0)*(cj1*cj1)))))))+IKsqr((new_r02*x259))-1) <= IKFAST_SINCOS_THRESH ) continue; j0array[0]=IKatan2((x259*(x261.value)*(((1.0)+(((-1.0)*(new_r02*new_r02)))+(((-1.0)*(cj1*cj1)))))), (new_r02*x259)); sj0array[0]=IKsin(j0array[0]); cj0array[0]=IKcos(j0array[0]); if( j0array[0] > IKPI ) { j0array[0]-=IK2PI; } else if( j0array[0] < -IKPI ) { j0array[0]+=IK2PI; } j0valid[0] = true; for(int ij0 = 0; ij0 < 1; ++ij0) { if( !j0valid[ij0] ) { continue; } _ij0[0] = ij0; _ij0[1] = -1; for(int iij0 = ij0+1; iij0 < 1; ++iij0) { if( j0valid[iij0] && IKabs(cj0array[ij0]-cj0array[iij0]) < IKFAST_SOLUTION_THRESH && IKabs(sj0array[ij0]-sj0array[iij0]) < IKFAST_SOLUTION_THRESH ) { j0valid[iij0]=false; _ij0[1] = iij0; break; } } j0 = j0array[ij0]; cj0 = cj0array[ij0]; sj0 = sj0array[ij0]; { IkReal evalcond[8]; IkReal x262=IKcos(j0); IkReal x263=IKsin(j0); IkReal x264=((1.0)*cj1); IkReal x265=((1.0)*sj1); IkReal x266=(new_r12*x263); IkReal x267=(new_r02*x262); evalcond[0]=((((-1.0)*x262*x265))+new_r02); evalcond[1]=((((-1.0)*x263*x265))+new_r12); evalcond[2]=(((new_r12*x262))+(((-1.0)*new_r02*x263))); evalcond[3]=(x267+x266+(((-1.0)*x265))); evalcond[4]=(((cj1*x267))+((cj1*x266))+(((-1.0)*new_r22*x265))); evalcond[5]=((((-1.0)*new_r00*x262*x265))+(((-1.0)*new_r20*x264))+(((-1.0)*new_r10*x263*x265))); evalcond[6]=((((-1.0)*new_r01*x262*x265))+(((-1.0)*new_r11*x263*x265))+(((-1.0)*new_r21*x264))); evalcond[7]=((1.0)+(((-1.0)*new_r22*x264))+(((-1.0)*x265*x266))+(((-1.0)*x265*x267))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { IkReal j2eval[3]; j2eval[0]=sj1; j2eval[1]=IKsign(sj1); j2eval[2]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(j2eval[0]) < 0.0000010000000000 || IKabs(j2eval[1]) < 0.0000010000000000 || IKabs(j2eval[2]) < 0.0000010000000000 ) { { IkReal j2eval[2]; j2eval[0]=sj0; j2eval[1]=sj1; if( IKabs(j2eval[0]) < 0.0000010000000000 || IKabs(j2eval[1]) < 0.0000010000000000 ) { { IkReal j2eval[3]; j2eval[0]=cj0; j2eval[1]=cj1; j2eval[2]=sj1; if( IKabs(j2eval[0]) < 0.0000010000000000 || IKabs(j2eval[1]) < 0.0000010000000000 || IKabs(j2eval[2]) < 0.0000010000000000 ) { { IkReal evalcond[5]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j0)))), 6.28318530717959))); evalcond[1]=new_r02; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2eval[3]; sj0=1.0; cj0=0; j0=1.5707963267949; j2eval[0]=sj1; j2eval[1]=IKsign(sj1); j2eval[2]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(j2eval[0]) < 0.0000010000000000 || IKabs(j2eval[1]) < 0.0000010000000000 || IKabs(j2eval[2]) < 0.0000010000000000 ) { { IkReal j2eval[3]; sj0=1.0; cj0=0; j0=1.5707963267949; j2eval[0]=cj1; j2eval[1]=IKsign(cj1); j2eval[2]=((IKabs(new_r11))+(IKabs(new_r10))); if( IKabs(j2eval[0]) < 0.0000010000000000 || IKabs(j2eval[1]) < 0.0000010000000000 || IKabs(j2eval[2]) < 0.0000010000000000 ) { { IkReal j2eval[1]; sj0=1.0; cj0=0; j0=1.5707963267949; j2eval[0]=sj1; if( IKabs(j2eval[0]) < 0.0000010000000000 ) { { IkReal evalcond[4]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j1))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r12; evalcond[3]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(((-1.0)*new_r11)) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r10) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r11))+IKsqr(new_r10)-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(((-1.0)*new_r11), new_r10); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[4]; IkReal x268=IKsin(j2); IkReal x269=((1.0)*(IKcos(j2))); evalcond[0]=(x268+new_r11); evalcond[1]=(new_r10+(((-1.0)*x269))); evalcond[2]=((((-1.0)*x268))+(((-1.0)*new_r00))); evalcond[3]=((((-1.0)*new_r01))+(((-1.0)*x269))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j1)))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r12; evalcond[3]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(new_r11) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r10)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r11)+IKsqr(((-1.0)*new_r10))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(new_r11, ((-1.0)*new_r10)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[4]; IkReal x270=IKcos(j2); IkReal x271=((1.0)*(IKsin(j2))); evalcond[0]=(x270+new_r10); evalcond[1]=((((-1.0)*x271))+new_r11); evalcond[2]=((((-1.0)*x271))+(((-1.0)*new_r00))); evalcond[3]=((((-1.0)*x270))+(((-1.0)*new_r01))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j1)))), 6.28318530717959))); evalcond[1]=new_r22; evalcond[2]=new_r11; evalcond[3]=new_r10; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(new_r21) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r21)+IKsqr(((-1.0)*new_r20))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(new_r21, ((-1.0)*new_r20)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[4]; IkReal x272=IKcos(j2); IkReal x273=((1.0)*(IKsin(j2))); evalcond[0]=(x272+new_r20); evalcond[1]=((((-1.0)*x273))+new_r21); evalcond[2]=((((-1.0)*x273))+(((-1.0)*new_r00))); evalcond[3]=((((-1.0)*x272))+(((-1.0)*new_r01))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j1)))), 6.28318530717959))); evalcond[1]=new_r22; evalcond[2]=new_r11; evalcond[3]=new_r10; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(((-1.0)*new_r21)) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r20) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r21))+IKsqr(new_r20)-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(((-1.0)*new_r21), new_r20); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[4]; IkReal x274=IKsin(j2); IkReal x275=((1.0)*(IKcos(j2))); evalcond[0]=(x274+new_r21); evalcond[1]=((((-1.0)*x275))+new_r20); evalcond[2]=((((-1.0)*x274))+(((-1.0)*new_r00))); evalcond[3]=((((-1.0)*x275))+(((-1.0)*new_r01))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(((-1.0)*new_r00)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r01)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r00))+IKsqr(((-1.0)*new_r01))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(((-1.0)*new_r00), ((-1.0)*new_r01)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[6]; IkReal x276=IKsin(j2); IkReal x277=IKcos(j2); IkReal x278=((-1.0)*x277); evalcond[0]=x276; evalcond[1]=(new_r22*x276); evalcond[2]=x278; evalcond[3]=(new_r22*x278); evalcond[4]=((((-1.0)*x276))+(((-1.0)*new_r00))); evalcond[5]=((((-1.0)*x277))+(((-1.0)*new_r01))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j2] } } while(0); if( bgotonextstatement ) { } } } } } } } } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; CheckValue<IkReal> x279=IKPowWithIntegerCheck(sj1,-1); if(!x279.valid){ continue; } if( IKabs(((-1.0)*new_r00)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20*(x279.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r00))+IKsqr(((-1.0)*new_r20*(x279.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(((-1.0)*new_r00), ((-1.0)*new_r20*(x279.value))); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x280=IKsin(j2); IkReal x281=IKcos(j2); IkReal x282=((1.0)*sj1); IkReal x283=((1.0)*x281); evalcond[0]=(new_r20+((sj1*x281))); evalcond[1]=(new_r11+((cj1*x280))); evalcond[2]=((((-1.0)*x280*x282))+new_r21); evalcond[3]=((((-1.0)*cj1*x283))+new_r10); evalcond[4]=((((-1.0)*x280))+(((-1.0)*new_r00))); evalcond[5]=((((-1.0)*x283))+(((-1.0)*new_r01))); evalcond[6]=(((cj1*new_r11))+x280+(((-1.0)*new_r21*x282))); evalcond[7]=(((cj1*new_r10))+(((-1.0)*x283))+(((-1.0)*new_r20*x282))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; CheckValue<IkReal> x284=IKPowWithIntegerCheck(IKsign(cj1),-1); if(!x284.valid){ continue; } CheckValue<IkReal> x285 = IKatan2WithCheck(IkReal(((-1.0)*new_r11)),IkReal(new_r10),IKFAST_ATAN2_MAGTHRESH); if(!x285.valid){ continue; } j2array[0]=((-1.5707963267949)+(((1.5707963267949)*(x284.value)))+(x285.value)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x286=IKsin(j2); IkReal x287=IKcos(j2); IkReal x288=((1.0)*sj1); IkReal x289=((1.0)*x287); evalcond[0]=(new_r20+((sj1*x287))); evalcond[1]=(new_r11+((cj1*x286))); evalcond[2]=(new_r21+(((-1.0)*x286*x288))); evalcond[3]=((((-1.0)*cj1*x289))+new_r10); evalcond[4]=((((-1.0)*x286))+(((-1.0)*new_r00))); evalcond[5]=((((-1.0)*x289))+(((-1.0)*new_r01))); evalcond[6]=(((cj1*new_r11))+x286+(((-1.0)*new_r21*x288))); evalcond[7]=(((cj1*new_r10))+(((-1.0)*x289))+(((-1.0)*new_r20*x288))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; CheckValue<IkReal> x290=IKPowWithIntegerCheck(IKsign(sj1),-1); if(!x290.valid){ continue; } CheckValue<IkReal> x291 = IKatan2WithCheck(IkReal(new_r21),IkReal(((-1.0)*new_r20)),IKFAST_ATAN2_MAGTHRESH); if(!x291.valid){ continue; } j2array[0]=((-1.5707963267949)+(((1.5707963267949)*(x290.value)))+(x291.value)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x292=IKsin(j2); IkReal x293=IKcos(j2); IkReal x294=((1.0)*sj1); IkReal x295=((1.0)*x293); evalcond[0]=(((sj1*x293))+new_r20); evalcond[1]=(((cj1*x292))+new_r11); evalcond[2]=(new_r21+(((-1.0)*x292*x294))); evalcond[3]=((((-1.0)*cj1*x295))+new_r10); evalcond[4]=((((-1.0)*x292))+(((-1.0)*new_r00))); evalcond[5]=((((-1.0)*x295))+(((-1.0)*new_r01))); evalcond[6]=((((-1.0)*new_r21*x294))+((cj1*new_r11))+x292); evalcond[7]=((((-1.0)*new_r20*x294))+(((-1.0)*x295))+((cj1*new_r10))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j0)))), 6.28318530717959))); evalcond[1]=new_r02; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(new_r00) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r01) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r00)+IKsqr(new_r01)-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(new_r00, new_r01); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x296=IKcos(j2); IkReal x297=IKsin(j2); IkReal x298=((1.0)*sj1); IkReal x299=((1.0)*new_r11); IkReal x300=((1.0)*new_r10); IkReal x301=((1.0)*x296); evalcond[0]=(((sj1*x296))+new_r20); evalcond[1]=((((-1.0)*x297))+new_r00); evalcond[2]=(new_r01+(((-1.0)*x301))); evalcond[3]=((((-1.0)*x297*x298))+new_r21); evalcond[4]=(((cj1*x297))+(((-1.0)*x299))); evalcond[5]=((((-1.0)*cj1*x301))+(((-1.0)*x300))); evalcond[6]=((((-1.0)*cj1*x299))+(((-1.0)*new_r21*x298))+x297); evalcond[7]=((((-1.0)*new_r20*x298))+(((-1.0)*cj1*x300))+(((-1.0)*x301))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j1)))), 6.28318530717959))); evalcond[1]=new_r22; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(new_r21) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r21)+IKsqr(((-1.0)*new_r20))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(new_r21, ((-1.0)*new_r20)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x302=IKcos(j2); IkReal x303=IKsin(j2); IkReal x304=((1.0)*sj0); IkReal x305=((1.0)*x303); IkReal x306=((1.0)*x302); evalcond[0]=(x302+new_r20); evalcond[1]=(new_r21+(((-1.0)*x305))); evalcond[2]=(((sj0*x302))+new_r01); evalcond[3]=(((sj0*x303))+new_r00); evalcond[4]=((((-1.0)*cj0*x306))+new_r11); evalcond[5]=((((-1.0)*new_r02*x305))+new_r10); evalcond[6]=((((-1.0)*new_r00*x304))+((cj0*new_r10))+(((-1.0)*x305))); evalcond[7]=((((-1.0)*new_r01*x304))+((cj0*new_r11))+(((-1.0)*x306))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j1)))), 6.28318530717959))); evalcond[1]=new_r22; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(((-1.0)*new_r21)) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r20) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r21))+IKsqr(new_r20)-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(((-1.0)*new_r21), new_r20); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x307=IKcos(j2); IkReal x308=IKsin(j2); IkReal x309=((1.0)*sj0); IkReal x310=((1.0)*x307); evalcond[0]=(x308+new_r21); evalcond[1]=((((-1.0)*x310))+new_r20); evalcond[2]=(((sj0*x307))+new_r01); evalcond[3]=(((sj0*x308))+new_r00); evalcond[4]=(((new_r02*x308))+new_r10); evalcond[5]=((((-1.0)*cj0*x310))+new_r11); evalcond[6]=((((-1.0)*x308))+(((-1.0)*new_r00*x309))+((cj0*new_r10))); evalcond[7]=((((-1.0)*x310))+(((-1.0)*new_r01*x309))+((cj0*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j1))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r12; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; IkReal x311=((1.0)*new_r01); if( IKabs(((((-1.0)*cj0*x311))+(((-1.0)*new_r00*sj0)))) < IKFAST_ATAN2_MAGTHRESH && IKabs((((cj0*new_r00))+(((-1.0)*sj0*x311)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*cj0*x311))+(((-1.0)*new_r00*sj0))))+IKsqr((((cj0*new_r00))+(((-1.0)*sj0*x311))))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(((((-1.0)*cj0*x311))+(((-1.0)*new_r00*sj0))), (((cj0*new_r00))+(((-1.0)*sj0*x311)))); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x312=IKsin(j2); IkReal x313=IKcos(j2); IkReal x314=((1.0)*sj0); IkReal x315=((1.0)*x313); IkReal x316=(sj0*x312); IkReal x317=(cj0*x312); IkReal x318=(cj0*x315); evalcond[0]=(((new_r11*sj0))+x312+((cj0*new_r01))); evalcond[1]=(((sj0*x313))+x317+new_r01); evalcond[2]=(((new_r10*sj0))+(((-1.0)*x315))+((cj0*new_r00))); evalcond[3]=((((-1.0)*new_r00*x314))+(((-1.0)*x312))+((cj0*new_r10))); evalcond[4]=((((-1.0)*x315))+((cj0*new_r11))+(((-1.0)*new_r01*x314))); evalcond[5]=(x316+(((-1.0)*x318))+new_r00); evalcond[6]=(x316+(((-1.0)*x318))+new_r11); evalcond[7]=((((-1.0)*x313*x314))+(((-1.0)*x317))+new_r10); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j1)))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r12; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; IkReal x319=((1.0)*sj0); if( IKabs(((((-1.0)*new_r00*x319))+((cj0*new_r01)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((((-1.0)*cj0*new_r00))+(((-1.0)*new_r01*x319)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*new_r00*x319))+((cj0*new_r01))))+IKsqr(((((-1.0)*cj0*new_r00))+(((-1.0)*new_r01*x319))))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(((((-1.0)*new_r00*x319))+((cj0*new_r01))), ((((-1.0)*cj0*new_r00))+(((-1.0)*new_r01*x319)))); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x320=IKsin(j2); IkReal x321=IKcos(j2); IkReal x322=((1.0)*sj0); IkReal x323=((1.0)*x320); IkReal x324=(sj0*x321); IkReal x325=((1.0)*x321); IkReal x326=(cj0*x323); evalcond[0]=(((new_r10*sj0))+x321+((cj0*new_r00))); evalcond[1]=(((new_r11*sj0))+(((-1.0)*x323))+((cj0*new_r01))); evalcond[2]=(((cj0*x321))+((sj0*x320))+new_r00); evalcond[3]=((((-1.0)*x323))+(((-1.0)*new_r00*x322))+((cj0*new_r10))); evalcond[4]=((((-1.0)*x325))+(((-1.0)*new_r01*x322))+((cj0*new_r11))); evalcond[5]=((((-1.0)*x326))+x324+new_r01); evalcond[6]=((((-1.0)*x326))+x324+new_r10); evalcond[7]=((((-1.0)*x320*x322))+(((-1.0)*cj0*x325))+new_r11); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j0))), 6.28318530717959))); evalcond[1]=new_r12; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(new_r10) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r11) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r10)+IKsqr(new_r11)-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(new_r10, new_r11); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x327=IKcos(j2); IkReal x328=IKsin(j2); IkReal x329=((1.0)*sj1); IkReal x330=((1.0)*x327); evalcond[0]=(((sj1*x327))+new_r20); evalcond[1]=((((-1.0)*x328))+new_r10); evalcond[2]=((((-1.0)*x330))+new_r11); evalcond[3]=(((cj1*x328))+new_r01); evalcond[4]=(new_r21+(((-1.0)*x328*x329))); evalcond[5]=(new_r00+(((-1.0)*cj1*x330))); evalcond[6]=(((cj1*new_r01))+x328+(((-1.0)*new_r21*x329))); evalcond[7]=(((cj1*new_r00))+(((-1.0)*x330))+(((-1.0)*new_r20*x329))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j0)))), 6.28318530717959))); evalcond[1]=new_r12; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2eval[3]; sj0=0; cj0=-1.0; j0=3.14159265358979; j2eval[0]=sj1; j2eval[1]=IKsign(sj1); j2eval[2]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(j2eval[0]) < 0.0000010000000000 || IKabs(j2eval[1]) < 0.0000010000000000 || IKabs(j2eval[2]) < 0.0000010000000000 ) { { IkReal j2eval[1]; sj0=0; cj0=-1.0; j0=3.14159265358979; j2eval[0]=sj1; if( IKabs(j2eval[0]) < 0.0000010000000000 ) { { IkReal j2eval[2]; sj0=0; cj0=-1.0; j0=3.14159265358979; j2eval[0]=cj1; j2eval[1]=sj1; if( IKabs(j2eval[0]) < 0.0000010000000000 || IKabs(j2eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[4]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j1)))), 6.28318530717959))); evalcond[1]=new_r22; evalcond[2]=new_r01; evalcond[3]=new_r00; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(new_r21) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r21)+IKsqr(((-1.0)*new_r20))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(new_r21, ((-1.0)*new_r20)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[4]; IkReal x331=IKcos(j2); IkReal x332=((1.0)*(IKsin(j2))); evalcond[0]=(x331+new_r20); evalcond[1]=((((-1.0)*x332))+new_r21); evalcond[2]=((((-1.0)*new_r10))+(((-1.0)*x332))); evalcond[3]=((((-1.0)*x331))+(((-1.0)*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j1)))), 6.28318530717959))); evalcond[1]=new_r22; evalcond[2]=new_r01; evalcond[3]=new_r00; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(((-1.0)*new_r21)) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r20) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r21))+IKsqr(new_r20)-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(((-1.0)*new_r21), new_r20); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[4]; IkReal x333=IKsin(j2); IkReal x334=((1.0)*(IKcos(j2))); evalcond[0]=(x333+new_r21); evalcond[1]=((((-1.0)*x334))+new_r20); evalcond[2]=((((-1.0)*x333))+(((-1.0)*new_r10))); evalcond[3]=((((-1.0)*new_r11))+(((-1.0)*x334))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j1))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(new_r01) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r11)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r01)+IKsqr(((-1.0)*new_r11))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(new_r01, ((-1.0)*new_r11)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[4]; IkReal x335=IKsin(j2); IkReal x336=((1.0)*(IKcos(j2))); evalcond[0]=(x335+(((-1.0)*new_r01))); evalcond[1]=((((-1.0)*x335))+(((-1.0)*new_r10))); evalcond[2]=((((-1.0)*new_r11))+(((-1.0)*x336))); evalcond[3]=((((-1.0)*x336))+(((-1.0)*new_r00))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j1)))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(((-1.0)*new_r10)) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r00) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r10))+IKsqr(new_r00)-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(((-1.0)*new_r10), new_r00); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[4]; IkReal x337=IKcos(j2); IkReal x338=((1.0)*(IKsin(j2))); evalcond[0]=(x337+(((-1.0)*new_r00))); evalcond[1]=((((-1.0)*new_r10))+(((-1.0)*x338))); evalcond[2]=((((-1.0)*x337))+(((-1.0)*new_r11))); evalcond[3]=((((-1.0)*x338))+(((-1.0)*new_r01))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(((-1.0)*new_r10)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r11)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r10))+IKsqr(((-1.0)*new_r11))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(((-1.0)*new_r10), ((-1.0)*new_r11)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[6]; IkReal x339=IKsin(j2); IkReal x340=IKcos(j2); IkReal x341=((-1.0)*x340); evalcond[0]=x339; evalcond[1]=(new_r22*x339); evalcond[2]=x341; evalcond[3]=(new_r22*x341); evalcond[4]=((((-1.0)*x339))+(((-1.0)*new_r10))); evalcond[5]=((((-1.0)*new_r11))+(((-1.0)*x340))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j2] } } while(0); if( bgotonextstatement ) { } } } } } } } } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; CheckValue<IkReal> x342=IKPowWithIntegerCheck(cj1,-1); if(!x342.valid){ continue; } CheckValue<IkReal> x343=IKPowWithIntegerCheck(sj1,-1); if(!x343.valid){ continue; } if( IKabs((new_r01*(x342.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20*(x343.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((new_r01*(x342.value)))+IKsqr(((-1.0)*new_r20*(x343.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2((new_r01*(x342.value)), ((-1.0)*new_r20*(x343.value))); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x344=IKsin(j2); IkReal x345=IKcos(j2); IkReal x346=((1.0)*new_r00); IkReal x347=((1.0)*sj1); IkReal x348=((1.0)*new_r01); IkReal x349=((1.0)*x345); evalcond[0]=(((sj1*x345))+new_r20); evalcond[1]=((((-1.0)*x344*x347))+new_r21); evalcond[2]=((((-1.0)*new_r10))+(((-1.0)*x344))); evalcond[3]=((((-1.0)*new_r11))+(((-1.0)*x349))); evalcond[4]=(((cj1*x344))+(((-1.0)*x348))); evalcond[5]=((((-1.0)*cj1*x349))+(((-1.0)*x346))); evalcond[6]=((((-1.0)*cj1*x348))+x344+(((-1.0)*new_r21*x347))); evalcond[7]=((((-1.0)*cj1*x346))+(((-1.0)*new_r20*x347))+(((-1.0)*x349))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; CheckValue<IkReal> x350=IKPowWithIntegerCheck(sj1,-1); if(!x350.valid){ continue; } if( IKabs((new_r21*(x350.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r11)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((new_r21*(x350.value)))+IKsqr(((-1.0)*new_r11))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2((new_r21*(x350.value)), ((-1.0)*new_r11)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x351=IKsin(j2); IkReal x352=IKcos(j2); IkReal x353=((1.0)*new_r00); IkReal x354=((1.0)*sj1); IkReal x355=((1.0)*new_r01); IkReal x356=((1.0)*x352); evalcond[0]=(((sj1*x352))+new_r20); evalcond[1]=((((-1.0)*x351*x354))+new_r21); evalcond[2]=((((-1.0)*x351))+(((-1.0)*new_r10))); evalcond[3]=((((-1.0)*x356))+(((-1.0)*new_r11))); evalcond[4]=(((cj1*x351))+(((-1.0)*x355))); evalcond[5]=((((-1.0)*x353))+(((-1.0)*cj1*x356))); evalcond[6]=((((-1.0)*cj1*x355))+x351+(((-1.0)*new_r21*x354))); evalcond[7]=((((-1.0)*x356))+(((-1.0)*cj1*x353))+(((-1.0)*new_r20*x354))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; CheckValue<IkReal> x357=IKPowWithIntegerCheck(IKsign(sj1),-1); if(!x357.valid){ continue; } CheckValue<IkReal> x358 = IKatan2WithCheck(IkReal(new_r21),IkReal(((-1.0)*new_r20)),IKFAST_ATAN2_MAGTHRESH); if(!x358.valid){ continue; } j2array[0]=((-1.5707963267949)+(((1.5707963267949)*(x357.value)))+(x358.value)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x359=IKsin(j2); IkReal x360=IKcos(j2); IkReal x361=((1.0)*new_r00); IkReal x362=((1.0)*sj1); IkReal x363=((1.0)*new_r01); IkReal x364=((1.0)*x360); evalcond[0]=(((sj1*x360))+new_r20); evalcond[1]=((((-1.0)*x359*x362))+new_r21); evalcond[2]=((((-1.0)*x359))+(((-1.0)*new_r10))); evalcond[3]=((((-1.0)*x364))+(((-1.0)*new_r11))); evalcond[4]=(((cj1*x359))+(((-1.0)*x363))); evalcond[5]=((((-1.0)*x361))+(((-1.0)*cj1*x364))); evalcond[6]=((((-1.0)*cj1*x363))+x359+(((-1.0)*new_r21*x362))); evalcond[7]=((((-1.0)*new_r20*x362))+(((-1.0)*x364))+(((-1.0)*cj1*x361))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2eval[1]; new_r21=0; new_r20=0; new_r02=0; new_r12=0; j2eval[0]=IKabs(new_r22); if( IKabs(j2eval[0]) < 0.0000000100000000 ) { continue; // no branches [j2] } else { IkReal op[2+1], zeror[2]; int numroots; op[0]=new_r22; op[1]=0; op[2]=((-1.0)*new_r22); polyroots2(op,zeror,numroots); IkReal j2array[2], cj2array[2], sj2array[2], tempj2array[1]; int numsolutions = 0; for(int ij2 = 0; ij2 < numroots; ++ij2) { IkReal htj2 = zeror[ij2]; tempj2array[0]=((2.0)*(atan(htj2))); for(int kj2 = 0; kj2 < 1; ++kj2) { j2array[numsolutions] = tempj2array[kj2]; if( j2array[numsolutions] > IKPI ) { j2array[numsolutions]-=IK2PI; } else if( j2array[numsolutions] < -IKPI ) { j2array[numsolutions]+=IK2PI; } sj2array[numsolutions] = IKsin(j2array[numsolutions]); cj2array[numsolutions] = IKcos(j2array[numsolutions]); numsolutions++; } } bool j2valid[2]={true,true}; _nj2 = 2; for(int ij2 = 0; ij2 < numsolutions; ++ij2) { if( !j2valid[ij2] ) { continue; } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; htj2 = IKtan(j2/2); _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < numsolutions; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j2] } } while(0); if( bgotonextstatement ) { } } } } } } } } } } } } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; CheckValue<IkReal> x366=IKPowWithIntegerCheck(sj1,-1); if(!x366.valid){ continue; } IkReal x365=x366.value; CheckValue<IkReal> x367=IKPowWithIntegerCheck(cj0,-1); if(!x367.valid){ continue; } CheckValue<IkReal> x368=IKPowWithIntegerCheck(cj1,-1); if(!x368.valid){ continue; } if( IKabs((x365*(x367.value)*(x368.value)*((((new_r20*sj0))+(((-1.0)*new_r01*sj1)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20*x365)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((x365*(x367.value)*(x368.value)*((((new_r20*sj0))+(((-1.0)*new_r01*sj1))))))+IKsqr(((-1.0)*new_r20*x365))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2((x365*(x367.value)*(x368.value)*((((new_r20*sj0))+(((-1.0)*new_r01*sj1))))), ((-1.0)*new_r20*x365)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[12]; IkReal x369=IKsin(j2); IkReal x370=IKcos(j2); IkReal x371=((1.0)*sj1); IkReal x372=((1.0)*sj0); IkReal x373=(cj0*new_r00); IkReal x374=(cj0*cj1); IkReal x375=(new_r11*sj0); IkReal x376=(new_r10*sj0); IkReal x377=((1.0)*x370); IkReal x378=(cj1*x369); IkReal x379=((1.0)*x369); evalcond[0]=(((sj1*x370))+new_r20); evalcond[1]=((((-1.0)*x369*x371))+new_r21); evalcond[2]=(x378+x375+((cj0*new_r01))); evalcond[3]=((((-1.0)*new_r00*x372))+(((-1.0)*x379))+((cj0*new_r10))); evalcond[4]=((((-1.0)*x377))+((cj0*new_r11))+(((-1.0)*new_r01*x372))); evalcond[5]=(((x369*x374))+((sj0*x370))+new_r01); evalcond[6]=((((-1.0)*cj1*x377))+x376+x373); evalcond[7]=(((sj0*x369))+(((-1.0)*x374*x377))+new_r00); evalcond[8]=(((sj0*x378))+new_r11+(((-1.0)*cj0*x377))); evalcond[9]=((((-1.0)*cj1*x370*x372))+new_r10+(((-1.0)*cj0*x379))); evalcond[10]=((((-1.0)*new_r21*x371))+((new_r01*x374))+x369+((cj1*x375))); evalcond[11]=((((-1.0)*new_r20*x371))+(((-1.0)*x377))+((cj1*x373))+((cj1*x376))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; CheckValue<IkReal> x381=IKPowWithIntegerCheck(sj1,-1); if(!x381.valid){ continue; } IkReal x380=x381.value; CheckValue<IkReal> x382=IKPowWithIntegerCheck(sj0,-1); if(!x382.valid){ continue; } if( IKabs((x380*(x382.value)*(((((-1.0)*cj0*cj1*new_r20))+(((-1.0)*new_r00*sj1)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20*x380)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((x380*(x382.value)*(((((-1.0)*cj0*cj1*new_r20))+(((-1.0)*new_r00*sj1))))))+IKsqr(((-1.0)*new_r20*x380))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2((x380*(x382.value)*(((((-1.0)*cj0*cj1*new_r20))+(((-1.0)*new_r00*sj1))))), ((-1.0)*new_r20*x380)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[12]; IkReal x383=IKsin(j2); IkReal x384=IKcos(j2); IkReal x385=((1.0)*sj1); IkReal x386=((1.0)*sj0); IkReal x387=(cj0*new_r00); IkReal x388=(cj0*cj1); IkReal x389=(new_r11*sj0); IkReal x390=(new_r10*sj0); IkReal x391=((1.0)*x384); IkReal x392=(cj1*x383); IkReal x393=((1.0)*x383); evalcond[0]=(new_r20+((sj1*x384))); evalcond[1]=(new_r21+(((-1.0)*x383*x385))); evalcond[2]=(x389+x392+((cj0*new_r01))); evalcond[3]=((((-1.0)*x393))+(((-1.0)*new_r00*x386))+((cj0*new_r10))); evalcond[4]=((((-1.0)*x391))+(((-1.0)*new_r01*x386))+((cj0*new_r11))); evalcond[5]=(((x383*x388))+new_r01+((sj0*x384))); evalcond[6]=((((-1.0)*cj1*x391))+x387+x390); evalcond[7]=((((-1.0)*x388*x391))+new_r00+((sj0*x383))); evalcond[8]=((((-1.0)*cj0*x391))+((sj0*x392))+new_r11); evalcond[9]=((((-1.0)*cj0*x393))+(((-1.0)*cj1*x384*x386))+new_r10); evalcond[10]=(((cj1*x389))+((new_r01*x388))+x383+(((-1.0)*new_r21*x385))); evalcond[11]=((((-1.0)*x391))+((cj1*x387))+(((-1.0)*new_r20*x385))+((cj1*x390))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; CheckValue<IkReal> x394=IKPowWithIntegerCheck(IKsign(sj1),-1); if(!x394.valid){ continue; } CheckValue<IkReal> x395 = IKatan2WithCheck(IkReal(new_r21),IkReal(((-1.0)*new_r20)),IKFAST_ATAN2_MAGTHRESH); if(!x395.valid){ continue; } j2array[0]=((-1.5707963267949)+(((1.5707963267949)*(x394.value)))+(x395.value)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[12]; IkReal x396=IKsin(j2); IkReal x397=IKcos(j2); IkReal x398=((1.0)*sj1); IkReal x399=((1.0)*sj0); IkReal x400=(cj0*new_r00); IkReal x401=(cj0*cj1); IkReal x402=(new_r11*sj0); IkReal x403=(new_r10*sj0); IkReal x404=((1.0)*x397); IkReal x405=(cj1*x396); IkReal x406=((1.0)*x396); evalcond[0]=(((sj1*x397))+new_r20); evalcond[1]=((((-1.0)*x396*x398))+new_r21); evalcond[2]=(x402+x405+((cj0*new_r01))); evalcond[3]=((((-1.0)*new_r00*x399))+((cj0*new_r10))+(((-1.0)*x406))); evalcond[4]=((((-1.0)*new_r01*x399))+((cj0*new_r11))+(((-1.0)*x404))); evalcond[5]=(((sj0*x397))+new_r01+((x396*x401))); evalcond[6]=((((-1.0)*cj1*x404))+x400+x403); evalcond[7]=(((sj0*x396))+(((-1.0)*x401*x404))+new_r00); evalcond[8]=(((sj0*x405))+(((-1.0)*cj0*x404))+new_r11); evalcond[9]=((((-1.0)*cj0*x406))+new_r10+(((-1.0)*cj1*x397*x399))); evalcond[10]=((((-1.0)*new_r21*x398))+x396+((cj1*x402))+((new_r01*x401))); evalcond[11]=(((cj1*x400))+((cj1*x403))+(((-1.0)*x404))+(((-1.0)*new_r20*x398))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } } } } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; CheckValue<IkReal> x407=IKPowWithIntegerCheck(IKsign(sj1),-1); if(!x407.valid){ continue; } CheckValue<IkReal> x408 = IKatan2WithCheck(IkReal(new_r21),IkReal(((-1.0)*new_r20)),IKFAST_ATAN2_MAGTHRESH); if(!x408.valid){ continue; } j2array[0]=((-1.5707963267949)+(((1.5707963267949)*(x407.value)))+(x408.value)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[2]; evalcond[0]=(((sj1*(IKcos(j2))))+new_r20); evalcond[1]=((((-1.0)*sj1*(IKsin(j2))))+new_r21); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH ) { continue; } } { IkReal j0eval[3]; j0eval[0]=sj1; j0eval[1]=((IKabs(new_r12))+(IKabs(new_r02))); j0eval[2]=IKsign(sj1); if( IKabs(j0eval[0]) < 0.0000010000000000 || IKabs(j0eval[1]) < 0.0000010000000000 || IKabs(j0eval[2]) < 0.0000010000000000 ) { { IkReal j0eval[2]; j0eval[0]=cj2; j0eval[1]=sj1; if( IKabs(j0eval[0]) < 0.0000010000000000 || IKabs(j0eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[5]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j2)))), 6.28318530717959))); evalcond[1]=new_r20; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j0array[1], cj0array[1], sj0array[1]; bool j0valid[1]={false}; _nj0 = 1; if( IKabs(((-1.0)*new_r00)) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r10) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r00))+IKsqr(new_r10)-1) <= IKFAST_SINCOS_THRESH ) continue; j0array[0]=IKatan2(((-1.0)*new_r00), new_r10); sj0array[0]=IKsin(j0array[0]); cj0array[0]=IKcos(j0array[0]); if( j0array[0] > IKPI ) { j0array[0]-=IK2PI; } else if( j0array[0] < -IKPI ) { j0array[0]+=IK2PI; } j0valid[0] = true; for(int ij0 = 0; ij0 < 1; ++ij0) { if( !j0valid[ij0] ) { continue; } _ij0[0] = ij0; _ij0[1] = -1; for(int iij0 = ij0+1; iij0 < 1; ++iij0) { if( j0valid[iij0] && IKabs(cj0array[ij0]-cj0array[iij0]) < IKFAST_SOLUTION_THRESH && IKabs(sj0array[ij0]-sj0array[iij0]) < IKFAST_SOLUTION_THRESH ) { j0valid[iij0]=false; _ij0[1] = iij0; break; } } j0 = j0array[ij0]; cj0 = cj0array[ij0]; sj0 = sj0array[ij0]; { IkReal evalcond[18]; IkReal x409=IKsin(j0); IkReal x410=IKcos(j0); IkReal x411=((1.0)*sj1); IkReal x412=((1.0)*cj1); IkReal x413=(new_r10*x409); IkReal x414=(new_r01*x410); IkReal x415=(new_r00*x410); IkReal x416=((1.0)*x409); IkReal x417=(new_r11*x409); IkReal x418=(new_r12*x409); IkReal x419=(cj1*x410); IkReal x420=(new_r02*x410); evalcond[0]=(x409+new_r00); evalcond[1]=(x419+new_r01); evalcond[2]=(new_r11+((cj1*x409))); evalcond[3]=(new_r10+(((-1.0)*x410))); evalcond[4]=((((-1.0)*x410*x411))+new_r02); evalcond[5]=(new_r12+(((-1.0)*x409*x411))); evalcond[6]=(x413+x415); evalcond[7]=(((new_r12*x410))+(((-1.0)*new_r02*x416))); evalcond[8]=(((new_r11*x410))+(((-1.0)*new_r01*x416))); evalcond[9]=(cj1+x417+x414); evalcond[10]=((-1.0)+((new_r10*x410))+(((-1.0)*new_r00*x416))); evalcond[11]=(((cj1*x415))+((cj1*x413))); evalcond[12]=(x418+x420+(((-1.0)*x411))); evalcond[13]=((((-1.0)*x411*x413))+(((-1.0)*x411*x415))); evalcond[14]=((((-1.0)*new_r22*x411))+((new_r02*x419))+((cj1*x418))); evalcond[15]=((1.0)+(((-1.0)*new_r21*x411))+((cj1*x417))+((cj1*x414))); evalcond[16]=((((-1.0)*new_r21*x412))+(((-1.0)*x411*x414))+(((-1.0)*x411*x417))); evalcond[17]=((1.0)+(((-1.0)*x411*x418))+(((-1.0)*new_r22*x412))+(((-1.0)*x411*x420))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[12]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[13]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[14]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[15]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[16]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[17]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j2)))), 6.28318530717959))); evalcond[1]=new_r20; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j0array[1], cj0array[1], sj0array[1]; bool j0valid[1]={false}; _nj0 = 1; if( IKabs(new_r00) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r10)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r00)+IKsqr(((-1.0)*new_r10))-1) <= IKFAST_SINCOS_THRESH ) continue; j0array[0]=IKatan2(new_r00, ((-1.0)*new_r10)); sj0array[0]=IKsin(j0array[0]); cj0array[0]=IKcos(j0array[0]); if( j0array[0] > IKPI ) { j0array[0]-=IK2PI; } else if( j0array[0] < -IKPI ) { j0array[0]+=IK2PI; } j0valid[0] = true; for(int ij0 = 0; ij0 < 1; ++ij0) { if( !j0valid[ij0] ) { continue; } _ij0[0] = ij0; _ij0[1] = -1; for(int iij0 = ij0+1; iij0 < 1; ++iij0) { if( j0valid[iij0] && IKabs(cj0array[ij0]-cj0array[iij0]) < IKFAST_SOLUTION_THRESH && IKabs(sj0array[ij0]-sj0array[iij0]) < IKFAST_SOLUTION_THRESH ) { j0valid[iij0]=false; _ij0[1] = iij0; break; } } j0 = j0array[ij0]; cj0 = cj0array[ij0]; sj0 = sj0array[ij0]; { IkReal evalcond[18]; IkReal x421=IKcos(j0); IkReal x422=IKsin(j0); IkReal x423=((1.0)*sj1); IkReal x424=((1.0)*cj1); IkReal x425=(new_r10*x422); IkReal x426=(new_r01*x421); IkReal x427=(new_r00*x421); IkReal x428=((1.0)*x422); IkReal x429=(new_r11*x422); IkReal x430=(new_r12*x422); IkReal x431=(new_r02*x421); evalcond[0]=(x421+new_r10); evalcond[1]=((((-1.0)*x428))+new_r00); evalcond[2]=((((-1.0)*x421*x423))+new_r02); evalcond[3]=((((-1.0)*x422*x423))+new_r12); evalcond[4]=((((-1.0)*x421*x424))+new_r01); evalcond[5]=((((-1.0)*x422*x424))+new_r11); evalcond[6]=(x427+x425); evalcond[7]=(((new_r12*x421))+(((-1.0)*new_r02*x428))); evalcond[8]=(((new_r11*x421))+(((-1.0)*new_r01*x428))); evalcond[9]=((1.0)+(((-1.0)*new_r00*x428))+((new_r10*x421))); evalcond[10]=(((cj1*x427))+((cj1*x425))); evalcond[11]=((((-1.0)*x423))+x430+x431); evalcond[12]=((((-1.0)*x424))+x429+x426); evalcond[13]=((((-1.0)*x423*x427))+(((-1.0)*x423*x425))); evalcond[14]=(((cj1*x430))+((cj1*x431))+(((-1.0)*new_r22*x423))); evalcond[15]=((-1.0)+(sj1*sj1)+((cj1*x429))+((cj1*x426))); evalcond[16]=((((-1.0)*x423*x429))+(((-1.0)*x423*x426))+(((-1.0)*new_r21*x424))); evalcond[17]=((1.0)+(((-1.0)*new_r22*x424))+(((-1.0)*x423*x431))+(((-1.0)*x423*x430))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[12]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[13]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[14]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[15]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[16]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[17]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j1))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r12; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j0array[1], cj0array[1], sj0array[1]; bool j0valid[1]={false}; _nj0 = 1; IkReal x432=((1.0)*sj2); if( IKabs(((((-1.0)*new_r00*x432))+(((-1.0)*cj2*new_r01)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((((-1.0)*new_r01*x432))+((cj2*new_r00)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*new_r00*x432))+(((-1.0)*cj2*new_r01))))+IKsqr(((((-1.0)*new_r01*x432))+((cj2*new_r00))))-1) <= IKFAST_SINCOS_THRESH ) continue; j0array[0]=IKatan2(((((-1.0)*new_r00*x432))+(((-1.0)*cj2*new_r01))), ((((-1.0)*new_r01*x432))+((cj2*new_r00)))); sj0array[0]=IKsin(j0array[0]); cj0array[0]=IKcos(j0array[0]); if( j0array[0] > IKPI ) { j0array[0]-=IK2PI; } else if( j0array[0] < -IKPI ) { j0array[0]+=IK2PI; } j0valid[0] = true; for(int ij0 = 0; ij0 < 1; ++ij0) { if( !j0valid[ij0] ) { continue; } _ij0[0] = ij0; _ij0[1] = -1; for(int iij0 = ij0+1; iij0 < 1; ++iij0) { if( j0valid[iij0] && IKabs(cj0array[ij0]-cj0array[iij0]) < IKFAST_SOLUTION_THRESH && IKabs(sj0array[ij0]-sj0array[iij0]) < IKFAST_SOLUTION_THRESH ) { j0valid[iij0]=false; _ij0[1] = iij0; break; } } j0 = j0array[ij0]; cj0 = cj0array[ij0]; sj0 = sj0array[ij0]; { IkReal evalcond[8]; IkReal x433=IKcos(j0); IkReal x434=IKsin(j0); IkReal x435=((1.0)*cj2); IkReal x436=((1.0)*sj2); IkReal x437=(sj2*x434); IkReal x438=((1.0)*x434); IkReal x439=(x433*x435); evalcond[0]=(((new_r01*x433))+sj2+((new_r11*x434))); evalcond[1]=(((sj2*x433))+((cj2*x434))+new_r01); evalcond[2]=((((-1.0)*x439))+x437+new_r00); evalcond[3]=((((-1.0)*x439))+x437+new_r11); evalcond[4]=((((-1.0)*x435))+((new_r00*x433))+((new_r10*x434))); evalcond[5]=((((-1.0)*x433*x436))+(((-1.0)*x434*x435))+new_r10); evalcond[6]=((((-1.0)*new_r00*x438))+(((-1.0)*x436))+((new_r10*x433))); evalcond[7]=((((-1.0)*x435))+(((-1.0)*new_r01*x438))+((new_r11*x433))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j1)))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r12; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j0array[1], cj0array[1], sj0array[1]; bool j0valid[1]={false}; _nj0 = 1; IkReal x440=((1.0)*new_r00); if( IKabs(((((-1.0)*sj2*x440))+(((-1.0)*cj2*new_r01)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((((-1.0)*cj2*x440))+((new_r01*sj2)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*sj2*x440))+(((-1.0)*cj2*new_r01))))+IKsqr(((((-1.0)*cj2*x440))+((new_r01*sj2))))-1) <= IKFAST_SINCOS_THRESH ) continue; j0array[0]=IKatan2(((((-1.0)*sj2*x440))+(((-1.0)*cj2*new_r01))), ((((-1.0)*cj2*x440))+((new_r01*sj2)))); sj0array[0]=IKsin(j0array[0]); cj0array[0]=IKcos(j0array[0]); if( j0array[0] > IKPI ) { j0array[0]-=IK2PI; } else if( j0array[0] < -IKPI ) { j0array[0]+=IK2PI; } j0valid[0] = true; for(int ij0 = 0; ij0 < 1; ++ij0) { if( !j0valid[ij0] ) { continue; } _ij0[0] = ij0; _ij0[1] = -1; for(int iij0 = ij0+1; iij0 < 1; ++iij0) { if( j0valid[iij0] && IKabs(cj0array[ij0]-cj0array[iij0]) < IKFAST_SOLUTION_THRESH && IKabs(sj0array[ij0]-sj0array[iij0]) < IKFAST_SOLUTION_THRESH ) { j0valid[iij0]=false; _ij0[1] = iij0; break; } } j0 = j0array[ij0]; cj0 = cj0array[ij0]; sj0 = sj0array[ij0]; { IkReal evalcond[8]; IkReal x441=IKcos(j0); IkReal x442=IKsin(j0); IkReal x443=((1.0)*sj2); IkReal x444=(cj2*x442); IkReal x445=(sj2*x442); IkReal x446=((1.0)*x441); IkReal x447=((1.0)*x442); IkReal x448=(x441*x443); evalcond[0]=(((new_r00*x441))+cj2+((new_r10*x442))); evalcond[1]=(x445+((cj2*x441))+new_r00); evalcond[2]=((((-1.0)*x448))+x444+new_r01); evalcond[3]=((((-1.0)*x448))+x444+new_r10); evalcond[4]=((((-1.0)*x443))+((new_r01*x441))+((new_r11*x442))); evalcond[5]=((((-1.0)*cj2*x446))+new_r11+(((-1.0)*x442*x443))); evalcond[6]=((((-1.0)*x443))+(((-1.0)*new_r00*x447))+((new_r10*x441))); evalcond[7]=((((-1.0)*new_r01*x447))+((new_r11*x441))+(((-1.0)*cj2))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r12))+(IKabs(new_r02))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j0eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; j0eval[0]=((IKabs(new_r11))+(IKabs(new_r01))); if( IKabs(j0eval[0]) < 0.0000010000000000 ) { { IkReal j0eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; j0eval[0]=((IKabs(new_r10))+(IKabs(new_r00))); if( IKabs(j0eval[0]) < 0.0000010000000000 ) { { IkReal j0eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; j0eval[0]=((IKabs((new_r11*new_r22)))+(IKabs((new_r01*new_r22)))); if( IKabs(j0eval[0]) < 0.0000010000000000 ) { continue; // no branches [j0] } else { { IkReal j0array[2], cj0array[2], sj0array[2]; bool j0valid[2]={false}; _nj0 = 2; CheckValue<IkReal> x450 = IKatan2WithCheck(IkReal((new_r01*new_r22)),IkReal((new_r11*new_r22)),IKFAST_ATAN2_MAGTHRESH); if(!x450.valid){ continue; } IkReal x449=x450.value; j0array[0]=((-1.0)*x449); sj0array[0]=IKsin(j0array[0]); cj0array[0]=IKcos(j0array[0]); j0array[1]=((3.14159265358979)+(((-1.0)*x449))); sj0array[1]=IKsin(j0array[1]); cj0array[1]=IKcos(j0array[1]); if( j0array[0] > IKPI ) { j0array[0]-=IK2PI; } else if( j0array[0] < -IKPI ) { j0array[0]+=IK2PI; } j0valid[0] = true; if( j0array[1] > IKPI ) { j0array[1]-=IK2PI; } else if( j0array[1] < -IKPI ) { j0array[1]+=IK2PI; } j0valid[1] = true; for(int ij0 = 0; ij0 < 2; ++ij0) { if( !j0valid[ij0] ) { continue; } _ij0[0] = ij0; _ij0[1] = -1; for(int iij0 = ij0+1; iij0 < 2; ++iij0) { if( j0valid[iij0] && IKabs(cj0array[ij0]-cj0array[iij0]) < IKFAST_SOLUTION_THRESH && IKabs(sj0array[ij0]-sj0array[iij0]) < IKFAST_SOLUTION_THRESH ) { j0valid[iij0]=false; _ij0[1] = iij0; break; } } j0 = j0array[ij0]; cj0 = cj0array[ij0]; sj0 = sj0array[ij0]; { IkReal evalcond[5]; IkReal x451=IKcos(j0); IkReal x452=IKsin(j0); IkReal x453=(new_r10*x452); IkReal x454=((1.0)*x452); IkReal x455=(new_r00*x451); evalcond[0]=(((new_r11*x452))+((new_r01*x451))); evalcond[1]=(x455+x453); evalcond[2]=(((new_r10*x451))+(((-1.0)*new_r00*x454))); evalcond[3]=(((new_r11*x451))+(((-1.0)*new_r01*x454))); evalcond[4]=(((new_r22*x453))+((new_r22*x455))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j0array[2], cj0array[2], sj0array[2]; bool j0valid[2]={false}; _nj0 = 2; CheckValue<IkReal> x457 = IKatan2WithCheck(IkReal(new_r00),IkReal(new_r10),IKFAST_ATAN2_MAGTHRESH); if(!x457.valid){ continue; } IkReal x456=x457.value; j0array[0]=((-1.0)*x456); sj0array[0]=IKsin(j0array[0]); cj0array[0]=IKcos(j0array[0]); j0array[1]=((3.14159265358979)+(((-1.0)*x456))); sj0array[1]=IKsin(j0array[1]); cj0array[1]=IKcos(j0array[1]); if( j0array[0] > IKPI ) { j0array[0]-=IK2PI; } else if( j0array[0] < -IKPI ) { j0array[0]+=IK2PI; } j0valid[0] = true; if( j0array[1] > IKPI ) { j0array[1]-=IK2PI; } else if( j0array[1] < -IKPI ) { j0array[1]+=IK2PI; } j0valid[1] = true; for(int ij0 = 0; ij0 < 2; ++ij0) { if( !j0valid[ij0] ) { continue; } _ij0[0] = ij0; _ij0[1] = -1; for(int iij0 = ij0+1; iij0 < 2; ++iij0) { if( j0valid[iij0] && IKabs(cj0array[ij0]-cj0array[iij0]) < IKFAST_SOLUTION_THRESH && IKabs(sj0array[ij0]-sj0array[iij0]) < IKFAST_SOLUTION_THRESH ) { j0valid[iij0]=false; _ij0[1] = iij0; break; } } j0 = j0array[ij0]; cj0 = cj0array[ij0]; sj0 = sj0array[ij0]; { IkReal evalcond[5]; IkReal x458=IKcos(j0); IkReal x459=IKsin(j0); IkReal x460=((1.0)*x459); IkReal x461=(new_r11*x459); IkReal x462=(new_r22*x458); evalcond[0]=(((new_r01*x458))+x461); evalcond[1]=(((new_r10*x458))+(((-1.0)*new_r00*x460))); evalcond[2]=(((new_r11*x458))+(((-1.0)*new_r01*x460))); evalcond[3]=(((new_r01*x462))+((new_r22*x461))); evalcond[4]=(((new_r10*new_r22*x459))+((new_r00*x462))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j0array[2], cj0array[2], sj0array[2]; bool j0valid[2]={false}; _nj0 = 2; CheckValue<IkReal> x464 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x464.valid){ continue; } IkReal x463=x464.value; j0array[0]=((-1.0)*x463); sj0array[0]=IKsin(j0array[0]); cj0array[0]=IKcos(j0array[0]); j0array[1]=((3.14159265358979)+(((-1.0)*x463))); sj0array[1]=IKsin(j0array[1]); cj0array[1]=IKcos(j0array[1]); if( j0array[0] > IKPI ) { j0array[0]-=IK2PI; } else if( j0array[0] < -IKPI ) { j0array[0]+=IK2PI; } j0valid[0] = true; if( j0array[1] > IKPI ) { j0array[1]-=IK2PI; } else if( j0array[1] < -IKPI ) { j0array[1]+=IK2PI; } j0valid[1] = true; for(int ij0 = 0; ij0 < 2; ++ij0) { if( !j0valid[ij0] ) { continue; } _ij0[0] = ij0; _ij0[1] = -1; for(int iij0 = ij0+1; iij0 < 2; ++iij0) { if( j0valid[iij0] && IKabs(cj0array[ij0]-cj0array[iij0]) < IKFAST_SOLUTION_THRESH && IKabs(sj0array[ij0]-sj0array[iij0]) < IKFAST_SOLUTION_THRESH ) { j0valid[iij0]=false; _ij0[1] = iij0; break; } } j0 = j0array[ij0]; cj0 = cj0array[ij0]; sj0 = sj0array[ij0]; { IkReal evalcond[5]; IkReal x465=IKcos(j0); IkReal x466=IKsin(j0); IkReal x467=(new_r10*x466); IkReal x468=((1.0)*x466); IkReal x469=(new_r00*x465); evalcond[0]=(x469+x467); evalcond[1]=(((new_r10*x465))+(((-1.0)*new_r00*x468))); evalcond[2]=(((new_r11*x465))+(((-1.0)*new_r01*x468))); evalcond[3]=(((new_r11*new_r22*x466))+((new_r01*new_r22*x465))); evalcond[4]=(((new_r22*x467))+((new_r22*x469))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j0] } } while(0); if( bgotonextstatement ) { } } } } } } } } else { { IkReal j0array[1], cj0array[1], sj0array[1]; bool j0valid[1]={false}; _nj0 = 1; CheckValue<IkReal> x471=IKPowWithIntegerCheck(sj1,-1); if(!x471.valid){ continue; } IkReal x470=x471.value; CheckValue<IkReal> x472=IKPowWithIntegerCheck(cj2,-1); if(!x472.valid){ continue; } if( IKabs((x470*(x472.value)*(((((-1.0)*new_r01*sj1))+(((-1.0)*cj1*new_r02*sj2)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs((new_r02*x470)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((x470*(x472.value)*(((((-1.0)*new_r01*sj1))+(((-1.0)*cj1*new_r02*sj2))))))+IKsqr((new_r02*x470))-1) <= IKFAST_SINCOS_THRESH ) continue; j0array[0]=IKatan2((x470*(x472.value)*(((((-1.0)*new_r01*sj1))+(((-1.0)*cj1*new_r02*sj2))))), (new_r02*x470)); sj0array[0]=IKsin(j0array[0]); cj0array[0]=IKcos(j0array[0]); if( j0array[0] > IKPI ) { j0array[0]-=IK2PI; } else if( j0array[0] < -IKPI ) { j0array[0]+=IK2PI; } j0valid[0] = true; for(int ij0 = 0; ij0 < 1; ++ij0) { if( !j0valid[ij0] ) { continue; } _ij0[0] = ij0; _ij0[1] = -1; for(int iij0 = ij0+1; iij0 < 1; ++iij0) { if( j0valid[iij0] && IKabs(cj0array[ij0]-cj0array[iij0]) < IKFAST_SOLUTION_THRESH && IKabs(sj0array[ij0]-sj0array[iij0]) < IKFAST_SOLUTION_THRESH ) { j0valid[iij0]=false; _ij0[1] = iij0; break; } } j0 = j0array[ij0]; cj0 = cj0array[ij0]; sj0 = sj0array[ij0]; { IkReal evalcond[18]; IkReal x473=IKcos(j0); IkReal x474=IKsin(j0); IkReal x475=((1.0)*cj2); IkReal x476=((1.0)*sj1); IkReal x477=((1.0)*cj1); IkReal x478=((1.0)*sj2); IkReal x479=(new_r10*x474); IkReal x480=(new_r01*x473); IkReal x481=(new_r00*x473); IkReal x482=((1.0)*x474); IkReal x483=(new_r11*x474); IkReal x484=(new_r12*x474); IkReal x485=(sj2*x474); IkReal x486=(cj1*x473); IkReal x487=(cj2*x474); IkReal x488=(new_r02*x473); evalcond[0]=((((-1.0)*x473*x476))+new_r02); evalcond[1]=(new_r12+(((-1.0)*x474*x476))); evalcond[2]=(((new_r12*x473))+(((-1.0)*new_r02*x482))); evalcond[3]=(x487+((sj2*x486))+new_r01); evalcond[4]=((((-1.0)*x476))+x488+x484); evalcond[5]=(((cj1*sj2))+x480+x483); evalcond[6]=((((-1.0)*x475*x486))+x485+new_r00); evalcond[7]=((((-1.0)*x473*x475))+((cj1*x485))+new_r11); evalcond[8]=((((-1.0)*new_r00*x482))+((new_r10*x473))+(((-1.0)*x478))); evalcond[9]=((((-1.0)*new_r01*x482))+((new_r11*x473))+(((-1.0)*x475))); evalcond[10]=((((-1.0)*cj1*x475))+x481+x479); evalcond[11]=((((-1.0)*cj1*x474*x475))+(((-1.0)*x473*x478))+new_r10); evalcond[12]=(((new_r02*x486))+(((-1.0)*new_r22*x476))+((cj1*x484))); evalcond[13]=(sj2+(((-1.0)*new_r21*x476))+((cj1*x480))+((cj1*x483))); evalcond[14]=((((-1.0)*x476*x481))+(((-1.0)*x476*x479))+(((-1.0)*new_r20*x477))); evalcond[15]=((((-1.0)*x476*x480))+(((-1.0)*x476*x483))+(((-1.0)*new_r21*x477))); evalcond[16]=((1.0)+(((-1.0)*x476*x484))+(((-1.0)*x476*x488))+(((-1.0)*new_r22*x477))); evalcond[17]=((((-1.0)*x475))+((cj1*x479))+((cj1*x481))+(((-1.0)*new_r20*x476))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[12]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[13]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[14]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[15]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[16]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[17]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j0array[1], cj0array[1], sj0array[1]; bool j0valid[1]={false}; _nj0 = 1; CheckValue<IkReal> x489=IKPowWithIntegerCheck(IKsign(sj1),-1); if(!x489.valid){ continue; } CheckValue<IkReal> x490 = IKatan2WithCheck(IkReal(new_r12),IkReal(new_r02),IKFAST_ATAN2_MAGTHRESH); if(!x490.valid){ continue; } j0array[0]=((-1.5707963267949)+(((1.5707963267949)*(x489.value)))+(x490.value)); sj0array[0]=IKsin(j0array[0]); cj0array[0]=IKcos(j0array[0]); if( j0array[0] > IKPI ) { j0array[0]-=IK2PI; } else if( j0array[0] < -IKPI ) { j0array[0]+=IK2PI; } j0valid[0] = true; for(int ij0 = 0; ij0 < 1; ++ij0) { if( !j0valid[ij0] ) { continue; } _ij0[0] = ij0; _ij0[1] = -1; for(int iij0 = ij0+1; iij0 < 1; ++iij0) { if( j0valid[iij0] && IKabs(cj0array[ij0]-cj0array[iij0]) < IKFAST_SOLUTION_THRESH && IKabs(sj0array[ij0]-sj0array[iij0]) < IKFAST_SOLUTION_THRESH ) { j0valid[iij0]=false; _ij0[1] = iij0; break; } } j0 = j0array[ij0]; cj0 = cj0array[ij0]; sj0 = sj0array[ij0]; { IkReal evalcond[18]; IkReal x491=IKcos(j0); IkReal x492=IKsin(j0); IkReal x493=((1.0)*cj2); IkReal x494=((1.0)*sj1); IkReal x495=((1.0)*cj1); IkReal x496=((1.0)*sj2); IkReal x497=(new_r10*x492); IkReal x498=(new_r01*x491); IkReal x499=(new_r00*x491); IkReal x500=((1.0)*x492); IkReal x501=(new_r11*x492); IkReal x502=(new_r12*x492); IkReal x503=(sj2*x492); IkReal x504=(cj1*x491); IkReal x505=(cj2*x492); IkReal x506=(new_r02*x491); evalcond[0]=((((-1.0)*x491*x494))+new_r02); evalcond[1]=(new_r12+(((-1.0)*x492*x494))); evalcond[2]=((((-1.0)*new_r02*x500))+((new_r12*x491))); evalcond[3]=(((sj2*x504))+x505+new_r01); evalcond[4]=((((-1.0)*x494))+x502+x506); evalcond[5]=(((cj1*sj2))+x498+x501); evalcond[6]=(x503+(((-1.0)*x493*x504))+new_r00); evalcond[7]=(((cj1*x503))+(((-1.0)*x491*x493))+new_r11); evalcond[8]=((((-1.0)*x496))+(((-1.0)*new_r00*x500))+((new_r10*x491))); evalcond[9]=((((-1.0)*new_r01*x500))+(((-1.0)*x493))+((new_r11*x491))); evalcond[10]=((((-1.0)*cj1*x493))+x499+x497); evalcond[11]=((((-1.0)*x491*x496))+(((-1.0)*cj1*x492*x493))+new_r10); evalcond[12]=(((cj1*x502))+((new_r02*x504))+(((-1.0)*new_r22*x494))); evalcond[13]=(sj2+((cj1*x501))+(((-1.0)*new_r21*x494))+((cj1*x498))); evalcond[14]=((((-1.0)*new_r20*x495))+(((-1.0)*x494*x499))+(((-1.0)*x494*x497))); evalcond[15]=((((-1.0)*x494*x498))+(((-1.0)*new_r21*x495))+(((-1.0)*x494*x501))); evalcond[16]=((1.0)+(((-1.0)*x494*x502))+(((-1.0)*x494*x506))+(((-1.0)*new_r22*x495))); evalcond[17]=((((-1.0)*new_r20*x494))+(((-1.0)*x493))+((cj1*x499))+((cj1*x497))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[12]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[13]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[14]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[15]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[16]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[17]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } } } } else { { IkReal j0array[1], cj0array[1], sj0array[1]; bool j0valid[1]={false}; _nj0 = 1; CheckValue<IkReal> x507=IKPowWithIntegerCheck(IKsign(sj1),-1); if(!x507.valid){ continue; } CheckValue<IkReal> x508 = IKatan2WithCheck(IkReal(new_r12),IkReal(new_r02),IKFAST_ATAN2_MAGTHRESH); if(!x508.valid){ continue; } j0array[0]=((-1.5707963267949)+(((1.5707963267949)*(x507.value)))+(x508.value)); sj0array[0]=IKsin(j0array[0]); cj0array[0]=IKcos(j0array[0]); if( j0array[0] > IKPI ) { j0array[0]-=IK2PI; } else if( j0array[0] < -IKPI ) { j0array[0]+=IK2PI; } j0valid[0] = true; for(int ij0 = 0; ij0 < 1; ++ij0) { if( !j0valid[ij0] ) { continue; } _ij0[0] = ij0; _ij0[1] = -1; for(int iij0 = ij0+1; iij0 < 1; ++iij0) { if( j0valid[iij0] && IKabs(cj0array[ij0]-cj0array[iij0]) < IKFAST_SOLUTION_THRESH && IKabs(sj0array[ij0]-sj0array[iij0]) < IKFAST_SOLUTION_THRESH ) { j0valid[iij0]=false; _ij0[1] = iij0; break; } } j0 = j0array[ij0]; cj0 = cj0array[ij0]; sj0 = sj0array[ij0]; { IkReal evalcond[8]; IkReal x509=IKcos(j0); IkReal x510=IKsin(j0); IkReal x511=((1.0)*cj1); IkReal x512=((1.0)*sj1); IkReal x513=(new_r12*x510); IkReal x514=(new_r02*x509); evalcond[0]=(new_r02+(((-1.0)*x509*x512))); evalcond[1]=(new_r12+(((-1.0)*x510*x512))); evalcond[2]=(((new_r12*x509))+(((-1.0)*new_r02*x510))); evalcond[3]=(x514+x513+(((-1.0)*x512))); evalcond[4]=((((-1.0)*new_r22*x512))+((cj1*x514))+((cj1*x513))); evalcond[5]=((((-1.0)*new_r20*x511))+(((-1.0)*new_r00*x509*x512))+(((-1.0)*new_r10*x510*x512))); evalcond[6]=((((-1.0)*new_r11*x510*x512))+(((-1.0)*new_r21*x511))+(((-1.0)*new_r01*x509*x512))); evalcond[7]=((1.0)+(((-1.0)*new_r22*x511))+(((-1.0)*x512*x514))+(((-1.0)*x512*x513))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { IkReal j2eval[3]; j2eval[0]=sj1; j2eval[1]=IKsign(sj1); j2eval[2]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(j2eval[0]) < 0.0000010000000000 || IKabs(j2eval[1]) < 0.0000010000000000 || IKabs(j2eval[2]) < 0.0000010000000000 ) { { IkReal j2eval[2]; j2eval[0]=sj0; j2eval[1]=sj1; if( IKabs(j2eval[0]) < 0.0000010000000000 || IKabs(j2eval[1]) < 0.0000010000000000 ) { { IkReal j2eval[3]; j2eval[0]=cj0; j2eval[1]=cj1; j2eval[2]=sj1; if( IKabs(j2eval[0]) < 0.0000010000000000 || IKabs(j2eval[1]) < 0.0000010000000000 || IKabs(j2eval[2]) < 0.0000010000000000 ) { { IkReal evalcond[5]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j0)))), 6.28318530717959))); evalcond[1]=new_r02; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2eval[3]; sj0=1.0; cj0=0; j0=1.5707963267949; j2eval[0]=sj1; j2eval[1]=IKsign(sj1); j2eval[2]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(j2eval[0]) < 0.0000010000000000 || IKabs(j2eval[1]) < 0.0000010000000000 || IKabs(j2eval[2]) < 0.0000010000000000 ) { { IkReal j2eval[3]; sj0=1.0; cj0=0; j0=1.5707963267949; j2eval[0]=cj1; j2eval[1]=IKsign(cj1); j2eval[2]=((IKabs(new_r11))+(IKabs(new_r10))); if( IKabs(j2eval[0]) < 0.0000010000000000 || IKabs(j2eval[1]) < 0.0000010000000000 || IKabs(j2eval[2]) < 0.0000010000000000 ) { { IkReal j2eval[1]; sj0=1.0; cj0=0; j0=1.5707963267949; j2eval[0]=sj1; if( IKabs(j2eval[0]) < 0.0000010000000000 ) { { IkReal evalcond[4]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j1))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r12; evalcond[3]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(((-1.0)*new_r11)) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r10) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r11))+IKsqr(new_r10)-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(((-1.0)*new_r11), new_r10); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[4]; IkReal x515=IKsin(j2); IkReal x516=((1.0)*(IKcos(j2))); evalcond[0]=(x515+new_r11); evalcond[1]=(new_r10+(((-1.0)*x516))); evalcond[2]=((((-1.0)*x515))+(((-1.0)*new_r00))); evalcond[3]=((((-1.0)*new_r01))+(((-1.0)*x516))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j1)))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r12; evalcond[3]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(new_r11) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r10)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r11)+IKsqr(((-1.0)*new_r10))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(new_r11, ((-1.0)*new_r10)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[4]; IkReal x517=IKcos(j2); IkReal x518=((1.0)*(IKsin(j2))); evalcond[0]=(x517+new_r10); evalcond[1]=(new_r11+(((-1.0)*x518))); evalcond[2]=((((-1.0)*new_r00))+(((-1.0)*x518))); evalcond[3]=((((-1.0)*x517))+(((-1.0)*new_r01))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j1)))), 6.28318530717959))); evalcond[1]=new_r22; evalcond[2]=new_r11; evalcond[3]=new_r10; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(new_r21) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r21)+IKsqr(((-1.0)*new_r20))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(new_r21, ((-1.0)*new_r20)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[4]; IkReal x519=IKcos(j2); IkReal x520=((1.0)*(IKsin(j2))); evalcond[0]=(x519+new_r20); evalcond[1]=((((-1.0)*x520))+new_r21); evalcond[2]=((((-1.0)*x520))+(((-1.0)*new_r00))); evalcond[3]=((((-1.0)*x519))+(((-1.0)*new_r01))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j1)))), 6.28318530717959))); evalcond[1]=new_r22; evalcond[2]=new_r11; evalcond[3]=new_r10; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(((-1.0)*new_r21)) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r20) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r21))+IKsqr(new_r20)-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(((-1.0)*new_r21), new_r20); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[4]; IkReal x521=IKsin(j2); IkReal x522=((1.0)*(IKcos(j2))); evalcond[0]=(x521+new_r21); evalcond[1]=((((-1.0)*x522))+new_r20); evalcond[2]=((((-1.0)*x521))+(((-1.0)*new_r00))); evalcond[3]=((((-1.0)*x522))+(((-1.0)*new_r01))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(((-1.0)*new_r00)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r01)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r00))+IKsqr(((-1.0)*new_r01))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(((-1.0)*new_r00), ((-1.0)*new_r01)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[6]; IkReal x523=IKsin(j2); IkReal x524=IKcos(j2); IkReal x525=((-1.0)*x524); evalcond[0]=x523; evalcond[1]=(new_r22*x523); evalcond[2]=x525; evalcond[3]=(new_r22*x525); evalcond[4]=((((-1.0)*x523))+(((-1.0)*new_r00))); evalcond[5]=((((-1.0)*x524))+(((-1.0)*new_r01))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j2] } } while(0); if( bgotonextstatement ) { } } } } } } } } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; CheckValue<IkReal> x526=IKPowWithIntegerCheck(sj1,-1); if(!x526.valid){ continue; } if( IKabs(((-1.0)*new_r00)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20*(x526.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r00))+IKsqr(((-1.0)*new_r20*(x526.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(((-1.0)*new_r00), ((-1.0)*new_r20*(x526.value))); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x527=IKsin(j2); IkReal x528=IKcos(j2); IkReal x529=((1.0)*sj1); IkReal x530=((1.0)*x528); evalcond[0]=(((sj1*x528))+new_r20); evalcond[1]=(((cj1*x527))+new_r11); evalcond[2]=((((-1.0)*x527*x529))+new_r21); evalcond[3]=((((-1.0)*cj1*x530))+new_r10); evalcond[4]=((((-1.0)*x527))+(((-1.0)*new_r00))); evalcond[5]=((((-1.0)*x530))+(((-1.0)*new_r01))); evalcond[6]=(((cj1*new_r11))+(((-1.0)*new_r21*x529))+x527); evalcond[7]=(((cj1*new_r10))+(((-1.0)*new_r20*x529))+(((-1.0)*x530))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; CheckValue<IkReal> x531=IKPowWithIntegerCheck(IKsign(cj1),-1); if(!x531.valid){ continue; } CheckValue<IkReal> x532 = IKatan2WithCheck(IkReal(((-1.0)*new_r11)),IkReal(new_r10),IKFAST_ATAN2_MAGTHRESH); if(!x532.valid){ continue; } j2array[0]=((-1.5707963267949)+(((1.5707963267949)*(x531.value)))+(x532.value)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x533=IKsin(j2); IkReal x534=IKcos(j2); IkReal x535=((1.0)*sj1); IkReal x536=((1.0)*x534); evalcond[0]=(((sj1*x534))+new_r20); evalcond[1]=(((cj1*x533))+new_r11); evalcond[2]=((((-1.0)*x533*x535))+new_r21); evalcond[3]=((((-1.0)*cj1*x536))+new_r10); evalcond[4]=((((-1.0)*x533))+(((-1.0)*new_r00))); evalcond[5]=((((-1.0)*x536))+(((-1.0)*new_r01))); evalcond[6]=(((cj1*new_r11))+(((-1.0)*new_r21*x535))+x533); evalcond[7]=(((cj1*new_r10))+(((-1.0)*x536))+(((-1.0)*new_r20*x535))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; CheckValue<IkReal> x537=IKPowWithIntegerCheck(IKsign(sj1),-1); if(!x537.valid){ continue; } CheckValue<IkReal> x538 = IKatan2WithCheck(IkReal(new_r21),IkReal(((-1.0)*new_r20)),IKFAST_ATAN2_MAGTHRESH); if(!x538.valid){ continue; } j2array[0]=((-1.5707963267949)+(((1.5707963267949)*(x537.value)))+(x538.value)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x539=IKsin(j2); IkReal x540=IKcos(j2); IkReal x541=((1.0)*sj1); IkReal x542=((1.0)*x540); evalcond[0]=(((sj1*x540))+new_r20); evalcond[1]=(((cj1*x539))+new_r11); evalcond[2]=((((-1.0)*x539*x541))+new_r21); evalcond[3]=((((-1.0)*cj1*x542))+new_r10); evalcond[4]=((((-1.0)*x539))+(((-1.0)*new_r00))); evalcond[5]=((((-1.0)*x542))+(((-1.0)*new_r01))); evalcond[6]=(((cj1*new_r11))+(((-1.0)*new_r21*x541))+x539); evalcond[7]=(((cj1*new_r10))+(((-1.0)*new_r20*x541))+(((-1.0)*x542))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j0)))), 6.28318530717959))); evalcond[1]=new_r02; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(new_r00) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r01) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r00)+IKsqr(new_r01)-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(new_r00, new_r01); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x543=IKcos(j2); IkReal x544=IKsin(j2); IkReal x545=((1.0)*sj1); IkReal x546=((1.0)*new_r11); IkReal x547=((1.0)*new_r10); IkReal x548=((1.0)*x543); evalcond[0]=(((sj1*x543))+new_r20); evalcond[1]=((((-1.0)*x544))+new_r00); evalcond[2]=((((-1.0)*x548))+new_r01); evalcond[3]=((((-1.0)*x544*x545))+new_r21); evalcond[4]=((((-1.0)*x546))+((cj1*x544))); evalcond[5]=((((-1.0)*cj1*x548))+(((-1.0)*x547))); evalcond[6]=((((-1.0)*cj1*x546))+(((-1.0)*new_r21*x545))+x544); evalcond[7]=((((-1.0)*cj1*x547))+(((-1.0)*new_r20*x545))+(((-1.0)*x548))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j1)))), 6.28318530717959))); evalcond[1]=new_r22; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(new_r21) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r21)+IKsqr(((-1.0)*new_r20))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(new_r21, ((-1.0)*new_r20)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x549=IKcos(j2); IkReal x550=IKsin(j2); IkReal x551=((1.0)*sj0); IkReal x552=((1.0)*x550); IkReal x553=((1.0)*x549); evalcond[0]=(x549+new_r20); evalcond[1]=((((-1.0)*x552))+new_r21); evalcond[2]=(((sj0*x549))+new_r01); evalcond[3]=(new_r00+((sj0*x550))); evalcond[4]=((((-1.0)*cj0*x553))+new_r11); evalcond[5]=(new_r10+(((-1.0)*new_r02*x552))); evalcond[6]=((((-1.0)*new_r00*x551))+(((-1.0)*x552))+((cj0*new_r10))); evalcond[7]=((((-1.0)*new_r01*x551))+(((-1.0)*x553))+((cj0*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j1)))), 6.28318530717959))); evalcond[1]=new_r22; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(((-1.0)*new_r21)) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r20) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r21))+IKsqr(new_r20)-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(((-1.0)*new_r21), new_r20); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x554=IKcos(j2); IkReal x555=IKsin(j2); IkReal x556=((1.0)*sj0); IkReal x557=((1.0)*x554); evalcond[0]=(x555+new_r21); evalcond[1]=((((-1.0)*x557))+new_r20); evalcond[2]=(new_r01+((sj0*x554))); evalcond[3]=(new_r00+((sj0*x555))); evalcond[4]=(((new_r02*x555))+new_r10); evalcond[5]=((((-1.0)*cj0*x557))+new_r11); evalcond[6]=((((-1.0)*x555))+(((-1.0)*new_r00*x556))+((cj0*new_r10))); evalcond[7]=((((-1.0)*new_r01*x556))+(((-1.0)*x557))+((cj0*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j1))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r12; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; IkReal x558=((1.0)*new_r01); if( IKabs(((((-1.0)*cj0*x558))+(((-1.0)*new_r00*sj0)))) < IKFAST_ATAN2_MAGTHRESH && IKabs((((cj0*new_r00))+(((-1.0)*sj0*x558)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*cj0*x558))+(((-1.0)*new_r00*sj0))))+IKsqr((((cj0*new_r00))+(((-1.0)*sj0*x558))))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(((((-1.0)*cj0*x558))+(((-1.0)*new_r00*sj0))), (((cj0*new_r00))+(((-1.0)*sj0*x558)))); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x559=IKsin(j2); IkReal x560=IKcos(j2); IkReal x561=((1.0)*sj0); IkReal x562=((1.0)*x560); IkReal x563=(sj0*x559); IkReal x564=(cj0*x559); IkReal x565=(cj0*x562); evalcond[0]=(((new_r11*sj0))+x559+((cj0*new_r01))); evalcond[1]=(((sj0*x560))+x564+new_r01); evalcond[2]=(((new_r10*sj0))+((cj0*new_r00))+(((-1.0)*x562))); evalcond[3]=((((-1.0)*new_r00*x561))+(((-1.0)*x559))+((cj0*new_r10))); evalcond[4]=(((cj0*new_r11))+(((-1.0)*x562))+(((-1.0)*new_r01*x561))); evalcond[5]=(x563+new_r00+(((-1.0)*x565))); evalcond[6]=(x563+new_r11+(((-1.0)*x565))); evalcond[7]=((((-1.0)*x560*x561))+(((-1.0)*x564))+new_r10); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j1)))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r12; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; IkReal x566=((1.0)*sj0); if( IKabs(((((-1.0)*new_r00*x566))+((cj0*new_r01)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((((-1.0)*cj0*new_r00))+(((-1.0)*new_r01*x566)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*new_r00*x566))+((cj0*new_r01))))+IKsqr(((((-1.0)*cj0*new_r00))+(((-1.0)*new_r01*x566))))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(((((-1.0)*new_r00*x566))+((cj0*new_r01))), ((((-1.0)*cj0*new_r00))+(((-1.0)*new_r01*x566)))); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x567=IKsin(j2); IkReal x568=IKcos(j2); IkReal x569=((1.0)*sj0); IkReal x570=((1.0)*x567); IkReal x571=(sj0*x568); IkReal x572=((1.0)*x568); IkReal x573=(cj0*x570); evalcond[0]=(((new_r10*sj0))+x568+((cj0*new_r00))); evalcond[1]=(((new_r11*sj0))+(((-1.0)*x570))+((cj0*new_r01))); evalcond[2]=(((cj0*x568))+((sj0*x567))+new_r00); evalcond[3]=((((-1.0)*new_r00*x569))+(((-1.0)*x570))+((cj0*new_r10))); evalcond[4]=((((-1.0)*x572))+((cj0*new_r11))+(((-1.0)*new_r01*x569))); evalcond[5]=((((-1.0)*x573))+x571+new_r01); evalcond[6]=((((-1.0)*x573))+x571+new_r10); evalcond[7]=((((-1.0)*cj0*x572))+(((-1.0)*x567*x569))+new_r11); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j0))), 6.28318530717959))); evalcond[1]=new_r12; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(new_r10) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r11) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r10)+IKsqr(new_r11)-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(new_r10, new_r11); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x574=IKcos(j2); IkReal x575=IKsin(j2); IkReal x576=((1.0)*sj1); IkReal x577=((1.0)*x574); evalcond[0]=(((sj1*x574))+new_r20); evalcond[1]=((((-1.0)*x575))+new_r10); evalcond[2]=((((-1.0)*x577))+new_r11); evalcond[3]=(new_r01+((cj1*x575))); evalcond[4]=((((-1.0)*x575*x576))+new_r21); evalcond[5]=((((-1.0)*cj1*x577))+new_r00); evalcond[6]=(((cj1*new_r01))+x575+(((-1.0)*new_r21*x576))); evalcond[7]=(((cj1*new_r00))+(((-1.0)*x577))+(((-1.0)*new_r20*x576))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j0)))), 6.28318530717959))); evalcond[1]=new_r12; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2eval[3]; sj0=0; cj0=-1.0; j0=3.14159265358979; j2eval[0]=sj1; j2eval[1]=IKsign(sj1); j2eval[2]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(j2eval[0]) < 0.0000010000000000 || IKabs(j2eval[1]) < 0.0000010000000000 || IKabs(j2eval[2]) < 0.0000010000000000 ) { { IkReal j2eval[1]; sj0=0; cj0=-1.0; j0=3.14159265358979; j2eval[0]=sj1; if( IKabs(j2eval[0]) < 0.0000010000000000 ) { { IkReal j2eval[2]; sj0=0; cj0=-1.0; j0=3.14159265358979; j2eval[0]=cj1; j2eval[1]=sj1; if( IKabs(j2eval[0]) < 0.0000010000000000 || IKabs(j2eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[4]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j1)))), 6.28318530717959))); evalcond[1]=new_r22; evalcond[2]=new_r01; evalcond[3]=new_r00; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(new_r21) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r21)+IKsqr(((-1.0)*new_r20))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(new_r21, ((-1.0)*new_r20)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[4]; IkReal x578=IKcos(j2); IkReal x579=((1.0)*(IKsin(j2))); evalcond[0]=(x578+new_r20); evalcond[1]=((((-1.0)*x579))+new_r21); evalcond[2]=((((-1.0)*x579))+(((-1.0)*new_r10))); evalcond[3]=((((-1.0)*x578))+(((-1.0)*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j1)))), 6.28318530717959))); evalcond[1]=new_r22; evalcond[2]=new_r01; evalcond[3]=new_r00; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(((-1.0)*new_r21)) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r20) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r21))+IKsqr(new_r20)-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(((-1.0)*new_r21), new_r20); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[4]; IkReal x580=IKsin(j2); IkReal x581=((1.0)*(IKcos(j2))); evalcond[0]=(x580+new_r21); evalcond[1]=(new_r20+(((-1.0)*x581))); evalcond[2]=((((-1.0)*x580))+(((-1.0)*new_r10))); evalcond[3]=((((-1.0)*new_r11))+(((-1.0)*x581))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j1))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(new_r01) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r11)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r01)+IKsqr(((-1.0)*new_r11))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(new_r01, ((-1.0)*new_r11)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[4]; IkReal x582=IKsin(j2); IkReal x583=((1.0)*(IKcos(j2))); evalcond[0]=(x582+(((-1.0)*new_r01))); evalcond[1]=((((-1.0)*x582))+(((-1.0)*new_r10))); evalcond[2]=((((-1.0)*new_r11))+(((-1.0)*x583))); evalcond[3]=((((-1.0)*new_r00))+(((-1.0)*x583))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j1)))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(((-1.0)*new_r10)) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r00) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r10))+IKsqr(new_r00)-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(((-1.0)*new_r10), new_r00); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[4]; IkReal x584=IKcos(j2); IkReal x585=((1.0)*(IKsin(j2))); evalcond[0]=(x584+(((-1.0)*new_r00))); evalcond[1]=((((-1.0)*new_r10))+(((-1.0)*x585))); evalcond[2]=((((-1.0)*x584))+(((-1.0)*new_r11))); evalcond[3]=((((-1.0)*new_r01))+(((-1.0)*x585))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; if( IKabs(((-1.0)*new_r10)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r11)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r10))+IKsqr(((-1.0)*new_r11))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2(((-1.0)*new_r10), ((-1.0)*new_r11)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[6]; IkReal x586=IKsin(j2); IkReal x587=IKcos(j2); IkReal x588=((-1.0)*x587); evalcond[0]=x586; evalcond[1]=(new_r22*x586); evalcond[2]=x588; evalcond[3]=(new_r22*x588); evalcond[4]=((((-1.0)*x586))+(((-1.0)*new_r10))); evalcond[5]=((((-1.0)*x587))+(((-1.0)*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j2] } } while(0); if( bgotonextstatement ) { } } } } } } } } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; CheckValue<IkReal> x589=IKPowWithIntegerCheck(cj1,-1); if(!x589.valid){ continue; } CheckValue<IkReal> x590=IKPowWithIntegerCheck(sj1,-1); if(!x590.valid){ continue; } if( IKabs((new_r01*(x589.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20*(x590.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((new_r01*(x589.value)))+IKsqr(((-1.0)*new_r20*(x590.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2((new_r01*(x589.value)), ((-1.0)*new_r20*(x590.value))); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x591=IKsin(j2); IkReal x592=IKcos(j2); IkReal x593=((1.0)*new_r00); IkReal x594=((1.0)*sj1); IkReal x595=((1.0)*new_r01); IkReal x596=((1.0)*x592); evalcond[0]=(((sj1*x592))+new_r20); evalcond[1]=(new_r21+(((-1.0)*x591*x594))); evalcond[2]=((((-1.0)*x591))+(((-1.0)*new_r10))); evalcond[3]=((((-1.0)*x596))+(((-1.0)*new_r11))); evalcond[4]=(((cj1*x591))+(((-1.0)*x595))); evalcond[5]=((((-1.0)*x593))+(((-1.0)*cj1*x596))); evalcond[6]=((((-1.0)*new_r21*x594))+(((-1.0)*cj1*x595))+x591); evalcond[7]=((((-1.0)*new_r20*x594))+(((-1.0)*x596))+(((-1.0)*cj1*x593))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; CheckValue<IkReal> x597=IKPowWithIntegerCheck(sj1,-1); if(!x597.valid){ continue; } if( IKabs((new_r21*(x597.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r11)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((new_r21*(x597.value)))+IKsqr(((-1.0)*new_r11))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2((new_r21*(x597.value)), ((-1.0)*new_r11)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x598=IKsin(j2); IkReal x599=IKcos(j2); IkReal x600=((1.0)*new_r00); IkReal x601=((1.0)*sj1); IkReal x602=((1.0)*new_r01); IkReal x603=((1.0)*x599); evalcond[0]=(((sj1*x599))+new_r20); evalcond[1]=((((-1.0)*x598*x601))+new_r21); evalcond[2]=((((-1.0)*x598))+(((-1.0)*new_r10))); evalcond[3]=((((-1.0)*new_r11))+(((-1.0)*x603))); evalcond[4]=(((cj1*x598))+(((-1.0)*x602))); evalcond[5]=((((-1.0)*cj1*x603))+(((-1.0)*x600))); evalcond[6]=((((-1.0)*cj1*x602))+x598+(((-1.0)*new_r21*x601))); evalcond[7]=((((-1.0)*new_r20*x601))+(((-1.0)*cj1*x600))+(((-1.0)*x603))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; CheckValue<IkReal> x604=IKPowWithIntegerCheck(IKsign(sj1),-1); if(!x604.valid){ continue; } CheckValue<IkReal> x605 = IKatan2WithCheck(IkReal(new_r21),IkReal(((-1.0)*new_r20)),IKFAST_ATAN2_MAGTHRESH); if(!x605.valid){ continue; } j2array[0]=((-1.5707963267949)+(((1.5707963267949)*(x604.value)))+(x605.value)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[8]; IkReal x606=IKsin(j2); IkReal x607=IKcos(j2); IkReal x608=((1.0)*new_r00); IkReal x609=((1.0)*sj1); IkReal x610=((1.0)*new_r01); IkReal x611=((1.0)*x607); evalcond[0]=(((sj1*x607))+new_r20); evalcond[1]=(new_r21+(((-1.0)*x606*x609))); evalcond[2]=((((-1.0)*x606))+(((-1.0)*new_r10))); evalcond[3]=((((-1.0)*x611))+(((-1.0)*new_r11))); evalcond[4]=(((cj1*x606))+(((-1.0)*x610))); evalcond[5]=((((-1.0)*cj1*x611))+(((-1.0)*x608))); evalcond[6]=((((-1.0)*cj1*x610))+x606+(((-1.0)*new_r21*x609))); evalcond[7]=((((-1.0)*new_r20*x609))+(((-1.0)*cj1*x608))+(((-1.0)*x611))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j2eval[1]; new_r21=0; new_r20=0; new_r02=0; new_r12=0; j2eval[0]=IKabs(new_r22); if( IKabs(j2eval[0]) < 0.0000000100000000 ) { continue; // no branches [j2] } else { IkReal op[2+1], zeror[2]; int numroots; op[0]=new_r22; op[1]=0; op[2]=((-1.0)*new_r22); polyroots2(op,zeror,numroots); IkReal j2array[2], cj2array[2], sj2array[2], tempj2array[1]; int numsolutions = 0; for(int ij2 = 0; ij2 < numroots; ++ij2) { IkReal htj2 = zeror[ij2]; tempj2array[0]=((2.0)*(atan(htj2))); for(int kj2 = 0; kj2 < 1; ++kj2) { j2array[numsolutions] = tempj2array[kj2]; if( j2array[numsolutions] > IKPI ) { j2array[numsolutions]-=IK2PI; } else if( j2array[numsolutions] < -IKPI ) { j2array[numsolutions]+=IK2PI; } sj2array[numsolutions] = IKsin(j2array[numsolutions]); cj2array[numsolutions] = IKcos(j2array[numsolutions]); numsolutions++; } } bool j2valid[2]={true,true}; _nj2 = 2; for(int ij2 = 0; ij2 < numsolutions; ++ij2) { if( !j2valid[ij2] ) { continue; } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; htj2 = IKtan(j2/2); _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < numsolutions; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j2] } } while(0); if( bgotonextstatement ) { } } } } } } } } } } } } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; CheckValue<IkReal> x613=IKPowWithIntegerCheck(sj1,-1); if(!x613.valid){ continue; } IkReal x612=x613.value; CheckValue<IkReal> x614=IKPowWithIntegerCheck(cj0,-1); if(!x614.valid){ continue; } CheckValue<IkReal> x615=IKPowWithIntegerCheck(cj1,-1); if(!x615.valid){ continue; } if( IKabs((x612*(x614.value)*(x615.value)*((((new_r20*sj0))+(((-1.0)*new_r01*sj1)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20*x612)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((x612*(x614.value)*(x615.value)*((((new_r20*sj0))+(((-1.0)*new_r01*sj1))))))+IKsqr(((-1.0)*new_r20*x612))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2((x612*(x614.value)*(x615.value)*((((new_r20*sj0))+(((-1.0)*new_r01*sj1))))), ((-1.0)*new_r20*x612)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[12]; IkReal x616=IKsin(j2); IkReal x617=IKcos(j2); IkReal x618=((1.0)*sj1); IkReal x619=((1.0)*sj0); IkReal x620=(cj0*new_r00); IkReal x621=(cj0*cj1); IkReal x622=(new_r11*sj0); IkReal x623=(new_r10*sj0); IkReal x624=((1.0)*x617); IkReal x625=(cj1*x616); IkReal x626=((1.0)*x616); evalcond[0]=(((sj1*x617))+new_r20); evalcond[1]=(new_r21+(((-1.0)*x616*x618))); evalcond[2]=(x625+x622+((cj0*new_r01))); evalcond[3]=((((-1.0)*x626))+(((-1.0)*new_r00*x619))+((cj0*new_r10))); evalcond[4]=((((-1.0)*x624))+((cj0*new_r11))+(((-1.0)*new_r01*x619))); evalcond[5]=(((x616*x621))+((sj0*x617))+new_r01); evalcond[6]=((((-1.0)*cj1*x624))+x620+x623); evalcond[7]=((((-1.0)*x621*x624))+((sj0*x616))+new_r00); evalcond[8]=((((-1.0)*cj0*x624))+((sj0*x625))+new_r11); evalcond[9]=((((-1.0)*cj0*x626))+(((-1.0)*cj1*x617*x619))+new_r10); evalcond[10]=((((-1.0)*new_r21*x618))+((new_r01*x621))+x616+((cj1*x622))); evalcond[11]=((((-1.0)*x624))+(((-1.0)*new_r20*x618))+((cj1*x620))+((cj1*x623))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; CheckValue<IkReal> x628=IKPowWithIntegerCheck(sj1,-1); if(!x628.valid){ continue; } IkReal x627=x628.value; CheckValue<IkReal> x629=IKPowWithIntegerCheck(sj0,-1); if(!x629.valid){ continue; } if( IKabs((x627*(x629.value)*(((((-1.0)*cj0*cj1*new_r20))+(((-1.0)*new_r00*sj1)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20*x627)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((x627*(x629.value)*(((((-1.0)*cj0*cj1*new_r20))+(((-1.0)*new_r00*sj1))))))+IKsqr(((-1.0)*new_r20*x627))-1) <= IKFAST_SINCOS_THRESH ) continue; j2array[0]=IKatan2((x627*(x629.value)*(((((-1.0)*cj0*cj1*new_r20))+(((-1.0)*new_r00*sj1))))), ((-1.0)*new_r20*x627)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[12]; IkReal x630=IKsin(j2); IkReal x631=IKcos(j2); IkReal x632=((1.0)*sj1); IkReal x633=((1.0)*sj0); IkReal x634=(cj0*new_r00); IkReal x635=(cj0*cj1); IkReal x636=(new_r11*sj0); IkReal x637=(new_r10*sj0); IkReal x638=((1.0)*x631); IkReal x639=(cj1*x630); IkReal x640=((1.0)*x630); evalcond[0]=(((sj1*x631))+new_r20); evalcond[1]=((((-1.0)*x630*x632))+new_r21); evalcond[2]=(x636+x639+((cj0*new_r01))); evalcond[3]=((((-1.0)*new_r00*x633))+(((-1.0)*x640))+((cj0*new_r10))); evalcond[4]=((((-1.0)*new_r01*x633))+(((-1.0)*x638))+((cj0*new_r11))); evalcond[5]=(((sj0*x631))+new_r01+((x630*x635))); evalcond[6]=((((-1.0)*cj1*x638))+x637+x634); evalcond[7]=((((-1.0)*x635*x638))+((sj0*x630))+new_r00); evalcond[8]=((((-1.0)*cj0*x638))+((sj0*x639))+new_r11); evalcond[9]=((((-1.0)*cj0*x640))+new_r10+(((-1.0)*cj1*x631*x633))); evalcond[10]=(((new_r01*x635))+(((-1.0)*new_r21*x632))+x630+((cj1*x636))); evalcond[11]=((((-1.0)*x638))+(((-1.0)*new_r20*x632))+((cj1*x637))+((cj1*x634))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; CheckValue<IkReal> x641=IKPowWithIntegerCheck(IKsign(sj1),-1); if(!x641.valid){ continue; } CheckValue<IkReal> x642 = IKatan2WithCheck(IkReal(new_r21),IkReal(((-1.0)*new_r20)),IKFAST_ATAN2_MAGTHRESH); if(!x642.valid){ continue; } j2array[0]=((-1.5707963267949)+(((1.5707963267949)*(x641.value)))+(x642.value)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[12]; IkReal x643=IKsin(j2); IkReal x644=IKcos(j2); IkReal x645=((1.0)*sj1); IkReal x646=((1.0)*sj0); IkReal x647=(cj0*new_r00); IkReal x648=(cj0*cj1); IkReal x649=(new_r11*sj0); IkReal x650=(new_r10*sj0); IkReal x651=((1.0)*x644); IkReal x652=(cj1*x643); IkReal x653=((1.0)*x643); evalcond[0]=(((sj1*x644))+new_r20); evalcond[1]=((((-1.0)*x643*x645))+new_r21); evalcond[2]=(x649+x652+((cj0*new_r01))); evalcond[3]=((((-1.0)*x653))+(((-1.0)*new_r00*x646))+((cj0*new_r10))); evalcond[4]=((((-1.0)*x651))+(((-1.0)*new_r01*x646))+((cj0*new_r11))); evalcond[5]=(((sj0*x644))+((x643*x648))+new_r01); evalcond[6]=((((-1.0)*cj1*x651))+x647+x650); evalcond[7]=(((sj0*x643))+new_r00+(((-1.0)*x648*x651))); evalcond[8]=(((sj0*x652))+(((-1.0)*cj0*x651))+new_r11); evalcond[9]=((((-1.0)*cj1*x644*x646))+(((-1.0)*cj0*x653))+new_r10); evalcond[10]=(((cj1*x649))+(((-1.0)*new_r21*x645))+((new_r01*x648))+x643); evalcond[11]=(((cj1*x647))+((cj1*x650))+(((-1.0)*x651))+(((-1.0)*new_r20*x645))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(7); vinfos[0].jointtype = 1; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } } } } } } }static inline void polyroots3(IkReal rawcoeffs[3+1], IkReal rawroots[3], int& numroots) { using std::complex; if( rawcoeffs[0] == 0 ) { // solve with one reduced degree polyroots2(&rawcoeffs[1], &rawroots[0], numroots); return; } IKFAST_ASSERT(rawcoeffs[0] != 0); const IkReal tol = 128.0*std::numeric_limits<IkReal>::epsilon(); const IkReal tolsqrt = sqrt(std::numeric_limits<IkReal>::epsilon()); complex<IkReal> coeffs[3]; const int maxsteps = 110; for(int i = 0; i < 3; ++i) { coeffs[i] = complex<IkReal>(rawcoeffs[i+1]/rawcoeffs[0]); } complex<IkReal> roots[3]; IkReal err[3]; roots[0] = complex<IkReal>(1,0); roots[1] = complex<IkReal>(0.4,0.9); // any complex number not a root of unity works err[0] = 1.0; err[1] = 1.0; for(int i = 2; i < 3; ++i) { roots[i] = roots[i-1]*roots[1]; err[i] = 1.0; } for(int step = 0; step < maxsteps; ++step) { bool changed = false; for(int i = 0; i < 3; ++i) { if ( err[i] >= tol ) { changed = true; // evaluate complex<IkReal> x = roots[i] + coeffs[0]; for(int j = 1; j < 3; ++j) { x = roots[i] * x + coeffs[j]; } for(int j = 0; j < 3; ++j) { if( i != j ) { if( roots[i] != roots[j] ) { x /= (roots[i] - roots[j]); } } } roots[i] -= x; err[i] = abs(x); } } if( !changed ) { break; } } numroots = 0; bool visited[3] = {false}; for(int i = 0; i < 3; ++i) { if( !visited[i] ) { // might be a multiple root, in which case it will have more error than the other roots // find any neighboring roots, and take the average complex<IkReal> newroot=roots[i]; int n = 1; for(int j = i+1; j < 3; ++j) { // care about error in real much more than imaginary if( abs(real(roots[i])-real(roots[j])) < tolsqrt && abs(imag(roots[i])-imag(roots[j])) < 0.002 ) { newroot += roots[j]; n += 1; visited[j] = true; } } if( n > 1 ) { newroot /= n; } // there are still cases where even the mean is not accurate enough, until a better multi-root algorithm is used, need to use the sqrt if( IKabs(imag(newroot)) < tolsqrt ) { rawroots[numroots++] = real(newroot); } } } } static inline void polyroots2(IkReal rawcoeffs[2+1], IkReal rawroots[2], int& numroots) { IkReal det = rawcoeffs[1]*rawcoeffs[1]-4*rawcoeffs[0]*rawcoeffs[2]; if( det < 0 ) { numroots=0; } else if( det == 0 ) { rawroots[0] = -0.5*rawcoeffs[1]/rawcoeffs[0]; numroots = 1; } else { det = IKsqrt(det); rawroots[0] = (-rawcoeffs[1]+det)/(2*rawcoeffs[0]); rawroots[1] = (-rawcoeffs[1]-det)/(2*rawcoeffs[0]);//rawcoeffs[2]/(rawcoeffs[0]*rawroots[0]); numroots = 2; } } static inline void polyroots4(IkReal rawcoeffs[4+1], IkReal rawroots[4], int& numroots) { using std::complex; if( rawcoeffs[0] == 0 ) { // solve with one reduced degree polyroots3(&rawcoeffs[1], &rawroots[0], numroots); return; } IKFAST_ASSERT(rawcoeffs[0] != 0); const IkReal tol = 128.0*std::numeric_limits<IkReal>::epsilon(); const IkReal tolsqrt = sqrt(std::numeric_limits<IkReal>::epsilon()); complex<IkReal> coeffs[4]; const int maxsteps = 110; for(int i = 0; i < 4; ++i) { coeffs[i] = complex<IkReal>(rawcoeffs[i+1]/rawcoeffs[0]); } complex<IkReal> roots[4]; IkReal err[4]; roots[0] = complex<IkReal>(1,0); roots[1] = complex<IkReal>(0.4,0.9); // any complex number not a root of unity works err[0] = 1.0; err[1] = 1.0; for(int i = 2; i < 4; ++i) { roots[i] = roots[i-1]*roots[1]; err[i] = 1.0; } for(int step = 0; step < maxsteps; ++step) { bool changed = false; for(int i = 0; i < 4; ++i) { if ( err[i] >= tol ) { changed = true; // evaluate complex<IkReal> x = roots[i] + coeffs[0]; for(int j = 1; j < 4; ++j) { x = roots[i] * x + coeffs[j]; } for(int j = 0; j < 4; ++j) { if( i != j ) { if( roots[i] != roots[j] ) { x /= (roots[i] - roots[j]); } } } roots[i] -= x; err[i] = abs(x); } } if( !changed ) { break; } } numroots = 0; bool visited[4] = {false}; for(int i = 0; i < 4; ++i) { if( !visited[i] ) { // might be a multiple root, in which case it will have more error than the other roots // find any neighboring roots, and take the average complex<IkReal> newroot=roots[i]; int n = 1; for(int j = i+1; j < 4; ++j) { // care about error in real much more than imaginary if( abs(real(roots[i])-real(roots[j])) < tolsqrt && abs(imag(roots[i])-imag(roots[j])) < 0.002 ) { newroot += roots[j]; n += 1; visited[j] = true; } } if( n > 1 ) { newroot /= n; } // there are still cases where even the mean is not accurate enough, until a better multi-root algorithm is used, need to use the sqrt if( IKabs(imag(newroot)) < tolsqrt ) { rawroots[numroots++] = real(newroot); } } } } }; /// solves the inverse kinematics equations. /// \param pfree is an array specifying the free joints of the chain. IKFAST_API bool ComputeIk(const IkReal* eetrans, const IkReal* eerot, const IkReal* pfree, IkSolutionListBase<IkReal>& solutions) { IKSolver solver; return solver.ComputeIk(eetrans,eerot,pfree,solutions); } IKFAST_API bool ComputeIk2(const IkReal* eetrans, const IkReal* eerot, const IkReal* pfree, IkSolutionListBase<IkReal>& solutions, void* pOpenRAVEManip) { IKSolver solver; return solver.ComputeIk(eetrans,eerot,pfree,solutions); } IKFAST_API const char* GetKinematicsHash() { return "bf50724965d11d261f26d50529e90097"; } IKFAST_API const char* GetIkFastVersion() { return "0x10000049"; } #ifdef IKFAST_NAMESPACE } // end namespace #endif #ifndef IKFAST_NO_MAIN #include <stdio.h> #include <stdlib.h> #ifdef IKFAST_NAMESPACE using namespace IKFAST_NAMESPACE; #endif int main(int argc, char** argv) { if( argc != 12+GetNumFreeParameters()+1 ) { printf("\nUsage: ./ik r00 r01 r02 t0 r10 r11 r12 t1 r20 r21 r22 t2 free0 ...\n\n" "Returns the ik solutions given the transformation of the end effector specified by\n" "a 3x3 rotation R (rXX), and a 3x1 translation (tX).\n" "There are %d free parameters that have to be specified.\n\n",GetNumFreeParameters()); return 1; } IkSolutionList<IkReal> solutions; std::vector<IkReal> vfree(GetNumFreeParameters()); IkReal eerot[9],eetrans[3]; eerot[0] = atof(argv[1]); eerot[1] = atof(argv[2]); eerot[2] = atof(argv[3]); eetrans[0] = atof(argv[4]); eerot[3] = atof(argv[5]); eerot[4] = atof(argv[6]); eerot[5] = atof(argv[7]); eetrans[1] = atof(argv[8]); eerot[6] = atof(argv[9]); eerot[7] = atof(argv[10]); eerot[8] = atof(argv[11]); eetrans[2] = atof(argv[12]); for(std::size_t i = 0; i < vfree.size(); ++i) vfree[i] = atof(argv[13+i]); bool bSuccess = ComputeIk(eetrans, eerot, vfree.size() > 0 ? &vfree[0] : NULL, solutions); if( !bSuccess ) { fprintf(stderr,"Failed to get ik solution\n"); return -1; } printf("Found %d ik solutions:\n", (int)solutions.GetNumSolutions()); std::vector<IkReal> solvalues(GetNumJoints()); for(std::size_t i = 0; i < solutions.GetNumSolutions(); ++i) { const IkSolutionBase<IkReal>& sol = solutions.GetSolution(i); printf("sol%d (free=%d): ", (int)i, (int)sol.GetFree().size()); std::vector<IkReal> vsolfree(sol.GetFree().size()); sol.GetSolution(&solvalues[0],vsolfree.size()>0?&vsolfree[0]:NULL); for( std::size_t j = 0; j < solvalues.size(); ++j) printf("%.15f, ", solvalues[j]); printf("\n"); } return 0; } #endif // start python bindings // https://github.com/caelan/ss-pybullet/blob/c5efe7ad32381a7a7a15c2bd147b5a8731d21342/pybullet_tools/ikfast/pr2/left_arm_ik.cpp#L12972 // https://github.com/yijiangh/conrob_pybullet/blob/master/utils/ikfast/kuka_kr6_r900/ikfast0x1000004a.Transform6D.0_1_2_3_4_5.cpp#L9923 static PyObject *get_ik(PyObject *self, PyObject *args) { IkSolutionList<IkReal> solutions; std::vector<IkReal> vfree(GetNumFreeParameters()); IkReal eerot[9], eetrans[3]; // First list if 3x3 rotation matrix, easier to compute in Python. // Next list is [x, y, z] translation matrix. // Last list is free joints. PyObject *rotList; // 3x3 rotation matrix PyObject *transList; // [x,y,z] PyObject *freeList; // can be empty // format 'O!': pass C object pointer with the pointer's address. if(!PyArg_ParseTuple(args, "O!O!O!", &PyList_Type, &rotList, &PyList_Type, &transList, &PyList_Type, &freeList)) { fprintf(stderr,"Failed to parse input to python objects\n"); return NULL; } for(std::size_t i = 0; i < 3; ++i) { eetrans[i] = PyFloat_AsDouble(PyList_GetItem(transList, i)); PyObject* rowList = PyList_GetItem(rotList, i); for( std::size_t j = 0; j < 3; ++j) { eerot[3*i + j] = PyFloat_AsDouble(PyList_GetItem(rowList, j)); } } for(int i = 0; i < GetNumFreeParameters(); ++i) { vfree[i] = PyFloat_AsDouble(PyList_GetItem(freeList, i)); } // call ikfast routine bool bSuccess = ComputeIk(eetrans, eerot, &vfree[0], solutions); if (!bSuccess) { //fprintf(stderr,"Failed to get ik solution\n"); return Py_BuildValue(""); // Equivalent to returning None in python } std::vector<IkReal> solvalues(GetNumJoints()); PyObject *solutionList = PyList_New(solutions.GetNumSolutions()); // convert all ikfast solutions into a python list for(std::size_t i = 0; i < solutions.GetNumSolutions(); ++i) { const IkSolutionBase<IkReal>& sol = solutions.GetSolution(i); std::vector<IkReal> vsolfree(sol.GetFree().size()); sol.GetSolution(&solvalues[0],vsolfree.size()>0?&vsolfree[0]:NULL); PyObject *individualSolution = PyList_New(GetNumJoints()); for( std::size_t j = 0; j < solvalues.size(); ++j) { // I think IkReal is just a wrapper for double. So this should work. PyList_SetItem(individualSolution, j, PyFloat_FromDouble(solvalues[j])); } PyList_SetItem(solutionList, i, individualSolution); } return solutionList; } static PyObject *get_fk(PyObject *self, PyObject *args) { std::vector<IkReal> joints(GetNumJoints()); // eerot is a flattened 3x3 rotation matrix IkReal eerot[9], eetrans[3]; PyObject *jointList; if(!PyArg_ParseTuple(args, "O!", &PyList_Type, &jointList)) { return NULL; } for(std::size_t i = 0; i < GetNumJoints(); ++i) { joints[i] = PyFloat_AsDouble(PyList_GetItem(jointList, i)); } // call ikfast routine ComputeFk(&joints[0], eetrans, eerot); // convert computed EE pose to a python object PyObject *pose = PyList_New(2); PyObject *pos = PyList_New(3); PyObject *rot = PyList_New(3); for(std::size_t i = 0; i < 3; ++i) { PyList_SetItem(pos, i, PyFloat_FromDouble(eetrans[i])); PyObject *row = PyList_New(3); for( std::size_t j = 0; j < 3; ++j) { PyList_SetItem(row, j, PyFloat_FromDouble(eerot[3*i + j])); } PyList_SetItem(rot, i, row); } PyList_SetItem(pose, 0, pos); PyList_SetItem(pose, 1, rot); return pose; } static PyMethodDef ikfast_methods[] = { {"get_ik", get_ik, METH_VARARGS, "Compute ik solutions using ikfast."}, {"get_fk", get_fk, METH_VARARGS, "Compute fk solutions using ikfast."}, {NULL, NULL, 0, NULL} // Not sure why/if this is needed. It shows up in the examples though(something about Sentinel). }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef ikfast_panda_arm_module = { PyModuleDef_HEAD_INIT, "ikfast_panda_arm", /* name of module */ NULL, /* module documentation, may be NULL */ -1, /* size of per-interpreter state of the module, or -1 if the module keeps state in global variables. */ ikfast_methods }; #define INITERROR return NULL PyMODINIT_FUNC PyInit_ikfast_panda_arm(void) #else // PY_MAJOR_VERSION < 3 #define INITERROR return PyMODINIT_FUNC initikfast_panda_arm(void) #endif { #if PY_MAJOR_VERSION >= 3 PyObject *module = PyModule_Create(&ikfast_panda_arm_module); #else PyObject *module = Py_InitModule("ikfast_panda_arm", ikfast_methods); #endif if (module == NULL) INITERROR; #if PY_MAJOR_VERSION >= 3 return module; #endif } // end python bindings
390,788
C++
29.072259
874
0.6345
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/pybullet_tools/ikfast/franka_panda/setup.py
#!/usr/bin/env python from __future__ import print_function import sys import os sys.path.append(os.path.join(os.pardir, os.pardir, os.pardir)) from pybullet_tools.ikfast.compile import compile_ikfast # Build C++ extension by running: 'python setup.py' # see: https://docs.python.org/3/extending/building.html def main(): # lib name template: 'ikfast_<robot name>' sys.argv[:] = sys.argv[:1] + ['build'] robot_name = 'panda_arm' compile_ikfast(module_name='ikfast_{}'.format(robot_name), cpp_filename='ikfast_{}.cpp'.format(robot_name)) if __name__ == '__main__': main()
616
Python
25.826086
67
0.655844
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/pybullet_tools/ikfast/movo/movo_right_arm_ik.cpp
/// autogenerated analytical inverse kinematics code from ikfast program part of OpenRAVE /// \author Rosen Diankov /// /// Licensed under the Apache License, Version 2.0 (the "License"); /// you may not use this file except in compliance with the License. /// You may obtain a copy of the License at /// http://www.apache.org/licenses/LICENSE-2.0 /// /// Unless required by applicable law or agreed to in writing, software /// distributed under the License is distributed on an "AS IS" BASIS, /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. /// See the License for the specific language governing permissions and /// limitations under the License. /// /// ikfast version 0x1000004a generated on 2018-08-20 11:32:33.505301 /// Generated using solver transform6d /// To compile with gcc: /// gcc -lstdc++ ik.cpp /// To compile without any main function as a shared object (might need -llapack): /// gcc -fPIC -lstdc++ -DIKFAST_NO_MAIN -DIKFAST_CLIBRARY -shared -Wl,-soname,libik.so -o libik.so ik.cpp //// START //// Make sure the version number matches. //// You might need to install the dev version to get the header files. //// sudo apt-get install python3.4-dev #include "Python.h" //// END #define IKFAST_HAS_LIBRARY #include "ikfast.h" // found inside share/openrave-X.Y/python/ikfast.h using namespace ikfast; // check if the included ikfast version matches what this file was compiled with #define IKFAST_COMPILE_ASSERT(x) extern int __dummy[(int)x] IKFAST_COMPILE_ASSERT(IKFAST_VERSION==0x1000004a); #include <cmath> #include <vector> #include <limits> #include <algorithm> #include <complex> #ifndef IKFAST_ASSERT #include <stdexcept> #include <sstream> #include <iostream> #ifdef _MSC_VER #ifndef __PRETTY_FUNCTION__ #define __PRETTY_FUNCTION__ __FUNCDNAME__ #endif #endif #ifndef __PRETTY_FUNCTION__ #define __PRETTY_FUNCTION__ __func__ #endif #define IKFAST_ASSERT(b) { if( !(b) ) { std::stringstream ss; ss << "ikfast exception: " << __FILE__ << ":" << __LINE__ << ": " <<__PRETTY_FUNCTION__ << ": Assertion '" << #b << "' failed"; throw std::runtime_error(ss.str()); } } #endif #if defined(_MSC_VER) #define IKFAST_ALIGNED16(x) __declspec(align(16)) x #else #define IKFAST_ALIGNED16(x) x __attribute((aligned(16))) #endif #define IK2PI ((IkReal)6.28318530717959) #define IKPI ((IkReal)3.14159265358979) #define IKPI_2 ((IkReal)1.57079632679490) #ifdef _MSC_VER #ifndef isnan #define isnan _isnan #endif #ifndef isinf #define isinf _isinf #endif //#ifndef isfinite //#define isfinite _isfinite //#endif #endif // _MSC_VER // lapack routines extern "C" { void dgetrf_ (const int* m, const int* n, double* a, const int* lda, int* ipiv, int* info); void zgetrf_ (const int* m, const int* n, std::complex<double>* a, const int* lda, int* ipiv, int* info); void dgetri_(const int* n, const double* a, const int* lda, int* ipiv, double* work, const int* lwork, int* info); void dgesv_ (const int* n, const int* nrhs, double* a, const int* lda, int* ipiv, double* b, const int* ldb, int* info); void dgetrs_(const char *trans, const int *n, const int *nrhs, double *a, const int *lda, int *ipiv, double *b, const int *ldb, int *info); void dgeev_(const char *jobvl, const char *jobvr, const int *n, double *a, const int *lda, double *wr, double *wi,double *vl, const int *ldvl, double *vr, const int *ldvr, double *work, const int *lwork, int *info); } using namespace std; // necessary to get std math routines #ifdef IKFAST_NAMESPACE namespace IKFAST_NAMESPACE { #endif inline float IKabs(float f) { return fabsf(f); } inline double IKabs(double f) { return fabs(f); } inline float IKsqr(float f) { return f*f; } inline double IKsqr(double f) { return f*f; } inline float IKlog(float f) { return logf(f); } inline double IKlog(double f) { return log(f); } // allows asin and acos to exceed 1. has to be smaller than thresholds used for branch conds and evaluation #ifndef IKFAST_SINCOS_THRESH #define IKFAST_SINCOS_THRESH ((IkReal)1e-7) #endif // used to check input to atan2 for degenerate cases. has to be smaller than thresholds used for branch conds and evaluation #ifndef IKFAST_ATAN2_MAGTHRESH #define IKFAST_ATAN2_MAGTHRESH ((IkReal)1e-7) #endif // minimum distance of separate solutions #ifndef IKFAST_SOLUTION_THRESH #define IKFAST_SOLUTION_THRESH ((IkReal)1e-6) #endif // there are checkpoints in ikfast that are evaluated to make sure they are 0. This threshold speicfies by how much they can deviate #ifndef IKFAST_EVALCOND_THRESH #define IKFAST_EVALCOND_THRESH ((IkReal)0.00001) #endif inline float IKasin(float f) { IKFAST_ASSERT( f > -1-IKFAST_SINCOS_THRESH && f < 1+IKFAST_SINCOS_THRESH ); // any more error implies something is wrong with the solver if( f <= -1 ) return float(-IKPI_2); else if( f >= 1 ) return float(IKPI_2); return asinf(f); } inline double IKasin(double f) { IKFAST_ASSERT( f > -1-IKFAST_SINCOS_THRESH && f < 1+IKFAST_SINCOS_THRESH ); // any more error implies something is wrong with the solver if( f <= -1 ) return -IKPI_2; else if( f >= 1 ) return IKPI_2; return asin(f); } // return positive value in [0,y) inline float IKfmod(float x, float y) { while(x < 0) { x += y; } return fmodf(x,y); } // return positive value in [0,y) inline double IKfmod(double x, double y) { while(x < 0) { x += y; } return fmod(x,y); } inline float IKacos(float f) { IKFAST_ASSERT( f > -1-IKFAST_SINCOS_THRESH && f < 1+IKFAST_SINCOS_THRESH ); // any more error implies something is wrong with the solver if( f <= -1 ) return float(IKPI); else if( f >= 1 ) return float(0); return acosf(f); } inline double IKacos(double f) { IKFAST_ASSERT( f > -1-IKFAST_SINCOS_THRESH && f < 1+IKFAST_SINCOS_THRESH ); // any more error implies something is wrong with the solver if( f <= -1 ) return IKPI; else if( f >= 1 ) return 0; return acos(f); } inline float IKsin(float f) { return sinf(f); } inline double IKsin(double f) { return sin(f); } inline float IKcos(float f) { return cosf(f); } inline double IKcos(double f) { return cos(f); } inline float IKtan(float f) { return tanf(f); } inline double IKtan(double f) { return tan(f); } inline float IKsqrt(float f) { if( f <= 0.0f ) return 0.0f; return sqrtf(f); } inline double IKsqrt(double f) { if( f <= 0.0 ) return 0.0; return sqrt(f); } inline float IKatan2Simple(float fy, float fx) { return atan2f(fy,fx); } inline float IKatan2(float fy, float fx) { if( isnan(fy) ) { IKFAST_ASSERT(!isnan(fx)); // if both are nan, probably wrong value will be returned return float(IKPI_2); } else if( isnan(fx) ) { return 0; } return atan2f(fy,fx); } inline double IKatan2Simple(double fy, double fx) { return atan2(fy,fx); } inline double IKatan2(double fy, double fx) { if( isnan(fy) ) { IKFAST_ASSERT(!isnan(fx)); // if both are nan, probably wrong value will be returned return IKPI_2; } else if( isnan(fx) ) { return 0; } return atan2(fy,fx); } template <typename T> struct CheckValue { T value; bool valid; }; template <typename T> inline CheckValue<T> IKatan2WithCheck(T fy, T fx, T epsilon) { CheckValue<T> ret; ret.valid = false; ret.value = 0; if( !isnan(fy) && !isnan(fx) ) { if( IKabs(fy) >= IKFAST_ATAN2_MAGTHRESH || IKabs(fx) > IKFAST_ATAN2_MAGTHRESH ) { ret.value = IKatan2Simple(fy,fx); ret.valid = true; } } return ret; } inline float IKsign(float f) { if( f > 0 ) { return float(1); } else if( f < 0 ) { return float(-1); } return 0; } inline double IKsign(double f) { if( f > 0 ) { return 1.0; } else if( f < 0 ) { return -1.0; } return 0; } template <typename T> inline CheckValue<T> IKPowWithIntegerCheck(T f, int n) { CheckValue<T> ret; ret.valid = true; if( n == 0 ) { ret.value = 1.0; return ret; } else if( n == 1 ) { ret.value = f; return ret; } else if( n < 0 ) { if( f == 0 ) { ret.valid = false; ret.value = (T)1.0e30; return ret; } if( n == -1 ) { ret.value = T(1.0)/f; return ret; } } int num = n > 0 ? n : -n; if( num == 2 ) { ret.value = f*f; } else if( num == 3 ) { ret.value = f*f*f; } else { ret.value = 1.0; while(num>0) { if( num & 1 ) { ret.value *= f; } num >>= 1; f *= f; } } if( n < 0 ) { ret.value = T(1.0)/ret.value; } return ret; } /// solves the forward kinematics equations. /// \param pfree is an array specifying the free joints of the chain. IKFAST_API void ComputeFk(const IkReal* j, IkReal* eetrans, IkReal* eerot) { IkReal x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,x17,x18,x19,x20,x21,x22,x23,x24,x25,x26,x27,x28,x29,x30,x31,x32,x33,x34,x35,x36,x37,x38,x39,x40,x41,x42,x43,x44,x45,x46,x47,x48,x49,x50,x51,x52,x53,x54,x55,x56,x57,x58,x59,x60,x61,x62; x0=IKcos(j[2]); x1=IKsin(j[4]); x2=IKcos(j[3]); x3=IKcos(j[4]); x4=IKsin(j[2]); x5=IKsin(j[5]); x6=IKcos(j[5]); x7=IKsin(j[3]); x8=IKsin(j[6]); x9=IKcos(j[6]); x10=IKsin(j[7]); x11=IKcos(j[7]); x12=IKcos(j[1]); x13=IKsin(j[1]); x14=((0.31105)*x2); x15=((0.26375)*x6); x16=((1.0)*x7); x17=((1.0)*x0); x18=((1.0)*x12); x19=((0.26375)*x5); x20=((1.0)*x13); x21=((0.41)*x4); x22=((1.0)*x8); x23=((0.26375)*x1); x24=((1.0)*x9); x25=((1.0)*x2); x26=((0.31105)*x13); x27=(x12*x7); x28=(x1*x4); x29=(x3*x4); x30=(x0*x13); x31=(x4*x7); x32=(x12*x2); x33=(x0*x3); x34=(x1*x17); x35=(x13*x16); x36=((((-1.0)*x35))+((x0*x32))); x37=(((x2*x30))+x27); x38=((((-1.0)*x25*x29))+x34); x39=((((-1.0)*x17*x32))+x35); x40=((((-1.0)*x18*x2))+((x16*x30))); x41=(((x17*x3))+((x25*x28))); x42=((-1.0)*x41); x43=(((x2*x20))+((x0*x12*x16))); x44=((((-1.0)*x12*x16))+(((-1.0)*x13*x17*x2))); x45=(x3*x36); x46=(x3*x37); x47=(x40*x5); x48=(x43*x5); x49=(x1*x44); x50=(x42*x8); x51=(((x31*x5))+((x38*x6))); x52=(((x12*x29))+((x1*x39))); x53=((((-1.0)*x16*x4*x6))+((x5*(((((-1.0)*x2*x29))+(((1.0)*x34))))))); x54=((((-1.0)*x45))+(((-1.0)*x18*x28))); x55=(x49+((x13*x29))); x56=((((-1.0)*x46))+(((-1.0)*x20*x28))); x57=(x52*x8); x58=(x51*x9); x59=(x54*x6); x60=(((x43*x6))+((x5*((x45+((x12*x28))))))); x61=(((x56*x6))+x47); x62=(((x5*(((((-1.0)*x46))+(((-1.0)*x13*x28))))))+(((-1.0)*x40*x6))); eerot[0]=(((x51*x8))+((x41*x9))); eerot[1]=(((x11*x53))+((x10*((x58+x50))))); eerot[2]=(((x10*x53))+((x11*(((((-1.0)*x22*x42))+(((-1.0)*x24*x51))))))); eetrans[0]=((0.2844948)+((x9*(((((0.26375)*x33))+((x2*x23*x4))))))+(((0.41)*x0))+((x14*x28))+(((-0.0114)*x31))+(((0.31105)*x33))+((x8*((((x19*x31))+((x15*x38))))))); eerot[3]=(((x8*(((((-1.0)*x48))+(((-1.0)*x59))))))+((x52*x9))); eerot[4]=(((x11*x60))+(((-1.0)*x10*(((((1.0)*x57))+(((1.0)*x9*((((x6*(((((-1.0)*x45))+(((-1.0)*x12*x28))))))+x48))))))))); eerot[5]=(((x10*x60))+((x11*((((x9*((x48+x59))))+x57))))); IkReal x63=(x12*x29); eetrans[1]=((-0.13335)+((x1*((((x26*x7))+(((-1.0)*x0*x12*x14))))))+(((0.0114)*x13*x2))+(((0.0114)*x0*x27))+((x12*x21))+(((0.31105)*x63))+((x8*(((((-1.0)*x19*x43))+(((-1.0)*x15*x54))))))+((x9*((((x23*x39))+(((0.26375)*x63))))))); eerot[6]=(((x9*(((((-1.0)*x49))+(((-1.0)*x20*x29))))))+((x61*x8))); eerot[7]=(((x11*x62))+((x10*((((x55*x8))+((x61*x9))))))); eerot[8]=(((x10*x62))+((x11*(((((-1.0)*x24*x61))+(((-1.0)*x22*x55))))))); eetrans[2]=((0.75007)+(((0.0114)*x32))+((x8*((((x19*x40))+((x15*x56))))))+(((-1.0)*x13*x21))+((x9*(((((-0.26375)*x13*x29))+(((-1.0)*x23*x44))))))+(((-0.0114)*x30*x7))+j[0]+((x1*(((((0.31105)*x27))+((x14*x30))))))+(((-1.0)*x26*x29))); } IKFAST_API int GetNumFreeParameters() { return 2; } IKFAST_API int* GetFreeParameters() { static int freeparams[] = {0, 3}; return freeparams; } IKFAST_API int GetNumJoints() { return 8; } IKFAST_API int GetIkRealSize() { return sizeof(IkReal); } IKFAST_API int GetIkType() { return 0x67000001; } class IKSolver { public: IkReal j11,cj11,sj11,htj11,j11mul,j12,cj12,sj12,htj12,j12mul,j14,cj14,sj14,htj14,j14mul,j15,cj15,sj15,htj15,j15mul,j16,cj16,sj16,htj16,j16mul,j17,cj17,sj17,htj17,j17mul,j0,cj0,sj0,htj0,j13,cj13,sj13,htj13,new_r00,r00,rxp0_0,new_r01,r01,rxp0_1,new_r02,r02,rxp0_2,new_r10,r10,rxp1_0,new_r11,r11,rxp1_1,new_r12,r12,rxp1_2,new_r20,r20,rxp2_0,new_r21,r21,rxp2_1,new_r22,r22,rxp2_2,new_px,px,npx,new_py,py,npy,new_pz,pz,npz,pp; unsigned char _ij11[2], _nj11,_ij12[2], _nj12,_ij14[2], _nj14,_ij15[2], _nj15,_ij16[2], _nj16,_ij17[2], _nj17,_ij0[2], _nj0,_ij13[2], _nj13; IkReal j100, cj100, sj100; unsigned char _ij100[2], _nj100; bool ComputeIk(const IkReal* eetrans, const IkReal* eerot, const IkReal* pfree, IkSolutionListBase<IkReal>& solutions) { j11=numeric_limits<IkReal>::quiet_NaN(); _ij11[0] = -1; _ij11[1] = -1; _nj11 = -1; j12=numeric_limits<IkReal>::quiet_NaN(); _ij12[0] = -1; _ij12[1] = -1; _nj12 = -1; j14=numeric_limits<IkReal>::quiet_NaN(); _ij14[0] = -1; _ij14[1] = -1; _nj14 = -1; j15=numeric_limits<IkReal>::quiet_NaN(); _ij15[0] = -1; _ij15[1] = -1; _nj15 = -1; j16=numeric_limits<IkReal>::quiet_NaN(); _ij16[0] = -1; _ij16[1] = -1; _nj16 = -1; j17=numeric_limits<IkReal>::quiet_NaN(); _ij17[0] = -1; _ij17[1] = -1; _nj17 = -1; _ij0[0] = -1; _ij0[1] = -1; _nj0 = 0; _ij13[0] = -1; _ij13[1] = -1; _nj13 = 0; for(int dummyiter = 0; dummyiter < 1; ++dummyiter) { solutions.Clear(); j0=pfree[0]; cj0=cos(pfree[0]); sj0=sin(pfree[0]), htj0=tan(pfree[0]*0.5); j13=pfree[1]; cj13=cos(pfree[1]); sj13=sin(pfree[1]), htj13=tan(pfree[1]*0.5); r00 = eerot[0*3+0]; r01 = eerot[0*3+1]; r02 = eerot[0*3+2]; r10 = eerot[1*3+0]; r11 = eerot[1*3+1]; r12 = eerot[1*3+2]; r20 = eerot[2*3+0]; r21 = eerot[2*3+1]; r22 = eerot[2*3+2]; px = eetrans[0]; py = eetrans[1]; pz = eetrans[2]; new_r00=r12; new_r01=r11; new_r02=((-1.0)*r10); new_px=((0.13335)+(((-0.26375)*r10))+py); new_r10=((-1.0)*r22); new_r11=((-1.0)*r21); new_r12=r20; new_py=((0.75007)+(((-1.0)*pz))+(((0.26375)*r20))+j0); new_r20=((-1.0)*r02); new_r21=((-1.0)*r01); new_r22=r00; new_pz=((0.1657448)+(((0.26375)*r00))+(((-1.0)*px))); r00 = new_r00; r01 = new_r01; r02 = new_r02; r10 = new_r10; r11 = new_r11; r12 = new_r12; r20 = new_r20; r21 = new_r21; r22 = new_r22; px = new_px; py = new_py; pz = new_pz; IkReal x64=((1.0)*px); IkReal x65=((1.0)*pz); IkReal x66=((1.0)*py); pp=((px*px)+(py*py)+(pz*pz)); npx=(((px*r00))+((py*r10))+((pz*r20))); npy=(((px*r01))+((py*r11))+((pz*r21))); npz=(((px*r02))+((py*r12))+((pz*r22))); rxp0_0=((((-1.0)*r20*x66))+((pz*r10))); rxp0_1=(((px*r20))+(((-1.0)*r00*x65))); rxp0_2=((((-1.0)*r10*x64))+((py*r00))); rxp1_0=((((-1.0)*r21*x66))+((pz*r11))); rxp1_1=(((px*r21))+(((-1.0)*r01*x65))); rxp1_2=((((-1.0)*r11*x64))+((py*r01))); rxp2_0=(((pz*r12))+(((-1.0)*r22*x66))); rxp2_1=(((px*r22))+(((-1.0)*r02*x65))); rxp2_2=((((-1.0)*r12*x64))+((py*r02))); { IkReal j14array[2], cj14array[2], sj14array[2]; bool j14valid[2]={false}; _nj14 = 2; cj14array[0]=((-0.98360980314513)+(((3.92063075107523)*pp))+(((0.931149803380368)*pz))); if( cj14array[0] >= -1-IKFAST_SINCOS_THRESH && cj14array[0] <= 1+IKFAST_SINCOS_THRESH ) { j14valid[0] = j14valid[1] = true; j14array[0] = IKacos(cj14array[0]); sj14array[0] = IKsin(j14array[0]); cj14array[1] = cj14array[0]; j14array[1] = -j14array[0]; sj14array[1] = -sj14array[0]; } else if( isnan(cj14array[0]) ) { // probably any value will work j14valid[0] = true; cj14array[0] = 1; sj14array[0] = 0; j14array[0] = 0; } for(int ij14 = 0; ij14 < 2; ++ij14) { if( !j14valid[ij14] ) { continue; } _ij14[0] = ij14; _ij14[1] = -1; for(int iij14 = ij14+1; iij14 < 2; ++iij14) { if( j14valid[iij14] && IKabs(cj14array[ij14]-cj14array[iij14]) < IKFAST_SOLUTION_THRESH && IKabs(sj14array[ij14]-sj14array[iij14]) < IKFAST_SOLUTION_THRESH ) { j14valid[iij14]=false; _ij14[1] = iij14; break; } } j14 = j14array[ij14]; cj14 = cj14array[ij14]; sj14 = sj14array[ij14]; { IkReal j11eval[2]; j11eval[0]=((px*px)+(py*py)); j11eval[1]=((IKabs(px))+(IKabs(py))); if( IKabs(j11eval[0]) < 0.0000010000000000 || IKabs(j11eval[1]) < 0.0000010000000000 ) { { IkReal j12eval[2]; IkReal x67=(cj13*sj14); j12eval[0]=((IKabs(((-0.41)+(((-0.31105)*cj14)))))+(IKabs(((((0.0114)*sj13))+(((-0.31105)*x67)))))); j12eval[1]=((1293.47491535857)+(((-54.5701754385965)*sj13*x67))+(((744.4760118498)*(cj14*cj14)))+(((744.4760118498)*(x67*x67)))+(((1962.61157279163)*cj14))+(sj13*sj13)); if( IKabs(j12eval[0]) < 0.0000010000000000 || IKabs(j12eval[1]) < 0.0000010000000000 ) { { IkReal j11eval[2]; IkReal x68=py*py*py*py; IkReal x69=sj13*sj13*sj13*sj13; IkReal x70=px*px; IkReal x71=py*py; IkReal x72=cj13*cj13; IkReal x73=sj13*sj13; IkReal x74=cj13*cj13*cj13*cj13; IkReal x75=((1.0)*px*py); IkReal x76=((2.0)*x72); IkReal x77=(x71*x73); IkReal x78=(x70*x71); j11eval[0]=(((x70*x76*x77))+((x68*x73*x76))+((x69*x78))+((x68*x74))+((x68*x69))+((x74*x78))); j11eval[1]=((IKabs(((((-1.0)*x72*x75))+(((-1.0)*x73*x75)))))+(IKabs((x77+((x71*x72)))))); if( IKabs(j11eval[0]) < 0.0000010000000000 || IKabs(j11eval[1]) < 0.0000010000000000 ) { continue; // no branches [j11, j12] } else { { IkReal j11array[2], cj11array[2], sj11array[2]; bool j11valid[2]={false}; _nj11 = 2; IkReal x79=cj13*cj13; IkReal x80=py*py; IkReal x81=sj13*sj13; IkReal x82=((1.0)*px*py); IkReal x83=(((x79*x80))+((x80*x81))); IkReal x84=((((-1.0)*x81*x82))+(((-1.0)*x79*x82))); CheckValue<IkReal> x87 = IKatan2WithCheck(IkReal(x83),IkReal(x84),IKFAST_ATAN2_MAGTHRESH); if(!x87.valid){ continue; } IkReal x85=((1.0)*(x87.value)); if((((x83*x83)+(x84*x84))) < -0.00001) continue; CheckValue<IkReal> x88=IKPowWithIntegerCheck(IKabs(IKsqrt(((x83*x83)+(x84*x84)))),-1); if(!x88.valid){ continue; } if( (((x88.value)*(((((0.31105)*py*sj13*sj14))+(((0.0114)*cj13*py)))))) < -1-IKFAST_SINCOS_THRESH || (((x88.value)*(((((0.31105)*py*sj13*sj14))+(((0.0114)*cj13*py)))))) > 1+IKFAST_SINCOS_THRESH ) continue; IkReal x86=IKasin(((x88.value)*(((((0.31105)*py*sj13*sj14))+(((0.0114)*cj13*py)))))); j11array[0]=((((-1.0)*x86))+(((-1.0)*x85))); sj11array[0]=IKsin(j11array[0]); cj11array[0]=IKcos(j11array[0]); j11array[1]=((3.14159265358979)+x86+(((-1.0)*x85))); sj11array[1]=IKsin(j11array[1]); cj11array[1]=IKcos(j11array[1]); if( j11array[0] > IKPI ) { j11array[0]-=IK2PI; } else if( j11array[0] < -IKPI ) { j11array[0]+=IK2PI; } j11valid[0] = true; if( j11array[1] > IKPI ) { j11array[1]-=IK2PI; } else if( j11array[1] < -IKPI ) { j11array[1]+=IK2PI; } j11valid[1] = true; for(int ij11 = 0; ij11 < 2; ++ij11) { if( !j11valid[ij11] ) { continue; } _ij11[0] = ij11; _ij11[1] = -1; for(int iij11 = ij11+1; iij11 < 2; ++iij11) { if( j11valid[iij11] && IKabs(cj11array[ij11]-cj11array[iij11]) < IKFAST_SOLUTION_THRESH && IKabs(sj11array[ij11]-sj11array[iij11]) < IKFAST_SOLUTION_THRESH ) { j11valid[iij11]=false; _ij11[1] = iij11; break; } } j11 = j11array[ij11]; cj11 = cj11array[ij11]; sj11 = sj11array[ij11]; { IkReal evalcond[2]; IkReal x89=px*px; IkReal x90=sj13*sj13; IkReal x91=cj13*cj13; IkReal x92=IKcos(j11); IkReal x93=IKsin(j11); IkReal x94=(px*py); IkReal x95=((0.0114)*cj13); IkReal x96=((0.31105)*sj13*sj14); IkReal x97=((1.0)*x89); evalcond[0]=(((px*x95))+((px*x96))+((x93*(((((-1.0)*x90*x97))+(((-1.0)*x91*x97))))))+((x92*((((x90*x94))+((x91*x94))))))); evalcond[1]=((((-1.0)*px*x93))+((py*x92))+x95+x96); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH ) { continue; } } { IkReal j12eval[2]; IkReal x98=(pz*sj13); IkReal x99=(cj13*sj14); IkReal x100=(py*sj11); IkReal x101=(cj11*px); IkReal x102=((229.769159741459)*cj14); IkReal x103=((0.31105)*cj14); j12eval[0]=((((-27.2850877192982)*x99))+(((-1.0)*x101*x102))+(((-1.0)*x100*x102))+(((-302.86241920591)*x101))+(((-302.86241920591)*x100))+sj13+(((8.42105263157895)*x98))+(((-229.769159741459)*pz*x99))); j12eval[1]=IKsign(((((-0.0369371875)*x99))+(((-1.0)*x101*x103))+(((-0.31105)*pz*x99))+(((0.0114)*x98))+(((-1.0)*x100*x103))+(((-0.41)*x101))+(((-0.41)*x100))+(((0.00135375)*sj13)))); if( IKabs(j12eval[0]) < 0.0000010000000000 || IKabs(j12eval[1]) < 0.0000010000000000 ) { { IkReal j12eval[2]; IkReal x104=cj13*cj13; IkReal x105=cj14*cj14; IkReal x106=(cj13*sj13*sj14); IkReal x107=((13.6425438596491)*x105); IkReal x108=((0.0967521025)*x105); j12eval[0]=((-23.7212892382056)+(((-35.9649122807018)*cj14))+(((-1.0)*x107))+(((-13.6242188315186)*x104))+x106+((x104*x107))); j12eval[1]=IKsign(((-0.16822996)+(((-0.255061)*cj14))+(((-1.0)*x108))+(((-0.0966221425)*x104))+(((0.00709194)*x106))+((x104*x108)))); if( IKabs(j12eval[0]) < 0.0000010000000000 || IKabs(j12eval[1]) < 0.0000010000000000 ) { { IkReal j12eval[2]; IkReal x109=(py*sj11); IkReal x110=((0.0114)*sj13); IkReal x111=(cj13*sj14); IkReal x112=(cj14*pz); IkReal x113=(cj11*px); j12eval[0]=((4.27083333333333)+(((3.24010416666667)*cj14))+(((27.2850877192982)*x112))+(((-27.2850877192982)*x109*x111))+(((35.9649122807018)*pz))+(((-27.2850877192982)*x111*x113))+((sj13*x113))+((sj13*x109))); j12eval[1]=IKsign(((0.0486875)+((x110*x113))+(((-0.31105)*x109*x111))+(((-0.31105)*x111*x113))+((x109*x110))+(((0.41)*pz))+(((0.31105)*x112))+(((0.0369371875)*cj14)))); if( IKabs(j12eval[0]) < 0.0000010000000000 || IKabs(j12eval[1]) < 0.0000010000000000 ) { continue; // no branches [j12] } else { { IkReal j12array[1], cj12array[1], sj12array[1]; bool j12valid[1]={false}; _nj12 = 1; IkReal x114=cj11*cj11; IkReal x115=py*py; IkReal x116=(py*sj11); IkReal x117=((0.0114)*sj13); IkReal x118=(cj11*px); IkReal x119=(cj13*sj14); CheckValue<IkReal> x120=IKPowWithIntegerCheck(IKsign(((0.0486875)+(((0.31105)*cj14*pz))+(((0.41)*pz))+(((-0.31105)*x118*x119))+((x116*x117))+(((-0.31105)*x116*x119))+(((0.0369371875)*cj14))+((x117*x118)))),-1); if(!x120.valid){ continue; } CheckValue<IkReal> x121 = IKatan2WithCheck(IkReal(((((-0.0967521025)*cj14*x119))+(((0.11875)*x118))+(((0.11875)*x116))+((pz*x118))+((pz*x116))+(((-0.1275305)*x119))+(((0.00354597)*cj14*sj13))+(((0.004674)*sj13)))),IkReal(((-0.1681)+(((-0.255061)*cj14))+((x114*(px*px)))+(((2.0)*x116*x118))+x115+(((-0.0967521025)*(cj14*cj14)))+(((-1.0)*x114*x115)))),IKFAST_ATAN2_MAGTHRESH); if(!x121.valid){ continue; } j12array[0]=((-1.5707963267949)+(((1.5707963267949)*(x120.value)))+(x121.value)); sj12array[0]=IKsin(j12array[0]); cj12array[0]=IKcos(j12array[0]); if( j12array[0] > IKPI ) { j12array[0]-=IK2PI; } else if( j12array[0] < -IKPI ) { j12array[0]+=IK2PI; } j12valid[0] = true; for(int ij12 = 0; ij12 < 1; ++ij12) { if( !j12valid[ij12] ) { continue; } _ij12[0] = ij12; _ij12[1] = -1; for(int iij12 = ij12+1; iij12 < 1; ++iij12) { if( j12valid[iij12] && IKabs(cj12array[ij12]-cj12array[iij12]) < IKFAST_SOLUTION_THRESH && IKabs(sj12array[ij12]-sj12array[iij12]) < IKFAST_SOLUTION_THRESH ) { j12valid[iij12]=false; _ij12[1] = iij12; break; } } j12 = j12array[ij12]; cj12 = cj12array[ij12]; sj12 = sj12array[ij12]; { IkReal evalcond[6]; IkReal x122=IKcos(j12); IkReal x123=IKsin(j12); IkReal x124=((1.0)*pz); IkReal x125=((0.0114)*sj13); IkReal x126=((0.31105)*sj14); IkReal x127=((0.31105)*cj14); IkReal x128=(px*sj11); IkReal x129=(py*sj11); IkReal x130=(cj13*x123); IkReal x131=((1.0)*cj11*py); IkReal x132=((1.0)*x129); IkReal x133=(cj13*x122); IkReal x134=((1.0)*cj11*px); IkReal x135=(sj13*x123); IkReal x136=(pz*x122); IkReal x137=(sj13*x122); IkReal x138=(cj11*px*x123); evalcond[0]=((0.41)+(((-1.0)*x123*x134))+(((-1.0)*x123*x132))+(((0.11875)*x122))+x136+x127); evalcond[1]=((-0.11875)+(((-1.0)*x126*x130))+(((-0.41)*x122))+(((-1.0)*x124))+((x123*x125))+(((-1.0)*x122*x127))); evalcond[2]=((-0.0853195)+(((-0.097375)*x122))+(((0.82)*x123*x129))+(((-0.2375)*pz))+(((-1.0)*pp))+(((-0.82)*x136))+(((0.82)*x138))); evalcond[3]=((((-1.0)*x126*x133))+((x122*x125))+(((-1.0)*x134))+(((-1.0)*x132))+((x123*x127))+(((0.41)*x123))); evalcond[4]=((-0.0114)+(((-1.0)*cj13*x131))+((x129*x137))+(((0.11875)*x135))+((cj13*x128))+((pz*x135))+((cj11*px*x137))); evalcond[5]=((((-1.0)*sj13*x131))+(((-1.0)*x124*x130))+(((-1.0)*x133*x134))+(((-1.0)*x126))+(((-1.0)*x132*x133))+((sj13*x128))+(((-0.11875)*x130))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j12array[1], cj12array[1], sj12array[1]; bool j12valid[1]={false}; _nj12 = 1; IkReal x1060=cj14*cj14; IkReal x1061=cj13*cj13; IkReal x1062=(py*sj11); IkReal x1063=((0.0114)*sj13); IkReal x1064=(cj13*sj14); IkReal x1065=((0.31105)*cj14); IkReal x1066=(cj11*px); IkReal x1067=((0.0967521025)*x1060); CheckValue<IkReal> x1068 = IKatan2WithCheck(IkReal(((((-0.41)*x1062))+(((-0.41)*x1066))+(((-0.00135375)*sj13))+(((-1.0)*x1062*x1065))+(((-1.0)*pz*x1063))+(((0.31105)*pz*x1064))+(((0.0369371875)*x1064))+(((-1.0)*x1065*x1066)))),IkReal(((0.0486875)+(((-1.0)*x1063*x1066))+((pz*x1065))+(((-1.0)*x1062*x1063))+(((0.41)*pz))+(((0.31105)*x1064*x1066))+(((0.31105)*x1062*x1064))+(((0.0369371875)*cj14)))),IKFAST_ATAN2_MAGTHRESH); if(!x1068.valid){ continue; } CheckValue<IkReal> x1069=IKPowWithIntegerCheck(IKsign(((-0.16822996)+(((-0.255061)*cj14))+((x1061*x1067))+(((-0.0966221425)*x1061))+(((0.00709194)*sj13*x1064))+(((-1.0)*x1067)))),-1); if(!x1069.valid){ continue; } j12array[0]=((-1.5707963267949)+(x1068.value)+(((1.5707963267949)*(x1069.value)))); sj12array[0]=IKsin(j12array[0]); cj12array[0]=IKcos(j12array[0]); if( j12array[0] > IKPI ) { j12array[0]-=IK2PI; } else if( j12array[0] < -IKPI ) { j12array[0]+=IK2PI; } j12valid[0] = true; for(int ij12 = 0; ij12 < 1; ++ij12) { if( !j12valid[ij12] ) { continue; } _ij12[0] = ij12; _ij12[1] = -1; for(int iij12 = ij12+1; iij12 < 1; ++iij12) { if( j12valid[iij12] && IKabs(cj12array[ij12]-cj12array[iij12]) < IKFAST_SOLUTION_THRESH && IKabs(sj12array[ij12]-sj12array[iij12]) < IKFAST_SOLUTION_THRESH ) { j12valid[iij12]=false; _ij12[1] = iij12; break; } } j12 = j12array[ij12]; cj12 = cj12array[ij12]; sj12 = sj12array[ij12]; { IkReal evalcond[6]; IkReal x1070=IKcos(j12); IkReal x1071=IKsin(j12); IkReal x1072=((1.0)*pz); IkReal x1073=((0.0114)*sj13); IkReal x1074=((0.31105)*sj14); IkReal x1075=((0.31105)*cj14); IkReal x1076=(px*sj11); IkReal x1077=(py*sj11); IkReal x1078=(cj13*x1071); IkReal x1079=((1.0)*cj11*py); IkReal x1080=((1.0)*x1077); IkReal x1081=(cj13*x1070); IkReal x1082=((1.0)*cj11*px); IkReal x1083=(sj13*x1071); IkReal x1084=(pz*x1070); IkReal x1085=(sj13*x1070); IkReal x1086=(cj11*px*x1071); evalcond[0]=((0.41)+x1075+x1084+(((0.11875)*x1070))+(((-1.0)*x1071*x1082))+(((-1.0)*x1071*x1080))); evalcond[1]=((-0.11875)+(((-0.41)*x1070))+(((-1.0)*x1074*x1078))+(((-1.0)*x1070*x1075))+((x1071*x1073))+(((-1.0)*x1072))); evalcond[2]=((-0.0853195)+(((-0.2375)*pz))+(((-0.82)*x1084))+(((0.82)*x1086))+(((-1.0)*pp))+(((0.82)*x1071*x1077))+(((-0.097375)*x1070))); evalcond[3]=((((-1.0)*x1074*x1081))+(((0.41)*x1071))+((x1070*x1073))+((x1071*x1075))+(((-1.0)*x1080))+(((-1.0)*x1082))); evalcond[4]=((-0.0114)+((pz*x1083))+(((-1.0)*cj13*x1079))+((cj11*px*x1085))+((x1077*x1085))+(((0.11875)*x1083))+((cj13*x1076))); evalcond[5]=((((-0.11875)*x1078))+(((-1.0)*sj13*x1079))+(((-1.0)*x1081*x1082))+(((-1.0)*x1080*x1081))+((sj13*x1076))+(((-1.0)*x1072*x1078))+(((-1.0)*x1074))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j12array[1], cj12array[1], sj12array[1]; bool j12valid[1]={false}; _nj12 = 1; IkReal x1087=(cj11*px); IkReal x1088=(py*sj11); IkReal x1089=(cj13*sj14); IkReal x1090=((0.31105)*cj14); CheckValue<IkReal> x1091 = IKatan2WithCheck(IkReal(((-0.1539984375)+(((-0.255061)*cj14))+(((0.2375)*pz))+(pz*pz)+(((-0.0967521025)*(cj14*cj14))))),IkReal((((pz*x1087))+((pz*x1088))+(((-0.004674)*sj13))+(((0.0967521025)*cj14*x1089))+(((0.11875)*x1087))+(((0.11875)*x1088))+(((0.1275305)*x1089))+(((-0.00354597)*cj14*sj13)))),IKFAST_ATAN2_MAGTHRESH); if(!x1091.valid){ continue; } CheckValue<IkReal> x1092=IKPowWithIntegerCheck(IKsign(((((-1.0)*x1088*x1090))+(((-0.41)*x1087))+(((-0.41)*x1088))+(((-0.0369371875)*x1089))+(((0.00135375)*sj13))+(((-1.0)*x1087*x1090))+(((-0.31105)*pz*x1089))+(((0.0114)*pz*sj13)))),-1); if(!x1092.valid){ continue; } j12array[0]=((-1.5707963267949)+(x1091.value)+(((1.5707963267949)*(x1092.value)))); sj12array[0]=IKsin(j12array[0]); cj12array[0]=IKcos(j12array[0]); if( j12array[0] > IKPI ) { j12array[0]-=IK2PI; } else if( j12array[0] < -IKPI ) { j12array[0]+=IK2PI; } j12valid[0] = true; for(int ij12 = 0; ij12 < 1; ++ij12) { if( !j12valid[ij12] ) { continue; } _ij12[0] = ij12; _ij12[1] = -1; for(int iij12 = ij12+1; iij12 < 1; ++iij12) { if( j12valid[iij12] && IKabs(cj12array[ij12]-cj12array[iij12]) < IKFAST_SOLUTION_THRESH && IKabs(sj12array[ij12]-sj12array[iij12]) < IKFAST_SOLUTION_THRESH ) { j12valid[iij12]=false; _ij12[1] = iij12; break; } } j12 = j12array[ij12]; cj12 = cj12array[ij12]; sj12 = sj12array[ij12]; { IkReal evalcond[6]; IkReal x1093=IKcos(j12); IkReal x1094=IKsin(j12); IkReal x1095=((1.0)*pz); IkReal x1096=((0.0114)*sj13); IkReal x1097=((0.31105)*sj14); IkReal x1098=((0.31105)*cj14); IkReal x1099=(px*sj11); IkReal x1100=(py*sj11); IkReal x1101=(cj13*x1094); IkReal x1102=((1.0)*cj11*py); IkReal x1103=((1.0)*x1100); IkReal x1104=(cj13*x1093); IkReal x1105=((1.0)*cj11*px); IkReal x1106=(sj13*x1094); IkReal x1107=(pz*x1093); IkReal x1108=(sj13*x1093); IkReal x1109=(cj11*px*x1094); evalcond[0]=((0.41)+x1107+x1098+(((-1.0)*x1094*x1103))+(((-1.0)*x1094*x1105))+(((0.11875)*x1093))); evalcond[1]=((-0.11875)+(((-1.0)*x1095))+((x1094*x1096))+(((-1.0)*x1093*x1098))+(((-0.41)*x1093))+(((-1.0)*x1097*x1101))); evalcond[2]=((-0.0853195)+(((-0.82)*x1107))+(((-0.2375)*pz))+(((0.82)*x1109))+(((-0.097375)*x1093))+(((-1.0)*pp))+(((0.82)*x1094*x1100))); evalcond[3]=(((x1094*x1098))+(((0.41)*x1094))+((x1093*x1096))+(((-1.0)*x1103))+(((-1.0)*x1105))+(((-1.0)*x1097*x1104))); evalcond[4]=((-0.0114)+(((-1.0)*cj13*x1102))+(((0.11875)*x1106))+((cj13*x1099))+((pz*x1106))+((x1100*x1108))+((cj11*px*x1108))); evalcond[5]=((((-1.0)*x1103*x1104))+((sj13*x1099))+(((-1.0)*sj13*x1102))+(((-1.0)*x1097))+(((-1.0)*x1104*x1105))+(((-1.0)*x1095*x1101))+(((-0.11875)*x1101))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } } } } else { { IkReal j12array[2], cj12array[2], sj12array[2]; bool j12valid[2]={false}; _nj12 = 2; IkReal x1110=((-0.41)+(((-0.31105)*cj14))); IkReal x1111=((((0.0114)*sj13))+(((-0.31105)*cj13*sj14))); CheckValue<IkReal> x1114 = IKatan2WithCheck(IkReal(x1110),IkReal(x1111),IKFAST_ATAN2_MAGTHRESH); if(!x1114.valid){ continue; } IkReal x1112=((1.0)*(x1114.value)); if((((x1111*x1111)+(x1110*x1110))) < -0.00001) continue; CheckValue<IkReal> x1115=IKPowWithIntegerCheck(IKabs(IKsqrt(((x1111*x1111)+(x1110*x1110)))),-1); if(!x1115.valid){ continue; } if( (((-1.0)*(x1115.value)*(((-0.11875)+(((-1.0)*pz)))))) < -1-IKFAST_SINCOS_THRESH || (((-1.0)*(x1115.value)*(((-0.11875)+(((-1.0)*pz)))))) > 1+IKFAST_SINCOS_THRESH ) continue; IkReal x1113=((-1.0)*(IKasin(((-1.0)*(x1115.value)*(((-0.11875)+(((-1.0)*pz)))))))); j12array[0]=((((-1.0)*x1112))+(((-1.0)*x1113))); sj12array[0]=IKsin(j12array[0]); cj12array[0]=IKcos(j12array[0]); j12array[1]=((3.14159265358979)+(((1.0)*x1113))+(((-1.0)*x1112))); sj12array[1]=IKsin(j12array[1]); cj12array[1]=IKcos(j12array[1]); if( j12array[0] > IKPI ) { j12array[0]-=IK2PI; } else if( j12array[0] < -IKPI ) { j12array[0]+=IK2PI; } j12valid[0] = true; if( j12array[1] > IKPI ) { j12array[1]-=IK2PI; } else if( j12array[1] < -IKPI ) { j12array[1]+=IK2PI; } j12valid[1] = true; for(int ij12 = 0; ij12 < 2; ++ij12) { if( !j12valid[ij12] ) { continue; } _ij12[0] = ij12; _ij12[1] = -1; for(int iij12 = ij12+1; iij12 < 2; ++iij12) { if( j12valid[iij12] && IKabs(cj12array[ij12]-cj12array[iij12]) < IKFAST_SOLUTION_THRESH && IKabs(sj12array[ij12]-sj12array[iij12]) < IKFAST_SOLUTION_THRESH ) { j12valid[iij12]=false; _ij12[1] = iij12; break; } } j12 = j12array[ij12]; cj12 = cj12array[ij12]; sj12 = sj12array[ij12]; { IkReal j11eval[3]; IkReal x1116=(cj12*pz); IkReal x1117=((0.31105)*py); IkReal x1118=((0.31105)*px); IkReal x1119=((0.11875)*cj12); IkReal x1120=(sj12*sj13*sj14); IkReal x1121=((0.0114)*cj13*sj12); IkReal x1122=((((-1.0)*sj12*(pz*pz)))+((pp*sj12))); j11eval[0]=x1122; j11eval[1]=IKsign(x1122); j11eval[2]=((IKabs(((((-1.0)*x1117*x1120))+(((-1.0)*py*x1121))+(((0.41)*px))+((px*x1116))+((px*x1119))+((cj14*x1118)))))+(IKabs((((px*x1121))+(((0.41)*py))+((py*x1119))+((py*x1116))+((x1118*x1120))+((cj14*x1117)))))); if( IKabs(j11eval[0]) < 0.0000010000000000 || IKabs(j11eval[1]) < 0.0000010000000000 || IKabs(j11eval[2]) < 0.0000010000000000 ) { { IkReal j11eval[2]; IkReal x1123=(pp+(((-1.0)*(pz*pz)))); j11eval[0]=x1123; j11eval[1]=IKsign(x1123); if( IKabs(j11eval[0]) < 0.0000010000000000 || IKabs(j11eval[1]) < 0.0000010000000000 ) { { IkReal j11eval[2]; IkReal x1124=pz*pz; IkReal x1125=(pp*sj12); IkReal x1126=(sj12*x1124); j11eval[0]=(x1125+(((-1.0)*x1126))); j11eval[1]=IKsign(((((41.0)*x1125))+(((-41.0)*x1126)))); if( IKabs(j11eval[0]) < 0.0000010000000000 || IKabs(j11eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j12))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j11eval[3]; sj12=0; cj12=1.0; j12=0; IkReal x1127=(cj13*py); IkReal x1128=((0.31105)*sj14); IkReal x1129=((0.0114)*px); IkReal x1130=(py*sj13); IkReal x1131=(pp+(((-1.0)*(pz*pz)))); j11eval[0]=x1131; j11eval[1]=((IKabs(((((0.0114)*x1130))+((px*sj13*x1128))+(((-1.0)*x1127*x1128))+((cj13*x1129)))))+(IKabs(((((-0.0114)*x1127))+(((-1.0)*cj13*px*x1128))+(((-1.0)*x1128*x1130))+((sj13*x1129)))))); j11eval[2]=IKsign(x1131); if( IKabs(j11eval[0]) < 0.0000010000000000 || IKabs(j11eval[1]) < 0.0000010000000000 || IKabs(j11eval[2]) < 0.0000010000000000 ) { { IkReal j11eval[3]; sj12=0; cj12=1.0; j12=0; IkReal x1132=pz*pz; IkReal x1133=cj13*cj13; IkReal x1134=(cj13*pp); IkReal x1135=(cj13*sj13); IkReal x1136=((228.0)*px); IkReal x1137=((6221.0)*sj14); IkReal x1138=((228.0)*py); IkReal x1139=(cj13*x1132); j11eval[0]=(x1139+(((-1.0)*x1134))); j11eval[1]=IKsign(((((5000.0)*x1139))+(((-5000.0)*x1134)))); j11eval[2]=((IKabs(((((-1.0)*px*x1135*x1137))+((py*x1133*x1137))+(((-1.0)*x1135*x1138))+(((-1.0)*x1133*x1136)))))+(IKabs((((py*x1135*x1137))+(((-1.0)*x1135*x1136))+((px*x1133*x1137))+((x1133*x1138)))))); if( IKabs(j11eval[0]) < 0.0000010000000000 || IKabs(j11eval[1]) < 0.0000010000000000 || IKabs(j11eval[2]) < 0.0000010000000000 ) { { IkReal j11eval[2]; sj12=0; cj12=1.0; j12=0; IkReal x1140=pz*pz; IkReal x1141=(pp*sj13); IkReal x1142=(sj13*x1140); j11eval[0]=(x1141+(((-1.0)*x1142))); j11eval[1]=IKsign(((((5000.0)*x1141))+(((-5000.0)*x1142)))); if( IKabs(j11eval[0]) < 0.0000010000000000 || IKabs(j11eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j13))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j11eval[3]; sj12=0; cj12=1.0; j12=0; sj13=0; cj13=1.0; j13=0; IkReal x1143=pz*pz; IkReal x1144=((6221.0)*sj14); j11eval[0]=((((-1.0)*x1143))+pp); j11eval[1]=IKsign(((((-20000.0)*x1143))+(((20000.0)*pp)))); j11eval[2]=((IKabs(((((-228.0)*py))+(((-1.0)*px*x1144)))))+(IKabs(((((228.0)*px))+(((-1.0)*py*x1144)))))); if( IKabs(j11eval[0]) < 0.0000010000000000 || IKabs(j11eval[1]) < 0.0000010000000000 || IKabs(j11eval[2]) < 0.0000010000000000 ) { continue; // no branches [j11] } else { { IkReal j11array[1], cj11array[1], sj11array[1]; bool j11valid[1]={false}; _nj11 = 1; IkReal x1145=((6221.0)*sj14); CheckValue<IkReal> x1146 = IKatan2WithCheck(IkReal(((((228.0)*px))+(((-1.0)*py*x1145)))),IkReal(((((-228.0)*py))+(((-1.0)*px*x1145)))),IKFAST_ATAN2_MAGTHRESH); if(!x1146.valid){ continue; } CheckValue<IkReal> x1147=IKPowWithIntegerCheck(IKsign(((((-20000.0)*(pz*pz)))+(((20000.0)*pp)))),-1); if(!x1147.valid){ continue; } j11array[0]=((-1.5707963267949)+(x1146.value)+(((1.5707963267949)*(x1147.value)))); sj11array[0]=IKsin(j11array[0]); cj11array[0]=IKcos(j11array[0]); if( j11array[0] > IKPI ) { j11array[0]-=IK2PI; } else if( j11array[0] < -IKPI ) { j11array[0]+=IK2PI; } j11valid[0] = true; for(int ij11 = 0; ij11 < 1; ++ij11) { if( !j11valid[ij11] ) { continue; } _ij11[0] = ij11; _ij11[1] = -1; for(int iij11 = ij11+1; iij11 < 1; ++iij11) { if( j11valid[iij11] && IKabs(cj11array[ij11]-cj11array[iij11]) < IKFAST_SOLUTION_THRESH && IKabs(sj11array[ij11]-sj11array[iij11]) < IKFAST_SOLUTION_THRESH ) { j11valid[iij11]=false; _ij11[1] = iij11; break; } } j11 = j11array[ij11]; cj11 = cj11array[ij11]; sj11 = sj11array[ij11]; { IkReal evalcond[2]; IkReal x1148=IKsin(j11); IkReal x1149=IKcos(j11); IkReal x1150=((1.0)*px); evalcond[0]=((0.0114)+((py*x1149))+(((-1.0)*x1148*x1150))); evalcond[1]=((((-1.0)*x1149*x1150))+(((-1.0)*py*x1148))+(((-0.31105)*sj14))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j13)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j11eval[3]; sj12=0; cj12=1.0; j12=0; sj13=0; cj13=-1.0; j13=3.14159265358979; IkReal x1151=pz*pz; IkReal x1152=((6221.0)*sj14); j11eval[0]=((((-1.0)*x1151))+pp); j11eval[1]=IKsign(((((-20000.0)*x1151))+(((20000.0)*pp)))); j11eval[2]=((IKabs(((((228.0)*py))+((px*x1152)))))+(IKabs(((((-228.0)*px))+((py*x1152)))))); if( IKabs(j11eval[0]) < 0.0000010000000000 || IKabs(j11eval[1]) < 0.0000010000000000 || IKabs(j11eval[2]) < 0.0000010000000000 ) { continue; // no branches [j11] } else { { IkReal j11array[1], cj11array[1], sj11array[1]; bool j11valid[1]={false}; _nj11 = 1; IkReal x1153=((6221.0)*sj14); CheckValue<IkReal> x1154 = IKatan2WithCheck(IkReal(((((-228.0)*px))+((py*x1153)))),IkReal(((((228.0)*py))+((px*x1153)))),IKFAST_ATAN2_MAGTHRESH); if(!x1154.valid){ continue; } CheckValue<IkReal> x1155=IKPowWithIntegerCheck(IKsign(((((-20000.0)*(pz*pz)))+(((20000.0)*pp)))),-1); if(!x1155.valid){ continue; } j11array[0]=((-1.5707963267949)+(x1154.value)+(((1.5707963267949)*(x1155.value)))); sj11array[0]=IKsin(j11array[0]); cj11array[0]=IKcos(j11array[0]); if( j11array[0] > IKPI ) { j11array[0]-=IK2PI; } else if( j11array[0] < -IKPI ) { j11array[0]+=IK2PI; } j11valid[0] = true; for(int ij11 = 0; ij11 < 1; ++ij11) { if( !j11valid[ij11] ) { continue; } _ij11[0] = ij11; _ij11[1] = -1; for(int iij11 = ij11+1; iij11 < 1; ++iij11) { if( j11valid[iij11] && IKabs(cj11array[ij11]-cj11array[iij11]) < IKFAST_SOLUTION_THRESH && IKabs(sj11array[ij11]-sj11array[iij11]) < IKFAST_SOLUTION_THRESH ) { j11valid[iij11]=false; _ij11[1] = iij11; break; } } j11 = j11array[ij11]; cj11 = cj11array[ij11]; sj11 = sj11array[ij11]; { IkReal evalcond[2]; IkReal x1156=IKsin(j11); IkReal x1157=IKcos(j11); IkReal x1158=((1.0)*px); evalcond[0]=((-0.0114)+(((-1.0)*x1156*x1158))+((py*x1157))); evalcond[1]=((((-1.0)*x1157*x1158))+(((0.31105)*sj14))+(((-1.0)*py*x1156))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j13)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j11eval[3]; sj12=0; cj12=1.0; j12=0; sj13=1.0; cj13=0; j13=1.5707963267949; IkReal x1159=pz*pz; IkReal x1160=((6221.0)*sj14); j11eval[0]=((((-1.0)*x1159))+pp); j11eval[1]=IKsign(((((-20000.0)*x1159))+(((20000.0)*pp)))); j11eval[2]=((IKabs(((((228.0)*px))+(((-1.0)*py*x1160)))))+(IKabs((((px*x1160))+(((228.0)*py)))))); if( IKabs(j11eval[0]) < 0.0000010000000000 || IKabs(j11eval[1]) < 0.0000010000000000 || IKabs(j11eval[2]) < 0.0000010000000000 ) { continue; // no branches [j11] } else { { IkReal j11array[1], cj11array[1], sj11array[1]; bool j11valid[1]={false}; _nj11 = 1; IkReal x1161=((6221.0)*sj14); CheckValue<IkReal> x1162 = IKatan2WithCheck(IkReal((((px*x1161))+(((228.0)*py)))),IkReal(((((228.0)*px))+(((-1.0)*py*x1161)))),IKFAST_ATAN2_MAGTHRESH); if(!x1162.valid){ continue; } CheckValue<IkReal> x1163=IKPowWithIntegerCheck(IKsign(((((-20000.0)*(pz*pz)))+(((20000.0)*pp)))),-1); if(!x1163.valid){ continue; } j11array[0]=((-1.5707963267949)+(x1162.value)+(((1.5707963267949)*(x1163.value)))); sj11array[0]=IKsin(j11array[0]); cj11array[0]=IKcos(j11array[0]); if( j11array[0] > IKPI ) { j11array[0]-=IK2PI; } else if( j11array[0] < -IKPI ) { j11array[0]+=IK2PI; } j11valid[0] = true; for(int ij11 = 0; ij11 < 1; ++ij11) { if( !j11valid[ij11] ) { continue; } _ij11[0] = ij11; _ij11[1] = -1; for(int iij11 = ij11+1; iij11 < 1; ++iij11) { if( j11valid[iij11] && IKabs(cj11array[ij11]-cj11array[iij11]) < IKFAST_SOLUTION_THRESH && IKabs(sj11array[ij11]-sj11array[iij11]) < IKFAST_SOLUTION_THRESH ) { j11valid[iij11]=false; _ij11[1] = iij11; break; } } j11 = j11array[ij11]; cj11 = cj11array[ij11]; sj11 = sj11array[ij11]; { IkReal evalcond[2]; IkReal x1164=IKcos(j11); IkReal x1165=IKsin(j11); IkReal x1166=((1.0)*px); evalcond[0]=((0.0114)+(((-1.0)*py*x1165))+(((-1.0)*x1164*x1166))); evalcond[1]=((((0.31105)*sj14))+((py*x1164))+(((-1.0)*x1165*x1166))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j13)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j11eval[3]; sj12=0; cj12=1.0; j12=0; sj13=-1.0; cj13=0; j13=-1.5707963267949; IkReal x1167=pz*pz; IkReal x1168=((6221.0)*sj14); j11eval[0]=(x1167+(((-1.0)*pp))); j11eval[1]=IKsign(((((-20000.0)*pp))+(((20000.0)*x1167)))); j11eval[2]=((IKabs((((px*x1168))+(((228.0)*py)))))+(IKabs(((((228.0)*px))+(((-1.0)*py*x1168)))))); if( IKabs(j11eval[0]) < 0.0000010000000000 || IKabs(j11eval[1]) < 0.0000010000000000 || IKabs(j11eval[2]) < 0.0000010000000000 ) { continue; // no branches [j11] } else { { IkReal j11array[1], cj11array[1], sj11array[1]; bool j11valid[1]={false}; _nj11 = 1; IkReal x1169=((6221.0)*sj14); CheckValue<IkReal> x1170 = IKatan2WithCheck(IkReal((((px*x1169))+(((228.0)*py)))),IkReal(((((228.0)*px))+(((-1.0)*py*x1169)))),IKFAST_ATAN2_MAGTHRESH); if(!x1170.valid){ continue; } CheckValue<IkReal> x1171=IKPowWithIntegerCheck(IKsign(((((-20000.0)*pp))+(((20000.0)*(pz*pz))))),-1); if(!x1171.valid){ continue; } j11array[0]=((-1.5707963267949)+(x1170.value)+(((1.5707963267949)*(x1171.value)))); sj11array[0]=IKsin(j11array[0]); cj11array[0]=IKcos(j11array[0]); if( j11array[0] > IKPI ) { j11array[0]-=IK2PI; } else if( j11array[0] < -IKPI ) { j11array[0]+=IK2PI; } j11valid[0] = true; for(int ij11 = 0; ij11 < 1; ++ij11) { if( !j11valid[ij11] ) { continue; } _ij11[0] = ij11; _ij11[1] = -1; for(int iij11 = ij11+1; iij11 < 1; ++iij11) { if( j11valid[iij11] && IKabs(cj11array[ij11]-cj11array[iij11]) < IKFAST_SOLUTION_THRESH && IKabs(sj11array[ij11]-sj11array[iij11]) < IKFAST_SOLUTION_THRESH ) { j11valid[iij11]=false; _ij11[1] = iij11; break; } } j11 = j11array[ij11]; cj11 = cj11array[ij11]; sj11 = sj11array[ij11]; { IkReal evalcond[2]; IkReal x1172=IKcos(j11); IkReal x1173=IKsin(j11); IkReal x1174=((1.0)*px); evalcond[0]=((-0.0114)+(((-1.0)*x1172*x1174))+(((-1.0)*py*x1173))); evalcond[1]=((((-1.0)*x1173*x1174))+(((-0.31105)*sj14))+((py*x1172))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j11] } } while(0); if( bgotonextstatement ) { } } } } } } } else { { IkReal j11array[1], cj11array[1], sj11array[1]; bool j11valid[1]={false}; _nj11 = 1; IkReal x1175=cj13*cj13; IkReal x1176=((1555.25)*sj14); IkReal x1177=((5000.0)*sj13); IkReal x1178=(cj13*sj13); IkReal x1179=((57.0)*py); IkReal x1180=((57.0)*px); IkReal x1181=(py*x1175); CheckValue<IkReal> x1182 = IKatan2WithCheck(IkReal(((((-1.0)*px*x1175*x1176))+x1179+((x1178*x1180))+((px*x1176))+(((-1.0)*py*x1176*x1178))+(((-1.0)*x1175*x1179)))),IkReal(((((-1.0)*x1175*x1180))+x1180+((x1176*x1181))+(((-1.0)*py*x1176))+(((-1.0)*x1178*x1179))+(((-1.0)*px*x1176*x1178)))),IKFAST_ATAN2_MAGTHRESH); if(!x1182.valid){ continue; } CheckValue<IkReal> x1183=IKPowWithIntegerCheck(IKsign((((pp*x1177))+(((-1.0)*x1177*(pz*pz))))),-1); if(!x1183.valid){ continue; } j11array[0]=((-1.5707963267949)+(x1182.value)+(((1.5707963267949)*(x1183.value)))); sj11array[0]=IKsin(j11array[0]); cj11array[0]=IKcos(j11array[0]); if( j11array[0] > IKPI ) { j11array[0]-=IK2PI; } else if( j11array[0] < -IKPI ) { j11array[0]+=IK2PI; } j11valid[0] = true; for(int ij11 = 0; ij11 < 1; ++ij11) { if( !j11valid[ij11] ) { continue; } _ij11[0] = ij11; _ij11[1] = -1; for(int iij11 = ij11+1; iij11 < 1; ++iij11) { if( j11valid[iij11] && IKabs(cj11array[ij11]-cj11array[iij11]) < IKFAST_SOLUTION_THRESH && IKabs(sj11array[ij11]-sj11array[iij11]) < IKFAST_SOLUTION_THRESH ) { j11valid[iij11]=false; _ij11[1] = iij11; break; } } j11 = j11array[ij11]; cj11 = cj11array[ij11]; sj11 = sj11array[ij11]; { IkReal evalcond[4]; IkReal x1184=IKsin(j11); IkReal x1185=IKcos(j11); IkReal x1186=(px*sj13); IkReal x1187=(py*sj13); IkReal x1188=(cj13*px); IkReal x1189=(cj13*py); IkReal x1190=((0.31105)*sj14); IkReal x1191=((1.0)*x1185); IkReal x1192=((1.0)*x1184); evalcond[0]=(((py*x1185))+(((0.0114)*cj13))+(((-1.0)*px*x1192))+((sj13*x1190))); evalcond[1]=((((0.0114)*sj13))+(((-1.0)*cj13*x1190))+(((-1.0)*py*x1192))+(((-1.0)*px*x1191))); evalcond[2]=((-0.0114)+((x1184*x1187))+((x1184*x1188))+(((-1.0)*x1189*x1191))+((x1185*x1186))); evalcond[3]=(((x1184*x1186))+(((-1.0)*x1189*x1192))+(((-1.0)*x1188*x1191))+(((-1.0)*x1190))+(((-1.0)*x1187*x1191))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j11array[1], cj11array[1], sj11array[1]; bool j11valid[1]={false}; _nj11 = 1; IkReal x1193=cj13*cj13; IkReal x1194=((5000.0)*cj13); IkReal x1195=((1555.25)*sj14); IkReal x1196=(cj13*sj13); IkReal x1197=(px*x1193); IkReal x1198=(py*x1193); CheckValue<IkReal> x1199=IKPowWithIntegerCheck(IKsign(((((-1.0)*pp*x1194))+((x1194*(pz*pz))))),-1); if(!x1199.valid){ continue; } CheckValue<IkReal> x1200 = IKatan2WithCheck(IkReal((((x1195*x1198))+(((-57.0)*py*x1196))+(((-57.0)*x1197))+(((-1.0)*px*x1195*x1196)))),IkReal((((x1195*x1197))+((py*x1195*x1196))+(((57.0)*x1198))+(((-57.0)*px*x1196)))),IKFAST_ATAN2_MAGTHRESH); if(!x1200.valid){ continue; } j11array[0]=((-1.5707963267949)+(((1.5707963267949)*(x1199.value)))+(x1200.value)); sj11array[0]=IKsin(j11array[0]); cj11array[0]=IKcos(j11array[0]); if( j11array[0] > IKPI ) { j11array[0]-=IK2PI; } else if( j11array[0] < -IKPI ) { j11array[0]+=IK2PI; } j11valid[0] = true; for(int ij11 = 0; ij11 < 1; ++ij11) { if( !j11valid[ij11] ) { continue; } _ij11[0] = ij11; _ij11[1] = -1; for(int iij11 = ij11+1; iij11 < 1; ++iij11) { if( j11valid[iij11] && IKabs(cj11array[ij11]-cj11array[iij11]) < IKFAST_SOLUTION_THRESH && IKabs(sj11array[ij11]-sj11array[iij11]) < IKFAST_SOLUTION_THRESH ) { j11valid[iij11]=false; _ij11[1] = iij11; break; } } j11 = j11array[ij11]; cj11 = cj11array[ij11]; sj11 = sj11array[ij11]; { IkReal evalcond[4]; IkReal x1201=IKsin(j11); IkReal x1202=IKcos(j11); IkReal x1203=(px*sj13); IkReal x1204=(py*sj13); IkReal x1205=(cj13*px); IkReal x1206=(cj13*py); IkReal x1207=((0.31105)*sj14); IkReal x1208=((1.0)*x1202); IkReal x1209=((1.0)*x1201); evalcond[0]=(((sj13*x1207))+(((0.0114)*cj13))+((py*x1202))+(((-1.0)*px*x1209))); evalcond[1]=((((0.0114)*sj13))+(((-1.0)*px*x1208))+(((-1.0)*cj13*x1207))+(((-1.0)*py*x1209))); evalcond[2]=((-0.0114)+((x1202*x1203))+((x1201*x1205))+((x1201*x1204))+(((-1.0)*x1206*x1208))); evalcond[3]=((((-1.0)*x1204*x1208))+(((-1.0)*x1205*x1208))+((x1201*x1203))+(((-1.0)*x1207))+(((-1.0)*x1206*x1209))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j11array[1], cj11array[1], sj11array[1]; bool j11valid[1]={false}; _nj11 = 1; IkReal x1210=((0.0114)*py); IkReal x1211=(px*sj13); IkReal x1212=((0.31105)*sj14); IkReal x1213=(cj13*px); IkReal x1214=(py*x1212); CheckValue<IkReal> x1215=IKPowWithIntegerCheck(IKsign((pp+(((-1.0)*(pz*pz))))),-1); if(!x1215.valid){ continue; } CheckValue<IkReal> x1216 = IKatan2WithCheck(IkReal(((((-1.0)*cj13*x1214))+(((0.0114)*x1213))+((sj13*x1210))+((x1211*x1212)))),IkReal(((((-1.0)*cj13*x1210))+(((0.0114)*x1211))+(((-1.0)*x1212*x1213))+(((-1.0)*sj13*x1214)))),IKFAST_ATAN2_MAGTHRESH); if(!x1216.valid){ continue; } j11array[0]=((-1.5707963267949)+(((1.5707963267949)*(x1215.value)))+(x1216.value)); sj11array[0]=IKsin(j11array[0]); cj11array[0]=IKcos(j11array[0]); if( j11array[0] > IKPI ) { j11array[0]-=IK2PI; } else if( j11array[0] < -IKPI ) { j11array[0]+=IK2PI; } j11valid[0] = true; for(int ij11 = 0; ij11 < 1; ++ij11) { if( !j11valid[ij11] ) { continue; } _ij11[0] = ij11; _ij11[1] = -1; for(int iij11 = ij11+1; iij11 < 1; ++iij11) { if( j11valid[iij11] && IKabs(cj11array[ij11]-cj11array[iij11]) < IKFAST_SOLUTION_THRESH && IKabs(sj11array[ij11]-sj11array[iij11]) < IKFAST_SOLUTION_THRESH ) { j11valid[iij11]=false; _ij11[1] = iij11; break; } } j11 = j11array[ij11]; cj11 = cj11array[ij11]; sj11 = sj11array[ij11]; { IkReal evalcond[4]; IkReal x1217=IKsin(j11); IkReal x1218=IKcos(j11); IkReal x1219=(px*sj13); IkReal x1220=(py*sj13); IkReal x1221=(cj13*px); IkReal x1222=(cj13*py); IkReal x1223=((0.31105)*sj14); IkReal x1224=((1.0)*x1218); IkReal x1225=((1.0)*x1217); evalcond[0]=((((-1.0)*px*x1225))+(((0.0114)*cj13))+((sj13*x1223))+((py*x1218))); evalcond[1]=((((0.0114)*sj13))+(((-1.0)*px*x1224))+(((-1.0)*cj13*x1223))+(((-1.0)*py*x1225))); evalcond[2]=((-0.0114)+((x1217*x1221))+((x1217*x1220))+((x1218*x1219))+(((-1.0)*x1222*x1224))); evalcond[3]=((((-1.0)*x1223))+(((-1.0)*x1220*x1224))+(((-1.0)*x1221*x1224))+(((-1.0)*x1222*x1225))+((x1217*x1219))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j12)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j11eval[3]; sj12=0; cj12=-1.0; j12=3.14159265358979; IkReal x1226=(cj13*py); IkReal x1227=((0.31105)*sj14); IkReal x1228=((0.0114)*px); IkReal x1229=(py*sj13); IkReal x1230=(pp+(((-1.0)*(pz*pz)))); j11eval[0]=x1230; j11eval[1]=((IKabs(((((-1.0)*sj13*x1228))+(((-1.0)*x1227*x1229))+((cj13*px*x1227))+(((-0.0114)*x1226)))))+(IKabs((((px*sj13*x1227))+((cj13*x1228))+((x1226*x1227))+(((-0.0114)*x1229)))))); j11eval[2]=IKsign(x1230); if( IKabs(j11eval[0]) < 0.0000010000000000 || IKabs(j11eval[1]) < 0.0000010000000000 || IKabs(j11eval[2]) < 0.0000010000000000 ) { { IkReal j11eval[3]; sj12=0; cj12=-1.0; j12=3.14159265358979; IkReal x1231=cj13*cj13; IkReal x1232=pz*pz; IkReal x1233=(cj13*sj13); IkReal x1234=((228.0)*px); IkReal x1235=(cj13*pp); IkReal x1236=((6221.0)*sj14); IkReal x1237=((228.0)*py); IkReal x1238=(cj13*x1232); j11eval[0]=((((-1.0)*x1238))+x1235); j11eval[1]=((IKabs(((((-1.0)*py*x1233*x1236))+((px*x1231*x1236))+(((-1.0)*x1233*x1234))+(((-1.0)*x1231*x1237)))))+(IKabs((((px*x1233*x1236))+((x1231*x1234))+(((-1.0)*x1233*x1237))+((py*x1231*x1236)))))); j11eval[2]=IKsign(((((-20000.0)*x1238))+(((20000.0)*x1235)))); if( IKabs(j11eval[0]) < 0.0000010000000000 || IKabs(j11eval[1]) < 0.0000010000000000 || IKabs(j11eval[2]) < 0.0000010000000000 ) { { IkReal j11eval[3]; sj12=0; cj12=-1.0; j12=3.14159265358979; IkReal x1239=cj13*cj13; IkReal x1240=pz*pz; IkReal x1241=(cj13*pp); IkReal x1242=(cj13*sj13); IkReal x1243=((228.0)*px); IkReal x1244=((6221.0)*sj14); IkReal x1245=((228.0)*py); IkReal x1246=(cj13*x1240); j11eval[0]=(x1246+(((-1.0)*x1241))); j11eval[1]=((IKabs(((((-1.0)*x1239*x1243))+((x1242*x1245))+(((-1.0)*py*x1239*x1244))+(((-1.0)*px*x1242*x1244)))))+(IKabs(((((-1.0)*px*x1239*x1244))+((py*x1242*x1244))+((x1239*x1245))+((x1242*x1243)))))); j11eval[2]=IKsign(((((5000.0)*x1246))+(((-5000.0)*x1241)))); if( IKabs(j11eval[0]) < 0.0000010000000000 || IKabs(j11eval[1]) < 0.0000010000000000 || IKabs(j11eval[2]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j13)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j11eval[3]; sj12=0; cj12=-1.0; j12=3.14159265358979; sj13=1.0; cj13=0; j13=1.5707963267949; IkReal x1247=pz*pz; IkReal x1248=((6221.0)*sj14); j11eval[0]=((((-1.0)*x1247))+pp); j11eval[1]=IKsign(((((20000.0)*pp))+(((-20000.0)*x1247)))); j11eval[2]=((IKabs(((((-228.0)*py))+((px*x1248)))))+(IKabs(((((-1.0)*py*x1248))+(((-228.0)*px)))))); if( IKabs(j11eval[0]) < 0.0000010000000000 || IKabs(j11eval[1]) < 0.0000010000000000 || IKabs(j11eval[2]) < 0.0000010000000000 ) { continue; // no branches [j11] } else { { IkReal j11array[1], cj11array[1], sj11array[1]; bool j11valid[1]={false}; _nj11 = 1; IkReal x1249=((6221.0)*sj14); CheckValue<IkReal> x1250 = IKatan2WithCheck(IkReal(((((-228.0)*py))+((px*x1249)))),IkReal(((((-1.0)*py*x1249))+(((-228.0)*px)))),IKFAST_ATAN2_MAGTHRESH); if(!x1250.valid){ continue; } CheckValue<IkReal> x1251=IKPowWithIntegerCheck(IKsign(((((-20000.0)*(pz*pz)))+(((20000.0)*pp)))),-1); if(!x1251.valid){ continue; } j11array[0]=((-1.5707963267949)+(x1250.value)+(((1.5707963267949)*(x1251.value)))); sj11array[0]=IKsin(j11array[0]); cj11array[0]=IKcos(j11array[0]); if( j11array[0] > IKPI ) { j11array[0]-=IK2PI; } else if( j11array[0] < -IKPI ) { j11array[0]+=IK2PI; } j11valid[0] = true; for(int ij11 = 0; ij11 < 1; ++ij11) { if( !j11valid[ij11] ) { continue; } _ij11[0] = ij11; _ij11[1] = -1; for(int iij11 = ij11+1; iij11 < 1; ++iij11) { if( j11valid[iij11] && IKabs(cj11array[ij11]-cj11array[iij11]) < IKFAST_SOLUTION_THRESH && IKabs(sj11array[ij11]-sj11array[iij11]) < IKFAST_SOLUTION_THRESH ) { j11valid[iij11]=false; _ij11[1] = iij11; break; } } j11 = j11array[ij11]; cj11 = cj11array[ij11]; sj11 = sj11array[ij11]; { IkReal evalcond[2]; IkReal x1252=IKcos(j11); IkReal x1253=IKsin(j11); IkReal x1254=((1.0)*px); evalcond[0]=((-0.0114)+(((-1.0)*py*x1253))+(((-1.0)*x1252*x1254))); evalcond[1]=((((0.31105)*sj14))+(((-1.0)*x1253*x1254))+((py*x1252))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j13)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j11eval[3]; sj12=0; cj12=-1.0; j12=3.14159265358979; sj13=-1.0; cj13=0; j13=-1.5707963267949; IkReal x1255=pz*pz; IkReal x1256=((6221.0)*sj14); j11eval[0]=(pp+(((-1.0)*x1255))); j11eval[1]=IKsign(((((20000.0)*pp))+(((-20000.0)*x1255)))); j11eval[2]=((IKabs(((((228.0)*px))+((py*x1256)))))+(IKabs(((((228.0)*py))+(((-1.0)*px*x1256)))))); if( IKabs(j11eval[0]) < 0.0000010000000000 || IKabs(j11eval[1]) < 0.0000010000000000 || IKabs(j11eval[2]) < 0.0000010000000000 ) { continue; // no branches [j11] } else { { IkReal j11array[1], cj11array[1], sj11array[1]; bool j11valid[1]={false}; _nj11 = 1; IkReal x1257=((6221.0)*sj14); CheckValue<IkReal> x1258 = IKatan2WithCheck(IkReal(((((228.0)*py))+(((-1.0)*px*x1257)))),IkReal(((((228.0)*px))+((py*x1257)))),IKFAST_ATAN2_MAGTHRESH); if(!x1258.valid){ continue; } CheckValue<IkReal> x1259=IKPowWithIntegerCheck(IKsign(((((-20000.0)*(pz*pz)))+(((20000.0)*pp)))),-1); if(!x1259.valid){ continue; } j11array[0]=((-1.5707963267949)+(x1258.value)+(((1.5707963267949)*(x1259.value)))); sj11array[0]=IKsin(j11array[0]); cj11array[0]=IKcos(j11array[0]); if( j11array[0] > IKPI ) { j11array[0]-=IK2PI; } else if( j11array[0] < -IKPI ) { j11array[0]+=IK2PI; } j11valid[0] = true; for(int ij11 = 0; ij11 < 1; ++ij11) { if( !j11valid[ij11] ) { continue; } _ij11[0] = ij11; _ij11[1] = -1; for(int iij11 = ij11+1; iij11 < 1; ++iij11) { if( j11valid[iij11] && IKabs(cj11array[ij11]-cj11array[iij11]) < IKFAST_SOLUTION_THRESH && IKabs(sj11array[ij11]-sj11array[iij11]) < IKFAST_SOLUTION_THRESH ) { j11valid[iij11]=false; _ij11[1] = iij11; break; } } j11 = j11array[ij11]; cj11 = cj11array[ij11]; sj11 = sj11array[ij11]; { IkReal evalcond[2]; IkReal x1260=IKcos(j11); IkReal x1261=IKsin(j11); IkReal x1262=((1.0)*px); evalcond[0]=((0.0114)+(((-1.0)*x1260*x1262))+(((-1.0)*py*x1261))); evalcond[1]=((((-1.0)*x1261*x1262))+(((-0.31105)*sj14))+((py*x1260))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j11] } } while(0); if( bgotonextstatement ) { } } } } } else { { IkReal j11array[1], cj11array[1], sj11array[1]; bool j11valid[1]={false}; _nj11 = 1; IkReal x1263=cj13*cj13; IkReal x1264=((5000.0)*cj13); IkReal x1265=((1555.25)*sj14); IkReal x1266=(cj13*sj13); IkReal x1267=(px*x1263); IkReal x1268=(py*x1263); CheckValue<IkReal> x1269 = IKatan2WithCheck(IkReal(((((57.0)*py*x1266))+(((-57.0)*x1267))+(((-1.0)*x1265*x1268))+(((-1.0)*px*x1265*x1266)))),IkReal((((py*x1265*x1266))+(((57.0)*x1268))+(((-1.0)*x1265*x1267))+(((57.0)*px*x1266)))),IKFAST_ATAN2_MAGTHRESH); if(!x1269.valid){ continue; } CheckValue<IkReal> x1270=IKPowWithIntegerCheck(IKsign(((((-1.0)*pp*x1264))+((x1264*(pz*pz))))),-1); if(!x1270.valid){ continue; } j11array[0]=((-1.5707963267949)+(x1269.value)+(((1.5707963267949)*(x1270.value)))); sj11array[0]=IKsin(j11array[0]); cj11array[0]=IKcos(j11array[0]); if( j11array[0] > IKPI ) { j11array[0]-=IK2PI; } else if( j11array[0] < -IKPI ) { j11array[0]+=IK2PI; } j11valid[0] = true; for(int ij11 = 0; ij11 < 1; ++ij11) { if( !j11valid[ij11] ) { continue; } _ij11[0] = ij11; _ij11[1] = -1; for(int iij11 = ij11+1; iij11 < 1; ++iij11) { if( j11valid[iij11] && IKabs(cj11array[ij11]-cj11array[iij11]) < IKFAST_SOLUTION_THRESH && IKabs(sj11array[ij11]-sj11array[iij11]) < IKFAST_SOLUTION_THRESH ) { j11valid[iij11]=false; _ij11[1] = iij11; break; } } j11 = j11array[ij11]; cj11 = cj11array[ij11]; sj11 = sj11array[ij11]; { IkReal evalcond[4]; IkReal x1271=IKsin(j11); IkReal x1272=IKcos(j11); IkReal x1273=((1.0)*sj13); IkReal x1274=((0.31105)*sj14); IkReal x1275=(px*x1271); IkReal x1276=(py*x1271); IkReal x1277=(py*x1272); IkReal x1278=(px*x1272); evalcond[0]=(x1277+(((0.0114)*cj13))+((sj13*x1274))+(((-1.0)*x1275))); evalcond[1]=(((cj13*x1274))+(((-1.0)*x1276))+(((-1.0)*x1278))+(((-0.0114)*sj13))); evalcond[2]=((-0.0114)+(((-1.0)*cj13*x1277))+((cj13*x1275))+(((-1.0)*x1273*x1278))+(((-1.0)*x1273*x1276))); evalcond[3]=((((-1.0)*x1274))+((cj13*x1278))+((cj13*x1276))+(((-1.0)*x1273*x1277))+((sj13*x1275))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j11array[1], cj11array[1], sj11array[1]; bool j11valid[1]={false}; _nj11 = 1; IkReal x1279=cj13*cj13; IkReal x1280=(cj13*sj13); IkReal x1281=((228.0)*px); IkReal x1282=((6221.0)*sj14); IkReal x1283=((20000.0)*cj13); IkReal x1284=(py*x1279); CheckValue<IkReal> x1285 = IKatan2WithCheck(IkReal((((x1279*x1281))+((x1282*x1284))+(((-228.0)*py*x1280))+((px*x1280*x1282)))),IkReal(((((-228.0)*x1284))+(((-1.0)*py*x1280*x1282))+((px*x1279*x1282))+(((-1.0)*x1280*x1281)))),IKFAST_ATAN2_MAGTHRESH); if(!x1285.valid){ continue; } CheckValue<IkReal> x1286=IKPowWithIntegerCheck(IKsign((((pp*x1283))+(((-1.0)*x1283*(pz*pz))))),-1); if(!x1286.valid){ continue; } j11array[0]=((-1.5707963267949)+(x1285.value)+(((1.5707963267949)*(x1286.value)))); sj11array[0]=IKsin(j11array[0]); cj11array[0]=IKcos(j11array[0]); if( j11array[0] > IKPI ) { j11array[0]-=IK2PI; } else if( j11array[0] < -IKPI ) { j11array[0]+=IK2PI; } j11valid[0] = true; for(int ij11 = 0; ij11 < 1; ++ij11) { if( !j11valid[ij11] ) { continue; } _ij11[0] = ij11; _ij11[1] = -1; for(int iij11 = ij11+1; iij11 < 1; ++iij11) { if( j11valid[iij11] && IKabs(cj11array[ij11]-cj11array[iij11]) < IKFAST_SOLUTION_THRESH && IKabs(sj11array[ij11]-sj11array[iij11]) < IKFAST_SOLUTION_THRESH ) { j11valid[iij11]=false; _ij11[1] = iij11; break; } } j11 = j11array[ij11]; cj11 = cj11array[ij11]; sj11 = sj11array[ij11]; { IkReal evalcond[4]; IkReal x1287=IKsin(j11); IkReal x1288=IKcos(j11); IkReal x1289=((1.0)*sj13); IkReal x1290=((0.31105)*sj14); IkReal x1291=(px*x1287); IkReal x1292=(py*x1287); IkReal x1293=(py*x1288); IkReal x1294=(px*x1288); evalcond[0]=(x1293+((sj13*x1290))+(((0.0114)*cj13))+(((-1.0)*x1291))); evalcond[1]=(((cj13*x1290))+(((-1.0)*x1292))+(((-1.0)*x1294))+(((-0.0114)*sj13))); evalcond[2]=((-0.0114)+(((-1.0)*cj13*x1293))+(((-1.0)*x1289*x1292))+(((-1.0)*x1289*x1294))+((cj13*x1291))); evalcond[3]=(((sj13*x1291))+(((-1.0)*x1290))+(((-1.0)*x1289*x1293))+((cj13*x1294))+((cj13*x1292))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j11array[1], cj11array[1], sj11array[1]; bool j11valid[1]={false}; _nj11 = 1; IkReal x1295=((0.0114)*py); IkReal x1296=(px*sj13); IkReal x1297=((0.31105)*sj14); IkReal x1298=(cj13*px); IkReal x1299=(py*x1297); CheckValue<IkReal> x1300=IKPowWithIntegerCheck(IKsign((pp+(((-1.0)*(pz*pz))))),-1); if(!x1300.valid){ continue; } CheckValue<IkReal> x1301 = IKatan2WithCheck(IkReal((((x1296*x1297))+(((-1.0)*sj13*x1295))+(((0.0114)*x1298))+((cj13*x1299)))),IkReal((((x1297*x1298))+(((-1.0)*sj13*x1299))+(((-1.0)*cj13*x1295))+(((-0.0114)*x1296)))),IKFAST_ATAN2_MAGTHRESH); if(!x1301.valid){ continue; } j11array[0]=((-1.5707963267949)+(((1.5707963267949)*(x1300.value)))+(x1301.value)); sj11array[0]=IKsin(j11array[0]); cj11array[0]=IKcos(j11array[0]); if( j11array[0] > IKPI ) { j11array[0]-=IK2PI; } else if( j11array[0] < -IKPI ) { j11array[0]+=IK2PI; } j11valid[0] = true; for(int ij11 = 0; ij11 < 1; ++ij11) { if( !j11valid[ij11] ) { continue; } _ij11[0] = ij11; _ij11[1] = -1; for(int iij11 = ij11+1; iij11 < 1; ++iij11) { if( j11valid[iij11] && IKabs(cj11array[ij11]-cj11array[iij11]) < IKFAST_SOLUTION_THRESH && IKabs(sj11array[ij11]-sj11array[iij11]) < IKFAST_SOLUTION_THRESH ) { j11valid[iij11]=false; _ij11[1] = iij11; break; } } j11 = j11array[ij11]; cj11 = cj11array[ij11]; sj11 = sj11array[ij11]; { IkReal evalcond[4]; IkReal x1302=IKsin(j11); IkReal x1303=IKcos(j11); IkReal x1304=((1.0)*sj13); IkReal x1305=((0.31105)*sj14); IkReal x1306=(px*x1302); IkReal x1307=(py*x1302); IkReal x1308=(py*x1303); IkReal x1309=(px*x1303); evalcond[0]=(x1308+(((-1.0)*x1306))+((sj13*x1305))+(((0.0114)*cj13))); evalcond[1]=((((-1.0)*x1309))+(((-1.0)*x1307))+(((-0.0114)*sj13))+((cj13*x1305))); evalcond[2]=((-0.0114)+(((-1.0)*cj13*x1308))+(((-1.0)*x1304*x1309))+(((-1.0)*x1304*x1307))+((cj13*x1306))); evalcond[3]=(((sj13*x1306))+(((-1.0)*x1305))+(((-1.0)*x1304*x1308))+((cj13*x1309))+((cj13*x1307))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j11] } } while(0); if( bgotonextstatement ) { } } } } } else { { IkReal j11array[1], cj11array[1], sj11array[1]; bool j11valid[1]={false}; _nj11 = 1; IkReal x1310=(py*sj12); IkReal x1311=((0.4674)*cj13); IkReal x1312=(px*sj12); IkReal x1313=(cj12*py); IkReal x1314=((41.0)*sj12); IkReal x1315=((50.0)*pp); IkReal x1316=((11.875)*pz); IkReal x1317=((41.0)*pz); IkReal x1318=(cj12*px); IkReal x1319=((12.75305)*sj13*sj14); CheckValue<IkReal> x1320=IKPowWithIntegerCheck(IKsign(((((-1.0)*x1314*(pz*pz)))+((pp*x1314)))),-1); if(!x1320.valid){ continue; } CheckValue<IkReal> x1321 = IKatan2WithCheck(IkReal((((x1311*x1312))+(((4.86875)*x1313))+((x1313*x1317))+((py*x1316))+((py*x1315))+(((4.265975)*py))+((x1312*x1319)))),IkReal((((x1317*x1318))+(((4.86875)*x1318))+((px*x1315))+((px*x1316))+(((4.265975)*px))+(((-1.0)*x1310*x1311))+(((-1.0)*x1310*x1319)))),IKFAST_ATAN2_MAGTHRESH); if(!x1321.valid){ continue; } j11array[0]=((-1.5707963267949)+(((1.5707963267949)*(x1320.value)))+(x1321.value)); sj11array[0]=IKsin(j11array[0]); cj11array[0]=IKcos(j11array[0]); if( j11array[0] > IKPI ) { j11array[0]-=IK2PI; } else if( j11array[0] < -IKPI ) { j11array[0]+=IK2PI; } j11valid[0] = true; for(int ij11 = 0; ij11 < 1; ++ij11) { if( !j11valid[ij11] ) { continue; } _ij11[0] = ij11; _ij11[1] = -1; for(int iij11 = ij11+1; iij11 < 1; ++iij11) { if( j11valid[iij11] && IKabs(cj11array[ij11]-cj11array[iij11]) < IKFAST_SOLUTION_THRESH && IKabs(sj11array[ij11]-sj11array[iij11]) < IKFAST_SOLUTION_THRESH ) { j11valid[iij11]=false; _ij11[1] = iij11; break; } } j11 = j11array[ij11]; cj11 = cj11array[ij11]; sj11 = sj11array[ij11]; { IkReal evalcond[6]; IkReal x1322=IKcos(j11); IkReal x1323=IKsin(j11); IkReal x1324=(cj12*pz); IkReal x1325=((0.31105)*sj14); IkReal x1326=(pz*sj12); IkReal x1327=((0.31105)*cj14); IkReal x1328=(cj12*sj13); IkReal x1329=((1.0)*cj13); IkReal x1330=((0.11875)*sj12); IkReal x1331=(cj12*cj13); IkReal x1332=((0.82)*sj12); IkReal x1333=((1.0)*x1323); IkReal x1334=(py*x1322); IkReal x1335=(py*x1323); IkReal x1336=(px*x1322); IkReal x1337=(px*x1323); IkReal x1338=((1.0)*x1336); evalcond[0]=(x1334+((sj13*x1325))+(((-1.0)*px*x1333))+(((0.0114)*cj13))); evalcond[1]=((0.41)+x1327+x1324+(((0.11875)*cj12))+(((-1.0)*sj12*x1338))+(((-1.0)*py*sj12*x1333))); evalcond[2]=((-0.0853195)+(((-0.2375)*pz))+(((-0.82)*x1324))+(((-1.0)*pp))+(((-0.097375)*cj12))+((x1332*x1335))+((x1332*x1336))); evalcond[3]=(((sj12*x1327))+(((-1.0)*x1325*x1331))+(((-1.0)*py*x1333))+(((0.0114)*x1328))+(((-1.0)*x1338))+(((0.41)*sj12))); evalcond[4]=((-0.0114)+((cj13*x1337))+((sj13*x1326))+((sj13*x1330))+((x1328*x1336))+((x1328*x1335))+(((-1.0)*x1329*x1334))); evalcond[5]=((((-1.0)*x1325))+((sj13*x1337))+(((-1.0)*x1326*x1329))+(((-1.0)*cj13*x1330))+(((-1.0)*sj13*x1334))+(((-1.0)*cj12*x1329*x1335))+(((-1.0)*cj12*x1329*x1336))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j11array[1], cj11array[1], sj11array[1]; bool j11valid[1]={false}; _nj11 = 1; IkReal x1339=(cj12*cj13); IkReal x1340=((0.31105)*px); IkReal x1341=(cj14*sj12); IkReal x1342=((0.41)*sj12); IkReal x1343=((0.0114)*cj13); IkReal x1344=((0.31105)*py*sj14); IkReal x1345=((0.0114)*cj12*sj13); CheckValue<IkReal> x1346=IKPowWithIntegerCheck(IKsign((pp+(((-1.0)*(pz*pz))))),-1); if(!x1346.valid){ continue; } CheckValue<IkReal> x1347 = IKatan2WithCheck(IkReal((((sj13*sj14*x1340))+((px*x1343))+(((-1.0)*x1339*x1344))+(((0.31105)*py*x1341))+((py*x1345))+((py*x1342)))),IkReal(((((-1.0)*sj14*x1339*x1340))+(((-1.0)*py*x1343))+((x1340*x1341))+((px*x1342))+((px*x1345))+(((-1.0)*sj13*x1344)))),IKFAST_ATAN2_MAGTHRESH); if(!x1347.valid){ continue; } j11array[0]=((-1.5707963267949)+(((1.5707963267949)*(x1346.value)))+(x1347.value)); sj11array[0]=IKsin(j11array[0]); cj11array[0]=IKcos(j11array[0]); if( j11array[0] > IKPI ) { j11array[0]-=IK2PI; } else if( j11array[0] < -IKPI ) { j11array[0]+=IK2PI; } j11valid[0] = true; for(int ij11 = 0; ij11 < 1; ++ij11) { if( !j11valid[ij11] ) { continue; } _ij11[0] = ij11; _ij11[1] = -1; for(int iij11 = ij11+1; iij11 < 1; ++iij11) { if( j11valid[iij11] && IKabs(cj11array[ij11]-cj11array[iij11]) < IKFAST_SOLUTION_THRESH && IKabs(sj11array[ij11]-sj11array[iij11]) < IKFAST_SOLUTION_THRESH ) { j11valid[iij11]=false; _ij11[1] = iij11; break; } } j11 = j11array[ij11]; cj11 = cj11array[ij11]; sj11 = sj11array[ij11]; { IkReal evalcond[6]; IkReal x1348=IKcos(j11); IkReal x1349=IKsin(j11); IkReal x1350=(cj12*pz); IkReal x1351=((0.31105)*sj14); IkReal x1352=(pz*sj12); IkReal x1353=((0.31105)*cj14); IkReal x1354=(cj12*sj13); IkReal x1355=((1.0)*cj13); IkReal x1356=((0.11875)*sj12); IkReal x1357=(cj12*cj13); IkReal x1358=((0.82)*sj12); IkReal x1359=((1.0)*x1349); IkReal x1360=(py*x1348); IkReal x1361=(py*x1349); IkReal x1362=(px*x1348); IkReal x1363=(px*x1349); IkReal x1364=((1.0)*x1362); evalcond[0]=(x1360+(((-1.0)*px*x1359))+(((0.0114)*cj13))+((sj13*x1351))); evalcond[1]=((0.41)+x1353+x1350+(((0.11875)*cj12))+(((-1.0)*sj12*x1364))+(((-1.0)*py*sj12*x1359))); evalcond[2]=((-0.0853195)+(((-0.82)*x1350))+(((-0.2375)*pz))+((x1358*x1361))+((x1358*x1362))+(((-1.0)*pp))+(((-0.097375)*cj12))); evalcond[3]=((((-1.0)*x1351*x1357))+((sj12*x1353))+(((0.41)*sj12))+(((0.0114)*x1354))+(((-1.0)*py*x1359))+(((-1.0)*x1364))); evalcond[4]=((-0.0114)+((x1354*x1361))+((x1354*x1362))+(((-1.0)*x1355*x1360))+((sj13*x1352))+((sj13*x1356))+((cj13*x1363))); evalcond[5]=((((-1.0)*x1351))+(((-1.0)*x1352*x1355))+(((-1.0)*cj13*x1356))+(((-1.0)*sj13*x1360))+(((-1.0)*cj12*x1355*x1361))+(((-1.0)*cj12*x1355*x1362))+((sj13*x1363))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j11array[1], cj11array[1], sj11array[1]; bool j11valid[1]={false}; _nj11 = 1; IkReal x1365=(cj12*pz); IkReal x1366=((0.31105)*py); IkReal x1367=((0.31105)*px); IkReal x1368=((0.11875)*cj12); IkReal x1369=(sj12*sj13*sj14); IkReal x1370=((0.0114)*cj13*sj12); CheckValue<IkReal> x1371 = IKatan2WithCheck(IkReal((((x1367*x1369))+((px*x1370))+((cj14*x1366))+(((0.41)*py))+((py*x1365))+((py*x1368)))),IkReal(((((-1.0)*x1366*x1369))+((cj14*x1367))+(((0.41)*px))+((px*x1365))+((px*x1368))+(((-1.0)*py*x1370)))),IKFAST_ATAN2_MAGTHRESH); if(!x1371.valid){ continue; } CheckValue<IkReal> x1372=IKPowWithIntegerCheck(IKsign(((((-1.0)*sj12*(pz*pz)))+((pp*sj12)))),-1); if(!x1372.valid){ continue; } j11array[0]=((-1.5707963267949)+(x1371.value)+(((1.5707963267949)*(x1372.value)))); sj11array[0]=IKsin(j11array[0]); cj11array[0]=IKcos(j11array[0]); if( j11array[0] > IKPI ) { j11array[0]-=IK2PI; } else if( j11array[0] < -IKPI ) { j11array[0]+=IK2PI; } j11valid[0] = true; for(int ij11 = 0; ij11 < 1; ++ij11) { if( !j11valid[ij11] ) { continue; } _ij11[0] = ij11; _ij11[1] = -1; for(int iij11 = ij11+1; iij11 < 1; ++iij11) { if( j11valid[iij11] && IKabs(cj11array[ij11]-cj11array[iij11]) < IKFAST_SOLUTION_THRESH && IKabs(sj11array[ij11]-sj11array[iij11]) < IKFAST_SOLUTION_THRESH ) { j11valid[iij11]=false; _ij11[1] = iij11; break; } } j11 = j11array[ij11]; cj11 = cj11array[ij11]; sj11 = sj11array[ij11]; { IkReal evalcond[6]; IkReal x1373=IKcos(j11); IkReal x1374=IKsin(j11); IkReal x1375=(cj12*pz); IkReal x1376=((0.31105)*sj14); IkReal x1377=(pz*sj12); IkReal x1378=((0.31105)*cj14); IkReal x1379=(cj12*sj13); IkReal x1380=((1.0)*cj13); IkReal x1381=((0.11875)*sj12); IkReal x1382=(cj12*cj13); IkReal x1383=((0.82)*sj12); IkReal x1384=((1.0)*x1374); IkReal x1385=(py*x1373); IkReal x1386=(py*x1374); IkReal x1387=(px*x1373); IkReal x1388=(px*x1374); IkReal x1389=((1.0)*x1387); evalcond[0]=(x1385+((sj13*x1376))+(((0.0114)*cj13))+(((-1.0)*px*x1384))); evalcond[1]=((0.41)+x1375+x1378+(((-1.0)*py*sj12*x1384))+(((0.11875)*cj12))+(((-1.0)*sj12*x1389))); evalcond[2]=((-0.0853195)+(((-0.2375)*pz))+(((-0.82)*x1375))+(((-1.0)*pp))+(((-0.097375)*cj12))+((x1383*x1386))+((x1383*x1387))); evalcond[3]=((((-1.0)*x1389))+((sj12*x1378))+(((-1.0)*x1376*x1382))+(((0.0114)*x1379))+(((0.41)*sj12))+(((-1.0)*py*x1384))); evalcond[4]=((-0.0114)+((sj13*x1377))+((sj13*x1381))+((cj13*x1388))+(((-1.0)*x1380*x1385))+((x1379*x1386))+((x1379*x1387))); evalcond[5]=((((-1.0)*cj13*x1381))+(((-1.0)*x1377*x1380))+(((-1.0)*x1376))+((sj13*x1388))+(((-1.0)*sj13*x1385))+(((-1.0)*cj12*x1380*x1387))+(((-1.0)*cj12*x1380*x1386))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } } } } else { { IkReal j11array[2], cj11array[2], sj11array[2]; bool j11valid[2]={false}; _nj11 = 2; CheckValue<IkReal> x1392 = IKatan2WithCheck(IkReal(py),IkReal(((-1.0)*px)),IKFAST_ATAN2_MAGTHRESH); if(!x1392.valid){ continue; } IkReal x1390=((1.0)*(x1392.value)); if((((px*px)+(py*py))) < -0.00001) continue; CheckValue<IkReal> x1393=IKPowWithIntegerCheck(IKabs(IKsqrt(((px*px)+(py*py)))),-1); if(!x1393.valid){ continue; } if( (((x1393.value)*(((((0.0114)*cj13))+(((0.31105)*sj13*sj14)))))) < -1-IKFAST_SINCOS_THRESH || (((x1393.value)*(((((0.0114)*cj13))+(((0.31105)*sj13*sj14)))))) > 1+IKFAST_SINCOS_THRESH ) continue; IkReal x1391=IKasin(((x1393.value)*(((((0.0114)*cj13))+(((0.31105)*sj13*sj14)))))); j11array[0]=((((-1.0)*x1391))+(((-1.0)*x1390))); sj11array[0]=IKsin(j11array[0]); cj11array[0]=IKcos(j11array[0]); j11array[1]=((3.14159265358979)+x1391+(((-1.0)*x1390))); sj11array[1]=IKsin(j11array[1]); cj11array[1]=IKcos(j11array[1]); if( j11array[0] > IKPI ) { j11array[0]-=IK2PI; } else if( j11array[0] < -IKPI ) { j11array[0]+=IK2PI; } j11valid[0] = true; if( j11array[1] > IKPI ) { j11array[1]-=IK2PI; } else if( j11array[1] < -IKPI ) { j11array[1]+=IK2PI; } j11valid[1] = true; for(int ij11 = 0; ij11 < 2; ++ij11) { if( !j11valid[ij11] ) { continue; } _ij11[0] = ij11; _ij11[1] = -1; for(int iij11 = ij11+1; iij11 < 2; ++iij11) { if( j11valid[iij11] && IKabs(cj11array[ij11]-cj11array[iij11]) < IKFAST_SOLUTION_THRESH && IKabs(sj11array[ij11]-sj11array[iij11]) < IKFAST_SOLUTION_THRESH ) { j11valid[iij11]=false; _ij11[1] = iij11; break; } } j11 = j11array[ij11]; cj11 = cj11array[ij11]; sj11 = sj11array[ij11]; { IkReal j12eval[2]; IkReal x1394=(pz*sj13); IkReal x1395=(cj13*sj14); IkReal x1396=(py*sj11); IkReal x1397=(cj11*px); IkReal x1398=((229.769159741459)*cj14); IkReal x1399=((0.31105)*cj14); j12eval[0]=((((-302.86241920591)*x1396))+(((-302.86241920591)*x1397))+(((8.42105263157895)*x1394))+(((-1.0)*x1397*x1398))+(((-1.0)*x1396*x1398))+sj13+(((-27.2850877192982)*x1395))+(((-229.769159741459)*pz*x1395))); j12eval[1]=IKsign(((((0.0114)*x1394))+(((-1.0)*x1397*x1399))+(((-1.0)*x1396*x1399))+(((-0.41)*x1396))+(((-0.41)*x1397))+(((-0.31105)*pz*x1395))+(((-0.0369371875)*x1395))+(((0.00135375)*sj13)))); if( IKabs(j12eval[0]) < 0.0000010000000000 || IKabs(j12eval[1]) < 0.0000010000000000 ) { { IkReal j12eval[2]; IkReal x1400=cj13*cj13; IkReal x1401=cj14*cj14; IkReal x1402=(cj13*sj13*sj14); IkReal x1403=((13.6425438596491)*x1401); IkReal x1404=((0.0967521025)*x1401); j12eval[0]=((-23.7212892382056)+(((-35.9649122807018)*cj14))+(((-13.6242188315186)*x1400))+(((-1.0)*x1403))+x1402+((x1400*x1403))); j12eval[1]=IKsign(((-0.16822996)+(((-0.255061)*cj14))+(((0.00709194)*x1402))+(((-1.0)*x1404))+(((-0.0966221425)*x1400))+((x1400*x1404)))); if( IKabs(j12eval[0]) < 0.0000010000000000 || IKabs(j12eval[1]) < 0.0000010000000000 ) { { IkReal j12eval[2]; IkReal x1405=(py*sj11); IkReal x1406=((0.0114)*sj13); IkReal x1407=(cj13*sj14); IkReal x1408=(cj14*pz); IkReal x1409=(cj11*px); j12eval[0]=((4.27083333333333)+(((-27.2850877192982)*x1405*x1407))+(((-27.2850877192982)*x1407*x1409))+(((3.24010416666667)*cj14))+(((27.2850877192982)*x1408))+(((35.9649122807018)*pz))+((sj13*x1409))+((sj13*x1405))); j12eval[1]=IKsign(((0.0486875)+(((0.31105)*x1408))+(((-0.31105)*x1405*x1407))+((x1405*x1406))+(((0.41)*pz))+((x1406*x1409))+(((0.0369371875)*cj14))+(((-0.31105)*x1407*x1409)))); if( IKabs(j12eval[0]) < 0.0000010000000000 || IKabs(j12eval[1]) < 0.0000010000000000 ) { continue; // no branches [j12] } else { { IkReal j12array[1], cj12array[1], sj12array[1]; bool j12valid[1]={false}; _nj12 = 1; IkReal x1410=cj11*cj11; IkReal x1411=py*py; IkReal x1412=(py*sj11); IkReal x1413=((0.0114)*sj13); IkReal x1414=(cj11*px); IkReal x1415=(cj13*sj14); CheckValue<IkReal> x1416 = IKatan2WithCheck(IkReal((((pz*x1414))+((pz*x1412))+(((0.11875)*x1412))+(((0.11875)*x1414))+(((-0.0967521025)*cj14*x1415))+(((0.00354597)*cj14*sj13))+(((0.004674)*sj13))+(((-0.1275305)*x1415)))),IkReal(((-0.1681)+(((-0.255061)*cj14))+(((2.0)*x1412*x1414))+(((-1.0)*x1410*x1411))+(((-0.0967521025)*(cj14*cj14)))+x1411+((x1410*(px*px))))),IKFAST_ATAN2_MAGTHRESH); if(!x1416.valid){ continue; } CheckValue<IkReal> x1417=IKPowWithIntegerCheck(IKsign(((0.0486875)+((x1413*x1414))+((x1412*x1413))+(((0.31105)*cj14*pz))+(((-0.31105)*x1412*x1415))+(((0.41)*pz))+(((0.0369371875)*cj14))+(((-0.31105)*x1414*x1415)))),-1); if(!x1417.valid){ continue; } j12array[0]=((-1.5707963267949)+(x1416.value)+(((1.5707963267949)*(x1417.value)))); sj12array[0]=IKsin(j12array[0]); cj12array[0]=IKcos(j12array[0]); if( j12array[0] > IKPI ) { j12array[0]-=IK2PI; } else if( j12array[0] < -IKPI ) { j12array[0]+=IK2PI; } j12valid[0] = true; for(int ij12 = 0; ij12 < 1; ++ij12) { if( !j12valid[ij12] ) { continue; } _ij12[0] = ij12; _ij12[1] = -1; for(int iij12 = ij12+1; iij12 < 1; ++iij12) { if( j12valid[iij12] && IKabs(cj12array[ij12]-cj12array[iij12]) < IKFAST_SOLUTION_THRESH && IKabs(sj12array[ij12]-sj12array[iij12]) < IKFAST_SOLUTION_THRESH ) { j12valid[iij12]=false; _ij12[1] = iij12; break; } } j12 = j12array[ij12]; cj12 = cj12array[ij12]; sj12 = sj12array[ij12]; { IkReal evalcond[6]; IkReal x1418=IKcos(j12); IkReal x1419=IKsin(j12); IkReal x1420=((1.0)*pz); IkReal x1421=((0.0114)*sj13); IkReal x1422=((0.31105)*sj14); IkReal x1423=((0.31105)*cj14); IkReal x1424=(px*sj11); IkReal x1425=(py*sj11); IkReal x1426=(cj13*x1419); IkReal x1427=((1.0)*cj11*py); IkReal x1428=((1.0)*x1425); IkReal x1429=(cj13*x1418); IkReal x1430=((1.0)*cj11*px); IkReal x1431=(sj13*x1419); IkReal x1432=(pz*x1418); IkReal x1433=(sj13*x1418); IkReal x1434=(cj11*px*x1419); evalcond[0]=((0.41)+(((-1.0)*x1419*x1430))+(((0.11875)*x1418))+(((-1.0)*x1419*x1428))+x1423+x1432); evalcond[1]=((-0.11875)+(((-0.41)*x1418))+(((-1.0)*x1418*x1423))+(((-1.0)*x1422*x1426))+((x1419*x1421))+(((-1.0)*x1420))); evalcond[2]=((-0.0853195)+(((-0.82)*x1432))+(((-0.2375)*pz))+(((0.82)*x1434))+(((-1.0)*pp))+(((-0.097375)*x1418))+(((0.82)*x1419*x1425))); evalcond[3]=((((-1.0)*x1430))+(((-1.0)*x1422*x1429))+((x1419*x1423))+((x1418*x1421))+(((0.41)*x1419))+(((-1.0)*x1428))); evalcond[4]=((-0.0114)+(((0.11875)*x1431))+(((-1.0)*cj13*x1427))+((x1425*x1433))+((pz*x1431))+((cj11*px*x1433))+((cj13*x1424))); evalcond[5]=((((-0.11875)*x1426))+(((-1.0)*x1429*x1430))+(((-1.0)*x1420*x1426))+((sj13*x1424))+(((-1.0)*sj13*x1427))+(((-1.0)*x1428*x1429))+(((-1.0)*x1422))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j12array[1], cj12array[1], sj12array[1]; bool j12valid[1]={false}; _nj12 = 1; IkReal x1435=cj14*cj14; IkReal x1436=cj13*cj13; IkReal x1437=(py*sj11); IkReal x1438=((0.0114)*sj13); IkReal x1439=(cj13*sj14); IkReal x1440=((0.31105)*cj14); IkReal x1441=(cj11*px); IkReal x1442=((0.0967521025)*x1435); CheckValue<IkReal> x1443 = IKatan2WithCheck(IkReal(((((0.31105)*pz*x1439))+(((-0.41)*x1437))+(((-1.0)*x1437*x1440))+(((-0.00135375)*sj13))+(((-0.41)*x1441))+(((-1.0)*x1440*x1441))+(((-1.0)*pz*x1438))+(((0.0369371875)*x1439)))),IkReal(((0.0486875)+(((-1.0)*x1437*x1438))+(((-1.0)*x1438*x1441))+(((0.31105)*x1437*x1439))+(((0.31105)*x1439*x1441))+(((0.41)*pz))+((pz*x1440))+(((0.0369371875)*cj14)))),IKFAST_ATAN2_MAGTHRESH); if(!x1443.valid){ continue; } CheckValue<IkReal> x1444=IKPowWithIntegerCheck(IKsign(((-0.16822996)+(((-0.255061)*cj14))+((x1436*x1442))+(((0.00709194)*sj13*x1439))+(((-0.0966221425)*x1436))+(((-1.0)*x1442)))),-1); if(!x1444.valid){ continue; } j12array[0]=((-1.5707963267949)+(x1443.value)+(((1.5707963267949)*(x1444.value)))); sj12array[0]=IKsin(j12array[0]); cj12array[0]=IKcos(j12array[0]); if( j12array[0] > IKPI ) { j12array[0]-=IK2PI; } else if( j12array[0] < -IKPI ) { j12array[0]+=IK2PI; } j12valid[0] = true; for(int ij12 = 0; ij12 < 1; ++ij12) { if( !j12valid[ij12] ) { continue; } _ij12[0] = ij12; _ij12[1] = -1; for(int iij12 = ij12+1; iij12 < 1; ++iij12) { if( j12valid[iij12] && IKabs(cj12array[ij12]-cj12array[iij12]) < IKFAST_SOLUTION_THRESH && IKabs(sj12array[ij12]-sj12array[iij12]) < IKFAST_SOLUTION_THRESH ) { j12valid[iij12]=false; _ij12[1] = iij12; break; } } j12 = j12array[ij12]; cj12 = cj12array[ij12]; sj12 = sj12array[ij12]; { IkReal evalcond[6]; IkReal x1445=IKcos(j12); IkReal x1446=IKsin(j12); IkReal x1447=((1.0)*pz); IkReal x1448=((0.0114)*sj13); IkReal x1449=((0.31105)*sj14); IkReal x1450=((0.31105)*cj14); IkReal x1451=(px*sj11); IkReal x1452=(py*sj11); IkReal x1453=(cj13*x1446); IkReal x1454=((1.0)*cj11*py); IkReal x1455=((1.0)*x1452); IkReal x1456=(cj13*x1445); IkReal x1457=((1.0)*cj11*px); IkReal x1458=(sj13*x1446); IkReal x1459=(pz*x1445); IkReal x1460=(sj13*x1445); IkReal x1461=(cj11*px*x1446); evalcond[0]=((0.41)+(((-1.0)*x1446*x1457))+(((-1.0)*x1446*x1455))+x1450+x1459+(((0.11875)*x1445))); evalcond[1]=((-0.11875)+(((-1.0)*x1445*x1450))+(((-1.0)*x1447))+(((-1.0)*x1449*x1453))+(((-0.41)*x1445))+((x1446*x1448))); evalcond[2]=((-0.0853195)+(((0.82)*x1461))+(((-0.097375)*x1445))+(((-0.82)*x1459))+(((-0.2375)*pz))+(((-1.0)*pp))+(((0.82)*x1446*x1452))); evalcond[3]=(((x1445*x1448))+(((0.41)*x1446))+((x1446*x1450))+(((-1.0)*x1457))+(((-1.0)*x1455))+(((-1.0)*x1449*x1456))); evalcond[4]=((-0.0114)+((x1452*x1460))+(((0.11875)*x1458))+((pz*x1458))+((cj13*x1451))+((cj11*px*x1460))+(((-1.0)*cj13*x1454))); evalcond[5]=((((-1.0)*x1447*x1453))+(((-1.0)*x1455*x1456))+(((-0.11875)*x1453))+(((-1.0)*sj13*x1454))+(((-1.0)*x1449))+((sj13*x1451))+(((-1.0)*x1456*x1457))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j12array[1], cj12array[1], sj12array[1]; bool j12valid[1]={false}; _nj12 = 1; IkReal x1462=(cj11*px); IkReal x1463=(py*sj11); IkReal x1464=(cj13*sj14); IkReal x1465=((0.31105)*cj14); CheckValue<IkReal> x1466=IKPowWithIntegerCheck(IKsign(((((-0.31105)*pz*x1464))+(((-1.0)*x1462*x1465))+(((-1.0)*x1463*x1465))+(((-0.41)*x1462))+(((-0.41)*x1463))+(((0.00135375)*sj13))+(((-0.0369371875)*x1464))+(((0.0114)*pz*sj13)))),-1); if(!x1466.valid){ continue; } CheckValue<IkReal> x1467 = IKatan2WithCheck(IkReal(((-0.1539984375)+(((-0.255061)*cj14))+(((0.2375)*pz))+(pz*pz)+(((-0.0967521025)*(cj14*cj14))))),IkReal((((pz*x1462))+((pz*x1463))+(((-0.004674)*sj13))+(((0.11875)*x1462))+(((0.11875)*x1463))+(((0.1275305)*x1464))+(((0.0967521025)*cj14*x1464))+(((-0.00354597)*cj14*sj13)))),IKFAST_ATAN2_MAGTHRESH); if(!x1467.valid){ continue; } j12array[0]=((-1.5707963267949)+(((1.5707963267949)*(x1466.value)))+(x1467.value)); sj12array[0]=IKsin(j12array[0]); cj12array[0]=IKcos(j12array[0]); if( j12array[0] > IKPI ) { j12array[0]-=IK2PI; } else if( j12array[0] < -IKPI ) { j12array[0]+=IK2PI; } j12valid[0] = true; for(int ij12 = 0; ij12 < 1; ++ij12) { if( !j12valid[ij12] ) { continue; } _ij12[0] = ij12; _ij12[1] = -1; for(int iij12 = ij12+1; iij12 < 1; ++iij12) { if( j12valid[iij12] && IKabs(cj12array[ij12]-cj12array[iij12]) < IKFAST_SOLUTION_THRESH && IKabs(sj12array[ij12]-sj12array[iij12]) < IKFAST_SOLUTION_THRESH ) { j12valid[iij12]=false; _ij12[1] = iij12; break; } } j12 = j12array[ij12]; cj12 = cj12array[ij12]; sj12 = sj12array[ij12]; { IkReal evalcond[6]; IkReal x1468=IKcos(j12); IkReal x1469=IKsin(j12); IkReal x1470=((1.0)*pz); IkReal x1471=((0.0114)*sj13); IkReal x1472=((0.31105)*sj14); IkReal x1473=((0.31105)*cj14); IkReal x1474=(px*sj11); IkReal x1475=(py*sj11); IkReal x1476=(cj13*x1469); IkReal x1477=((1.0)*cj11*py); IkReal x1478=((1.0)*x1475); IkReal x1479=(cj13*x1468); IkReal x1480=((1.0)*cj11*px); IkReal x1481=(sj13*x1469); IkReal x1482=(pz*x1468); IkReal x1483=(sj13*x1468); IkReal x1484=(cj11*px*x1469); evalcond[0]=((0.41)+(((-1.0)*x1469*x1480))+(((0.11875)*x1468))+(((-1.0)*x1469*x1478))+x1473+x1482); evalcond[1]=((-0.11875)+(((-0.41)*x1468))+(((-1.0)*x1468*x1473))+(((-1.0)*x1470))+(((-1.0)*x1472*x1476))+((x1469*x1471))); evalcond[2]=((-0.0853195)+(((-0.82)*x1482))+(((-0.2375)*pz))+(((0.82)*x1484))+(((-1.0)*pp))+(((0.82)*x1469*x1475))+(((-0.097375)*x1468))); evalcond[3]=((((-1.0)*x1480))+(((0.41)*x1469))+(((-1.0)*x1478))+((x1468*x1471))+(((-1.0)*x1472*x1479))+((x1469*x1473))); evalcond[4]=((-0.0114)+(((-1.0)*cj13*x1477))+((pz*x1481))+(((0.11875)*x1481))+((cj11*px*x1483))+((cj13*x1474))+((x1475*x1483))); evalcond[5]=((((-1.0)*x1478*x1479))+(((-1.0)*x1479*x1480))+(((-1.0)*sj13*x1477))+(((-1.0)*x1470*x1476))+((sj13*x1474))+(((-1.0)*x1472))+(((-0.11875)*x1476))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } } } } } } return solutions.GetNumSolutions()>0; } inline void rotationfunction0(IkSolutionListBase<IkReal>& solutions) { for(int rotationiter = 0; rotationiter < 1; ++rotationiter) { IkReal x139=((1.0)*sj11); IkReal x140=(cj14*sj13); IkReal x141=(cj12*sj14); IkReal x142=(cj12*cj14); IkReal x143=((1.0)*sj12); IkReal x144=(sj13*sj14); IkReal x145=(cj13*sj12); IkReal x146=(cj12*sj13); IkReal x147=(((cj13*x142))+((sj12*sj14))); IkReal x148=(((cj14*x145))+(((-1.0)*x141))); IkReal x149=(((cj11*cj13))+(((-1.0)*x139*x146))); IkReal x150=(((cj13*x141))+(((-1.0)*cj14*x143))); IkReal x151=(x142+((sj14*x145))); IkReal x152=(cj11*x150); IkReal x153=((((-1.0)*cj13*x139))+(((-1.0)*cj11*x146))); IkReal x154=(((cj11*x140))+((sj11*x147))); IkReal x155=(((cj11*x147))+(((-1.0)*x139*x140))); IkReal x156=(((cj11*x144))+((sj11*x150))); IkReal x157=((((-1.0)*x139*x144))+x152); new_r00=(((r20*x148))+((r00*x155))+((r10*x154))); new_r01=(((r01*x155))+((r21*x148))+((r11*x154))); new_r02=(((r02*x155))+((r22*x148))+((r12*x154))); new_r10=((((-1.0)*r20*sj13*x143))+((r00*x153))+((r10*x149))); new_r11=(((r01*x153))+(((-1.0)*r21*sj13*x143))+((r11*x149))); new_r12=((((-1.0)*r22*sj13*x143))+((r02*x153))+((r12*x149))); new_r20=(((r20*x151))+((r00*((x152+(((-1.0)*sj11*x144))))))+((r10*x156))); new_r21=(((r01*x157))+((r21*x151))+((r11*x156))); new_r22=(((r22*x151))+((r02*x157))+((r12*x156))); { IkReal j16array[2], cj16array[2], sj16array[2]; bool j16valid[2]={false}; _nj16 = 2; cj16array[0]=new_r22; if( cj16array[0] >= -1-IKFAST_SINCOS_THRESH && cj16array[0] <= 1+IKFAST_SINCOS_THRESH ) { j16valid[0] = j16valid[1] = true; j16array[0] = IKacos(cj16array[0]); sj16array[0] = IKsin(j16array[0]); cj16array[1] = cj16array[0]; j16array[1] = -j16array[0]; sj16array[1] = -sj16array[0]; } else if( isnan(cj16array[0]) ) { // probably any value will work j16valid[0] = true; cj16array[0] = 1; sj16array[0] = 0; j16array[0] = 0; } for(int ij16 = 0; ij16 < 2; ++ij16) { if( !j16valid[ij16] ) { continue; } _ij16[0] = ij16; _ij16[1] = -1; for(int iij16 = ij16+1; iij16 < 2; ++iij16) { if( j16valid[iij16] && IKabs(cj16array[ij16]-cj16array[iij16]) < IKFAST_SOLUTION_THRESH && IKabs(sj16array[ij16]-sj16array[iij16]) < IKFAST_SOLUTION_THRESH ) { j16valid[iij16]=false; _ij16[1] = iij16; break; } } j16 = j16array[ij16]; cj16 = cj16array[ij16]; sj16 = sj16array[ij16]; { IkReal j17eval[3]; j17eval[0]=sj16; j17eval[1]=IKsign(sj16); j17eval[2]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(j17eval[0]) < 0.0000010000000000 || IKabs(j17eval[1]) < 0.0000010000000000 || IKabs(j17eval[2]) < 0.0000010000000000 ) { { IkReal j15eval[3]; j15eval[0]=sj16; j15eval[1]=IKsign(sj16); j15eval[2]=((IKabs(new_r12))+(IKabs(new_r02))); if( IKabs(j15eval[0]) < 0.0000010000000000 || IKabs(j15eval[1]) < 0.0000010000000000 || IKabs(j15eval[2]) < 0.0000010000000000 ) { { IkReal j15eval[2]; j15eval[0]=new_r12; j15eval[1]=sj16; if( IKabs(j15eval[0]) < 0.0000010000000000 || IKabs(j15eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[5]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j16))), 6.28318530717959))); evalcond[1]=new_r02; evalcond[2]=new_r12; evalcond[3]=new_r20; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; IkReal j17mul = 1; j17=0; j15mul=-1.0; if( IKabs(((-1.0)*new_r10)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r00)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r10))+IKsqr(((-1.0)*new_r00))-1) <= IKFAST_SINCOS_THRESH ) continue; j15=IKatan2(((-1.0)*new_r10), ((-1.0)*new_r00)); { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].fmul = j15mul; vinfos[5].freeind = 0; vinfos[5].maxsolutions = 0; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].fmul = j17mul; vinfos[7].freeind = 0; vinfos[7].maxsolutions = 0; std::vector<int> vfree(1); vfree[0] = 7; solutions.AddSolution(vinfos,vfree); } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j16)))), 6.28318530717959))); evalcond[1]=new_r02; evalcond[2]=new_r12; evalcond[3]=new_r20; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; IkReal j17mul = 1; j17=0; j15mul=1.0; if( IKabs(new_r10) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r11)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r10)+IKsqr(((-1.0)*new_r11))-1) <= IKFAST_SINCOS_THRESH ) continue; j15=IKatan2(new_r10, ((-1.0)*new_r11)); { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].fmul = j15mul; vinfos[5].freeind = 0; vinfos[5].maxsolutions = 0; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].fmul = j17mul; vinfos[7].freeind = 0; vinfos[7].maxsolutions = 0; std::vector<int> vfree(1); vfree[0] = 7; solutions.AddSolution(vinfos,vfree); } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j15eval[1]; new_r21=0; new_r20=0; new_r02=0; new_r12=0; IkReal x158=new_r22*new_r22; IkReal x159=((16.0)*new_r10); IkReal x160=((16.0)*new_r01); IkReal x161=((16.0)*new_r22); IkReal x162=((8.0)*new_r11); IkReal x163=((8.0)*new_r00); IkReal x164=(x158*x159); IkReal x165=(x158*x160); j15eval[0]=((IKabs(((((-1.0)*new_r22*x163))+((x158*x162)))))+(IKabs(((((-32.0)*new_r00*x158))+((new_r11*x161))+(((16.0)*new_r00)))))+(IKabs(((((-1.0)*x163))+((new_r22*x162)))))+(IKabs(((((-1.0)*new_r00*x161))+(((32.0)*new_r11))+(((-16.0)*new_r11*x158)))))+(IKabs(((((-1.0)*x160))+x165)))+(IKabs(((((-1.0)*x159))+x164)))+(IKabs(((((-1.0)*x165))+x160)))+(IKabs(((((-1.0)*x164))+x159)))); if( IKabs(j15eval[0]) < 0.0000000100000000 ) { continue; // no branches [j15, j17] } else { IkReal op[4+1], zeror[4]; int numroots; IkReal j15evalpoly[1]; IkReal x166=new_r22*new_r22; IkReal x167=((16.0)*new_r10); IkReal x168=(new_r11*new_r22); IkReal x169=(x166*x167); IkReal x170=((((8.0)*x168))+(((-8.0)*new_r00))); op[0]=x170; op[1]=((((-1.0)*x169))+x167); op[2]=((((-32.0)*new_r00*x166))+(((16.0)*new_r00))+(((16.0)*x168))); op[3]=((((-1.0)*x167))+x169); op[4]=x170; polyroots4(op,zeror,numroots); IkReal j15array[4], cj15array[4], sj15array[4], tempj15array[1]; int numsolutions = 0; for(int ij15 = 0; ij15 < numroots; ++ij15) { IkReal htj15 = zeror[ij15]; tempj15array[0]=((2.0)*(atan(htj15))); for(int kj15 = 0; kj15 < 1; ++kj15) { j15array[numsolutions] = tempj15array[kj15]; if( j15array[numsolutions] > IKPI ) { j15array[numsolutions]-=IK2PI; } else if( j15array[numsolutions] < -IKPI ) { j15array[numsolutions]+=IK2PI; } sj15array[numsolutions] = IKsin(j15array[numsolutions]); cj15array[numsolutions] = IKcos(j15array[numsolutions]); numsolutions++; } } bool j15valid[4]={true,true,true,true}; _nj15 = 4; for(int ij15 = 0; ij15 < numsolutions; ++ij15) { if( !j15valid[ij15] ) { continue; } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; htj15 = IKtan(j15/2); IkReal x171=new_r22*new_r22; IkReal x172=((16.0)*new_r01); IkReal x173=(new_r00*new_r22); IkReal x174=((8.0)*x173); IkReal x175=(new_r11*x171); IkReal x176=(x171*x172); IkReal x177=((8.0)*x175); j15evalpoly[0]=(((htj15*(((((-1.0)*x176))+x172))))+(((htj15*htj15*htj15*htj15)*(((((-1.0)*x174))+x177))))+(((htj15*htj15*htj15)*(((((-1.0)*x172))+x176))))+(((-1.0)*x174))+x177+(((htj15*htj15)*(((((32.0)*new_r11))+(((-16.0)*x173))+(((-16.0)*x175))))))); if( IKabs(j15evalpoly[0]) > 0.0000001000000000 ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < numsolutions; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } { IkReal j17eval[3]; new_r21=0; new_r20=0; new_r02=0; new_r12=0; IkReal x178=cj15*cj15; IkReal x179=new_r22*new_r22; IkReal x180=(new_r22*sj15); IkReal x181=((1.0)*cj15); IkReal x182=(x179+x178+(((-1.0)*x178*x179))); j17eval[0]=x182; j17eval[1]=((IKabs((((new_r11*x180))+(((-1.0)*new_r10*x181)))))+(IKabs(((((-1.0)*new_r11*x181))+(((-1.0)*new_r10*x180)))))); j17eval[2]=IKsign(x182); if( IKabs(j17eval[0]) < 0.0000010000000000 || IKabs(j17eval[1]) < 0.0000010000000000 || IKabs(j17eval[2]) < 0.0000010000000000 ) { { IkReal j17eval[1]; new_r21=0; new_r20=0; new_r02=0; new_r12=0; j17eval[0]=new_r22; if( IKabs(j17eval[0]) < 0.0000010000000000 ) { { IkReal j17eval[1]; new_r21=0; new_r20=0; new_r02=0; new_r12=0; j17eval[0]=cj15; if( IKabs(j17eval[0]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j15)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; if( IKabs(new_r00) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r01) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r00)+IKsqr(new_r01)-1) <= IKFAST_SINCOS_THRESH ) continue; j17array[0]=IKatan2(new_r00, new_r01); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[4]; IkReal x183=IKsin(j17); IkReal x184=IKcos(j17); evalcond[0]=x183; evalcond[1]=((-1.0)*x184); evalcond[2]=(x183+(((-1.0)*new_r00))); evalcond[3]=(x184+(((-1.0)*new_r01))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j15)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; if( IKabs(((-1.0)*new_r00)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r01)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r00))+IKsqr(((-1.0)*new_r01))-1) <= IKFAST_SINCOS_THRESH ) continue; j17array[0]=IKatan2(((-1.0)*new_r00), ((-1.0)*new_r01)); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[4]; IkReal x185=IKsin(j17); IkReal x186=IKcos(j17); evalcond[0]=x185; evalcond[1]=(x185+new_r00); evalcond[2]=(x186+new_r01); evalcond[3]=((-1.0)*x186); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { IkReal x187=new_r22*new_r22; CheckValue<IkReal> x188=IKPowWithIntegerCheck(((1.0)+(((-1.0)*x187))),-1); if(!x188.valid){ continue; } if((((-1.0)*x187*(x188.value))) < -0.00001) continue; IkReal gconst12=IKsqrt(((-1.0)*x187*(x188.value))); evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs((cj15+(((-1.0)*gconst12)))))+(IKabs(((-1.0)+(IKsign(sj15)))))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j17eval[1]; IkReal x189=new_r22*new_r22; new_r21=0; new_r20=0; new_r02=0; new_r12=0; if((((1.0)+(((-1.0)*(gconst12*gconst12))))) < -0.00001) continue; sj15=IKsqrt(((1.0)+(((-1.0)*(gconst12*gconst12))))); cj15=gconst12; if( (gconst12) < -1-IKFAST_SINCOS_THRESH || (gconst12) > 1+IKFAST_SINCOS_THRESH ) continue; j15=IKacos(gconst12); CheckValue<IkReal> x190=IKPowWithIntegerCheck(((1.0)+(((-1.0)*x189))),-1); if(!x190.valid){ continue; } if((((-1.0)*x189*(x190.value))) < -0.00001) continue; IkReal gconst12=IKsqrt(((-1.0)*x189*(x190.value))); j17eval[0]=((IKabs(new_r11))+(IKabs(new_r10))); if( IKabs(j17eval[0]) < 0.0000010000000000 ) { { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; CheckValue<IkReal> x191=IKPowWithIntegerCheck(gconst12,-1); if(!x191.valid){ continue; } if((((1.0)+(((-1.0)*(gconst12*gconst12))))) < -0.00001) continue; if( IKabs(((-1.0)*new_r10*(x191.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs((((new_r01*(IKsqrt(((1.0)+(((-1.0)*(gconst12*gconst12))))))))+(((-1.0)*gconst12*new_r11)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r10*(x191.value)))+IKsqr((((new_r01*(IKsqrt(((1.0)+(((-1.0)*(gconst12*gconst12))))))))+(((-1.0)*gconst12*new_r11))))-1) <= IKFAST_SINCOS_THRESH ) continue; j17array[0]=IKatan2(((-1.0)*new_r10*(x191.value)), (((new_r01*(IKsqrt(((1.0)+(((-1.0)*(gconst12*gconst12))))))))+(((-1.0)*gconst12*new_r11)))); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[8]; IkReal x192=IKsin(j17); IkReal x193=IKcos(j17); if((((1.0)+(((-1.0)*(gconst12*gconst12))))) < -0.00001) continue; IkReal x194=IKsqrt(((1.0)+(((-1.0)*(gconst12*gconst12))))); IkReal x195=((1.0)*x194); evalcond[0]=x192; evalcond[1]=((-1.0)*x193); evalcond[2]=(((gconst12*x192))+new_r10); evalcond[3]=(((gconst12*x193))+new_r11); evalcond[4]=((((-1.0)*x192*x195))+new_r00); evalcond[5]=(new_r01+(((-1.0)*x193*x195))); evalcond[6]=(x192+(((-1.0)*new_r00*x195))+((gconst12*new_r10))); evalcond[7]=(x193+(((-1.0)*new_r01*x195))+((gconst12*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } else { { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; CheckValue<IkReal> x196 = IKatan2WithCheck(IkReal(((-1.0)*new_r10)),IkReal(((-1.0)*new_r11)),IKFAST_ATAN2_MAGTHRESH); if(!x196.valid){ continue; } CheckValue<IkReal> x197=IKPowWithIntegerCheck(IKsign(gconst12),-1); if(!x197.valid){ continue; } j17array[0]=((-1.5707963267949)+(x196.value)+(((1.5707963267949)*(x197.value)))); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[8]; IkReal x198=IKsin(j17); IkReal x199=IKcos(j17); if((((1.0)+(((-1.0)*(gconst12*gconst12))))) < -0.00001) continue; IkReal x200=IKsqrt(((1.0)+(((-1.0)*(gconst12*gconst12))))); IkReal x201=((1.0)*x200); evalcond[0]=x198; evalcond[1]=((-1.0)*x199); evalcond[2]=(((gconst12*x198))+new_r10); evalcond[3]=(((gconst12*x199))+new_r11); evalcond[4]=((((-1.0)*x198*x201))+new_r00); evalcond[5]=((((-1.0)*x199*x201))+new_r01); evalcond[6]=((((-1.0)*new_r00*x201))+x198+((gconst12*new_r10))); evalcond[7]=(x199+(((-1.0)*new_r01*x201))+((gconst12*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { IkReal x202=new_r22*new_r22; CheckValue<IkReal> x203=IKPowWithIntegerCheck(((1.0)+(((-1.0)*x202))),-1); if(!x203.valid){ continue; } if((((-1.0)*x202*(x203.value))) < -0.00001) continue; IkReal gconst12=IKsqrt(((-1.0)*x202*(x203.value))); evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs((cj15+(((-1.0)*gconst12)))))+(IKabs(((1.0)+(IKsign(sj15)))))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j17eval[1]; IkReal x204=new_r22*new_r22; new_r21=0; new_r20=0; new_r02=0; new_r12=0; if((((1.0)+(((-1.0)*(gconst12*gconst12))))) < -0.00001) continue; sj15=((-1.0)*(IKsqrt(((1.0)+(((-1.0)*(gconst12*gconst12))))))); cj15=gconst12; if( (gconst12) < -1-IKFAST_SINCOS_THRESH || (gconst12) > 1+IKFAST_SINCOS_THRESH ) continue; j15=((-1.0)*(IKacos(gconst12))); CheckValue<IkReal> x205=IKPowWithIntegerCheck(((1.0)+(((-1.0)*x204))),-1); if(!x205.valid){ continue; } if((((-1.0)*x204*(x205.value))) < -0.00001) continue; IkReal gconst12=IKsqrt(((-1.0)*x204*(x205.value))); j17eval[0]=((IKabs(new_r11))+(IKabs(new_r10))); if( IKabs(j17eval[0]) < 0.0000010000000000 ) { { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; CheckValue<IkReal> x206=IKPowWithIntegerCheck(gconst12,-1); if(!x206.valid){ continue; } if((((1.0)+(((-1.0)*(gconst12*gconst12))))) < -0.00001) continue; if( IKabs(((-1.0)*new_r10*(x206.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((((-1.0)*new_r01*(IKsqrt(((1.0)+(((-1.0)*(gconst12*gconst12))))))))+(((-1.0)*gconst12*new_r11)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r10*(x206.value)))+IKsqr(((((-1.0)*new_r01*(IKsqrt(((1.0)+(((-1.0)*(gconst12*gconst12))))))))+(((-1.0)*gconst12*new_r11))))-1) <= IKFAST_SINCOS_THRESH ) continue; j17array[0]=IKatan2(((-1.0)*new_r10*(x206.value)), ((((-1.0)*new_r01*(IKsqrt(((1.0)+(((-1.0)*(gconst12*gconst12))))))))+(((-1.0)*gconst12*new_r11)))); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[8]; IkReal x207=IKsin(j17); IkReal x208=IKcos(j17); if((((1.0)+(((-1.0)*(gconst12*gconst12))))) < -0.00001) continue; IkReal x209=IKsqrt(((1.0)+(((-1.0)*(gconst12*gconst12))))); evalcond[0]=x207; evalcond[1]=((-1.0)*x208); evalcond[2]=(((gconst12*x207))+new_r10); evalcond[3]=(((gconst12*x208))+new_r11); evalcond[4]=(new_r00+((x207*x209))); evalcond[5]=(new_r01+((x208*x209))); evalcond[6]=(((new_r00*x209))+x207+((gconst12*new_r10))); evalcond[7]=(((new_r01*x209))+x208+((gconst12*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } else { { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; CheckValue<IkReal> x210 = IKatan2WithCheck(IkReal(((-1.0)*new_r10)),IkReal(((-1.0)*new_r11)),IKFAST_ATAN2_MAGTHRESH); if(!x210.valid){ continue; } CheckValue<IkReal> x211=IKPowWithIntegerCheck(IKsign(gconst12),-1); if(!x211.valid){ continue; } j17array[0]=((-1.5707963267949)+(x210.value)+(((1.5707963267949)*(x211.value)))); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[8]; IkReal x212=IKsin(j17); IkReal x213=IKcos(j17); if((((1.0)+(((-1.0)*(gconst12*gconst12))))) < -0.00001) continue; IkReal x214=IKsqrt(((1.0)+(((-1.0)*(gconst12*gconst12))))); evalcond[0]=x212; evalcond[1]=((-1.0)*x213); evalcond[2]=(new_r10+((gconst12*x212))); evalcond[3]=(new_r11+((gconst12*x213))); evalcond[4]=(((x212*x214))+new_r00); evalcond[5]=(((x213*x214))+new_r01); evalcond[6]=(x212+((new_r00*x214))+((gconst12*new_r10))); evalcond[7]=(x213+((new_r01*x214))+((gconst12*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { IkReal x215=new_r22*new_r22; CheckValue<IkReal> x216=IKPowWithIntegerCheck(((1.0)+(((-1.0)*x215))),-1); if(!x216.valid){ continue; } if((((-1.0)*x215*(x216.value))) < -0.00001) continue; IkReal gconst13=((-1.0)*(IKsqrt(((-1.0)*x215*(x216.value))))); evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.0)+(IKsign(sj15)))))+(IKabs((cj15+(((-1.0)*gconst13)))))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j17eval[1]; IkReal x217=new_r22*new_r22; new_r21=0; new_r20=0; new_r02=0; new_r12=0; if((((1.0)+(((-1.0)*(gconst13*gconst13))))) < -0.00001) continue; sj15=IKsqrt(((1.0)+(((-1.0)*(gconst13*gconst13))))); cj15=gconst13; if( (gconst13) < -1-IKFAST_SINCOS_THRESH || (gconst13) > 1+IKFAST_SINCOS_THRESH ) continue; j15=IKacos(gconst13); CheckValue<IkReal> x218=IKPowWithIntegerCheck(((1.0)+(((-1.0)*x217))),-1); if(!x218.valid){ continue; } if((((-1.0)*x217*(x218.value))) < -0.00001) continue; IkReal gconst13=((-1.0)*(IKsqrt(((-1.0)*x217*(x218.value))))); j17eval[0]=((IKabs(new_r11))+(IKabs(new_r10))); if( IKabs(j17eval[0]) < 0.0000010000000000 ) { { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; CheckValue<IkReal> x219=IKPowWithIntegerCheck(gconst13,-1); if(!x219.valid){ continue; } if((((1.0)+(((-1.0)*(gconst13*gconst13))))) < -0.00001) continue; if( IKabs(((-1.0)*new_r10*(x219.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((((-1.0)*gconst13*new_r11))+((new_r01*(IKsqrt(((1.0)+(((-1.0)*(gconst13*gconst13)))))))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r10*(x219.value)))+IKsqr(((((-1.0)*gconst13*new_r11))+((new_r01*(IKsqrt(((1.0)+(((-1.0)*(gconst13*gconst13))))))))))-1) <= IKFAST_SINCOS_THRESH ) continue; j17array[0]=IKatan2(((-1.0)*new_r10*(x219.value)), ((((-1.0)*gconst13*new_r11))+((new_r01*(IKsqrt(((1.0)+(((-1.0)*(gconst13*gconst13)))))))))); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[8]; IkReal x220=IKsin(j17); IkReal x221=IKcos(j17); if((((1.0)+(((-1.0)*(gconst13*gconst13))))) < -0.00001) continue; IkReal x222=IKsqrt(((1.0)+(((-1.0)*(gconst13*gconst13))))); IkReal x223=((1.0)*x222); evalcond[0]=x220; evalcond[1]=((-1.0)*x221); evalcond[2]=(((gconst13*x220))+new_r10); evalcond[3]=(((gconst13*x221))+new_r11); evalcond[4]=((((-1.0)*x220*x223))+new_r00); evalcond[5]=((((-1.0)*x221*x223))+new_r01); evalcond[6]=(x220+((gconst13*new_r10))+(((-1.0)*new_r00*x223))); evalcond[7]=((((-1.0)*new_r01*x223))+x221+((gconst13*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } else { { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; CheckValue<IkReal> x224 = IKatan2WithCheck(IkReal(((-1.0)*new_r10)),IkReal(((-1.0)*new_r11)),IKFAST_ATAN2_MAGTHRESH); if(!x224.valid){ continue; } CheckValue<IkReal> x225=IKPowWithIntegerCheck(IKsign(gconst13),-1); if(!x225.valid){ continue; } j17array[0]=((-1.5707963267949)+(x224.value)+(((1.5707963267949)*(x225.value)))); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[8]; IkReal x226=IKsin(j17); IkReal x227=IKcos(j17); if((((1.0)+(((-1.0)*(gconst13*gconst13))))) < -0.00001) continue; IkReal x228=IKsqrt(((1.0)+(((-1.0)*(gconst13*gconst13))))); IkReal x229=((1.0)*x228); evalcond[0]=x226; evalcond[1]=((-1.0)*x227); evalcond[2]=(((gconst13*x226))+new_r10); evalcond[3]=(((gconst13*x227))+new_r11); evalcond[4]=(new_r00+(((-1.0)*x226*x229))); evalcond[5]=((((-1.0)*x227*x229))+new_r01); evalcond[6]=(x226+((gconst13*new_r10))+(((-1.0)*new_r00*x229))); evalcond[7]=((((-1.0)*new_r01*x229))+x227+((gconst13*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { IkReal x230=new_r22*new_r22; CheckValue<IkReal> x231=IKPowWithIntegerCheck(((1.0)+(((-1.0)*x230))),-1); if(!x231.valid){ continue; } if((((-1.0)*x230*(x231.value))) < -0.00001) continue; IkReal gconst13=((-1.0)*(IKsqrt(((-1.0)*x230*(x231.value))))); evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.0)+(IKsign(sj15)))))+(IKabs((cj15+(((-1.0)*gconst13)))))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j17eval[1]; IkReal x232=new_r22*new_r22; new_r21=0; new_r20=0; new_r02=0; new_r12=0; if((((1.0)+(((-1.0)*(gconst13*gconst13))))) < -0.00001) continue; sj15=((-1.0)*(IKsqrt(((1.0)+(((-1.0)*(gconst13*gconst13))))))); cj15=gconst13; if( (gconst13) < -1-IKFAST_SINCOS_THRESH || (gconst13) > 1+IKFAST_SINCOS_THRESH ) continue; j15=((-1.0)*(IKacos(gconst13))); CheckValue<IkReal> x233=IKPowWithIntegerCheck(((1.0)+(((-1.0)*x232))),-1); if(!x233.valid){ continue; } if((((-1.0)*x232*(x233.value))) < -0.00001) continue; IkReal gconst13=((-1.0)*(IKsqrt(((-1.0)*x232*(x233.value))))); j17eval[0]=((IKabs(new_r11))+(IKabs(new_r10))); if( IKabs(j17eval[0]) < 0.0000010000000000 ) { { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; CheckValue<IkReal> x234=IKPowWithIntegerCheck(gconst13,-1); if(!x234.valid){ continue; } if((((1.0)+(((-1.0)*(gconst13*gconst13))))) < -0.00001) continue; if( IKabs(((-1.0)*new_r10*(x234.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((((-1.0)*gconst13*new_r11))+(((-1.0)*new_r01*(IKsqrt(((1.0)+(((-1.0)*(gconst13*gconst13)))))))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r10*(x234.value)))+IKsqr(((((-1.0)*gconst13*new_r11))+(((-1.0)*new_r01*(IKsqrt(((1.0)+(((-1.0)*(gconst13*gconst13))))))))))-1) <= IKFAST_SINCOS_THRESH ) continue; j17array[0]=IKatan2(((-1.0)*new_r10*(x234.value)), ((((-1.0)*gconst13*new_r11))+(((-1.0)*new_r01*(IKsqrt(((1.0)+(((-1.0)*(gconst13*gconst13)))))))))); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[8]; IkReal x235=IKsin(j17); IkReal x236=IKcos(j17); if((((1.0)+(((-1.0)*(gconst13*gconst13))))) < -0.00001) continue; IkReal x237=IKsqrt(((1.0)+(((-1.0)*(gconst13*gconst13))))); evalcond[0]=x235; evalcond[1]=((-1.0)*x236); evalcond[2]=(((gconst13*x235))+new_r10); evalcond[3]=(((gconst13*x236))+new_r11); evalcond[4]=(((x235*x237))+new_r00); evalcond[5]=(new_r01+((x236*x237))); evalcond[6]=(((new_r00*x237))+x235+((gconst13*new_r10))); evalcond[7]=(((new_r01*x237))+x236+((gconst13*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } else { { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; CheckValue<IkReal> x238 = IKatan2WithCheck(IkReal(((-1.0)*new_r10)),IkReal(((-1.0)*new_r11)),IKFAST_ATAN2_MAGTHRESH); if(!x238.valid){ continue; } CheckValue<IkReal> x239=IKPowWithIntegerCheck(IKsign(gconst13),-1); if(!x239.valid){ continue; } j17array[0]=((-1.5707963267949)+(x238.value)+(((1.5707963267949)*(x239.value)))); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[8]; IkReal x240=IKsin(j17); IkReal x241=IKcos(j17); if((((1.0)+(((-1.0)*(gconst13*gconst13))))) < -0.00001) continue; IkReal x242=IKsqrt(((1.0)+(((-1.0)*(gconst13*gconst13))))); evalcond[0]=x240; evalcond[1]=((-1.0)*x241); evalcond[2]=(((gconst13*x240))+new_r10); evalcond[3]=(((gconst13*x241))+new_r11); evalcond[4]=(((x240*x242))+new_r00); evalcond[5]=(((x241*x242))+new_r01); evalcond[6]=(x240+((new_r00*x242))+((gconst13*new_r10))); evalcond[7]=(x241+((new_r01*x242))+((gconst13*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j17] } } while(0); if( bgotonextstatement ) { } } } } } } } } } else { { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; IkReal x243=(new_r01*new_r22); IkReal x244=(cj15*new_r11); CheckValue<IkReal> x245=IKPowWithIntegerCheck(cj15,-1); if(!x245.valid){ continue; } if( IKabs(((x245.value)*(((((-1.0)*x243))+((x243*(cj15*cj15)))+((new_r22*sj15*x244))+(((-1.0)*new_r10)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((((-1.0)*x244))+((new_r01*sj15)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((x245.value)*(((((-1.0)*x243))+((x243*(cj15*cj15)))+((new_r22*sj15*x244))+(((-1.0)*new_r10))))))+IKsqr(((((-1.0)*x244))+((new_r01*sj15))))-1) <= IKFAST_SINCOS_THRESH ) continue; j17array[0]=IKatan2(((x245.value)*(((((-1.0)*x243))+((x243*(cj15*cj15)))+((new_r22*sj15*x244))+(((-1.0)*new_r10))))), ((((-1.0)*x244))+((new_r01*sj15)))); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[10]; IkReal x246=IKcos(j17); IkReal x247=IKsin(j17); IkReal x248=((1.0)*new_r01); IkReal x249=(cj15*new_r22); IkReal x250=(new_r22*sj15); IkReal x251=((1.0)*new_r00); IkReal x252=((1.0)*x247); IkReal x253=((1.0)*x246); evalcond[0]=(((cj15*new_r10))+x247+(((-1.0)*sj15*x251))); evalcond[1]=(((cj15*new_r11))+x246+(((-1.0)*sj15*x248))); evalcond[2]=(((new_r22*x246))+((cj15*new_r00))+((new_r10*sj15))); evalcond[3]=(((x246*x250))+((cj15*x247))+new_r10); evalcond[4]=(((cj15*new_r01))+(((-1.0)*new_r22*x252))+((new_r11*sj15))); evalcond[5]=(new_r00+((x246*x249))+(((-1.0)*sj15*x252))); evalcond[6]=((((-1.0)*x250*x252))+((cj15*x246))+new_r11); evalcond[7]=((((-1.0)*x248*x249))+(((-1.0)*new_r11*x250))+x247); evalcond[8]=((((-1.0)*x249*x252))+new_r01+(((-1.0)*sj15*x253))); evalcond[9]=((((-1.0)*new_r10*x250))+(((-1.0)*x249*x251))+(((-1.0)*x253))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; IkReal x254=((1.0)*cj15); CheckValue<IkReal> x255=IKPowWithIntegerCheck(new_r22,-1); if(!x255.valid){ continue; } if( IKabs(((((-1.0)*new_r10*x254))+((new_r00*sj15)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((x255.value)*(((((-1.0)*new_r10*sj15))+(((-1.0)*new_r00*x254)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*new_r10*x254))+((new_r00*sj15))))+IKsqr(((x255.value)*(((((-1.0)*new_r10*sj15))+(((-1.0)*new_r00*x254))))))-1) <= IKFAST_SINCOS_THRESH ) continue; j17array[0]=IKatan2(((((-1.0)*new_r10*x254))+((new_r00*sj15))), ((x255.value)*(((((-1.0)*new_r10*sj15))+(((-1.0)*new_r00*x254)))))); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[10]; IkReal x256=IKcos(j17); IkReal x257=IKsin(j17); IkReal x258=((1.0)*new_r01); IkReal x259=(cj15*new_r22); IkReal x260=(new_r22*sj15); IkReal x261=((1.0)*new_r00); IkReal x262=((1.0)*x257); IkReal x263=((1.0)*x256); evalcond[0]=(((cj15*new_r10))+x257+(((-1.0)*sj15*x261))); evalcond[1]=(((cj15*new_r11))+x256+(((-1.0)*sj15*x258))); evalcond[2]=(((cj15*new_r00))+((new_r22*x256))+((new_r10*sj15))); evalcond[3]=(((cj15*x257))+((x256*x260))+new_r10); evalcond[4]=((((-1.0)*new_r22*x262))+((cj15*new_r01))+((new_r11*sj15))); evalcond[5]=(((x256*x259))+(((-1.0)*sj15*x262))+new_r00); evalcond[6]=(((cj15*x256))+new_r11+(((-1.0)*x260*x262))); evalcond[7]=(x257+(((-1.0)*new_r11*x260))+(((-1.0)*x258*x259))); evalcond[8]=((((-1.0)*x259*x262))+(((-1.0)*sj15*x263))+new_r01); evalcond[9]=((((-1.0)*x259*x261))+(((-1.0)*new_r10*x260))+(((-1.0)*x263))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; IkReal x264=cj15*cj15; IkReal x265=new_r22*new_r22; IkReal x266=((1.0)*cj15); IkReal x267=(new_r22*sj15); CheckValue<IkReal> x268 = IKatan2WithCheck(IkReal(((((-1.0)*new_r10*x266))+((new_r11*x267)))),IkReal(((((-1.0)*new_r10*x267))+(((-1.0)*new_r11*x266)))),IKFAST_ATAN2_MAGTHRESH); if(!x268.valid){ continue; } CheckValue<IkReal> x269=IKPowWithIntegerCheck(IKsign((x265+x264+(((-1.0)*x264*x265)))),-1); if(!x269.valid){ continue; } j17array[0]=((-1.5707963267949)+(x268.value)+(((1.5707963267949)*(x269.value)))); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[10]; IkReal x270=IKcos(j17); IkReal x271=IKsin(j17); IkReal x272=((1.0)*new_r01); IkReal x273=(cj15*new_r22); IkReal x274=(new_r22*sj15); IkReal x275=((1.0)*new_r00); IkReal x276=((1.0)*x271); IkReal x277=((1.0)*x270); evalcond[0]=(((cj15*new_r10))+x271+(((-1.0)*sj15*x275))); evalcond[1]=(((cj15*new_r11))+x270+(((-1.0)*sj15*x272))); evalcond[2]=(((new_r22*x270))+((cj15*new_r00))+((new_r10*sj15))); evalcond[3]=(((cj15*x271))+((x270*x274))+new_r10); evalcond[4]=((((-1.0)*new_r22*x276))+((cj15*new_r01))+((new_r11*sj15))); evalcond[5]=(((x270*x273))+(((-1.0)*sj15*x276))+new_r00); evalcond[6]=((((-1.0)*x274*x276))+((cj15*x270))+new_r11); evalcond[7]=((((-1.0)*x272*x273))+x271+(((-1.0)*new_r11*x274))); evalcond[8]=((((-1.0)*x273*x276))+(((-1.0)*sj15*x277))+new_r01); evalcond[9]=((((-1.0)*x273*x275))+(((-1.0)*new_r10*x274))+(((-1.0)*x277))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j15, j17] } } while(0); if( bgotonextstatement ) { } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; CheckValue<IkReal> x279=IKPowWithIntegerCheck(sj16,-1); if(!x279.valid){ continue; } IkReal x278=x279.value; CheckValue<IkReal> x280=IKPowWithIntegerCheck(new_r12,-1); if(!x280.valid){ continue; } if( IKabs((x278*(x280.value)*(((-1.0)+(new_r02*new_r02)+(cj16*cj16))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r02*x278)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((x278*(x280.value)*(((-1.0)+(new_r02*new_r02)+(cj16*cj16)))))+IKsqr(((-1.0)*new_r02*x278))-1) <= IKFAST_SINCOS_THRESH ) continue; j15array[0]=IKatan2((x278*(x280.value)*(((-1.0)+(new_r02*new_r02)+(cj16*cj16)))), ((-1.0)*new_r02*x278)); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x281=IKcos(j15); IkReal x282=IKsin(j15); IkReal x283=((1.0)*cj16); IkReal x284=(new_r02*x281); IkReal x285=(sj16*x281); IkReal x286=(sj16*x282); IkReal x287=(new_r12*x282); evalcond[0]=(x285+new_r02); evalcond[1]=(x286+new_r12); evalcond[2]=(((new_r12*x281))+(((-1.0)*new_r02*x282))); evalcond[3]=(x287+x284+sj16); evalcond[4]=((((-1.0)*new_r20*x283))+((new_r00*x285))+((new_r10*x286))); evalcond[5]=((((-1.0)*new_r21*x283))+((new_r11*x286))+((new_r01*x285))); evalcond[6]=((1.0)+(((-1.0)*new_r22*x283))+((new_r12*x286))+((sj16*x284))); evalcond[7]=((((-1.0)*new_r22*sj16))+(((-1.0)*x283*x284))+(((-1.0)*x283*x287))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { IkReal j17eval[3]; j17eval[0]=sj16; j17eval[1]=IKsign(sj16); j17eval[2]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(j17eval[0]) < 0.0000010000000000 || IKabs(j17eval[1]) < 0.0000010000000000 || IKabs(j17eval[2]) < 0.0000010000000000 ) { { IkReal j17eval[2]; j17eval[0]=cj15; j17eval[1]=sj16; if( IKabs(j17eval[0]) < 0.0000010000000000 || IKabs(j17eval[1]) < 0.0000010000000000 ) { { IkReal j17eval[2]; j17eval[0]=sj15; j17eval[1]=sj16; if( IKabs(j17eval[0]) < 0.0000010000000000 || IKabs(j17eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[5]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j15))), 6.28318530717959))); evalcond[1]=new_r12; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; if( IKabs(((-1.0)*new_r10)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r11)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r10))+IKsqr(((-1.0)*new_r11))-1) <= IKFAST_SINCOS_THRESH ) continue; j17array[0]=IKatan2(((-1.0)*new_r10), ((-1.0)*new_r11)); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[8]; IkReal x288=IKsin(j17); IkReal x289=IKcos(j17); CheckValue<IkReal> x294=IKPowWithIntegerCheck(new_r02,-1); if(!x294.valid){ continue; } IkReal x290=x294.value; IkReal x291=new_r22*new_r22; IkReal x292=(x290*x291); IkReal x293=((1.0)*x289); evalcond[0]=(x288+new_r10); evalcond[1]=(x289+new_r11); evalcond[2]=(((new_r02*x288))+new_r21); evalcond[3]=(((cj16*x289))+new_r00); evalcond[4]=(new_r20+(((-1.0)*new_r02*x293))); evalcond[5]=((((-1.0)*cj16*x288))+new_r01); evalcond[6]=(x288+((new_r21*x292))+((new_r02*new_r21))); evalcond[7]=(((new_r20*x292))+(((-1.0)*x293))+((new_r02*new_r20))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j15)))), 6.28318530717959))); evalcond[1]=new_r12; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; if( IKabs(new_r10) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r11) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r10)+IKsqr(new_r11)-1) <= IKFAST_SINCOS_THRESH ) continue; j17array[0]=IKatan2(new_r10, new_r11); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[8]; IkReal x295=IKcos(j17); IkReal x296=IKsin(j17); IkReal x297=((1.0)*sj16); IkReal x298=((1.0)*x296); evalcond[0]=(((new_r02*x295))+new_r20); evalcond[1]=(x296+(((-1.0)*new_r10))); evalcond[2]=(x295+(((-1.0)*new_r11))); evalcond[3]=(new_r21+(((-1.0)*new_r02*x298))); evalcond[4]=((((-1.0)*new_r00))+((cj16*x295))); evalcond[5]=((((-1.0)*new_r01))+(((-1.0)*cj16*x298))); evalcond[6]=((((-1.0)*new_r21*x297))+x296+((cj16*new_r01))); evalcond[7]=((((-1.0)*x295))+(((-1.0)*new_r20*x297))+((cj16*new_r00))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j16))), 6.28318530717959))); evalcond[1]=new_r02; evalcond[2]=new_r12; evalcond[3]=new_r20; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; IkReal x299=((1.0)*cj15); if( IKabs(((((-1.0)*new_r10*x299))+((new_r00*sj15)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((((-1.0)*new_r10*sj15))+(((-1.0)*new_r00*x299)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*new_r10*x299))+((new_r00*sj15))))+IKsqr(((((-1.0)*new_r10*sj15))+(((-1.0)*new_r00*x299))))-1) <= IKFAST_SINCOS_THRESH ) continue; j17array[0]=IKatan2(((((-1.0)*new_r10*x299))+((new_r00*sj15))), ((((-1.0)*new_r10*sj15))+(((-1.0)*new_r00*x299)))); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[8]; IkReal x300=IKcos(j17); IkReal x301=IKsin(j17); IkReal x302=((1.0)*sj15); IkReal x303=(cj15*x300); IkReal x304=((1.0)*x301); IkReal x305=(x301*x302); evalcond[0]=(x300+((cj15*new_r00))+((new_r10*sj15))); evalcond[1]=(((cj15*new_r10))+x301+(((-1.0)*new_r00*x302))); evalcond[2]=(((cj15*new_r11))+x300+(((-1.0)*new_r01*x302))); evalcond[3]=(((sj15*x300))+new_r10+((cj15*x301))); evalcond[4]=(((cj15*new_r01))+((new_r11*sj15))+(((-1.0)*x304))); evalcond[5]=(x303+new_r00+(((-1.0)*x305))); evalcond[6]=(x303+new_r11+(((-1.0)*x305))); evalcond[7]=(new_r01+(((-1.0)*cj15*x304))+(((-1.0)*x300*x302))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j16)))), 6.28318530717959))); evalcond[1]=new_r02; evalcond[2]=new_r12; evalcond[3]=new_r20; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; IkReal x306=((1.0)*new_r11); if( IKabs(((((-1.0)*cj15*new_r10))+(((-1.0)*sj15*x306)))) < IKFAST_ATAN2_MAGTHRESH && IKabs((((new_r10*sj15))+(((-1.0)*cj15*x306)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*cj15*new_r10))+(((-1.0)*sj15*x306))))+IKsqr((((new_r10*sj15))+(((-1.0)*cj15*x306))))-1) <= IKFAST_SINCOS_THRESH ) continue; j17array[0]=IKatan2(((((-1.0)*cj15*new_r10))+(((-1.0)*sj15*x306))), (((new_r10*sj15))+(((-1.0)*cj15*x306)))); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[8]; IkReal x307=IKsin(j17); IkReal x308=IKcos(j17); IkReal x309=((1.0)*sj15); IkReal x310=(cj15*x307); IkReal x311=((1.0)*x308); IkReal x312=(x308*x309); evalcond[0]=(x307+((cj15*new_r01))+((new_r11*sj15))); evalcond[1]=(((cj15*new_r10))+x307+(((-1.0)*new_r00*x309))); evalcond[2]=(((cj15*new_r11))+x308+(((-1.0)*new_r01*x309))); evalcond[3]=(((cj15*new_r00))+(((-1.0)*x311))+((new_r10*sj15))); evalcond[4]=(((sj15*x307))+new_r11+((cj15*x308))); evalcond[5]=(x310+(((-1.0)*x312))+new_r10); evalcond[6]=(x310+(((-1.0)*x312))+new_r01); evalcond[7]=((((-1.0)*x307*x309))+new_r00+(((-1.0)*cj15*x311))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j15)))), 6.28318530717959))); evalcond[1]=new_r02; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; if( IKabs(new_r00) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r01) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r00)+IKsqr(new_r01)-1) <= IKFAST_SINCOS_THRESH ) continue; j17array[0]=IKatan2(new_r00, new_r01); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[8]; IkReal x313=IKcos(j17); IkReal x314=IKsin(j17); IkReal x315=((1.0)*cj16); IkReal x316=((1.0)*sj16); IkReal x317=((1.0)*x313); evalcond[0]=(x314+(((-1.0)*new_r00))); evalcond[1]=(x313+(((-1.0)*new_r01))); evalcond[2]=(((cj16*x313))+new_r10); evalcond[3]=((((-1.0)*new_r12*x317))+new_r20); evalcond[4]=((((-1.0)*x314*x316))+new_r21); evalcond[5]=((((-1.0)*x314*x315))+new_r11); evalcond[6]=((((-1.0)*new_r21*x316))+(((-1.0)*new_r11*x315))+x314); CheckValue<IkReal> x318=IKPowWithIntegerCheck(new_r12,-1); if(!x318.valid){ continue; } evalcond[7]=(((new_r12*new_r20))+(((-1.0)*x317))+((new_r20*(x318.value)*(new_r22*new_r22)))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j15)))), 6.28318530717959))); evalcond[1]=new_r02; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; if( IKabs(((-1.0)*new_r00)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r01)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r00))+IKsqr(((-1.0)*new_r01))-1) <= IKFAST_SINCOS_THRESH ) continue; j17array[0]=IKatan2(((-1.0)*new_r00), ((-1.0)*new_r01)); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[8]; IkReal x319=IKcos(j17); IkReal x320=IKsin(j17); IkReal x321=((1.0)*sj16); evalcond[0]=(x320+new_r00); evalcond[1]=(x319+new_r01); evalcond[2]=(((new_r12*x319))+new_r20); evalcond[3]=((((-1.0)*x320*x321))+new_r21); evalcond[4]=(((cj16*x319))+(((-1.0)*new_r10))); evalcond[5]=((((-1.0)*cj16*x320))+(((-1.0)*new_r11))); evalcond[6]=(x320+(((-1.0)*new_r21*x321))+((cj16*new_r11))); evalcond[7]=((((-1.0)*x319))+((cj16*new_r10))+(((-1.0)*new_r20*x321))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j17eval[1]; new_r21=0; new_r20=0; new_r02=0; new_r12=0; j17eval[0]=1.0; if( IKabs(j17eval[0]) < 0.0000000100000000 ) { continue; // no branches [j17] } else { IkReal op[2+1], zeror[2]; int numroots; op[0]=-1.0; op[1]=0; op[2]=1.0; polyroots2(op,zeror,numroots); IkReal j17array[2], cj17array[2], sj17array[2], tempj17array[1]; int numsolutions = 0; for(int ij17 = 0; ij17 < numroots; ++ij17) { IkReal htj17 = zeror[ij17]; tempj17array[0]=((2.0)*(atan(htj17))); for(int kj17 = 0; kj17 < 1; ++kj17) { j17array[numsolutions] = tempj17array[kj17]; if( j17array[numsolutions] > IKPI ) { j17array[numsolutions]-=IK2PI; } else if( j17array[numsolutions] < -IKPI ) { j17array[numsolutions]+=IK2PI; } sj17array[numsolutions] = IKsin(j17array[numsolutions]); cj17array[numsolutions] = IKcos(j17array[numsolutions]); numsolutions++; } } bool j17valid[2]={true,true}; _nj17 = 2; for(int ij17 = 0; ij17 < numsolutions; ++ij17) { if( !j17valid[ij17] ) { continue; } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; htj17 = IKtan(j17/2); _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < numsolutions; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j17] } } while(0); if( bgotonextstatement ) { } } } } } } } } } } else { { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; CheckValue<IkReal> x323=IKPowWithIntegerCheck(sj16,-1); if(!x323.valid){ continue; } IkReal x322=x323.value; CheckValue<IkReal> x324=IKPowWithIntegerCheck(sj15,-1); if(!x324.valid){ continue; } if( IKabs((x322*(x324.value)*(((((-1.0)*cj15*cj16*new_r20))+((new_r00*sj16)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20*x322)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((x322*(x324.value)*(((((-1.0)*cj15*cj16*new_r20))+((new_r00*sj16))))))+IKsqr(((-1.0)*new_r20*x322))-1) <= IKFAST_SINCOS_THRESH ) continue; j17array[0]=IKatan2((x322*(x324.value)*(((((-1.0)*cj15*cj16*new_r20))+((new_r00*sj16))))), ((-1.0)*new_r20*x322)); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[12]; IkReal x325=IKsin(j17); IkReal x326=IKcos(j17); IkReal x327=((1.0)*sj15); IkReal x328=(cj15*new_r01); IkReal x329=((1.0)*cj16); IkReal x330=((1.0)*sj16); IkReal x331=(cj15*new_r00); IkReal x332=(cj16*x326); IkReal x333=(cj16*x325); evalcond[0]=(((sj16*x326))+new_r20); evalcond[1]=(new_r21+(((-1.0)*x325*x330))); evalcond[2]=(((cj15*new_r10))+x325+(((-1.0)*new_r00*x327))); evalcond[3]=(((cj15*new_r11))+x326+(((-1.0)*new_r01*x327))); evalcond[4]=(x332+x331+((new_r10*sj15))); evalcond[5]=(((sj15*x332))+((cj15*x325))+new_r10); evalcond[6]=((((-1.0)*x325*x329))+x328+((new_r11*sj15))); evalcond[7]=((((-1.0)*x325*x327))+new_r00+((cj15*x332))); evalcond[8]=(((cj15*x326))+new_r11+(((-1.0)*x327*x333))); evalcond[9]=((((-1.0)*x326*x327))+(((-1.0)*cj15*x325*x329))+new_r01); evalcond[10]=((((-1.0)*cj16*new_r11*x327))+(((-1.0)*new_r21*x330))+x325+(((-1.0)*x328*x329))); evalcond[11]=((((-1.0)*x329*x331))+(((-1.0)*new_r20*x330))+(((-1.0)*cj16*new_r10*x327))+(((-1.0)*x326))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; CheckValue<IkReal> x335=IKPowWithIntegerCheck(sj16,-1); if(!x335.valid){ continue; } IkReal x334=x335.value; CheckValue<IkReal> x336=IKPowWithIntegerCheck(cj15,-1); if(!x336.valid){ continue; } if( IKabs((x334*(x336.value)*((((cj16*new_r20*sj15))+(((-1.0)*new_r10*sj16)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20*x334)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((x334*(x336.value)*((((cj16*new_r20*sj15))+(((-1.0)*new_r10*sj16))))))+IKsqr(((-1.0)*new_r20*x334))-1) <= IKFAST_SINCOS_THRESH ) continue; j17array[0]=IKatan2((x334*(x336.value)*((((cj16*new_r20*sj15))+(((-1.0)*new_r10*sj16))))), ((-1.0)*new_r20*x334)); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[12]; IkReal x337=IKsin(j17); IkReal x338=IKcos(j17); IkReal x339=((1.0)*sj15); IkReal x340=(cj15*new_r01); IkReal x341=((1.0)*cj16); IkReal x342=((1.0)*sj16); IkReal x343=(cj15*new_r00); IkReal x344=(cj16*x338); IkReal x345=(cj16*x337); evalcond[0]=(((sj16*x338))+new_r20); evalcond[1]=((((-1.0)*x337*x342))+new_r21); evalcond[2]=(((cj15*new_r10))+x337+(((-1.0)*new_r00*x339))); evalcond[3]=(((cj15*new_r11))+x338+(((-1.0)*new_r01*x339))); evalcond[4]=(x343+x344+((new_r10*sj15))); evalcond[5]=(((sj15*x344))+new_r10+((cj15*x337))); evalcond[6]=((((-1.0)*x337*x341))+x340+((new_r11*sj15))); evalcond[7]=((((-1.0)*x337*x339))+new_r00+((cj15*x344))); evalcond[8]=(new_r11+((cj15*x338))+(((-1.0)*x339*x345))); evalcond[9]=((((-1.0)*x338*x339))+(((-1.0)*cj15*x337*x341))+new_r01); evalcond[10]=((((-1.0)*cj16*new_r11*x339))+x337+(((-1.0)*x340*x341))+(((-1.0)*new_r21*x342))); evalcond[11]=((((-1.0)*cj16*new_r10*x339))+(((-1.0)*x338))+(((-1.0)*x341*x343))+(((-1.0)*new_r20*x342))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; CheckValue<IkReal> x346 = IKatan2WithCheck(IkReal(new_r21),IkReal(((-1.0)*new_r20)),IKFAST_ATAN2_MAGTHRESH); if(!x346.valid){ continue; } CheckValue<IkReal> x347=IKPowWithIntegerCheck(IKsign(sj16),-1); if(!x347.valid){ continue; } j17array[0]=((-1.5707963267949)+(x346.value)+(((1.5707963267949)*(x347.value)))); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[12]; IkReal x348=IKsin(j17); IkReal x349=IKcos(j17); IkReal x350=((1.0)*sj15); IkReal x351=(cj15*new_r01); IkReal x352=((1.0)*cj16); IkReal x353=((1.0)*sj16); IkReal x354=(cj15*new_r00); IkReal x355=(cj16*x349); IkReal x356=(cj16*x348); evalcond[0]=(((sj16*x349))+new_r20); evalcond[1]=((((-1.0)*x348*x353))+new_r21); evalcond[2]=(((cj15*new_r10))+x348+(((-1.0)*new_r00*x350))); evalcond[3]=(((cj15*new_r11))+x349+(((-1.0)*new_r01*x350))); evalcond[4]=(x355+x354+((new_r10*sj15))); evalcond[5]=(new_r10+((cj15*x348))+((sj15*x355))); evalcond[6]=((((-1.0)*x348*x352))+x351+((new_r11*sj15))); evalcond[7]=((((-1.0)*x348*x350))+new_r00+((cj15*x355))); evalcond[8]=(new_r11+((cj15*x349))+(((-1.0)*x350*x356))); evalcond[9]=((((-1.0)*x349*x350))+(((-1.0)*cj15*x348*x352))+new_r01); evalcond[10]=((((-1.0)*cj16*new_r11*x350))+x348+(((-1.0)*x351*x352))+(((-1.0)*new_r21*x353))); evalcond[11]=((((-1.0)*cj16*new_r10*x350))+(((-1.0)*x352*x354))+(((-1.0)*new_r20*x353))+(((-1.0)*x349))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; CheckValue<IkReal> x357=IKPowWithIntegerCheck(IKsign(sj16),-1); if(!x357.valid){ continue; } CheckValue<IkReal> x358 = IKatan2WithCheck(IkReal(((-1.0)*new_r12)),IkReal(((-1.0)*new_r02)),IKFAST_ATAN2_MAGTHRESH); if(!x358.valid){ continue; } j15array[0]=((-1.5707963267949)+(((1.5707963267949)*(x357.value)))+(x358.value)); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x359=IKcos(j15); IkReal x360=IKsin(j15); IkReal x361=((1.0)*cj16); IkReal x362=(new_r02*x359); IkReal x363=(sj16*x359); IkReal x364=(sj16*x360); IkReal x365=(new_r12*x360); evalcond[0]=(x363+new_r02); evalcond[1]=(x364+new_r12); evalcond[2]=((((-1.0)*new_r02*x360))+((new_r12*x359))); evalcond[3]=(x362+x365+sj16); evalcond[4]=((((-1.0)*new_r20*x361))+((new_r00*x363))+((new_r10*x364))); evalcond[5]=(((new_r01*x363))+((new_r11*x364))+(((-1.0)*new_r21*x361))); evalcond[6]=((1.0)+((sj16*x362))+(((-1.0)*new_r22*x361))+((new_r12*x364))); evalcond[7]=((((-1.0)*x361*x362))+(((-1.0)*x361*x365))+(((-1.0)*new_r22*sj16))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { IkReal j17eval[3]; j17eval[0]=sj16; j17eval[1]=IKsign(sj16); j17eval[2]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(j17eval[0]) < 0.0000010000000000 || IKabs(j17eval[1]) < 0.0000010000000000 || IKabs(j17eval[2]) < 0.0000010000000000 ) { { IkReal j17eval[2]; j17eval[0]=cj15; j17eval[1]=sj16; if( IKabs(j17eval[0]) < 0.0000010000000000 || IKabs(j17eval[1]) < 0.0000010000000000 ) { { IkReal j17eval[2]; j17eval[0]=sj15; j17eval[1]=sj16; if( IKabs(j17eval[0]) < 0.0000010000000000 || IKabs(j17eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[5]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j15))), 6.28318530717959))); evalcond[1]=new_r12; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; if( IKabs(((-1.0)*new_r10)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r11)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r10))+IKsqr(((-1.0)*new_r11))-1) <= IKFAST_SINCOS_THRESH ) continue; j17array[0]=IKatan2(((-1.0)*new_r10), ((-1.0)*new_r11)); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[8]; IkReal x366=IKsin(j17); IkReal x367=IKcos(j17); CheckValue<IkReal> x372=IKPowWithIntegerCheck(new_r02,-1); if(!x372.valid){ continue; } IkReal x368=x372.value; IkReal x369=new_r22*new_r22; IkReal x370=(x368*x369); IkReal x371=((1.0)*x367); evalcond[0]=(x366+new_r10); evalcond[1]=(x367+new_r11); evalcond[2]=(new_r21+((new_r02*x366))); evalcond[3]=(((cj16*x367))+new_r00); evalcond[4]=(new_r20+(((-1.0)*new_r02*x371))); evalcond[5]=(new_r01+(((-1.0)*cj16*x366))); evalcond[6]=(x366+((new_r21*x370))+((new_r02*new_r21))); evalcond[7]=(((new_r20*x370))+(((-1.0)*x371))+((new_r02*new_r20))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j15)))), 6.28318530717959))); evalcond[1]=new_r12; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; if( IKabs(new_r10) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r11) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r10)+IKsqr(new_r11)-1) <= IKFAST_SINCOS_THRESH ) continue; j17array[0]=IKatan2(new_r10, new_r11); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[8]; IkReal x373=IKcos(j17); IkReal x374=IKsin(j17); IkReal x375=((1.0)*sj16); IkReal x376=((1.0)*x374); evalcond[0]=(new_r20+((new_r02*x373))); evalcond[1]=(x374+(((-1.0)*new_r10))); evalcond[2]=(x373+(((-1.0)*new_r11))); evalcond[3]=(new_r21+(((-1.0)*new_r02*x376))); evalcond[4]=(((cj16*x373))+(((-1.0)*new_r00))); evalcond[5]=((((-1.0)*new_r01))+(((-1.0)*cj16*x376))); evalcond[6]=((((-1.0)*new_r21*x375))+x374+((cj16*new_r01))); evalcond[7]=((((-1.0)*x373))+(((-1.0)*new_r20*x375))+((cj16*new_r00))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j16))), 6.28318530717959))); evalcond[1]=new_r02; evalcond[2]=new_r12; evalcond[3]=new_r20; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; IkReal x377=((1.0)*cj15); if( IKabs(((((-1.0)*new_r10*x377))+((new_r00*sj15)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((((-1.0)*new_r00*x377))+(((-1.0)*new_r10*sj15)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*new_r10*x377))+((new_r00*sj15))))+IKsqr(((((-1.0)*new_r00*x377))+(((-1.0)*new_r10*sj15))))-1) <= IKFAST_SINCOS_THRESH ) continue; j17array[0]=IKatan2(((((-1.0)*new_r10*x377))+((new_r00*sj15))), ((((-1.0)*new_r00*x377))+(((-1.0)*new_r10*sj15)))); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[8]; IkReal x378=IKcos(j17); IkReal x379=IKsin(j17); IkReal x380=((1.0)*sj15); IkReal x381=(cj15*x378); IkReal x382=((1.0)*x379); IkReal x383=(x379*x380); evalcond[0]=(x378+((cj15*new_r00))+((new_r10*sj15))); evalcond[1]=((((-1.0)*new_r00*x380))+((cj15*new_r10))+x379); evalcond[2]=((((-1.0)*new_r01*x380))+((cj15*new_r11))+x378); evalcond[3]=(((sj15*x378))+((cj15*x379))+new_r10); evalcond[4]=(((cj15*new_r01))+(((-1.0)*x382))+((new_r11*sj15))); evalcond[5]=(x381+(((-1.0)*x383))+new_r00); evalcond[6]=(x381+(((-1.0)*x383))+new_r11); evalcond[7]=((((-1.0)*cj15*x382))+(((-1.0)*x378*x380))+new_r01); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j16)))), 6.28318530717959))); evalcond[1]=new_r02; evalcond[2]=new_r12; evalcond[3]=new_r20; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; IkReal x384=((1.0)*new_r11); if( IKabs(((((-1.0)*cj15*new_r10))+(((-1.0)*sj15*x384)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((((-1.0)*cj15*x384))+((new_r10*sj15)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*cj15*new_r10))+(((-1.0)*sj15*x384))))+IKsqr(((((-1.0)*cj15*x384))+((new_r10*sj15))))-1) <= IKFAST_SINCOS_THRESH ) continue; j17array[0]=IKatan2(((((-1.0)*cj15*new_r10))+(((-1.0)*sj15*x384))), ((((-1.0)*cj15*x384))+((new_r10*sj15)))); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[8]; IkReal x385=IKsin(j17); IkReal x386=IKcos(j17); IkReal x387=((1.0)*sj15); IkReal x388=(cj15*x385); IkReal x389=((1.0)*x386); IkReal x390=(x386*x387); evalcond[0]=(x385+((cj15*new_r01))+((new_r11*sj15))); evalcond[1]=((((-1.0)*new_r00*x387))+((cj15*new_r10))+x385); evalcond[2]=((((-1.0)*new_r01*x387))+((cj15*new_r11))+x386); evalcond[3]=(((cj15*new_r00))+(((-1.0)*x389))+((new_r10*sj15))); evalcond[4]=(((sj15*x385))+((cj15*x386))+new_r11); evalcond[5]=((((-1.0)*x390))+x388+new_r10); evalcond[6]=((((-1.0)*x390))+x388+new_r01); evalcond[7]=((((-1.0)*cj15*x389))+new_r00+(((-1.0)*x385*x387))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j15)))), 6.28318530717959))); evalcond[1]=new_r02; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; if( IKabs(new_r00) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r01) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r00)+IKsqr(new_r01)-1) <= IKFAST_SINCOS_THRESH ) continue; j17array[0]=IKatan2(new_r00, new_r01); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[8]; IkReal x391=IKcos(j17); IkReal x392=IKsin(j17); IkReal x393=((1.0)*cj16); IkReal x394=((1.0)*sj16); IkReal x395=((1.0)*x391); evalcond[0]=(x392+(((-1.0)*new_r00))); evalcond[1]=(x391+(((-1.0)*new_r01))); evalcond[2]=(((cj16*x391))+new_r10); evalcond[3]=((((-1.0)*new_r12*x395))+new_r20); evalcond[4]=(new_r21+(((-1.0)*x392*x394))); evalcond[5]=(new_r11+(((-1.0)*x392*x393))); evalcond[6]=((((-1.0)*new_r21*x394))+x392+(((-1.0)*new_r11*x393))); CheckValue<IkReal> x396=IKPowWithIntegerCheck(new_r12,-1); if(!x396.valid){ continue; } evalcond[7]=((((-1.0)*x395))+((new_r12*new_r20))+((new_r20*(x396.value)*(new_r22*new_r22)))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j15)))), 6.28318530717959))); evalcond[1]=new_r02; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; if( IKabs(((-1.0)*new_r00)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r01)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r00))+IKsqr(((-1.0)*new_r01))-1) <= IKFAST_SINCOS_THRESH ) continue; j17array[0]=IKatan2(((-1.0)*new_r00), ((-1.0)*new_r01)); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[8]; IkReal x397=IKcos(j17); IkReal x398=IKsin(j17); IkReal x399=((1.0)*sj16); evalcond[0]=(x398+new_r00); evalcond[1]=(x397+new_r01); evalcond[2]=(new_r20+((new_r12*x397))); evalcond[3]=((((-1.0)*x398*x399))+new_r21); evalcond[4]=(((cj16*x397))+(((-1.0)*new_r10))); evalcond[5]=((((-1.0)*cj16*x398))+(((-1.0)*new_r11))); evalcond[6]=((((-1.0)*new_r21*x399))+x398+((cj16*new_r11))); evalcond[7]=((((-1.0)*x397))+((cj16*new_r10))+(((-1.0)*new_r20*x399))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j17eval[1]; new_r21=0; new_r20=0; new_r02=0; new_r12=0; j17eval[0]=1.0; if( IKabs(j17eval[0]) < 0.0000000100000000 ) { continue; // no branches [j17] } else { IkReal op[2+1], zeror[2]; int numroots; op[0]=-1.0; op[1]=0; op[2]=1.0; polyroots2(op,zeror,numroots); IkReal j17array[2], cj17array[2], sj17array[2], tempj17array[1]; int numsolutions = 0; for(int ij17 = 0; ij17 < numroots; ++ij17) { IkReal htj17 = zeror[ij17]; tempj17array[0]=((2.0)*(atan(htj17))); for(int kj17 = 0; kj17 < 1; ++kj17) { j17array[numsolutions] = tempj17array[kj17]; if( j17array[numsolutions] > IKPI ) { j17array[numsolutions]-=IK2PI; } else if( j17array[numsolutions] < -IKPI ) { j17array[numsolutions]+=IK2PI; } sj17array[numsolutions] = IKsin(j17array[numsolutions]); cj17array[numsolutions] = IKcos(j17array[numsolutions]); numsolutions++; } } bool j17valid[2]={true,true}; _nj17 = 2; for(int ij17 = 0; ij17 < numsolutions; ++ij17) { if( !j17valid[ij17] ) { continue; } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; htj17 = IKtan(j17/2); _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < numsolutions; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j17] } } while(0); if( bgotonextstatement ) { } } } } } } } } } } else { { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; CheckValue<IkReal> x401=IKPowWithIntegerCheck(sj16,-1); if(!x401.valid){ continue; } IkReal x400=x401.value; CheckValue<IkReal> x402=IKPowWithIntegerCheck(sj15,-1); if(!x402.valid){ continue; } if( IKabs((x400*(x402.value)*(((((-1.0)*cj15*cj16*new_r20))+((new_r00*sj16)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20*x400)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((x400*(x402.value)*(((((-1.0)*cj15*cj16*new_r20))+((new_r00*sj16))))))+IKsqr(((-1.0)*new_r20*x400))-1) <= IKFAST_SINCOS_THRESH ) continue; j17array[0]=IKatan2((x400*(x402.value)*(((((-1.0)*cj15*cj16*new_r20))+((new_r00*sj16))))), ((-1.0)*new_r20*x400)); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[12]; IkReal x403=IKsin(j17); IkReal x404=IKcos(j17); IkReal x405=((1.0)*sj15); IkReal x406=(cj15*new_r01); IkReal x407=((1.0)*cj16); IkReal x408=((1.0)*sj16); IkReal x409=(cj15*new_r00); IkReal x410=(cj16*x404); IkReal x411=(cj16*x403); evalcond[0]=(new_r20+((sj16*x404))); evalcond[1]=((((-1.0)*x403*x408))+new_r21); evalcond[2]=(((cj15*new_r10))+x403+(((-1.0)*new_r00*x405))); evalcond[3]=(((cj15*new_r11))+x404+(((-1.0)*new_r01*x405))); evalcond[4]=(x409+x410+((new_r10*sj15))); evalcond[5]=(((cj15*x403))+((sj15*x410))+new_r10); evalcond[6]=((((-1.0)*x403*x407))+x406+((new_r11*sj15))); evalcond[7]=(((cj15*x410))+(((-1.0)*x403*x405))+new_r00); evalcond[8]=(((cj15*x404))+(((-1.0)*x405*x411))+new_r11); evalcond[9]=((((-1.0)*x404*x405))+new_r01+(((-1.0)*cj15*x403*x407))); evalcond[10]=((((-1.0)*x406*x407))+x403+(((-1.0)*new_r21*x408))+(((-1.0)*cj16*new_r11*x405))); evalcond[11]=((((-1.0)*new_r20*x408))+(((-1.0)*x407*x409))+(((-1.0)*cj16*new_r10*x405))+(((-1.0)*x404))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; CheckValue<IkReal> x413=IKPowWithIntegerCheck(sj16,-1); if(!x413.valid){ continue; } IkReal x412=x413.value; CheckValue<IkReal> x414=IKPowWithIntegerCheck(cj15,-1); if(!x414.valid){ continue; } if( IKabs((x412*(x414.value)*((((cj16*new_r20*sj15))+(((-1.0)*new_r10*sj16)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20*x412)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((x412*(x414.value)*((((cj16*new_r20*sj15))+(((-1.0)*new_r10*sj16))))))+IKsqr(((-1.0)*new_r20*x412))-1) <= IKFAST_SINCOS_THRESH ) continue; j17array[0]=IKatan2((x412*(x414.value)*((((cj16*new_r20*sj15))+(((-1.0)*new_r10*sj16))))), ((-1.0)*new_r20*x412)); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[12]; IkReal x415=IKsin(j17); IkReal x416=IKcos(j17); IkReal x417=((1.0)*sj15); IkReal x418=(cj15*new_r01); IkReal x419=((1.0)*cj16); IkReal x420=((1.0)*sj16); IkReal x421=(cj15*new_r00); IkReal x422=(cj16*x416); IkReal x423=(cj16*x415); evalcond[0]=(new_r20+((sj16*x416))); evalcond[1]=(new_r21+(((-1.0)*x415*x420))); evalcond[2]=(((cj15*new_r10))+x415+(((-1.0)*new_r00*x417))); evalcond[3]=(((cj15*new_r11))+x416+(((-1.0)*new_r01*x417))); evalcond[4]=(x422+x421+((new_r10*sj15))); evalcond[5]=(((sj15*x422))+((cj15*x415))+new_r10); evalcond[6]=(x418+(((-1.0)*x415*x419))+((new_r11*sj15))); evalcond[7]=(((cj15*x422))+(((-1.0)*x415*x417))+new_r00); evalcond[8]=(((cj15*x416))+(((-1.0)*x417*x423))+new_r11); evalcond[9]=((((-1.0)*cj15*x415*x419))+(((-1.0)*x416*x417))+new_r01); evalcond[10]=((((-1.0)*x418*x419))+x415+(((-1.0)*new_r21*x420))+(((-1.0)*cj16*new_r11*x417))); evalcond[11]=((((-1.0)*x419*x421))+(((-1.0)*cj16*new_r10*x417))+(((-1.0)*new_r20*x420))+(((-1.0)*x416))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; CheckValue<IkReal> x424 = IKatan2WithCheck(IkReal(new_r21),IkReal(((-1.0)*new_r20)),IKFAST_ATAN2_MAGTHRESH); if(!x424.valid){ continue; } CheckValue<IkReal> x425=IKPowWithIntegerCheck(IKsign(sj16),-1); if(!x425.valid){ continue; } j17array[0]=((-1.5707963267949)+(x424.value)+(((1.5707963267949)*(x425.value)))); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[12]; IkReal x426=IKsin(j17); IkReal x427=IKcos(j17); IkReal x428=((1.0)*sj15); IkReal x429=(cj15*new_r01); IkReal x430=((1.0)*cj16); IkReal x431=((1.0)*sj16); IkReal x432=(cj15*new_r00); IkReal x433=(cj16*x427); IkReal x434=(cj16*x426); evalcond[0]=(((sj16*x427))+new_r20); evalcond[1]=((((-1.0)*x426*x431))+new_r21); evalcond[2]=((((-1.0)*new_r00*x428))+((cj15*new_r10))+x426); evalcond[3]=(((cj15*new_r11))+x427+(((-1.0)*new_r01*x428))); evalcond[4]=(x432+x433+((new_r10*sj15))); evalcond[5]=(((cj15*x426))+new_r10+((sj15*x433))); evalcond[6]=(x429+(((-1.0)*x426*x430))+((new_r11*sj15))); evalcond[7]=((((-1.0)*x426*x428))+((cj15*x433))+new_r00); evalcond[8]=(((cj15*x427))+new_r11+(((-1.0)*x428*x434))); evalcond[9]=((((-1.0)*x427*x428))+(((-1.0)*cj15*x426*x430))+new_r01); evalcond[10]=((((-1.0)*x429*x430))+x426+(((-1.0)*cj16*new_r11*x428))+(((-1.0)*new_r21*x431))); evalcond[11]=((((-1.0)*x430*x432))+(((-1.0)*x427))+(((-1.0)*new_r20*x431))+(((-1.0)*cj16*new_r10*x428))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } } } } else { { IkReal j17array[1], cj17array[1], sj17array[1]; bool j17valid[1]={false}; _nj17 = 1; CheckValue<IkReal> x435 = IKatan2WithCheck(IkReal(new_r21),IkReal(((-1.0)*new_r20)),IKFAST_ATAN2_MAGTHRESH); if(!x435.valid){ continue; } CheckValue<IkReal> x436=IKPowWithIntegerCheck(IKsign(sj16),-1); if(!x436.valid){ continue; } j17array[0]=((-1.5707963267949)+(x435.value)+(((1.5707963267949)*(x436.value)))); sj17array[0]=IKsin(j17array[0]); cj17array[0]=IKcos(j17array[0]); if( j17array[0] > IKPI ) { j17array[0]-=IK2PI; } else if( j17array[0] < -IKPI ) { j17array[0]+=IK2PI; } j17valid[0] = true; for(int ij17 = 0; ij17 < 1; ++ij17) { if( !j17valid[ij17] ) { continue; } _ij17[0] = ij17; _ij17[1] = -1; for(int iij17 = ij17+1; iij17 < 1; ++iij17) { if( j17valid[iij17] && IKabs(cj17array[ij17]-cj17array[iij17]) < IKFAST_SOLUTION_THRESH && IKabs(sj17array[ij17]-sj17array[iij17]) < IKFAST_SOLUTION_THRESH ) { j17valid[iij17]=false; _ij17[1] = iij17; break; } } j17 = j17array[ij17]; cj17 = cj17array[ij17]; sj17 = sj17array[ij17]; { IkReal evalcond[2]; evalcond[0]=(((sj16*(IKcos(j17))))+new_r20); evalcond[1]=((((-1.0)*sj16*(IKsin(j17))))+new_r21); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH ) { continue; } } { IkReal j15eval[3]; j15eval[0]=sj16; j15eval[1]=IKsign(sj16); j15eval[2]=((IKabs(new_r12))+(IKabs(new_r02))); if( IKabs(j15eval[0]) < 0.0000010000000000 || IKabs(j15eval[1]) < 0.0000010000000000 || IKabs(j15eval[2]) < 0.0000010000000000 ) { { IkReal j15eval[2]; j15eval[0]=new_r12; j15eval[1]=sj16; if( IKabs(j15eval[0]) < 0.0000010000000000 || IKabs(j15eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[5]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j16))), 6.28318530717959))); evalcond[1]=new_r02; evalcond[2]=new_r12; evalcond[3]=new_r20; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j15eval[3]; sj16=0; cj16=1.0; j16=0; IkReal x437=((1.0)*new_r10); IkReal x438=((new_r10*new_r10)+(new_r00*new_r00)); j15eval[0]=x438; j15eval[1]=((IKabs(((((-1.0)*sj17*x437))+(((-1.0)*cj17*new_r00)))))+(IKabs(((((-1.0)*cj17*x437))+((new_r00*sj17)))))); j15eval[2]=IKsign(x438); if( IKabs(j15eval[0]) < 0.0000010000000000 || IKabs(j15eval[1]) < 0.0000010000000000 || IKabs(j15eval[2]) < 0.0000010000000000 ) { { IkReal j15eval[3]; sj16=0; cj16=1.0; j16=0; IkReal x439=((1.0)*cj17); IkReal x440=(((new_r10*new_r11))+((new_r00*new_r01))); j15eval[0]=x440; j15eval[1]=((IKabs(((((-1.0)*new_r11*x439))+((cj17*new_r00)))))+(IKabs(((((-1.0)*new_r01*x439))+(((-1.0)*new_r10*x439)))))); j15eval[2]=IKsign(x440); if( IKabs(j15eval[0]) < 0.0000010000000000 || IKabs(j15eval[1]) < 0.0000010000000000 || IKabs(j15eval[2]) < 0.0000010000000000 ) { { IkReal j15eval[3]; sj16=0; cj16=1.0; j16=0; IkReal x441=((1.0)*new_r10); IkReal x442=((((-1.0)*sj17*x441))+((cj17*new_r00))); j15eval[0]=x442; j15eval[1]=((IKabs(((((-1.0)*new_r00*x441))+((cj17*sj17)))))+(IKabs(((new_r10*new_r10)+(((-1.0)*(cj17*cj17))))))); j15eval[2]=IKsign(x442); if( IKabs(j15eval[0]) < 0.0000010000000000 || IKabs(j15eval[1]) < 0.0000010000000000 || IKabs(j15eval[2]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { IkReal x445 = ((new_r10*new_r10)+(new_r00*new_r00)); if(IKabs(x445)==0){ continue; } IkReal x443=pow(x445,-0.5); IkReal x444=((-1.0)*x443); CheckValue<IkReal> x446 = IKatan2WithCheck(IkReal(new_r00),IkReal(((-1.0)*new_r10)),IKFAST_ATAN2_MAGTHRESH); if(!x446.valid){ continue; } IkReal gconst1=(new_r00*x444); IkReal gconst2=(new_r10*x444); CheckValue<IkReal> x447 = IKatan2WithCheck(IkReal(new_r00),IkReal(((-1.0)*new_r10)),IKFAST_ATAN2_MAGTHRESH); if(!x447.valid){ continue; } evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((x447.value)+j17)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j15eval[2]; CheckValue<IkReal> x451 = IKatan2WithCheck(IkReal(new_r00),IkReal(((-1.0)*new_r10)),IKFAST_ATAN2_MAGTHRESH); if(!x451.valid){ continue; } IkReal x448=((-1.0)*(x451.value)); IkReal x449=x443; IkReal x450=((-1.0)*x449); sj16=0; cj16=1.0; j16=0; sj17=gconst1; cj17=gconst2; j17=x448; IkReal gconst1=(new_r00*x450); IkReal gconst2=(new_r10*x450); IkReal x452=((new_r10*new_r10)+(new_r00*new_r00)); j15eval[0]=x452; j15eval[1]=IKsign(x452); if( IKabs(j15eval[0]) < 0.0000010000000000 || IKabs(j15eval[1]) < 0.0000010000000000 ) { { IkReal j15eval[3]; CheckValue<IkReal> x456 = IKatan2WithCheck(IkReal(new_r00),IkReal(((-1.0)*new_r10)),IKFAST_ATAN2_MAGTHRESH); if(!x456.valid){ continue; } IkReal x453=((-1.0)*(x456.value)); IkReal x454=x443; IkReal x455=((-1.0)*x454); sj16=0; cj16=1.0; j16=0; sj17=gconst1; cj17=gconst2; j17=x453; IkReal gconst1=(new_r00*x455); IkReal gconst2=(new_r10*x455); IkReal x457=new_r10*new_r10; IkReal x458=(((new_r10*new_r11))+((new_r00*new_r01))); IkReal x459=x443; IkReal x460=(new_r10*x459); j15eval[0]=x458; j15eval[1]=IKsign(x458); j15eval[2]=((IKabs((((new_r11*x460))+(((-1.0)*new_r00*x460)))))+(IKabs((((new_r01*x460))+((x457*x459)))))); if( IKabs(j15eval[0]) < 0.0000010000000000 || IKabs(j15eval[1]) < 0.0000010000000000 || IKabs(j15eval[2]) < 0.0000010000000000 ) { { IkReal j15eval[1]; CheckValue<IkReal> x464 = IKatan2WithCheck(IkReal(new_r00),IkReal(((-1.0)*new_r10)),IKFAST_ATAN2_MAGTHRESH); if(!x464.valid){ continue; } IkReal x461=((-1.0)*(x464.value)); IkReal x462=x443; IkReal x463=((-1.0)*x462); sj16=0; cj16=1.0; j16=0; sj17=gconst1; cj17=gconst2; j17=x461; IkReal gconst1=(new_r00*x463); IkReal gconst2=(new_r10*x463); IkReal x465=new_r10*new_r10; IkReal x466=new_r00*new_r00; CheckValue<IkReal> x473=IKPowWithIntegerCheck((x466+x465),-1); if(!x473.valid){ continue; } IkReal x467=x473.value; IkReal x468=(x465*x467); CheckValue<IkReal> x474=IKPowWithIntegerCheck(((((-1.0)*x466))+(((-1.0)*x465))),-1); if(!x474.valid){ continue; } IkReal x469=x474.value; IkReal x470=((1.0)*x469); IkReal x471=(new_r00*x470); j15eval[0]=((IKabs((((x466*x468))+(((-1.0)*x468))+((x467*(x466*x466))))))+(IKabs(((((-1.0)*new_r10*x471))+(((-1.0)*x471*(new_r10*new_r10*new_r10)))+(((-1.0)*new_r10*x471*(new_r00*new_r00))))))); if( IKabs(j15eval[0]) < 0.0000010000000000 ) { continue; // no branches [j15] } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; CheckValue<IkReal> x475 = IKatan2WithCheck(IkReal(((((-1.0)*(gconst2*gconst2)))+(new_r00*new_r00))),IkReal(((((-1.0)*gconst1*gconst2))+(((-1.0)*new_r00*new_r10)))),IKFAST_ATAN2_MAGTHRESH); if(!x475.valid){ continue; } CheckValue<IkReal> x476=IKPowWithIntegerCheck(IKsign((((gconst2*new_r10))+((gconst1*new_r00)))),-1); if(!x476.valid){ continue; } j15array[0]=((-1.5707963267949)+(x475.value)+(((1.5707963267949)*(x476.value)))); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x477=IKsin(j15); IkReal x478=IKcos(j15); IkReal x479=(gconst2*x478); IkReal x480=((1.0)*x477); IkReal x481=(gconst1*x478); IkReal x482=(gconst1*x480); evalcond[0]=(((new_r10*x477))+gconst2+((new_r00*x478))); evalcond[1]=(x481+((gconst2*x477))+new_r10); evalcond[2]=((((-1.0)*new_r00*x480))+((new_r10*x478))+gconst1); evalcond[3]=((((-1.0)*new_r01*x480))+gconst2+((new_r11*x478))); evalcond[4]=((((-1.0)*x482))+x479+new_r00); evalcond[5]=((((-1.0)*x482))+x479+new_r11); evalcond[6]=(((new_r01*x478))+((new_r11*x477))+(((-1.0)*gconst1))); evalcond[7]=((((-1.0)*gconst2*x480))+(((-1.0)*x481))+new_r01); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; IkReal x483=((1.0)*gconst2); CheckValue<IkReal> x484 = IKatan2WithCheck(IkReal((((gconst2*new_r00))+(((-1.0)*new_r11*x483)))),IkReal(((((-1.0)*new_r01*x483))+(((-1.0)*new_r10*x483)))),IKFAST_ATAN2_MAGTHRESH); if(!x484.valid){ continue; } CheckValue<IkReal> x485=IKPowWithIntegerCheck(IKsign((((new_r10*new_r11))+((new_r00*new_r01)))),-1); if(!x485.valid){ continue; } j15array[0]=((-1.5707963267949)+(x484.value)+(((1.5707963267949)*(x485.value)))); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x486=IKsin(j15); IkReal x487=IKcos(j15); IkReal x488=(gconst2*x487); IkReal x489=((1.0)*x486); IkReal x490=(gconst1*x487); IkReal x491=(gconst1*x489); evalcond[0]=(gconst2+((new_r10*x486))+((new_r00*x487))); evalcond[1]=(x490+((gconst2*x486))+new_r10); evalcond[2]=((((-1.0)*new_r00*x489))+gconst1+((new_r10*x487))); evalcond[3]=((((-1.0)*new_r01*x489))+((new_r11*x487))+gconst2); evalcond[4]=((((-1.0)*x491))+x488+new_r00); evalcond[5]=((((-1.0)*x491))+x488+new_r11); evalcond[6]=(((new_r11*x486))+(((-1.0)*gconst1))+((new_r01*x487))); evalcond[7]=((((-1.0)*gconst2*x489))+(((-1.0)*x490))+new_r01); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; IkReal x492=((1.0)*new_r10); CheckValue<IkReal> x493=IKPowWithIntegerCheck(IKsign(((new_r10*new_r10)+(new_r00*new_r00))),-1); if(!x493.valid){ continue; } CheckValue<IkReal> x494 = IKatan2WithCheck(IkReal((((gconst1*new_r00))+(((-1.0)*gconst2*x492)))),IkReal(((((-1.0)*gconst1*x492))+(((-1.0)*gconst2*new_r00)))),IKFAST_ATAN2_MAGTHRESH); if(!x494.valid){ continue; } j15array[0]=((-1.5707963267949)+(((1.5707963267949)*(x493.value)))+(x494.value)); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x495=IKsin(j15); IkReal x496=IKcos(j15); IkReal x497=(gconst2*x496); IkReal x498=((1.0)*x495); IkReal x499=(gconst1*x496); IkReal x500=(gconst1*x498); evalcond[0]=(gconst2+((new_r10*x495))+((new_r00*x496))); evalcond[1]=(((gconst2*x495))+x499+new_r10); evalcond[2]=((((-1.0)*new_r00*x498))+gconst1+((new_r10*x496))); evalcond[3]=((((-1.0)*new_r01*x498))+gconst2+((new_r11*x496))); evalcond[4]=((((-1.0)*x500))+x497+new_r00); evalcond[5]=((((-1.0)*x500))+x497+new_r11); evalcond[6]=((((-1.0)*gconst1))+((new_r11*x495))+((new_r01*x496))); evalcond[7]=((((-1.0)*gconst2*x498))+(((-1.0)*x499))+new_r01); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { IkReal x503 = ((new_r10*new_r10)+(new_r00*new_r00)); if(IKabs(x503)==0){ continue; } IkReal x501=pow(x503,-0.5); IkReal x502=((1.0)*x501); CheckValue<IkReal> x504 = IKatan2WithCheck(IkReal(new_r00),IkReal(((-1.0)*new_r10)),IKFAST_ATAN2_MAGTHRESH); if(!x504.valid){ continue; } IkReal gconst4=(new_r00*x502); IkReal gconst5=(new_r10*x502); CheckValue<IkReal> x505 = IKatan2WithCheck(IkReal(new_r00),IkReal(((-1.0)*new_r10)),IKFAST_ATAN2_MAGTHRESH); if(!x505.valid){ continue; } evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+(x505.value)+j17)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j15eval[2]; CheckValue<IkReal> x509 = IKatan2WithCheck(IkReal(new_r00),IkReal(((-1.0)*new_r10)),IKFAST_ATAN2_MAGTHRESH); if(!x509.valid){ continue; } IkReal x506=((1.0)*(x509.value)); IkReal x507=x501; IkReal x508=((1.0)*x507); sj16=0; cj16=1.0; j16=0; sj17=gconst4; cj17=gconst5; j17=((3.14159265)+(((-1.0)*x506))); IkReal gconst4=(new_r00*x508); IkReal gconst5=(new_r10*x508); IkReal x510=((new_r10*new_r10)+(new_r00*new_r00)); j15eval[0]=x510; j15eval[1]=IKsign(x510); if( IKabs(j15eval[0]) < 0.0000010000000000 || IKabs(j15eval[1]) < 0.0000010000000000 ) { { IkReal j15eval[3]; CheckValue<IkReal> x514 = IKatan2WithCheck(IkReal(new_r00),IkReal(((-1.0)*new_r10)),IKFAST_ATAN2_MAGTHRESH); if(!x514.valid){ continue; } IkReal x511=((1.0)*(x514.value)); IkReal x512=x501; IkReal x513=((1.0)*x512); sj16=0; cj16=1.0; j16=0; sj17=gconst4; cj17=gconst5; j17=((3.14159265)+(((-1.0)*x511))); IkReal gconst4=(new_r00*x513); IkReal gconst5=(new_r10*x513); IkReal x515=new_r10*new_r10; IkReal x516=(new_r10*new_r11); IkReal x517=(((new_r00*new_r01))+x516); IkReal x518=x501; IkReal x519=((1.0)*x518); j15eval[0]=x517; j15eval[1]=((IKabs(((((-1.0)*x515*x519))+(((-1.0)*new_r01*new_r10*x519)))))+(IKabs((((new_r00*new_r10*x518))+(((-1.0)*x516*x519)))))); j15eval[2]=IKsign(x517); if( IKabs(j15eval[0]) < 0.0000010000000000 || IKabs(j15eval[1]) < 0.0000010000000000 || IKabs(j15eval[2]) < 0.0000010000000000 ) { { IkReal j15eval[1]; CheckValue<IkReal> x523 = IKatan2WithCheck(IkReal(new_r00),IkReal(((-1.0)*new_r10)),IKFAST_ATAN2_MAGTHRESH); if(!x523.valid){ continue; } IkReal x520=((1.0)*(x523.value)); IkReal x521=x501; IkReal x522=((1.0)*x521); sj16=0; cj16=1.0; j16=0; sj17=gconst4; cj17=gconst5; j17=((3.14159265)+(((-1.0)*x520))); IkReal gconst4=(new_r00*x522); IkReal gconst5=(new_r10*x522); IkReal x524=new_r10*new_r10; IkReal x525=new_r00*new_r00; CheckValue<IkReal> x532=IKPowWithIntegerCheck((x524+x525),-1); if(!x532.valid){ continue; } IkReal x526=x532.value; IkReal x527=(x524*x526); CheckValue<IkReal> x533=IKPowWithIntegerCheck(((((-1.0)*x524))+(((-1.0)*x525))),-1); if(!x533.valid){ continue; } IkReal x528=x533.value; IkReal x529=((1.0)*x528); IkReal x530=(new_r00*x529); j15eval[0]=((IKabs(((((-1.0)*new_r10*x530))+(((-1.0)*new_r10*x530*(new_r00*new_r00)))+(((-1.0)*x530*(new_r10*new_r10*new_r10))))))+(IKabs((((x526*(x525*x525)))+(((-1.0)*x527))+((x525*x527)))))); if( IKabs(j15eval[0]) < 0.0000010000000000 ) { continue; // no branches [j15] } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; CheckValue<IkReal> x534=IKPowWithIntegerCheck(IKsign((((gconst4*new_r00))+((gconst5*new_r10)))),-1); if(!x534.valid){ continue; } CheckValue<IkReal> x535 = IKatan2WithCheck(IkReal(((((-1.0)*(gconst5*gconst5)))+(new_r00*new_r00))),IkReal(((((-1.0)*gconst4*gconst5))+(((-1.0)*new_r00*new_r10)))),IKFAST_ATAN2_MAGTHRESH); if(!x535.valid){ continue; } j15array[0]=((-1.5707963267949)+(((1.5707963267949)*(x534.value)))+(x535.value)); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x536=IKsin(j15); IkReal x537=IKcos(j15); IkReal x538=((1.0)*gconst4); IkReal x539=(gconst5*x537); IkReal x540=(gconst5*x536); IkReal x541=((1.0)*x536); IkReal x542=(x536*x538); evalcond[0]=(gconst5+((new_r10*x536))+((new_r00*x537))); evalcond[1]=(((gconst4*x537))+x540+new_r10); evalcond[2]=((((-1.0)*new_r00*x541))+gconst4+((new_r10*x537))); evalcond[3]=(gconst5+((new_r11*x537))+(((-1.0)*new_r01*x541))); evalcond[4]=((((-1.0)*x542))+x539+new_r00); evalcond[5]=((((-1.0)*x542))+x539+new_r11); evalcond[6]=(((new_r01*x537))+((new_r11*x536))+(((-1.0)*x538))); evalcond[7]=((((-1.0)*x537*x538))+(((-1.0)*x540))+new_r01); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; IkReal x543=((1.0)*gconst5); CheckValue<IkReal> x544 = IKatan2WithCheck(IkReal((((gconst5*new_r00))+(((-1.0)*new_r11*x543)))),IkReal(((((-1.0)*new_r10*x543))+(((-1.0)*new_r01*x543)))),IKFAST_ATAN2_MAGTHRESH); if(!x544.valid){ continue; } CheckValue<IkReal> x545=IKPowWithIntegerCheck(IKsign((((new_r10*new_r11))+((new_r00*new_r01)))),-1); if(!x545.valid){ continue; } j15array[0]=((-1.5707963267949)+(x544.value)+(((1.5707963267949)*(x545.value)))); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x546=IKsin(j15); IkReal x547=IKcos(j15); IkReal x548=((1.0)*gconst4); IkReal x549=(gconst5*x547); IkReal x550=(gconst5*x546); IkReal x551=((1.0)*x546); IkReal x552=(x546*x548); evalcond[0]=(((new_r00*x547))+gconst5+((new_r10*x546))); evalcond[1]=(((gconst4*x547))+x550+new_r10); evalcond[2]=(gconst4+((new_r10*x547))+(((-1.0)*new_r00*x551))); evalcond[3]=(gconst5+(((-1.0)*new_r01*x551))+((new_r11*x547))); evalcond[4]=((((-1.0)*x552))+x549+new_r00); evalcond[5]=((((-1.0)*x552))+x549+new_r11); evalcond[6]=(((new_r11*x546))+(((-1.0)*x548))+((new_r01*x547))); evalcond[7]=((((-1.0)*x550))+(((-1.0)*x547*x548))+new_r01); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; IkReal x553=((1.0)*new_r10); CheckValue<IkReal> x554=IKPowWithIntegerCheck(IKsign(((new_r10*new_r10)+(new_r00*new_r00))),-1); if(!x554.valid){ continue; } CheckValue<IkReal> x555 = IKatan2WithCheck(IkReal((((gconst4*new_r00))+(((-1.0)*gconst5*x553)))),IkReal(((((-1.0)*gconst4*x553))+(((-1.0)*gconst5*new_r00)))),IKFAST_ATAN2_MAGTHRESH); if(!x555.valid){ continue; } j15array[0]=((-1.5707963267949)+(((1.5707963267949)*(x554.value)))+(x555.value)); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x556=IKsin(j15); IkReal x557=IKcos(j15); IkReal x558=((1.0)*gconst4); IkReal x559=(gconst5*x557); IkReal x560=(gconst5*x556); IkReal x561=((1.0)*x556); IkReal x562=(x556*x558); evalcond[0]=(((new_r10*x556))+gconst5+((new_r00*x557))); evalcond[1]=(((gconst4*x557))+x560+new_r10); evalcond[2]=((((-1.0)*new_r00*x561))+((new_r10*x557))+gconst4); evalcond[3]=(((new_r11*x557))+gconst5+(((-1.0)*new_r01*x561))); evalcond[4]=(x559+new_r00+(((-1.0)*x562))); evalcond[5]=(x559+new_r11+(((-1.0)*x562))); evalcond[6]=(((new_r11*x556))+(((-1.0)*x558))+((new_r01*x557))); evalcond[7]=((((-1.0)*x560))+new_r01+(((-1.0)*x557*x558))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j17)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; if( IKabs(new_r00) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r10)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r00)+IKsqr(((-1.0)*new_r10))-1) <= IKFAST_SINCOS_THRESH ) continue; j15array[0]=IKatan2(new_r00, ((-1.0)*new_r10)); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x563=IKcos(j15); IkReal x564=IKsin(j15); IkReal x565=((1.0)*x564); evalcond[0]=(x563+new_r10); evalcond[1]=(new_r00+(((-1.0)*x565))); evalcond[2]=(new_r11+(((-1.0)*x565))); evalcond[3]=((((-1.0)*x563))+new_r01); evalcond[4]=(((new_r00*x563))+((new_r10*x564))); evalcond[5]=(((new_r11*x563))+(((-1.0)*new_r01*x565))); evalcond[6]=((-1.0)+((new_r01*x563))+((new_r11*x564))); evalcond[7]=((1.0)+(((-1.0)*new_r00*x565))+((new_r10*x563))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j17)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; if( IKabs(((-1.0)*new_r00)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r01)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r00))+IKsqr(((-1.0)*new_r01))-1) <= IKFAST_SINCOS_THRESH ) continue; j15array[0]=IKatan2(((-1.0)*new_r00), ((-1.0)*new_r01)); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x566=IKsin(j15); IkReal x567=IKcos(j15); IkReal x568=((1.0)*x566); evalcond[0]=(x566+new_r00); evalcond[1]=(x566+new_r11); evalcond[2]=(x567+new_r01); evalcond[3]=((((-1.0)*x567))+new_r10); evalcond[4]=(((new_r00*x567))+((new_r10*x566))); evalcond[5]=(((new_r11*x567))+(((-1.0)*new_r01*x568))); evalcond[6]=((1.0)+((new_r01*x567))+((new_r11*x566))); evalcond[7]=((-1.0)+(((-1.0)*new_r00*x568))+((new_r10*x567))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((new_r10*new_r10)+(new_r00*new_r00)); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j15eval[1]; sj16=0; cj16=1.0; j16=0; new_r10=0; new_r00=0; j15eval[0]=((IKabs(new_r11))+(IKabs(new_r01))); if( IKabs(j15eval[0]) < 0.0000010000000000 ) { continue; // 3 cases reached } else { { IkReal j15array[2], cj15array[2], sj15array[2]; bool j15valid[2]={false}; _nj15 = 2; CheckValue<IkReal> x570 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x570.valid){ continue; } IkReal x569=x570.value; j15array[0]=((-1.0)*x569); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); j15array[1]=((3.14159265358979)+(((-1.0)*x569))); sj15array[1]=IKsin(j15array[1]); cj15array[1]=IKcos(j15array[1]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; if( j15array[1] > IKPI ) { j15array[1]-=IK2PI; } else if( j15array[1] < -IKPI ) { j15array[1]+=IK2PI; } j15valid[1] = true; for(int ij15 = 0; ij15 < 2; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 2; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[1]; evalcond[0]=((((-1.0)*new_r01*(IKsin(j15))))+((new_r11*(IKcos(j15))))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r10))+(IKabs(new_r00))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j15eval[1]; sj16=0; cj16=1.0; j16=0; new_r00=0; new_r10=0; new_r21=0; new_r22=0; j15eval[0]=((IKabs(new_r11))+(IKabs(new_r01))); if( IKabs(j15eval[0]) < 0.0000010000000000 ) { continue; // no branches [j15] } else { { IkReal j15array[2], cj15array[2], sj15array[2]; bool j15valid[2]={false}; _nj15 = 2; CheckValue<IkReal> x572 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x572.valid){ continue; } IkReal x571=x572.value; j15array[0]=((-1.0)*x571); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); j15array[1]=((3.14159265358979)+(((-1.0)*x571))); sj15array[1]=IKsin(j15array[1]); cj15array[1]=IKcos(j15array[1]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; if( j15array[1] > IKPI ) { j15array[1]-=IK2PI; } else if( j15array[1] < -IKPI ) { j15array[1]+=IK2PI; } j15valid[1] = true; for(int ij15 = 0; ij15 < 2; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 2; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[1]; evalcond[0]=((((-1.0)*new_r01*(IKsin(j15))))+((new_r11*(IKcos(j15))))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j15] } } while(0); if( bgotonextstatement ) { } } } } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; IkReal x573=((1.0)*new_r10); CheckValue<IkReal> x574 = IKatan2WithCheck(IkReal(((((-1.0)*new_r00*x573))+((cj17*sj17)))),IkReal(((new_r10*new_r10)+(((-1.0)*(cj17*cj17))))),IKFAST_ATAN2_MAGTHRESH); if(!x574.valid){ continue; } CheckValue<IkReal> x575=IKPowWithIntegerCheck(IKsign(((((-1.0)*sj17*x573))+((cj17*new_r00)))),-1); if(!x575.valid){ continue; } j15array[0]=((-1.5707963267949)+(x574.value)+(((1.5707963267949)*(x575.value)))); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x576=IKcos(j15); IkReal x577=IKsin(j15); IkReal x578=((1.0)*sj17); IkReal x579=(cj17*x576); IkReal x580=(cj17*x577); IkReal x581=((1.0)*x577); IkReal x582=(x577*x578); evalcond[0]=(((new_r00*x576))+((new_r10*x577))+cj17); evalcond[1]=(((sj17*x576))+x580+new_r10); evalcond[2]=(((new_r10*x576))+sj17+(((-1.0)*new_r00*x581))); evalcond[3]=((((-1.0)*new_r01*x581))+((new_r11*x576))+cj17); evalcond[4]=(x579+new_r00+(((-1.0)*x582))); evalcond[5]=(x579+new_r11+(((-1.0)*x582))); evalcond[6]=(((new_r11*x577))+((new_r01*x576))+(((-1.0)*x578))); evalcond[7]=((((-1.0)*x580))+(((-1.0)*x576*x578))+new_r01); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; IkReal x583=((1.0)*cj17); CheckValue<IkReal> x584 = IKatan2WithCheck(IkReal(((((-1.0)*new_r11*x583))+((cj17*new_r00)))),IkReal(((((-1.0)*new_r01*x583))+(((-1.0)*new_r10*x583)))),IKFAST_ATAN2_MAGTHRESH); if(!x584.valid){ continue; } CheckValue<IkReal> x585=IKPowWithIntegerCheck(IKsign((((new_r10*new_r11))+((new_r00*new_r01)))),-1); if(!x585.valid){ continue; } j15array[0]=((-1.5707963267949)+(x584.value)+(((1.5707963267949)*(x585.value)))); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x586=IKcos(j15); IkReal x587=IKsin(j15); IkReal x588=((1.0)*sj17); IkReal x589=(cj17*x586); IkReal x590=(cj17*x587); IkReal x591=((1.0)*x587); IkReal x592=(x587*x588); evalcond[0]=(cj17+((new_r00*x586))+((new_r10*x587))); evalcond[1]=(((sj17*x586))+x590+new_r10); evalcond[2]=((((-1.0)*new_r00*x591))+sj17+((new_r10*x586))); evalcond[3]=((((-1.0)*new_r01*x591))+cj17+((new_r11*x586))); evalcond[4]=((((-1.0)*x592))+x589+new_r00); evalcond[5]=((((-1.0)*x592))+x589+new_r11); evalcond[6]=(((new_r01*x586))+(((-1.0)*x588))+((new_r11*x587))); evalcond[7]=((((-1.0)*x590))+(((-1.0)*x586*x588))+new_r01); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; IkReal x593=((1.0)*new_r10); CheckValue<IkReal> x594=IKPowWithIntegerCheck(IKsign(((new_r10*new_r10)+(new_r00*new_r00))),-1); if(!x594.valid){ continue; } CheckValue<IkReal> x595 = IKatan2WithCheck(IkReal((((new_r00*sj17))+(((-1.0)*cj17*x593)))),IkReal(((((-1.0)*sj17*x593))+(((-1.0)*cj17*new_r00)))),IKFAST_ATAN2_MAGTHRESH); if(!x595.valid){ continue; } j15array[0]=((-1.5707963267949)+(((1.5707963267949)*(x594.value)))+(x595.value)); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x596=IKcos(j15); IkReal x597=IKsin(j15); IkReal x598=((1.0)*sj17); IkReal x599=(cj17*x596); IkReal x600=(cj17*x597); IkReal x601=((1.0)*x597); IkReal x602=(x597*x598); evalcond[0]=(((new_r10*x597))+((new_r00*x596))+cj17); evalcond[1]=(x600+new_r10+((sj17*x596))); evalcond[2]=(((new_r10*x596))+sj17+(((-1.0)*new_r00*x601))); evalcond[3]=(((new_r11*x596))+cj17+(((-1.0)*new_r01*x601))); evalcond[4]=(x599+(((-1.0)*x602))+new_r00); evalcond[5]=(x599+(((-1.0)*x602))+new_r11); evalcond[6]=(((new_r11*x597))+((new_r01*x596))+(((-1.0)*x598))); evalcond[7]=((((-1.0)*x596*x598))+(((-1.0)*x600))+new_r01); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j16)))), 6.28318530717959))); evalcond[1]=new_r02; evalcond[2]=new_r12; evalcond[3]=new_r20; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j15eval[3]; sj16=0; cj16=-1.0; j16=3.14159265358979; IkReal x603=((1.0)*sj17); IkReal x604=(((new_r10*new_r11))+((new_r00*new_r01))); j15eval[0]=x604; j15eval[1]=((IKabs(((((-1.0)*new_r11*x603))+(((-1.0)*new_r00*x603)))))+(IKabs(((((-1.0)*new_r10*x603))+((new_r01*sj17)))))); j15eval[2]=IKsign(x604); if( IKabs(j15eval[0]) < 0.0000010000000000 || IKabs(j15eval[1]) < 0.0000010000000000 || IKabs(j15eval[2]) < 0.0000010000000000 ) { { IkReal j15eval[3]; sj16=0; cj16=-1.0; j16=3.14159265358979; IkReal x605=((1.0)*new_r11); IkReal x606=((new_r01*new_r01)+(new_r11*new_r11)); j15eval[0]=x606; j15eval[1]=((IKabs(((((-1.0)*sj17*x605))+((cj17*new_r01)))))+(IKabs(((((-1.0)*cj17*x605))+(((-1.0)*new_r01*sj17)))))); j15eval[2]=IKsign(x606); if( IKabs(j15eval[0]) < 0.0000010000000000 || IKabs(j15eval[1]) < 0.0000010000000000 || IKabs(j15eval[2]) < 0.0000010000000000 ) { { IkReal j15eval[3]; sj16=0; cj16=-1.0; j16=3.14159265358979; IkReal x607=(((new_r11*sj17))+((cj17*new_r01))); j15eval[0]=x607; j15eval[1]=((IKabs(((((-1.0)*cj17*sj17))+(((-1.0)*new_r10*new_r11)))))+(IKabs(((-1.0)+((new_r01*new_r10))+(cj17*cj17))))); j15eval[2]=IKsign(x607); if( IKabs(j15eval[0]) < 0.0000010000000000 || IKabs(j15eval[1]) < 0.0000010000000000 || IKabs(j15eval[2]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { IkReal x609 = ((new_r01*new_r01)+(new_r11*new_r11)); if(IKabs(x609)==0){ continue; } IkReal x608=pow(x609,-0.5); CheckValue<IkReal> x610 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x610.valid){ continue; } IkReal gconst7=((-1.0)*new_r01*x608); IkReal gconst8=(new_r11*x608); CheckValue<IkReal> x611 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x611.valid){ continue; } evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs((j17+(x611.value))))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j15eval[3]; CheckValue<IkReal> x614 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x614.valid){ continue; } IkReal x612=((-1.0)*(x614.value)); IkReal x613=x608; sj16=0; cj16=-1.0; j16=3.14159265358979; sj17=gconst7; cj17=gconst8; j17=x612; IkReal gconst7=((-1.0)*new_r01*x613); IkReal gconst8=(new_r11*x613); IkReal x615=new_r01*new_r01; IkReal x616=(new_r00*new_r01); IkReal x617=(((new_r10*new_r11))+x616); IkReal x618=x608; IkReal x619=(new_r01*x618); j15eval[0]=x617; j15eval[1]=IKsign(x617); j15eval[2]=((IKabs((((x616*x618))+((new_r11*x619)))))+(IKabs(((((-1.0)*x615*x618))+((new_r10*x619)))))); if( IKabs(j15eval[0]) < 0.0000010000000000 || IKabs(j15eval[1]) < 0.0000010000000000 || IKabs(j15eval[2]) < 0.0000010000000000 ) { { IkReal j15eval[2]; CheckValue<IkReal> x622 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x622.valid){ continue; } IkReal x620=((-1.0)*(x622.value)); IkReal x621=x608; sj16=0; cj16=-1.0; j16=3.14159265358979; sj17=gconst7; cj17=gconst8; j17=x620; IkReal gconst7=((-1.0)*new_r01*x621); IkReal gconst8=(new_r11*x621); IkReal x623=((new_r01*new_r01)+(new_r11*new_r11)); j15eval[0]=x623; j15eval[1]=IKsign(x623); if( IKabs(j15eval[0]) < 0.0000010000000000 || IKabs(j15eval[1]) < 0.0000010000000000 ) { { IkReal j15eval[1]; CheckValue<IkReal> x626 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x626.valid){ continue; } IkReal x624=((-1.0)*(x626.value)); IkReal x625=x608; sj16=0; cj16=-1.0; j16=3.14159265358979; sj17=gconst7; cj17=gconst8; j17=x624; IkReal gconst7=((-1.0)*new_r01*x625); IkReal gconst8=(new_r11*x625); IkReal x627=new_r01*new_r01; IkReal x628=new_r11*new_r11; IkReal x629=((1.0)*x627); CheckValue<IkReal> x635=IKPowWithIntegerCheck((x627+x628),-1); if(!x635.valid){ continue; } IkReal x630=x635.value; CheckValue<IkReal> x636=IKPowWithIntegerCheck(((((-1.0)*x629))+(((-1.0)*x628))),-1); if(!x636.valid){ continue; } IkReal x631=x636.value; IkReal x632=((1.0)*x631); IkReal x633=(new_r11*x632); j15eval[0]=((IKabs(((((-1.0)*new_r01*x633))+(((-1.0)*new_r01*x633*(new_r11*new_r11)))+(((-1.0)*x633*(new_r01*new_r01*new_r01))))))+(IKabs(((((-1.0)*x629*x630))+((x630*(x628*x628)))+((x627*x628*x630)))))); if( IKabs(j15eval[0]) < 0.0000010000000000 ) { { IkReal evalcond[2]; bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r11))+(IKabs(new_r00))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j15eval[1]; CheckValue<IkReal> x638 = IKatan2WithCheck(IkReal(new_r01),IkReal(0),IKFAST_ATAN2_MAGTHRESH); if(!x638.valid){ continue; } IkReal x637=((-1.0)*(x638.value)); sj16=0; cj16=-1.0; j16=3.14159265358979; sj17=gconst7; cj17=gconst8; j17=x637; new_r11=0; new_r00=0; IkReal x639 = new_r01*new_r01; if(IKabs(x639)==0){ continue; } IkReal gconst7=((-1.0)*new_r01*(pow(x639,-0.5))); j15eval[0]=new_r10; if( IKabs(j15eval[0]) < 0.0000010000000000 ) { { IkReal j15array[2], cj15array[2], sj15array[2]; bool j15valid[2]={false}; _nj15 = 2; CheckValue<IkReal> x640=IKPowWithIntegerCheck(gconst7,-1); if(!x640.valid){ continue; } cj15array[0]=((-1.0)*new_r10*(x640.value)); if( cj15array[0] >= -1-IKFAST_SINCOS_THRESH && cj15array[0] <= 1+IKFAST_SINCOS_THRESH ) { j15valid[0] = j15valid[1] = true; j15array[0] = IKacos(cj15array[0]); sj15array[0] = IKsin(j15array[0]); cj15array[1] = cj15array[0]; j15array[1] = -j15array[0]; sj15array[1] = -sj15array[0]; } else if( isnan(cj15array[0]) ) { // probably any value will work j15valid[0] = true; cj15array[0] = 1; sj15array[0] = 0; j15array[0] = 0; } for(int ij15 = 0; ij15 < 2; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 2; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[6]; IkReal x641=IKsin(j15); IkReal x642=IKcos(j15); IkReal x643=((-1.0)*x641); evalcond[0]=(new_r10*x641); evalcond[1]=(new_r01*x643); evalcond[2]=(gconst7*x643); evalcond[3]=(gconst7+((new_r10*x642))); evalcond[4]=(gconst7+((new_r01*x642))); evalcond[5]=(((gconst7*x642))+new_r01); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } else { { IkReal j15array[2], cj15array[2], sj15array[2]; bool j15valid[2]={false}; _nj15 = 2; CheckValue<IkReal> x644=IKPowWithIntegerCheck(new_r10,-1); if(!x644.valid){ continue; } cj15array[0]=((-1.0)*gconst7*(x644.value)); if( cj15array[0] >= -1-IKFAST_SINCOS_THRESH && cj15array[0] <= 1+IKFAST_SINCOS_THRESH ) { j15valid[0] = j15valid[1] = true; j15array[0] = IKacos(cj15array[0]); sj15array[0] = IKsin(j15array[0]); cj15array[1] = cj15array[0]; j15array[1] = -j15array[0]; sj15array[1] = -sj15array[0]; } else if( isnan(cj15array[0]) ) { // probably any value will work j15valid[0] = true; cj15array[0] = 1; sj15array[0] = 0; j15array[0] = 0; } for(int ij15 = 0; ij15 < 2; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 2; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[6]; IkReal x645=IKsin(j15); IkReal x646=IKcos(j15); IkReal x647=(gconst7*x646); IkReal x648=((-1.0)*x645); evalcond[0]=(new_r10*x645); evalcond[1]=(new_r01*x648); evalcond[2]=(gconst7*x648); evalcond[3]=(x647+new_r10); evalcond[4]=(gconst7+((new_r01*x646))); evalcond[5]=(x647+new_r01); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r10))+(IKabs(new_r00))); evalcond[1]=gconst7; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j15eval[3]; CheckValue<IkReal> x650 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x650.valid){ continue; } IkReal x649=((-1.0)*(x650.value)); sj16=0; cj16=-1.0; j16=3.14159265358979; sj17=gconst7; cj17=gconst8; j17=x649; new_r00=0; new_r10=0; new_r21=0; new_r22=0; IkReal gconst7=((-1.0)*new_r01); IkReal gconst8=new_r11; j15eval[0]=-1.0; j15eval[1]=((IKabs((new_r01*new_r11)))+(IKabs(((1.0)+(((-1.0)*(new_r01*new_r01))))))); j15eval[2]=-1.0; if( IKabs(j15eval[0]) < 0.0000010000000000 || IKabs(j15eval[1]) < 0.0000010000000000 || IKabs(j15eval[2]) < 0.0000010000000000 ) { { IkReal j15eval[3]; CheckValue<IkReal> x652 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x652.valid){ continue; } IkReal x651=((-1.0)*(x652.value)); sj16=0; cj16=-1.0; j16=3.14159265358979; sj17=gconst7; cj17=gconst8; j17=x651; new_r00=0; new_r10=0; new_r21=0; new_r22=0; IkReal gconst7=((-1.0)*new_r01); IkReal gconst8=new_r11; j15eval[0]=-1.0; j15eval[1]=((IKabs((new_r01*new_r11)))+(IKabs(((1.0)+(((-1.0)*(new_r01*new_r01))))))); j15eval[2]=-1.0; if( IKabs(j15eval[0]) < 0.0000010000000000 || IKabs(j15eval[1]) < 0.0000010000000000 || IKabs(j15eval[2]) < 0.0000010000000000 ) { { IkReal j15eval[3]; CheckValue<IkReal> x654 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x654.valid){ continue; } IkReal x653=((-1.0)*(x654.value)); sj16=0; cj16=-1.0; j16=3.14159265358979; sj17=gconst7; cj17=gconst8; j17=x653; new_r00=0; new_r10=0; new_r21=0; new_r22=0; IkReal gconst7=((-1.0)*new_r01); IkReal gconst8=new_r11; j15eval[0]=1.0; j15eval[1]=((((0.5)*(IKabs(((-1.0)+(((2.0)*(new_r01*new_r01))))))))+(IKabs((new_r01*new_r11)))); j15eval[2]=1.0; if( IKabs(j15eval[0]) < 0.0000010000000000 || IKabs(j15eval[1]) < 0.0000010000000000 || IKabs(j15eval[2]) < 0.0000010000000000 ) { continue; // 3 cases reached } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; IkReal x655=((1.0)*new_r11); CheckValue<IkReal> x656 = IKatan2WithCheck(IkReal((((gconst8*new_r01))+(((-1.0)*gconst7*x655)))),IkReal(((((-1.0)*gconst7*new_r01))+(((-1.0)*gconst8*x655)))),IKFAST_ATAN2_MAGTHRESH); if(!x656.valid){ continue; } CheckValue<IkReal> x657=IKPowWithIntegerCheck(IKsign(((new_r01*new_r01)+(new_r11*new_r11))),-1); if(!x657.valid){ continue; } j15array[0]=((-1.5707963267949)+(x656.value)+(((1.5707963267949)*(x657.value)))); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[6]; IkReal x658=IKcos(j15); IkReal x659=IKsin(j15); IkReal x660=((1.0)*gconst8); IkReal x661=(gconst7*x658); IkReal x662=(gconst7*x659); IkReal x663=(x659*x660); evalcond[0]=((((-1.0)*x663))+x661); evalcond[1]=(gconst7+((new_r01*x658))+((new_r11*x659))); evalcond[2]=(((gconst8*x658))+x662+new_r11); evalcond[3]=(gconst8+(((-1.0)*new_r01*x659))+((new_r11*x658))); evalcond[4]=((((-1.0)*x658*x660))+(((-1.0)*x662))); evalcond[5]=((((-1.0)*x663))+x661+new_r01); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; CheckValue<IkReal> x664 = IKatan2WithCheck(IkReal((gconst7*new_r11)),IkReal((gconst8*new_r11)),IKFAST_ATAN2_MAGTHRESH); if(!x664.valid){ continue; } CheckValue<IkReal> x665=IKPowWithIntegerCheck(IKsign(((((-1.0)*(gconst8*gconst8)))+(((-1.0)*(gconst7*gconst7))))),-1); if(!x665.valid){ continue; } j15array[0]=((-1.5707963267949)+(x664.value)+(((1.5707963267949)*(x665.value)))); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[6]; IkReal x666=IKcos(j15); IkReal x667=IKsin(j15); IkReal x668=((1.0)*gconst8); IkReal x669=(gconst7*x666); IkReal x670=(gconst7*x667); IkReal x671=(x667*x668); evalcond[0]=(x669+(((-1.0)*x671))); evalcond[1]=(gconst7+((new_r11*x667))+((new_r01*x666))); evalcond[2]=(((gconst8*x666))+x670+new_r11); evalcond[3]=(gconst8+((new_r11*x666))+(((-1.0)*new_r01*x667))); evalcond[4]=((((-1.0)*x670))+(((-1.0)*x666*x668))); evalcond[5]=(x669+new_r01+(((-1.0)*x671))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; CheckValue<IkReal> x672 = IKatan2WithCheck(IkReal((gconst7*gconst8)),IkReal(gconst8*gconst8),IKFAST_ATAN2_MAGTHRESH); if(!x672.valid){ continue; } CheckValue<IkReal> x673=IKPowWithIntegerCheck(IKsign(((((-1.0)*gconst8*new_r11))+((gconst7*new_r01)))),-1); if(!x673.valid){ continue; } j15array[0]=((-1.5707963267949)+(x672.value)+(((1.5707963267949)*(x673.value)))); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[6]; IkReal x674=IKcos(j15); IkReal x675=IKsin(j15); IkReal x676=((1.0)*gconst8); IkReal x677=(gconst7*x674); IkReal x678=(gconst7*x675); IkReal x679=(x675*x676); evalcond[0]=(x677+(((-1.0)*x679))); evalcond[1]=(((new_r11*x675))+((new_r01*x674))+gconst7); evalcond[2]=(x678+new_r11+((gconst8*x674))); evalcond[3]=(((new_r11*x674))+gconst8+(((-1.0)*new_r01*x675))); evalcond[4]=((((-1.0)*x678))+(((-1.0)*x674*x676))); evalcond[5]=(x677+new_r01+(((-1.0)*x679))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r10))+(IKabs(new_r01))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j15array[2], cj15array[2], sj15array[2]; bool j15valid[2]={false}; _nj15 = 2; CheckValue<IkReal> x680=IKPowWithIntegerCheck(gconst8,-1); if(!x680.valid){ continue; } cj15array[0]=(new_r00*(x680.value)); if( cj15array[0] >= -1-IKFAST_SINCOS_THRESH && cj15array[0] <= 1+IKFAST_SINCOS_THRESH ) { j15valid[0] = j15valid[1] = true; j15array[0] = IKacos(cj15array[0]); sj15array[0] = IKsin(j15array[0]); cj15array[1] = cj15array[0]; j15array[1] = -j15array[0]; sj15array[1] = -sj15array[0]; } else if( isnan(cj15array[0]) ) { // probably any value will work j15valid[0] = true; cj15array[0] = 1; sj15array[0] = 0; j15array[0] = 0; } for(int ij15 = 0; ij15 < 2; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 2; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[6]; IkReal x681=IKsin(j15); IkReal x682=IKcos(j15); IkReal x683=((-1.0)*x681); evalcond[0]=(new_r11*x681); evalcond[1]=(new_r00*x683); evalcond[2]=(gconst8*x683); evalcond[3]=(gconst8+((new_r11*x682))); evalcond[4]=(new_r11+((gconst8*x682))); evalcond[5]=((((-1.0)*gconst8))+((new_r00*x682))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r00))+(IKabs(new_r01))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j15eval[1]; CheckValue<IkReal> x685 = IKatan2WithCheck(IkReal(0),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x685.valid){ continue; } IkReal x684=((-1.0)*(x685.value)); sj16=0; cj16=-1.0; j16=3.14159265358979; sj17=gconst7; cj17=gconst8; j17=x684; new_r00=0; new_r01=0; new_r12=0; new_r22=0; IkReal gconst7=0; IkReal x686 = ((1.0)+(((-1.0)*(new_r10*new_r10)))); if(IKabs(x686)==0){ continue; } IkReal gconst8=(new_r11*(pow(x686,-0.5))); j15eval[0]=((IKabs(new_r11))+(IKabs(new_r10))); if( IKabs(j15eval[0]) < 0.0000010000000000 ) { { IkReal j15eval[1]; CheckValue<IkReal> x688 = IKatan2WithCheck(IkReal(0),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x688.valid){ continue; } IkReal x687=((-1.0)*(x688.value)); sj16=0; cj16=-1.0; j16=3.14159265358979; sj17=gconst7; cj17=gconst8; j17=x687; new_r00=0; new_r01=0; new_r12=0; new_r22=0; IkReal gconst7=0; IkReal x689 = ((1.0)+(((-1.0)*(new_r10*new_r10)))); if(IKabs(x689)==0){ continue; } IkReal gconst8=(new_r11*(pow(x689,-0.5))); j15eval[0]=new_r11; if( IKabs(j15eval[0]) < 0.0000010000000000 ) { { IkReal j15eval[2]; CheckValue<IkReal> x691 = IKatan2WithCheck(IkReal(0),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x691.valid){ continue; } IkReal x690=((-1.0)*(x691.value)); sj16=0; cj16=-1.0; j16=3.14159265358979; sj17=gconst7; cj17=gconst8; j17=x690; new_r00=0; new_r01=0; new_r12=0; new_r22=0; IkReal x692 = ((1.0)+(((-1.0)*(new_r10*new_r10)))); if(IKabs(x692)==0){ continue; } IkReal gconst8=(new_r11*(pow(x692,-0.5))); j15eval[0]=new_r10; j15eval[1]=new_r11; if( IKabs(j15eval[0]) < 0.0000010000000000 || IKabs(j15eval[1]) < 0.0000010000000000 ) { continue; // 3 cases reached } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; CheckValue<IkReal> x693=IKPowWithIntegerCheck(new_r10,-1); if(!x693.valid){ continue; } CheckValue<IkReal> x694=IKPowWithIntegerCheck(new_r11,-1); if(!x694.valid){ continue; } if( IKabs((gconst8*(x693.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*gconst8*(x694.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((gconst8*(x693.value)))+IKsqr(((-1.0)*gconst8*(x694.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j15array[0]=IKatan2((gconst8*(x693.value)), ((-1.0)*gconst8*(x694.value))); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x695=IKcos(j15); IkReal x696=IKsin(j15); IkReal x697=((1.0)*gconst8); IkReal x698=((-1.0)*gconst8); evalcond[0]=(new_r10*x695); evalcond[1]=(new_r11*x696); evalcond[2]=(x695*x698); evalcond[3]=(x696*x698); evalcond[4]=(gconst8+((new_r11*x695))); evalcond[5]=(((gconst8*x695))+new_r11); evalcond[6]=((((-1.0)*x696*x697))+new_r10); evalcond[7]=(((new_r10*x696))+(((-1.0)*x697))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; CheckValue<IkReal> x699=IKPowWithIntegerCheck(gconst8,-1); if(!x699.valid){ continue; } CheckValue<IkReal> x700=IKPowWithIntegerCheck(new_r11,-1); if(!x700.valid){ continue; } if( IKabs((new_r10*(x699.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*gconst8*(x700.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((new_r10*(x699.value)))+IKsqr(((-1.0)*gconst8*(x700.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j15array[0]=IKatan2((new_r10*(x699.value)), ((-1.0)*gconst8*(x700.value))); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x701=IKcos(j15); IkReal x702=IKsin(j15); IkReal x703=((1.0)*gconst8); IkReal x704=((-1.0)*gconst8); evalcond[0]=(new_r10*x701); evalcond[1]=(new_r11*x702); evalcond[2]=(x701*x704); evalcond[3]=(x702*x704); evalcond[4]=(gconst8+((new_r11*x701))); evalcond[5]=(((gconst8*x701))+new_r11); evalcond[6]=((((-1.0)*x702*x703))+new_r10); evalcond[7]=((((-1.0)*x703))+((new_r10*x702))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; CheckValue<IkReal> x705 = IKatan2WithCheck(IkReal(new_r10),IkReal(((-1.0)*new_r11)),IKFAST_ATAN2_MAGTHRESH); if(!x705.valid){ continue; } CheckValue<IkReal> x706=IKPowWithIntegerCheck(IKsign(gconst8),-1); if(!x706.valid){ continue; } j15array[0]=((-1.5707963267949)+(x705.value)+(((1.5707963267949)*(x706.value)))); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x707=IKcos(j15); IkReal x708=IKsin(j15); IkReal x709=((1.0)*gconst8); IkReal x710=((-1.0)*gconst8); evalcond[0]=(new_r10*x707); evalcond[1]=(new_r11*x708); evalcond[2]=(x707*x710); evalcond[3]=(x708*x710); evalcond[4]=(gconst8+((new_r11*x707))); evalcond[5]=(((gconst8*x707))+new_r11); evalcond[6]=(new_r10+(((-1.0)*x708*x709))); evalcond[7]=((((-1.0)*x709))+((new_r10*x708))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=IKabs(new_r01); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j15eval[1]; CheckValue<IkReal> x712 = IKatan2WithCheck(IkReal(0),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x712.valid){ continue; } IkReal x711=((-1.0)*(x712.value)); sj16=0; cj16=-1.0; j16=3.14159265358979; sj17=gconst7; cj17=gconst8; j17=x711; new_r01=0; IkReal gconst7=0; IkReal x713 = new_r11*new_r11; if(IKabs(x713)==0){ continue; } IkReal gconst8=(new_r11*(pow(x713,-0.5))); j15eval[0]=((IKabs(new_r10))+(IKabs(new_r00))); if( IKabs(j15eval[0]) < 0.0000010000000000 ) { { IkReal j15eval[1]; CheckValue<IkReal> x715 = IKatan2WithCheck(IkReal(0),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x715.valid){ continue; } IkReal x714=((-1.0)*(x715.value)); sj16=0; cj16=-1.0; j16=3.14159265358979; sj17=gconst7; cj17=gconst8; j17=x714; new_r01=0; IkReal gconst7=0; IkReal x716 = new_r11*new_r11; if(IKabs(x716)==0){ continue; } IkReal gconst8=(new_r11*(pow(x716,-0.5))); j15eval[0]=((IKabs(new_r11))+(IKabs(new_r10))); if( IKabs(j15eval[0]) < 0.0000010000000000 ) { { IkReal j15eval[1]; CheckValue<IkReal> x718 = IKatan2WithCheck(IkReal(0),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x718.valid){ continue; } IkReal x717=((-1.0)*(x718.value)); sj16=0; cj16=-1.0; j16=3.14159265358979; sj17=gconst7; cj17=gconst8; j17=x717; new_r01=0; IkReal x719 = new_r11*new_r11; if(IKabs(x719)==0){ continue; } IkReal gconst8=(new_r11*(pow(x719,-0.5))); j15eval[0]=new_r11; if( IKabs(j15eval[0]) < 0.0000010000000000 ) { continue; // 3 cases reached } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; CheckValue<IkReal> x720=IKPowWithIntegerCheck(gconst8,-1); if(!x720.valid){ continue; } CheckValue<IkReal> x721=IKPowWithIntegerCheck(new_r11,-1); if(!x721.valid){ continue; } if( IKabs((new_r10*(x720.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*gconst8*(x721.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((new_r10*(x720.value)))+IKsqr(((-1.0)*gconst8*(x721.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j15array[0]=IKatan2((new_r10*(x720.value)), ((-1.0)*gconst8*(x721.value))); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x722=IKsin(j15); IkReal x723=IKcos(j15); IkReal x724=((1.0)*gconst8); evalcond[0]=(new_r11*x722); evalcond[1]=((-1.0)*gconst8*x722); evalcond[2]=(gconst8+((new_r11*x723))); evalcond[3]=(((gconst8*x723))+new_r11); evalcond[4]=((((-1.0)*x722*x724))+new_r10); evalcond[5]=((((-1.0)*x723*x724))+new_r00); evalcond[6]=((((-1.0)*new_r00*x722))+((new_r10*x723))); evalcond[7]=(((new_r00*x723))+(((-1.0)*x724))+((new_r10*x722))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; CheckValue<IkReal> x725 = IKatan2WithCheck(IkReal(new_r10),IkReal(((-1.0)*new_r11)),IKFAST_ATAN2_MAGTHRESH); if(!x725.valid){ continue; } CheckValue<IkReal> x726=IKPowWithIntegerCheck(IKsign(gconst8),-1); if(!x726.valid){ continue; } j15array[0]=((-1.5707963267949)+(x725.value)+(((1.5707963267949)*(x726.value)))); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x727=IKsin(j15); IkReal x728=IKcos(j15); IkReal x729=((1.0)*gconst8); evalcond[0]=(new_r11*x727); evalcond[1]=((-1.0)*gconst8*x727); evalcond[2]=(gconst8+((new_r11*x728))); evalcond[3]=(((gconst8*x728))+new_r11); evalcond[4]=((((-1.0)*x727*x729))+new_r10); evalcond[5]=(new_r00+(((-1.0)*x728*x729))); evalcond[6]=((((-1.0)*new_r00*x727))+((new_r10*x728))); evalcond[7]=(((new_r00*x728))+(((-1.0)*x729))+((new_r10*x727))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; CheckValue<IkReal> x730=IKPowWithIntegerCheck(IKsign(gconst8),-1); if(!x730.valid){ continue; } CheckValue<IkReal> x731 = IKatan2WithCheck(IkReal(new_r10),IkReal(new_r00),IKFAST_ATAN2_MAGTHRESH); if(!x731.valid){ continue; } j15array[0]=((-1.5707963267949)+(((1.5707963267949)*(x730.value)))+(x731.value)); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x732=IKsin(j15); IkReal x733=IKcos(j15); IkReal x734=((1.0)*gconst8); evalcond[0]=(new_r11*x732); evalcond[1]=((-1.0)*gconst8*x732); evalcond[2]=(gconst8+((new_r11*x733))); evalcond[3]=(((gconst8*x733))+new_r11); evalcond[4]=((((-1.0)*x732*x734))+new_r10); evalcond[5]=((((-1.0)*x733*x734))+new_r00); evalcond[6]=((((-1.0)*new_r00*x732))+((new_r10*x733))); evalcond[7]=(((new_r00*x733))+(((-1.0)*x734))+((new_r10*x732))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j15] } } while(0); if( bgotonextstatement ) { } } } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; IkReal x735=((1.0)*new_r11); CheckValue<IkReal> x736=IKPowWithIntegerCheck(IKsign(((((-1.0)*gconst8*x735))+((gconst7*new_r01)))),-1); if(!x736.valid){ continue; } CheckValue<IkReal> x737 = IKatan2WithCheck(IkReal((((gconst7*gconst8))+(((-1.0)*new_r01*x735)))),IkReal(((((-1.0)*(gconst7*gconst7)))+(new_r11*new_r11))),IKFAST_ATAN2_MAGTHRESH); if(!x737.valid){ continue; } j15array[0]=((-1.5707963267949)+(((1.5707963267949)*(x736.value)))+(x737.value)); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x738=IKcos(j15); IkReal x739=IKsin(j15); IkReal x740=((1.0)*gconst8); IkReal x741=(gconst7*x738); IkReal x742=(gconst7*x739); IkReal x743=((1.0)*x739); IkReal x744=(x739*x740); evalcond[0]=(gconst7+((new_r01*x738))+((new_r11*x739))); evalcond[1]=(((gconst8*x738))+x742+new_r11); evalcond[2]=((((-1.0)*new_r00*x743))+gconst7+((new_r10*x738))); evalcond[3]=((((-1.0)*new_r01*x743))+gconst8+((new_r11*x738))); evalcond[4]=(x741+new_r10+(((-1.0)*x744))); evalcond[5]=(x741+new_r01+(((-1.0)*x744))); evalcond[6]=(((new_r00*x738))+(((-1.0)*x740))+((new_r10*x739))); evalcond[7]=((((-1.0)*x738*x740))+(((-1.0)*x742))+new_r00); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; IkReal x745=((1.0)*new_r11); CheckValue<IkReal> x746=IKPowWithIntegerCheck(IKsign(((new_r01*new_r01)+(new_r11*new_r11))),-1); if(!x746.valid){ continue; } CheckValue<IkReal> x747 = IKatan2WithCheck(IkReal(((((-1.0)*gconst7*x745))+((gconst8*new_r01)))),IkReal(((((-1.0)*gconst7*new_r01))+(((-1.0)*gconst8*x745)))),IKFAST_ATAN2_MAGTHRESH); if(!x747.valid){ continue; } j15array[0]=((-1.5707963267949)+(((1.5707963267949)*(x746.value)))+(x747.value)); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x748=IKcos(j15); IkReal x749=IKsin(j15); IkReal x750=((1.0)*gconst8); IkReal x751=(gconst7*x748); IkReal x752=(gconst7*x749); IkReal x753=((1.0)*x749); IkReal x754=(x749*x750); evalcond[0]=(gconst7+((new_r01*x748))+((new_r11*x749))); evalcond[1]=(((gconst8*x748))+x752+new_r11); evalcond[2]=(gconst7+(((-1.0)*new_r00*x753))+((new_r10*x748))); evalcond[3]=((((-1.0)*new_r01*x753))+gconst8+((new_r11*x748))); evalcond[4]=(x751+new_r10+(((-1.0)*x754))); evalcond[5]=(x751+new_r01+(((-1.0)*x754))); evalcond[6]=(((new_r10*x749))+((new_r00*x748))+(((-1.0)*x750))); evalcond[7]=((((-1.0)*x752))+new_r00+(((-1.0)*x748*x750))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; IkReal x755=((1.0)*gconst7); CheckValue<IkReal> x756 = IKatan2WithCheck(IkReal(((((-1.0)*new_r10*x755))+((gconst7*new_r01)))),IkReal(((((-1.0)*new_r00*x755))+(((-1.0)*new_r11*x755)))),IKFAST_ATAN2_MAGTHRESH); if(!x756.valid){ continue; } CheckValue<IkReal> x757=IKPowWithIntegerCheck(IKsign((((new_r10*new_r11))+((new_r00*new_r01)))),-1); if(!x757.valid){ continue; } j15array[0]=((-1.5707963267949)+(x756.value)+(((1.5707963267949)*(x757.value)))); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x758=IKcos(j15); IkReal x759=IKsin(j15); IkReal x760=((1.0)*gconst8); IkReal x761=(gconst7*x758); IkReal x762=(gconst7*x759); IkReal x763=((1.0)*x759); IkReal x764=(x759*x760); evalcond[0]=(gconst7+((new_r11*x759))+((new_r01*x758))); evalcond[1]=(((gconst8*x758))+x762+new_r11); evalcond[2]=((((-1.0)*new_r00*x763))+gconst7+((new_r10*x758))); evalcond[3]=(gconst8+((new_r11*x758))+(((-1.0)*new_r01*x763))); evalcond[4]=((((-1.0)*x764))+x761+new_r10); evalcond[5]=((((-1.0)*x764))+x761+new_r01); evalcond[6]=((((-1.0)*x760))+((new_r00*x758))+((new_r10*x759))); evalcond[7]=((((-1.0)*x758*x760))+(((-1.0)*x762))+new_r00); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { IkReal x766 = ((new_r01*new_r01)+(new_r11*new_r11)); if(IKabs(x766)==0){ continue; } IkReal x765=pow(x766,-0.5); CheckValue<IkReal> x767 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x767.valid){ continue; } IkReal gconst10=((1.0)*new_r01*x765); IkReal gconst11=((-1.0)*new_r11*x765); CheckValue<IkReal> x768 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x768.valid){ continue; } evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j17+(x768.value))))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j15eval[3]; CheckValue<IkReal> x771 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x771.valid){ continue; } IkReal x769=((1.0)*(x771.value)); IkReal x770=x765; sj16=0; cj16=-1.0; j16=3.14159265358979; sj17=gconst10; cj17=gconst11; j17=((3.14159265)+(((-1.0)*x769))); IkReal gconst10=((1.0)*new_r01*x770); IkReal gconst11=((-1.0)*new_r11*x770); IkReal x772=new_r01*new_r01; IkReal x773=(((new_r10*new_r11))+((new_r00*new_r01))); IkReal x774=x765; IkReal x775=((1.0)*new_r01*x774); j15eval[0]=x773; j15eval[1]=((IKabs(((((-1.0)*new_r00*x775))+(((-1.0)*new_r11*x775)))))+(IKabs((((x772*x774))+(((-1.0)*new_r10*x775)))))); j15eval[2]=IKsign(x773); if( IKabs(j15eval[0]) < 0.0000010000000000 || IKabs(j15eval[1]) < 0.0000010000000000 || IKabs(j15eval[2]) < 0.0000010000000000 ) { { IkReal j15eval[2]; CheckValue<IkReal> x778 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x778.valid){ continue; } IkReal x776=((1.0)*(x778.value)); IkReal x777=x765; sj16=0; cj16=-1.0; j16=3.14159265358979; sj17=gconst10; cj17=gconst11; j17=((3.14159265)+(((-1.0)*x776))); IkReal gconst10=((1.0)*new_r01*x777); IkReal gconst11=((-1.0)*new_r11*x777); IkReal x779=((new_r01*new_r01)+(new_r11*new_r11)); j15eval[0]=x779; j15eval[1]=IKsign(x779); if( IKabs(j15eval[0]) < 0.0000010000000000 || IKabs(j15eval[1]) < 0.0000010000000000 ) { { IkReal j15eval[1]; CheckValue<IkReal> x782 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x782.valid){ continue; } IkReal x780=((1.0)*(x782.value)); IkReal x781=x765; sj16=0; cj16=-1.0; j16=3.14159265358979; sj17=gconst10; cj17=gconst11; j17=((3.14159265)+(((-1.0)*x780))); IkReal gconst10=((1.0)*new_r01*x781); IkReal gconst11=((-1.0)*new_r11*x781); IkReal x783=new_r01*new_r01; IkReal x784=new_r11*new_r11; IkReal x785=((1.0)*x783); CheckValue<IkReal> x791=IKPowWithIntegerCheck((x783+x784),-1); if(!x791.valid){ continue; } IkReal x786=x791.value; CheckValue<IkReal> x792=IKPowWithIntegerCheck(((((-1.0)*x785))+(((-1.0)*x784))),-1); if(!x792.valid){ continue; } IkReal x787=x792.value; IkReal x788=((1.0)*x787); IkReal x789=(new_r11*x788); j15eval[0]=((IKabs((((x786*(x784*x784)))+((x783*x784*x786))+(((-1.0)*x785*x786)))))+(IKabs(((((-1.0)*x789*(new_r01*new_r01*new_r01)))+(((-1.0)*new_r01*x789))+(((-1.0)*new_r01*x789*(new_r11*new_r11))))))); if( IKabs(j15eval[0]) < 0.0000010000000000 ) { { IkReal evalcond[2]; bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r11))+(IKabs(new_r00))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j15eval[1]; CheckValue<IkReal> x794 = IKatan2WithCheck(IkReal(new_r01),IkReal(0),IKFAST_ATAN2_MAGTHRESH); if(!x794.valid){ continue; } IkReal x793=((1.0)*(x794.value)); sj16=0; cj16=-1.0; j16=3.14159265358979; sj17=gconst10; cj17=gconst11; j17=((3.14159265)+(((-1.0)*x793))); new_r11=0; new_r00=0; IkReal x795 = new_r01*new_r01; if(IKabs(x795)==0){ continue; } IkReal gconst10=((1.0)*new_r01*(pow(x795,-0.5))); j15eval[0]=new_r10; if( IKabs(j15eval[0]) < 0.0000010000000000 ) { { IkReal j15array[2], cj15array[2], sj15array[2]; bool j15valid[2]={false}; _nj15 = 2; CheckValue<IkReal> x796=IKPowWithIntegerCheck(gconst10,-1); if(!x796.valid){ continue; } cj15array[0]=((-1.0)*new_r10*(x796.value)); if( cj15array[0] >= -1-IKFAST_SINCOS_THRESH && cj15array[0] <= 1+IKFAST_SINCOS_THRESH ) { j15valid[0] = j15valid[1] = true; j15array[0] = IKacos(cj15array[0]); sj15array[0] = IKsin(j15array[0]); cj15array[1] = cj15array[0]; j15array[1] = -j15array[0]; sj15array[1] = -sj15array[0]; } else if( isnan(cj15array[0]) ) { // probably any value will work j15valid[0] = true; cj15array[0] = 1; sj15array[0] = 0; j15array[0] = 0; } for(int ij15 = 0; ij15 < 2; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 2; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[6]; IkReal x797=IKsin(j15); IkReal x798=IKcos(j15); IkReal x799=((-1.0)*x797); evalcond[0]=(new_r10*x797); evalcond[1]=(new_r01*x799); evalcond[2]=(gconst10*x799); evalcond[3]=(((new_r10*x798))+gconst10); evalcond[4]=(gconst10+((new_r01*x798))); evalcond[5]=(((gconst10*x798))+new_r01); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } else { { IkReal j15array[2], cj15array[2], sj15array[2]; bool j15valid[2]={false}; _nj15 = 2; CheckValue<IkReal> x800=IKPowWithIntegerCheck(new_r10,-1); if(!x800.valid){ continue; } cj15array[0]=((-1.0)*gconst10*(x800.value)); if( cj15array[0] >= -1-IKFAST_SINCOS_THRESH && cj15array[0] <= 1+IKFAST_SINCOS_THRESH ) { j15valid[0] = j15valid[1] = true; j15array[0] = IKacos(cj15array[0]); sj15array[0] = IKsin(j15array[0]); cj15array[1] = cj15array[0]; j15array[1] = -j15array[0]; sj15array[1] = -sj15array[0]; } else if( isnan(cj15array[0]) ) { // probably any value will work j15valid[0] = true; cj15array[0] = 1; sj15array[0] = 0; j15array[0] = 0; } for(int ij15 = 0; ij15 < 2; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 2; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[6]; IkReal x801=IKsin(j15); IkReal x802=IKcos(j15); IkReal x803=(gconst10*x802); IkReal x804=((-1.0)*x801); evalcond[0]=(new_r10*x801); evalcond[1]=(new_r01*x804); evalcond[2]=(gconst10*x804); evalcond[3]=(new_r10+x803); evalcond[4]=(gconst10+((new_r01*x802))); evalcond[5]=(new_r01+x803); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r10))+(IKabs(new_r00))); evalcond[1]=gconst10; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j15eval[3]; CheckValue<IkReal> x806 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x806.valid){ continue; } IkReal x805=((1.0)*(x806.value)); sj16=0; cj16=-1.0; j16=3.14159265358979; sj17=gconst10; cj17=gconst11; j17=((3.14159265)+(((-1.0)*x805))); new_r00=0; new_r10=0; new_r21=0; new_r22=0; IkReal gconst10=((1.0)*new_r01); IkReal gconst11=((-1.0)*new_r11); j15eval[0]=1.0; j15eval[1]=1.0; j15eval[2]=((IKabs(((1.0)+(((-1.0)*(new_r01*new_r01))))))+(IKabs(((1.0)*new_r01*new_r11)))); if( IKabs(j15eval[0]) < 0.0000010000000000 || IKabs(j15eval[1]) < 0.0000010000000000 || IKabs(j15eval[2]) < 0.0000010000000000 ) { { IkReal j15eval[3]; CheckValue<IkReal> x808 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x808.valid){ continue; } IkReal x807=((1.0)*(x808.value)); sj16=0; cj16=-1.0; j16=3.14159265358979; sj17=gconst10; cj17=gconst11; j17=((3.14159265)+(((-1.0)*x807))); new_r00=0; new_r10=0; new_r21=0; new_r22=0; IkReal gconst10=((1.0)*new_r01); IkReal gconst11=((-1.0)*new_r11); j15eval[0]=-1.0; j15eval[1]=-1.0; j15eval[2]=((IKabs(((-1.0)+(new_r01*new_r01))))+(IKabs(((1.0)*new_r01*new_r11)))); if( IKabs(j15eval[0]) < 0.0000010000000000 || IKabs(j15eval[1]) < 0.0000010000000000 || IKabs(j15eval[2]) < 0.0000010000000000 ) { { IkReal j15eval[3]; CheckValue<IkReal> x810 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x810.valid){ continue; } IkReal x809=((1.0)*(x810.value)); sj16=0; cj16=-1.0; j16=3.14159265358979; sj17=gconst10; cj17=gconst11; j17=((3.14159265)+(((-1.0)*x809))); new_r00=0; new_r10=0; new_r21=0; new_r22=0; IkReal gconst10=((1.0)*new_r01); IkReal gconst11=((-1.0)*new_r11); j15eval[0]=1.0; j15eval[1]=1.0; j15eval[2]=((IKabs(((2.0)*new_r01*new_r11)))+(IKabs(((1.0)+(((-2.0)*(new_r01*new_r01))))))); if( IKabs(j15eval[0]) < 0.0000010000000000 || IKabs(j15eval[1]) < 0.0000010000000000 || IKabs(j15eval[2]) < 0.0000010000000000 ) { continue; // 3 cases reached } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; IkReal x811=((1.0)*new_r11); CheckValue<IkReal> x812 = IKatan2WithCheck(IkReal((((gconst11*new_r01))+(((-1.0)*gconst10*x811)))),IkReal(((((-1.0)*gconst11*x811))+(((-1.0)*gconst10*new_r01)))),IKFAST_ATAN2_MAGTHRESH); if(!x812.valid){ continue; } CheckValue<IkReal> x813=IKPowWithIntegerCheck(IKsign(((new_r01*new_r01)+(new_r11*new_r11))),-1); if(!x813.valid){ continue; } j15array[0]=((-1.5707963267949)+(x812.value)+(((1.5707963267949)*(x813.value)))); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[6]; IkReal x814=IKcos(j15); IkReal x815=IKsin(j15); IkReal x816=(gconst10*x814); IkReal x817=(gconst11*x814); IkReal x818=((1.0)*x815); IkReal x819=(gconst11*x818); evalcond[0]=((((-1.0)*x819))+x816); evalcond[1]=(((new_r11*x815))+((new_r01*x814))+gconst10); evalcond[2]=(((gconst10*x815))+new_r11+x817); evalcond[3]=(((new_r11*x814))+gconst11+(((-1.0)*new_r01*x818))); evalcond[4]=((((-1.0)*gconst10*x818))+(((-1.0)*x817))); evalcond[5]=((((-1.0)*x819))+new_r01+x816); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; CheckValue<IkReal> x820=IKPowWithIntegerCheck(IKsign(((((-1.0)*(gconst11*gconst11)))+(((-1.0)*(gconst10*gconst10))))),-1); if(!x820.valid){ continue; } CheckValue<IkReal> x821 = IKatan2WithCheck(IkReal((gconst10*new_r11)),IkReal((gconst11*new_r11)),IKFAST_ATAN2_MAGTHRESH); if(!x821.valid){ continue; } j15array[0]=((-1.5707963267949)+(((1.5707963267949)*(x820.value)))+(x821.value)); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[6]; IkReal x822=IKcos(j15); IkReal x823=IKsin(j15); IkReal x824=(gconst10*x822); IkReal x825=(gconst11*x822); IkReal x826=((1.0)*x823); IkReal x827=(gconst11*x826); evalcond[0]=((((-1.0)*x827))+x824); evalcond[1]=(((new_r01*x822))+gconst10+((new_r11*x823))); evalcond[2]=(((gconst10*x823))+new_r11+x825); evalcond[3]=(gconst11+((new_r11*x822))+(((-1.0)*new_r01*x826))); evalcond[4]=((((-1.0)*gconst10*x826))+(((-1.0)*x825))); evalcond[5]=((((-1.0)*x827))+new_r01+x824); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; CheckValue<IkReal> x828=IKPowWithIntegerCheck(IKsign((((gconst10*new_r01))+(((-1.0)*gconst11*new_r11)))),-1); if(!x828.valid){ continue; } CheckValue<IkReal> x829 = IKatan2WithCheck(IkReal((gconst10*gconst11)),IkReal(gconst11*gconst11),IKFAST_ATAN2_MAGTHRESH); if(!x829.valid){ continue; } j15array[0]=((-1.5707963267949)+(((1.5707963267949)*(x828.value)))+(x829.value)); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[6]; IkReal x830=IKcos(j15); IkReal x831=IKsin(j15); IkReal x832=(gconst10*x830); IkReal x833=(gconst11*x830); IkReal x834=((1.0)*x831); IkReal x835=(gconst11*x834); evalcond[0]=((((-1.0)*x835))+x832); evalcond[1]=(((new_r11*x831))+((new_r01*x830))+gconst10); evalcond[2]=(((gconst10*x831))+new_r11+x833); evalcond[3]=(((new_r11*x830))+gconst11+(((-1.0)*new_r01*x834))); evalcond[4]=((((-1.0)*gconst10*x834))+(((-1.0)*x833))); evalcond[5]=((((-1.0)*x835))+new_r01+x832); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r10))+(IKabs(new_r01))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j15array[2], cj15array[2], sj15array[2]; bool j15valid[2]={false}; _nj15 = 2; CheckValue<IkReal> x836=IKPowWithIntegerCheck(gconst11,-1); if(!x836.valid){ continue; } cj15array[0]=(new_r00*(x836.value)); if( cj15array[0] >= -1-IKFAST_SINCOS_THRESH && cj15array[0] <= 1+IKFAST_SINCOS_THRESH ) { j15valid[0] = j15valid[1] = true; j15array[0] = IKacos(cj15array[0]); sj15array[0] = IKsin(j15array[0]); cj15array[1] = cj15array[0]; j15array[1] = -j15array[0]; sj15array[1] = -sj15array[0]; } else if( isnan(cj15array[0]) ) { // probably any value will work j15valid[0] = true; cj15array[0] = 1; sj15array[0] = 0; j15array[0] = 0; } for(int ij15 = 0; ij15 < 2; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 2; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[6]; IkReal x837=IKsin(j15); IkReal x838=IKcos(j15); IkReal x839=((-1.0)*x837); evalcond[0]=(new_r11*x837); evalcond[1]=(new_r00*x839); evalcond[2]=(gconst11*x839); evalcond[3]=(((new_r11*x838))+gconst11); evalcond[4]=(((gconst11*x838))+new_r11); evalcond[5]=(((new_r00*x838))+(((-1.0)*gconst11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r00))+(IKabs(new_r01))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j15eval[1]; CheckValue<IkReal> x841 = IKatan2WithCheck(IkReal(0),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x841.valid){ continue; } IkReal x840=((1.0)*(x841.value)); sj16=0; cj16=-1.0; j16=3.14159265358979; sj17=gconst10; cj17=gconst11; j17=((3.14159265)+(((-1.0)*x840))); new_r00=0; new_r01=0; new_r12=0; new_r22=0; IkReal gconst10=0; IkReal x842 = ((1.0)+(((-1.0)*(new_r10*new_r10)))); if(IKabs(x842)==0){ continue; } IkReal gconst11=((-1.0)*new_r11*(pow(x842,-0.5))); j15eval[0]=((IKabs(new_r11))+(IKabs(new_r10))); if( IKabs(j15eval[0]) < 0.0000010000000000 ) { { IkReal j15eval[1]; CheckValue<IkReal> x844 = IKatan2WithCheck(IkReal(0),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x844.valid){ continue; } IkReal x843=((1.0)*(x844.value)); sj16=0; cj16=-1.0; j16=3.14159265358979; sj17=gconst10; cj17=gconst11; j17=((3.14159265)+(((-1.0)*x843))); new_r00=0; new_r01=0; new_r12=0; new_r22=0; IkReal gconst10=0; IkReal x845 = ((1.0)+(((-1.0)*(new_r10*new_r10)))); if(IKabs(x845)==0){ continue; } IkReal gconst11=((-1.0)*new_r11*(pow(x845,-0.5))); j15eval[0]=new_r11; if( IKabs(j15eval[0]) < 0.0000010000000000 ) { { IkReal j15eval[2]; CheckValue<IkReal> x847 = IKatan2WithCheck(IkReal(0),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x847.valid){ continue; } IkReal x846=((1.0)*(x847.value)); sj16=0; cj16=-1.0; j16=3.14159265358979; sj17=gconst10; cj17=gconst11; j17=((3.14159265)+(((-1.0)*x846))); new_r00=0; new_r01=0; new_r12=0; new_r22=0; IkReal x848 = ((1.0)+(((-1.0)*(new_r10*new_r10)))); if(IKabs(x848)==0){ continue; } IkReal gconst11=((-1.0)*new_r11*(pow(x848,-0.5))); j15eval[0]=new_r10; j15eval[1]=new_r11; if( IKabs(j15eval[0]) < 0.0000010000000000 || IKabs(j15eval[1]) < 0.0000010000000000 ) { continue; // 3 cases reached } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; CheckValue<IkReal> x849=IKPowWithIntegerCheck(new_r10,-1); if(!x849.valid){ continue; } CheckValue<IkReal> x850=IKPowWithIntegerCheck(new_r11,-1); if(!x850.valid){ continue; } if( IKabs((gconst11*(x849.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*gconst11*(x850.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((gconst11*(x849.value)))+IKsqr(((-1.0)*gconst11*(x850.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j15array[0]=IKatan2((gconst11*(x849.value)), ((-1.0)*gconst11*(x850.value))); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x851=IKcos(j15); IkReal x852=IKsin(j15); IkReal x853=((1.0)*gconst11); IkReal x854=(gconst11*x851); evalcond[0]=(new_r10*x851); evalcond[1]=(new_r11*x852); evalcond[2]=((-1.0)*x854); evalcond[3]=((-1.0)*gconst11*x852); evalcond[4]=(gconst11+((new_r11*x851))); evalcond[5]=(new_r11+x854); evalcond[6]=((((-1.0)*x852*x853))+new_r10); evalcond[7]=((((-1.0)*x853))+((new_r10*x852))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; CheckValue<IkReal> x855=IKPowWithIntegerCheck(gconst11,-1); if(!x855.valid){ continue; } CheckValue<IkReal> x856=IKPowWithIntegerCheck(new_r11,-1); if(!x856.valid){ continue; } if( IKabs((new_r10*(x855.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*gconst11*(x856.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((new_r10*(x855.value)))+IKsqr(((-1.0)*gconst11*(x856.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j15array[0]=IKatan2((new_r10*(x855.value)), ((-1.0)*gconst11*(x856.value))); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x857=IKcos(j15); IkReal x858=IKsin(j15); IkReal x859=((1.0)*gconst11); IkReal x860=(gconst11*x857); evalcond[0]=(new_r10*x857); evalcond[1]=(new_r11*x858); evalcond[2]=((-1.0)*x860); evalcond[3]=((-1.0)*gconst11*x858); evalcond[4]=(gconst11+((new_r11*x857))); evalcond[5]=(new_r11+x860); evalcond[6]=((((-1.0)*x858*x859))+new_r10); evalcond[7]=((((-1.0)*x859))+((new_r10*x858))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; CheckValue<IkReal> x861=IKPowWithIntegerCheck(IKsign(gconst11),-1); if(!x861.valid){ continue; } CheckValue<IkReal> x862 = IKatan2WithCheck(IkReal(new_r10),IkReal(((-1.0)*new_r11)),IKFAST_ATAN2_MAGTHRESH); if(!x862.valid){ continue; } j15array[0]=((-1.5707963267949)+(((1.5707963267949)*(x861.value)))+(x862.value)); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x863=IKcos(j15); IkReal x864=IKsin(j15); IkReal x865=((1.0)*gconst11); IkReal x866=(gconst11*x863); evalcond[0]=(new_r10*x863); evalcond[1]=(new_r11*x864); evalcond[2]=((-1.0)*x866); evalcond[3]=((-1.0)*gconst11*x864); evalcond[4]=(gconst11+((new_r11*x863))); evalcond[5]=(new_r11+x866); evalcond[6]=((((-1.0)*x864*x865))+new_r10); evalcond[7]=((((-1.0)*x865))+((new_r10*x864))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=IKabs(new_r01); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j15eval[1]; CheckValue<IkReal> x868 = IKatan2WithCheck(IkReal(0),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x868.valid){ continue; } IkReal x867=((1.0)*(x868.value)); sj16=0; cj16=-1.0; j16=3.14159265358979; sj17=gconst10; cj17=gconst11; j17=((3.14159265)+(((-1.0)*x867))); new_r01=0; IkReal gconst10=0; IkReal x869 = new_r11*new_r11; if(IKabs(x869)==0){ continue; } IkReal gconst11=((-1.0)*new_r11*(pow(x869,-0.5))); j15eval[0]=((IKabs(new_r10))+(IKabs(new_r00))); if( IKabs(j15eval[0]) < 0.0000010000000000 ) { { IkReal j15eval[1]; CheckValue<IkReal> x871 = IKatan2WithCheck(IkReal(0),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x871.valid){ continue; } IkReal x870=((1.0)*(x871.value)); sj16=0; cj16=-1.0; j16=3.14159265358979; sj17=gconst10; cj17=gconst11; j17=((3.14159265)+(((-1.0)*x870))); new_r01=0; IkReal gconst10=0; IkReal x872 = new_r11*new_r11; if(IKabs(x872)==0){ continue; } IkReal gconst11=((-1.0)*new_r11*(pow(x872,-0.5))); j15eval[0]=((IKabs(new_r11))+(IKabs(new_r10))); if( IKabs(j15eval[0]) < 0.0000010000000000 ) { { IkReal j15eval[1]; CheckValue<IkReal> x874 = IKatan2WithCheck(IkReal(0),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x874.valid){ continue; } IkReal x873=((1.0)*(x874.value)); sj16=0; cj16=-1.0; j16=3.14159265358979; sj17=gconst10; cj17=gconst11; j17=((3.14159265)+(((-1.0)*x873))); new_r01=0; IkReal x875 = new_r11*new_r11; if(IKabs(x875)==0){ continue; } IkReal gconst11=((-1.0)*new_r11*(pow(x875,-0.5))); j15eval[0]=new_r11; if( IKabs(j15eval[0]) < 0.0000010000000000 ) { continue; // 3 cases reached } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; CheckValue<IkReal> x876=IKPowWithIntegerCheck(gconst11,-1); if(!x876.valid){ continue; } CheckValue<IkReal> x877=IKPowWithIntegerCheck(new_r11,-1); if(!x877.valid){ continue; } if( IKabs((new_r10*(x876.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*gconst11*(x877.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((new_r10*(x876.value)))+IKsqr(((-1.0)*gconst11*(x877.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j15array[0]=IKatan2((new_r10*(x876.value)), ((-1.0)*gconst11*(x877.value))); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x878=IKsin(j15); IkReal x879=IKcos(j15); IkReal x880=((1.0)*gconst11); IkReal x881=(gconst11*x879); evalcond[0]=(new_r11*x878); evalcond[1]=((-1.0)*gconst11*x878); evalcond[2]=(gconst11+((new_r11*x879))); evalcond[3]=(new_r11+x881); evalcond[4]=(new_r10+(((-1.0)*x878*x880))); evalcond[5]=((((-1.0)*x879*x880))+new_r00); evalcond[6]=((((-1.0)*new_r00*x878))+((new_r10*x879))); evalcond[7]=(((new_r00*x879))+(((-1.0)*x880))+((new_r10*x878))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; CheckValue<IkReal> x882=IKPowWithIntegerCheck(IKsign(gconst11),-1); if(!x882.valid){ continue; } CheckValue<IkReal> x883 = IKatan2WithCheck(IkReal(new_r10),IkReal(((-1.0)*new_r11)),IKFAST_ATAN2_MAGTHRESH); if(!x883.valid){ continue; } j15array[0]=((-1.5707963267949)+(((1.5707963267949)*(x882.value)))+(x883.value)); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x884=IKsin(j15); IkReal x885=IKcos(j15); IkReal x886=((1.0)*gconst11); IkReal x887=(gconst11*x885); evalcond[0]=(new_r11*x884); evalcond[1]=((-1.0)*gconst11*x884); evalcond[2]=(((new_r11*x885))+gconst11); evalcond[3]=(new_r11+x887); evalcond[4]=(new_r10+(((-1.0)*x884*x886))); evalcond[5]=(new_r00+(((-1.0)*x885*x886))); evalcond[6]=((((-1.0)*new_r00*x884))+((new_r10*x885))); evalcond[7]=(((new_r10*x884))+((new_r00*x885))+(((-1.0)*x886))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; CheckValue<IkReal> x888=IKPowWithIntegerCheck(IKsign(gconst11),-1); if(!x888.valid){ continue; } CheckValue<IkReal> x889 = IKatan2WithCheck(IkReal(new_r10),IkReal(new_r00),IKFAST_ATAN2_MAGTHRESH); if(!x889.valid){ continue; } j15array[0]=((-1.5707963267949)+(((1.5707963267949)*(x888.value)))+(x889.value)); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x890=IKsin(j15); IkReal x891=IKcos(j15); IkReal x892=((1.0)*gconst11); IkReal x893=(gconst11*x891); evalcond[0]=(new_r11*x890); evalcond[1]=((-1.0)*gconst11*x890); evalcond[2]=(((new_r11*x891))+gconst11); evalcond[3]=(new_r11+x893); evalcond[4]=(new_r10+(((-1.0)*x890*x892))); evalcond[5]=(new_r00+(((-1.0)*x891*x892))); evalcond[6]=((((-1.0)*new_r00*x890))+((new_r10*x891))); evalcond[7]=(((new_r00*x891))+((new_r10*x890))+(((-1.0)*x892))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j15] } } while(0); if( bgotonextstatement ) { } } } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; IkReal x894=((1.0)*new_r11); CheckValue<IkReal> x895 = IKatan2WithCheck(IkReal((((gconst10*gconst11))+(((-1.0)*new_r01*x894)))),IkReal(((new_r11*new_r11)+(((-1.0)*(gconst10*gconst10))))),IKFAST_ATAN2_MAGTHRESH); if(!x895.valid){ continue; } CheckValue<IkReal> x896=IKPowWithIntegerCheck(IKsign(((((-1.0)*gconst11*x894))+((gconst10*new_r01)))),-1); if(!x896.valid){ continue; } j15array[0]=((-1.5707963267949)+(x895.value)+(((1.5707963267949)*(x896.value)))); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x897=IKcos(j15); IkReal x898=IKsin(j15); IkReal x899=((1.0)*gconst11); IkReal x900=(gconst10*x897); IkReal x901=(gconst11*x897); IkReal x902=(gconst10*x898); IkReal x903=((1.0)*x898); IkReal x904=(x898*x899); evalcond[0]=(((new_r11*x898))+((new_r01*x897))+gconst10); evalcond[1]=(new_r11+x901+x902); evalcond[2]=(((new_r10*x897))+gconst10+(((-1.0)*new_r00*x903))); evalcond[3]=(((new_r11*x897))+gconst11+(((-1.0)*new_r01*x903))); evalcond[4]=((((-1.0)*x904))+new_r10+x900); evalcond[5]=((((-1.0)*x904))+new_r01+x900); evalcond[6]=(((new_r00*x897))+((new_r10*x898))+(((-1.0)*x899))); evalcond[7]=((((-1.0)*x902))+(((-1.0)*x897*x899))+new_r00); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; IkReal x905=((1.0)*new_r11); CheckValue<IkReal> x906 = IKatan2WithCheck(IkReal((((gconst11*new_r01))+(((-1.0)*gconst10*x905)))),IkReal(((((-1.0)*gconst11*x905))+(((-1.0)*gconst10*new_r01)))),IKFAST_ATAN2_MAGTHRESH); if(!x906.valid){ continue; } CheckValue<IkReal> x907=IKPowWithIntegerCheck(IKsign(((new_r01*new_r01)+(new_r11*new_r11))),-1); if(!x907.valid){ continue; } j15array[0]=((-1.5707963267949)+(x906.value)+(((1.5707963267949)*(x907.value)))); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x908=IKcos(j15); IkReal x909=IKsin(j15); IkReal x910=((1.0)*gconst11); IkReal x911=(gconst10*x908); IkReal x912=(gconst11*x908); IkReal x913=(gconst10*x909); IkReal x914=((1.0)*x909); IkReal x915=(x909*x910); evalcond[0]=(gconst10+((new_r11*x909))+((new_r01*x908))); evalcond[1]=(new_r11+x913+x912); evalcond[2]=(gconst10+((new_r10*x908))+(((-1.0)*new_r00*x914))); evalcond[3]=(gconst11+((new_r11*x908))+(((-1.0)*new_r01*x914))); evalcond[4]=((((-1.0)*x915))+new_r10+x911); evalcond[5]=((((-1.0)*x915))+new_r01+x911); evalcond[6]=((((-1.0)*x910))+((new_r10*x909))+((new_r00*x908))); evalcond[7]=((((-1.0)*x908*x910))+(((-1.0)*x913))+new_r00); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; IkReal x916=((1.0)*gconst10); CheckValue<IkReal> x917 = IKatan2WithCheck(IkReal((((gconst10*new_r01))+(((-1.0)*new_r10*x916)))),IkReal(((((-1.0)*new_r11*x916))+(((-1.0)*new_r00*x916)))),IKFAST_ATAN2_MAGTHRESH); if(!x917.valid){ continue; } CheckValue<IkReal> x918=IKPowWithIntegerCheck(IKsign((((new_r10*new_r11))+((new_r00*new_r01)))),-1); if(!x918.valid){ continue; } j15array[0]=((-1.5707963267949)+(x917.value)+(((1.5707963267949)*(x918.value)))); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x919=IKcos(j15); IkReal x920=IKsin(j15); IkReal x921=((1.0)*gconst11); IkReal x922=(gconst10*x919); IkReal x923=(gconst11*x919); IkReal x924=(gconst10*x920); IkReal x925=((1.0)*x920); IkReal x926=(x920*x921); evalcond[0]=(gconst10+((new_r01*x919))+((new_r11*x920))); evalcond[1]=(new_r11+x924+x923); evalcond[2]=(gconst10+((new_r10*x919))+(((-1.0)*new_r00*x925))); evalcond[3]=(gconst11+((new_r11*x919))+(((-1.0)*new_r01*x925))); evalcond[4]=((((-1.0)*x926))+new_r10+x922); evalcond[5]=((((-1.0)*x926))+new_r01+x922); evalcond[6]=((((-1.0)*x921))+((new_r00*x919))+((new_r10*x920))); evalcond[7]=((((-1.0)*x924))+(((-1.0)*x919*x921))+new_r00); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((new_r01*new_r01)+(new_r11*new_r11)); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j15eval[1]; sj16=0; cj16=-1.0; j16=3.14159265358979; new_r01=0; new_r11=0; j15eval[0]=((IKabs(new_r10))+(IKabs(new_r00))); if( IKabs(j15eval[0]) < 0.0000010000000000 ) { continue; // 3 cases reached } else { { IkReal j15array[2], cj15array[2], sj15array[2]; bool j15valid[2]={false}; _nj15 = 2; CheckValue<IkReal> x928 = IKatan2WithCheck(IkReal(new_r00),IkReal(new_r10),IKFAST_ATAN2_MAGTHRESH); if(!x928.valid){ continue; } IkReal x927=x928.value; j15array[0]=((-1.0)*x927); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); j15array[1]=((3.14159265358979)+(((-1.0)*x927))); sj15array[1]=IKsin(j15array[1]); cj15array[1]=IKcos(j15array[1]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; if( j15array[1] > IKPI ) { j15array[1]-=IK2PI; } else if( j15array[1] < -IKPI ) { j15array[1]+=IK2PI; } j15valid[1] = true; for(int ij15 = 0; ij15 < 2; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 2; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[1]; evalcond[0]=(((new_r10*(IKcos(j15))))+(((-1.0)*new_r00*(IKsin(j15))))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j17))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; if( IKabs(new_r10) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r11)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r10)+IKsqr(((-1.0)*new_r11))-1) <= IKFAST_SINCOS_THRESH ) continue; j15array[0]=IKatan2(new_r10, ((-1.0)*new_r11)); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x929=IKcos(j15); IkReal x930=IKsin(j15); IkReal x931=((1.0)*x930); evalcond[0]=(new_r11+x929); evalcond[1]=(new_r10+(((-1.0)*x931))); evalcond[2]=((((-1.0)*x929))+new_r00); evalcond[3]=(new_r01+(((-1.0)*x931))); evalcond[4]=(((new_r01*x929))+((new_r11*x930))); evalcond[5]=((((-1.0)*new_r00*x931))+((new_r10*x929))); evalcond[6]=((-1.0)+((new_r00*x929))+((new_r10*x930))); evalcond[7]=((1.0)+(((-1.0)*new_r01*x931))+((new_r11*x929))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j17)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; if( IKabs(((-1.0)*new_r10)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r00)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r10))+IKsqr(((-1.0)*new_r00))-1) <= IKFAST_SINCOS_THRESH ) continue; j15array[0]=IKatan2(((-1.0)*new_r10), ((-1.0)*new_r00)); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x932=IKsin(j15); IkReal x933=IKcos(j15); IkReal x934=((1.0)*x932); evalcond[0]=(new_r10+x932); evalcond[1]=(new_r00+x933); evalcond[2]=(new_r01+x932); evalcond[3]=((((-1.0)*x933))+new_r11); evalcond[4]=(((new_r01*x933))+((new_r11*x932))); evalcond[5]=((((-1.0)*new_r00*x934))+((new_r10*x933))); evalcond[6]=((1.0)+((new_r00*x933))+((new_r10*x932))); evalcond[7]=((-1.0)+(((-1.0)*new_r01*x934))+((new_r11*x933))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r11))+(IKabs(new_r00))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j15eval[3]; sj16=0; cj16=-1.0; j16=3.14159265358979; new_r11=0; new_r00=0; j15eval[0]=new_r01; j15eval[1]=IKsign(new_r01); j15eval[2]=((IKabs(sj17))+(IKabs(cj17))); if( IKabs(j15eval[0]) < 0.0000010000000000 || IKabs(j15eval[1]) < 0.0000010000000000 || IKabs(j15eval[2]) < 0.0000010000000000 ) { { IkReal j15eval[3]; sj16=0; cj16=-1.0; j16=3.14159265358979; new_r11=0; new_r00=0; j15eval[0]=new_r10; j15eval[1]=((IKabs(sj17))+(IKabs(cj17))); j15eval[2]=IKsign(new_r10); if( IKabs(j15eval[0]) < 0.0000010000000000 || IKabs(j15eval[1]) < 0.0000010000000000 || IKabs(j15eval[2]) < 0.0000010000000000 ) { { IkReal j15eval[2]; sj16=0; cj16=-1.0; j16=3.14159265358979; new_r11=0; new_r00=0; j15eval[0]=new_r01; j15eval[1]=new_r10; if( IKabs(j15eval[0]) < 0.0000010000000000 || IKabs(j15eval[1]) < 0.0000010000000000 ) { continue; // no branches [j15] } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; CheckValue<IkReal> x935=IKPowWithIntegerCheck(new_r01,-1); if(!x935.valid){ continue; } CheckValue<IkReal> x936=IKPowWithIntegerCheck(new_r10,-1); if(!x936.valid){ continue; } if( IKabs((cj17*(x935.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*sj17*(x936.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((cj17*(x935.value)))+IKsqr(((-1.0)*sj17*(x936.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j15array[0]=IKatan2((cj17*(x935.value)), ((-1.0)*sj17*(x936.value))); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[7]; IkReal x937=IKcos(j15); IkReal x938=IKsin(j15); IkReal x939=((1.0)*cj17); IkReal x940=(sj17*x937); IkReal x941=((1.0)*x938); IkReal x942=(x938*x939); evalcond[0]=(sj17+((new_r10*x937))); evalcond[1]=(((new_r01*x937))+sj17); evalcond[2]=(cj17+(((-1.0)*new_r01*x941))); evalcond[3]=(((new_r10*x938))+(((-1.0)*x939))); evalcond[4]=((((-1.0)*x942))+new_r10+x940); evalcond[5]=((((-1.0)*x937*x939))+(((-1.0)*sj17*x941))); evalcond[6]=((((-1.0)*x942))+new_r01+x940); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; CheckValue<IkReal> x943=IKPowWithIntegerCheck(IKsign(new_r10),-1); if(!x943.valid){ continue; } CheckValue<IkReal> x944 = IKatan2WithCheck(IkReal(cj17),IkReal(((-1.0)*sj17)),IKFAST_ATAN2_MAGTHRESH); if(!x944.valid){ continue; } j15array[0]=((-1.5707963267949)+(((1.5707963267949)*(x943.value)))+(x944.value)); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[7]; IkReal x945=IKcos(j15); IkReal x946=IKsin(j15); IkReal x947=((1.0)*cj17); IkReal x948=(sj17*x945); IkReal x949=((1.0)*x946); IkReal x950=(x946*x947); evalcond[0]=(sj17+((new_r10*x945))); evalcond[1]=(((new_r01*x945))+sj17); evalcond[2]=(cj17+(((-1.0)*new_r01*x949))); evalcond[3]=((((-1.0)*x947))+((new_r10*x946))); evalcond[4]=(new_r10+(((-1.0)*x950))+x948); evalcond[5]=((((-1.0)*x945*x947))+(((-1.0)*sj17*x949))); evalcond[6]=(new_r01+(((-1.0)*x950))+x948); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; CheckValue<IkReal> x951=IKPowWithIntegerCheck(IKsign(new_r01),-1); if(!x951.valid){ continue; } CheckValue<IkReal> x952 = IKatan2WithCheck(IkReal(cj17),IkReal(((-1.0)*sj17)),IKFAST_ATAN2_MAGTHRESH); if(!x952.valid){ continue; } j15array[0]=((-1.5707963267949)+(((1.5707963267949)*(x951.value)))+(x952.value)); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[7]; IkReal x953=IKcos(j15); IkReal x954=IKsin(j15); IkReal x955=((1.0)*cj17); IkReal x956=(sj17*x953); IkReal x957=((1.0)*x954); IkReal x958=(x954*x955); evalcond[0]=(((new_r10*x953))+sj17); evalcond[1]=(((new_r01*x953))+sj17); evalcond[2]=(cj17+(((-1.0)*new_r01*x957))); evalcond[3]=(((new_r10*x954))+(((-1.0)*x955))); evalcond[4]=(new_r10+(((-1.0)*x958))+x956); evalcond[5]=((((-1.0)*x953*x955))+(((-1.0)*sj17*x957))); evalcond[6]=(new_r01+(((-1.0)*x958))+x956); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r11))+(IKabs(new_r01))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j15eval[1]; sj16=0; cj16=-1.0; j16=3.14159265358979; new_r11=0; new_r01=0; new_r22=0; new_r20=0; j15eval[0]=((IKabs(new_r10))+(IKabs(new_r00))); if( IKabs(j15eval[0]) < 0.0000010000000000 ) { continue; // no branches [j15] } else { { IkReal j15array[2], cj15array[2], sj15array[2]; bool j15valid[2]={false}; _nj15 = 2; CheckValue<IkReal> x960 = IKatan2WithCheck(IkReal(new_r00),IkReal(new_r10),IKFAST_ATAN2_MAGTHRESH); if(!x960.valid){ continue; } IkReal x959=x960.value; j15array[0]=((-1.0)*x959); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); j15array[1]=((3.14159265358979)+(((-1.0)*x959))); sj15array[1]=IKsin(j15array[1]); cj15array[1]=IKcos(j15array[1]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; if( j15array[1] > IKPI ) { j15array[1]-=IK2PI; } else if( j15array[1] < -IKPI ) { j15array[1]+=IK2PI; } j15valid[1] = true; for(int ij15 = 0; ij15 < 2; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 2; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[1]; evalcond[0]=(((new_r10*(IKcos(j15))))+(((-1.0)*new_r00*(IKsin(j15))))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r10))+(IKabs(new_r00))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j15eval[1]; sj16=0; cj16=-1.0; j16=3.14159265358979; new_r00=0; new_r10=0; new_r21=0; new_r22=0; j15eval[0]=((IKabs(new_r11))+(IKabs(new_r01))); if( IKabs(j15eval[0]) < 0.0000010000000000 ) { continue; // no branches [j15] } else { { IkReal j15array[2], cj15array[2], sj15array[2]; bool j15valid[2]={false}; _nj15 = 2; CheckValue<IkReal> x962 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x962.valid){ continue; } IkReal x961=x962.value; j15array[0]=((-1.0)*x961); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); j15array[1]=((3.14159265358979)+(((-1.0)*x961))); sj15array[1]=IKsin(j15array[1]); cj15array[1]=IKcos(j15array[1]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; if( j15array[1] > IKPI ) { j15array[1]-=IK2PI; } else if( j15array[1] < -IKPI ) { j15array[1]+=IK2PI; } j15valid[1] = true; for(int ij15 = 0; ij15 < 2; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 2; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[1]; evalcond[0]=((((-1.0)*new_r01*(IKsin(j15))))+((new_r11*(IKcos(j15))))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r10))+(IKabs(new_r01))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j15eval[3]; sj16=0; cj16=-1.0; j16=3.14159265358979; new_r01=0; new_r10=0; j15eval[0]=new_r11; j15eval[1]=IKsign(new_r11); j15eval[2]=((IKabs(sj17))+(IKabs(cj17))); if( IKabs(j15eval[0]) < 0.0000010000000000 || IKabs(j15eval[1]) < 0.0000010000000000 || IKabs(j15eval[2]) < 0.0000010000000000 ) { { IkReal j15eval[2]; sj16=0; cj16=-1.0; j16=3.14159265358979; new_r01=0; new_r10=0; j15eval[0]=new_r00; j15eval[1]=new_r11; if( IKabs(j15eval[0]) < 0.0000010000000000 || IKabs(j15eval[1]) < 0.0000010000000000 ) { continue; // no branches [j15] } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; CheckValue<IkReal> x963=IKPowWithIntegerCheck(new_r00,-1); if(!x963.valid){ continue; } CheckValue<IkReal> x964=IKPowWithIntegerCheck(new_r11,-1); if(!x964.valid){ continue; } if( IKabs((sj17*(x963.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*cj17*(x964.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((sj17*(x963.value)))+IKsqr(((-1.0)*cj17*(x964.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j15array[0]=IKatan2((sj17*(x963.value)), ((-1.0)*cj17*(x964.value))); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[7]; IkReal x965=IKsin(j15); IkReal x966=IKcos(j15); IkReal x967=((1.0)*cj17); IkReal x968=((1.0)*x965); evalcond[0]=(((new_r11*x966))+cj17); evalcond[1]=(((new_r11*x965))+sj17); evalcond[2]=((((-1.0)*new_r00*x968))+sj17); evalcond[3]=(((new_r00*x966))+(((-1.0)*x967))); evalcond[4]=(((sj17*x966))+(((-1.0)*x965*x967))); evalcond[5]=(((sj17*x965))+((cj17*x966))+new_r11); evalcond[6]=((((-1.0)*x966*x967))+new_r00+(((-1.0)*sj17*x968))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; CheckValue<IkReal> x969=IKPowWithIntegerCheck(IKsign(new_r11),-1); if(!x969.valid){ continue; } CheckValue<IkReal> x970 = IKatan2WithCheck(IkReal(((-1.0)*sj17)),IkReal(((-1.0)*cj17)),IKFAST_ATAN2_MAGTHRESH); if(!x970.valid){ continue; } j15array[0]=((-1.5707963267949)+(((1.5707963267949)*(x969.value)))+(x970.value)); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[7]; IkReal x971=IKsin(j15); IkReal x972=IKcos(j15); IkReal x973=((1.0)*cj17); IkReal x974=((1.0)*x971); evalcond[0]=(cj17+((new_r11*x972))); evalcond[1]=(sj17+((new_r11*x971))); evalcond[2]=(sj17+(((-1.0)*new_r00*x974))); evalcond[3]=((((-1.0)*x973))+((new_r00*x972))); evalcond[4]=((((-1.0)*x971*x973))+((sj17*x972))); evalcond[5]=(((cj17*x972))+new_r11+((sj17*x971))); evalcond[6]=((((-1.0)*sj17*x974))+(((-1.0)*x972*x973))+new_r00); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j15] } } while(0); if( bgotonextstatement ) { } } } } } } } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; CheckValue<IkReal> x975=IKPowWithIntegerCheck(IKsign((((new_r11*sj17))+((cj17*new_r01)))),-1); if(!x975.valid){ continue; } CheckValue<IkReal> x976 = IKatan2WithCheck(IkReal(((-1.0)+((new_r01*new_r10))+(cj17*cj17))),IkReal(((((-1.0)*cj17*sj17))+(((-1.0)*new_r10*new_r11)))),IKFAST_ATAN2_MAGTHRESH); if(!x976.valid){ continue; } j15array[0]=((-1.5707963267949)+(((1.5707963267949)*(x975.value)))+(x976.value)); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x977=IKsin(j15); IkReal x978=IKcos(j15); IkReal x979=((1.0)*cj17); IkReal x980=(sj17*x978); IkReal x981=((1.0)*x977); IkReal x982=(x977*x979); evalcond[0]=(((new_r01*x978))+sj17+((new_r11*x977))); evalcond[1]=(((cj17*x978))+new_r11+((sj17*x977))); evalcond[2]=((((-1.0)*new_r00*x981))+sj17+((new_r10*x978))); evalcond[3]=((((-1.0)*new_r01*x981))+cj17+((new_r11*x978))); evalcond[4]=((((-1.0)*x982))+new_r10+x980); evalcond[5]=((((-1.0)*x982))+new_r01+x980); evalcond[6]=(((new_r10*x977))+(((-1.0)*x979))+((new_r00*x978))); evalcond[7]=((((-1.0)*x978*x979))+new_r00+(((-1.0)*sj17*x981))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; IkReal x983=((1.0)*new_r11); CheckValue<IkReal> x984 = IKatan2WithCheck(IkReal((((cj17*new_r01))+(((-1.0)*sj17*x983)))),IkReal(((((-1.0)*cj17*x983))+(((-1.0)*new_r01*sj17)))),IKFAST_ATAN2_MAGTHRESH); if(!x984.valid){ continue; } CheckValue<IkReal> x985=IKPowWithIntegerCheck(IKsign(((new_r01*new_r01)+(new_r11*new_r11))),-1); if(!x985.valid){ continue; } j15array[0]=((-1.5707963267949)+(x984.value)+(((1.5707963267949)*(x985.value)))); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x986=IKsin(j15); IkReal x987=IKcos(j15); IkReal x988=((1.0)*cj17); IkReal x989=(sj17*x987); IkReal x990=((1.0)*x986); IkReal x991=(x986*x988); evalcond[0]=(sj17+((new_r11*x986))+((new_r01*x987))); evalcond[1]=(((sj17*x986))+((cj17*x987))+new_r11); evalcond[2]=((((-1.0)*new_r00*x990))+sj17+((new_r10*x987))); evalcond[3]=((((-1.0)*new_r01*x990))+cj17+((new_r11*x987))); evalcond[4]=((((-1.0)*x991))+new_r10+x989); evalcond[5]=((((-1.0)*x991))+new_r01+x989); evalcond[6]=(((new_r00*x987))+(((-1.0)*x988))+((new_r10*x986))); evalcond[7]=((((-1.0)*sj17*x990))+(((-1.0)*x987*x988))+new_r00); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; IkReal x992=((1.0)*sj17); CheckValue<IkReal> x993 = IKatan2WithCheck(IkReal(((((-1.0)*new_r10*x992))+((new_r01*sj17)))),IkReal(((((-1.0)*new_r11*x992))+(((-1.0)*new_r00*x992)))),IKFAST_ATAN2_MAGTHRESH); if(!x993.valid){ continue; } CheckValue<IkReal> x994=IKPowWithIntegerCheck(IKsign((((new_r10*new_r11))+((new_r00*new_r01)))),-1); if(!x994.valid){ continue; } j15array[0]=((-1.5707963267949)+(x993.value)+(((1.5707963267949)*(x994.value)))); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[8]; IkReal x995=IKsin(j15); IkReal x996=IKcos(j15); IkReal x997=((1.0)*cj17); IkReal x998=(sj17*x996); IkReal x999=((1.0)*x995); IkReal x1000=(x995*x997); evalcond[0]=(((new_r11*x995))+sj17+((new_r01*x996))); evalcond[1]=(((sj17*x995))+((cj17*x996))+new_r11); evalcond[2]=((((-1.0)*new_r00*x999))+((new_r10*x996))+sj17); evalcond[3]=(((new_r11*x996))+(((-1.0)*new_r01*x999))+cj17); evalcond[4]=((((-1.0)*x1000))+new_r10+x998); evalcond[5]=((((-1.0)*x1000))+new_r01+x998); evalcond[6]=(((new_r10*x995))+(((-1.0)*x997))+((new_r00*x996))); evalcond[7]=((((-1.0)*sj17*x999))+(((-1.0)*x996*x997))+new_r00); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r12))+(IKabs(new_r02))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j15eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; j15eval[0]=((IKabs(new_r10))+(IKabs(new_r00))); if( IKabs(j15eval[0]) < 0.0000010000000000 ) { { IkReal j15eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; j15eval[0]=((IKabs(new_r11))+(IKabs(new_r01))); if( IKabs(j15eval[0]) < 0.0000010000000000 ) { { IkReal j15eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; j15eval[0]=((IKabs((new_r11*new_r22)))+(IKabs((new_r01*new_r22)))); if( IKabs(j15eval[0]) < 0.0000010000000000 ) { continue; // no branches [j15] } else { { IkReal j15array[2], cj15array[2], sj15array[2]; bool j15valid[2]={false}; _nj15 = 2; IkReal x1001=((-1.0)*new_r22); CheckValue<IkReal> x1003 = IKatan2WithCheck(IkReal((new_r01*x1001)),IkReal((new_r11*x1001)),IKFAST_ATAN2_MAGTHRESH); if(!x1003.valid){ continue; } IkReal x1002=x1003.value; j15array[0]=((-1.0)*x1002); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); j15array[1]=((3.14159265358979)+(((-1.0)*x1002))); sj15array[1]=IKsin(j15array[1]); cj15array[1]=IKcos(j15array[1]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; if( j15array[1] > IKPI ) { j15array[1]-=IK2PI; } else if( j15array[1] < -IKPI ) { j15array[1]+=IK2PI; } j15valid[1] = true; for(int ij15 = 0; ij15 < 2; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 2; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[5]; IkReal x1004=IKcos(j15); IkReal x1005=IKsin(j15); IkReal x1006=(new_r00*x1004); IkReal x1007=((1.0)*x1005); evalcond[0]=(x1006+((new_r10*x1005))); evalcond[1]=(((new_r11*x1005))+((new_r01*x1004))); evalcond[2]=(((new_r10*x1004))+(((-1.0)*new_r00*x1007))); evalcond[3]=(((new_r11*x1004))+(((-1.0)*new_r01*x1007))); evalcond[4]=((((-1.0)*new_r22*x1006))+(((-1.0)*new_r10*new_r22*x1007))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j15array[2], cj15array[2], sj15array[2]; bool j15valid[2]={false}; _nj15 = 2; CheckValue<IkReal> x1009 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x1009.valid){ continue; } IkReal x1008=x1009.value; j15array[0]=((-1.0)*x1008); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); j15array[1]=((3.14159265358979)+(((-1.0)*x1008))); sj15array[1]=IKsin(j15array[1]); cj15array[1]=IKcos(j15array[1]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; if( j15array[1] > IKPI ) { j15array[1]-=IK2PI; } else if( j15array[1] < -IKPI ) { j15array[1]+=IK2PI; } j15valid[1] = true; for(int ij15 = 0; ij15 < 2; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 2; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[5]; IkReal x1010=IKcos(j15); IkReal x1011=IKsin(j15); IkReal x1012=((1.0)*new_r01); IkReal x1013=(new_r00*x1010); IkReal x1014=((1.0)*x1011); evalcond[0]=(x1013+((new_r10*x1011))); evalcond[1]=(((new_r10*x1010))+(((-1.0)*new_r00*x1014))); evalcond[2]=((((-1.0)*x1011*x1012))+((new_r11*x1010))); evalcond[3]=((((-1.0)*new_r22*x1010*x1012))+(((-1.0)*new_r11*new_r22*x1014))); evalcond[4]=((((-1.0)*new_r10*new_r22*x1014))+(((-1.0)*new_r22*x1013))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j15array[2], cj15array[2], sj15array[2]; bool j15valid[2]={false}; _nj15 = 2; CheckValue<IkReal> x1016 = IKatan2WithCheck(IkReal(new_r00),IkReal(new_r10),IKFAST_ATAN2_MAGTHRESH); if(!x1016.valid){ continue; } IkReal x1015=x1016.value; j15array[0]=((-1.0)*x1015); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); j15array[1]=((3.14159265358979)+(((-1.0)*x1015))); sj15array[1]=IKsin(j15array[1]); cj15array[1]=IKcos(j15array[1]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; if( j15array[1] > IKPI ) { j15array[1]-=IK2PI; } else if( j15array[1] < -IKPI ) { j15array[1]+=IK2PI; } j15valid[1] = true; for(int ij15 = 0; ij15 < 2; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 2; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[5]; IkReal x1017=IKcos(j15); IkReal x1018=IKsin(j15); IkReal x1019=((1.0)*new_r22); IkReal x1020=(new_r01*x1017); IkReal x1021=((1.0)*x1018); IkReal x1022=(new_r11*x1018); evalcond[0]=(x1020+x1022); evalcond[1]=((((-1.0)*new_r00*x1021))+((new_r10*x1017))); evalcond[2]=(((new_r11*x1017))+(((-1.0)*new_r01*x1021))); evalcond[3]=((((-1.0)*x1019*x1022))+(((-1.0)*x1019*x1020))); evalcond[4]=((((-1.0)*new_r00*x1017*x1019))+(((-1.0)*new_r10*x1018*x1019))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j15] } } while(0); if( bgotonextstatement ) { } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; CheckValue<IkReal> x1024=IKPowWithIntegerCheck(sj16,-1); if(!x1024.valid){ continue; } IkReal x1023=x1024.value; CheckValue<IkReal> x1025=IKPowWithIntegerCheck(new_r12,-1); if(!x1025.valid){ continue; } if( IKabs((x1023*(x1025.value)*(((-1.0)+(new_r02*new_r02)+(cj16*cj16))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r02*x1023)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((x1023*(x1025.value)*(((-1.0)+(new_r02*new_r02)+(cj16*cj16)))))+IKsqr(((-1.0)*new_r02*x1023))-1) <= IKFAST_SINCOS_THRESH ) continue; j15array[0]=IKatan2((x1023*(x1025.value)*(((-1.0)+(new_r02*new_r02)+(cj16*cj16)))), ((-1.0)*new_r02*x1023)); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[18]; IkReal x1026=IKcos(j15); IkReal x1027=IKsin(j15); IkReal x1028=((1.0)*cj16); IkReal x1029=(cj16*cj17); IkReal x1030=((1.0)*sj16); IkReal x1031=(new_r02*x1026); IkReal x1032=(new_r00*x1026); IkReal x1033=(new_r12*x1027); IkReal x1034=(sj17*x1026); IkReal x1035=(sj16*x1026); IkReal x1036=(sj17*x1027); IkReal x1037=(new_r10*x1027); IkReal x1038=((1.0)*x1027); IkReal x1039=(new_r01*x1026); IkReal x1040=(sj16*x1027); IkReal x1041=(new_r11*x1027); evalcond[0]=(x1035+new_r02); evalcond[1]=(x1040+new_r12); evalcond[2]=((((-1.0)*new_r02*x1038))+((new_r12*x1026))); evalcond[3]=(x1033+x1031+sj16); evalcond[4]=(((new_r10*x1026))+sj17+(((-1.0)*new_r00*x1038))); evalcond[5]=(((new_r11*x1026))+cj17+(((-1.0)*new_r01*x1038))); evalcond[6]=(x1034+new_r10+((x1027*x1029))); evalcond[7]=(x1032+x1037+x1029); evalcond[8]=((((-1.0)*x1036))+((x1026*x1029))+new_r00); evalcond[9]=((((-1.0)*x1028*x1036))+((cj17*x1026))+new_r11); evalcond[10]=(x1041+x1039+(((-1.0)*sj17*x1028))); evalcond[11]=((((-1.0)*x1028*x1034))+(((-1.0)*cj17*x1038))+new_r01); evalcond[12]=(((sj16*x1032))+((sj16*x1037))+(((-1.0)*new_r20*x1028))); evalcond[13]=(((new_r11*x1040))+(((-1.0)*new_r21*x1028))+((new_r01*x1035))); evalcond[14]=((1.0)+(((-1.0)*new_r22*x1028))+((sj16*x1031))+((sj16*x1033))); evalcond[15]=((((-1.0)*x1028*x1033))+(((-1.0)*x1028*x1031))+(((-1.0)*new_r22*x1030))); evalcond[16]=((((-1.0)*x1028*x1039))+(((-1.0)*x1028*x1041))+sj17+(((-1.0)*new_r21*x1030))); evalcond[17]=((((-1.0)*x1028*x1032))+(((-1.0)*x1028*x1037))+(((-1.0)*new_r20*x1030))+(((-1.0)*cj17))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[12]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[13]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[14]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[15]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[16]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[17]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j15array[1], cj15array[1], sj15array[1]; bool j15valid[1]={false}; _nj15 = 1; CheckValue<IkReal> x1042=IKPowWithIntegerCheck(IKsign(sj16),-1); if(!x1042.valid){ continue; } CheckValue<IkReal> x1043 = IKatan2WithCheck(IkReal(((-1.0)*new_r12)),IkReal(((-1.0)*new_r02)),IKFAST_ATAN2_MAGTHRESH); if(!x1043.valid){ continue; } j15array[0]=((-1.5707963267949)+(((1.5707963267949)*(x1042.value)))+(x1043.value)); sj15array[0]=IKsin(j15array[0]); cj15array[0]=IKcos(j15array[0]); if( j15array[0] > IKPI ) { j15array[0]-=IK2PI; } else if( j15array[0] < -IKPI ) { j15array[0]+=IK2PI; } j15valid[0] = true; for(int ij15 = 0; ij15 < 1; ++ij15) { if( !j15valid[ij15] ) { continue; } _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < 1; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; { IkReal evalcond[18]; IkReal x1044=IKcos(j15); IkReal x1045=IKsin(j15); IkReal x1046=((1.0)*cj16); IkReal x1047=(cj16*cj17); IkReal x1048=((1.0)*sj16); IkReal x1049=(new_r02*x1044); IkReal x1050=(new_r00*x1044); IkReal x1051=(new_r12*x1045); IkReal x1052=(sj17*x1044); IkReal x1053=(sj16*x1044); IkReal x1054=(sj17*x1045); IkReal x1055=(new_r10*x1045); IkReal x1056=((1.0)*x1045); IkReal x1057=(new_r01*x1044); IkReal x1058=(sj16*x1045); IkReal x1059=(new_r11*x1045); evalcond[0]=(x1053+new_r02); evalcond[1]=(x1058+new_r12); evalcond[2]=((((-1.0)*new_r02*x1056))+((new_r12*x1044))); evalcond[3]=(x1051+x1049+sj16); evalcond[4]=((((-1.0)*new_r00*x1056))+sj17+((new_r10*x1044))); evalcond[5]=((((-1.0)*new_r01*x1056))+((new_r11*x1044))+cj17); evalcond[6]=(x1052+new_r10+((x1045*x1047))); evalcond[7]=(x1050+x1055+x1047); evalcond[8]=((((-1.0)*x1054))+new_r00+((x1044*x1047))); evalcond[9]=(((cj17*x1044))+(((-1.0)*x1046*x1054))+new_r11); evalcond[10]=(x1057+x1059+(((-1.0)*sj17*x1046))); evalcond[11]=((((-1.0)*x1046*x1052))+(((-1.0)*cj17*x1056))+new_r01); evalcond[12]=((((-1.0)*new_r20*x1046))+((sj16*x1055))+((sj16*x1050))); evalcond[13]=((((-1.0)*new_r21*x1046))+((new_r01*x1053))+((new_r11*x1058))); evalcond[14]=((1.0)+((sj16*x1049))+(((-1.0)*new_r22*x1046))+((sj16*x1051))); evalcond[15]=((((-1.0)*x1046*x1049))+(((-1.0)*new_r22*x1048))+(((-1.0)*x1046*x1051))); evalcond[16]=((((-1.0)*x1046*x1057))+(((-1.0)*x1046*x1059))+(((-1.0)*new_r21*x1048))+sj17); evalcond[17]=((((-1.0)*x1046*x1055))+(((-1.0)*x1046*x1050))+(((-1.0)*new_r20*x1048))+(((-1.0)*cj17))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[12]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[13]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[14]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[15]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[16]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[17]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j11; vinfos[1].indices[0] = _ij11[0]; vinfos[1].indices[1] = _ij11[1]; vinfos[1].maxsolutions = _nj11; vinfos[2].jointtype = 1; vinfos[2].foffset = j12; vinfos[2].indices[0] = _ij12[0]; vinfos[2].indices[1] = _ij12[1]; vinfos[2].maxsolutions = _nj12; vinfos[3].jointtype = 1; vinfos[3].foffset = j13; vinfos[3].indices[0] = _ij13[0]; vinfos[3].indices[1] = _ij13[1]; vinfos[3].maxsolutions = _nj13; vinfos[4].jointtype = 1; vinfos[4].foffset = j14; vinfos[4].indices[0] = _ij14[0]; vinfos[4].indices[1] = _ij14[1]; vinfos[4].maxsolutions = _nj14; vinfos[5].jointtype = 1; vinfos[5].foffset = j15; vinfos[5].indices[0] = _ij15[0]; vinfos[5].indices[1] = _ij15[1]; vinfos[5].maxsolutions = _nj15; vinfos[6].jointtype = 1; vinfos[6].foffset = j16; vinfos[6].indices[0] = _ij16[0]; vinfos[6].indices[1] = _ij16[1]; vinfos[6].maxsolutions = _nj16; vinfos[7].jointtype = 1; vinfos[7].foffset = j17; vinfos[7].indices[0] = _ij17[0]; vinfos[7].indices[1] = _ij17[1]; vinfos[7].maxsolutions = _nj17; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } } } } } } }static inline void polyroots3(IkReal rawcoeffs[3+1], IkReal rawroots[3], int& numroots) { using std::complex; if( rawcoeffs[0] == 0 ) { // solve with one reduced degree polyroots2(&rawcoeffs[1], &rawroots[0], numroots); return; } IKFAST_ASSERT(rawcoeffs[0] != 0); const IkReal tol = 128.0*std::numeric_limits<IkReal>::epsilon(); const IkReal tolsqrt = sqrt(std::numeric_limits<IkReal>::epsilon()); complex<IkReal> coeffs[3]; const int maxsteps = 110; for(int i = 0; i < 3; ++i) { coeffs[i] = complex<IkReal>(rawcoeffs[i+1]/rawcoeffs[0]); } complex<IkReal> roots[3]; IkReal err[3]; roots[0] = complex<IkReal>(1,0); roots[1] = complex<IkReal>(0.4,0.9); // any complex number not a root of unity works err[0] = 1.0; err[1] = 1.0; for(int i = 2; i < 3; ++i) { roots[i] = roots[i-1]*roots[1]; err[i] = 1.0; } for(int step = 0; step < maxsteps; ++step) { bool changed = false; for(int i = 0; i < 3; ++i) { if ( err[i] >= tol ) { changed = true; // evaluate complex<IkReal> x = roots[i] + coeffs[0]; for(int j = 1; j < 3; ++j) { x = roots[i] * x + coeffs[j]; } for(int j = 0; j < 3; ++j) { if( i != j ) { if( roots[i] != roots[j] ) { x /= (roots[i] - roots[j]); } } } roots[i] -= x; err[i] = abs(x); } } if( !changed ) { break; } } numroots = 0; bool visited[3] = {false}; for(int i = 0; i < 3; ++i) { if( !visited[i] ) { // might be a multiple root, in which case it will have more error than the other roots // find any neighboring roots, and take the average complex<IkReal> newroot=roots[i]; int n = 1; for(int j = i+1; j < 3; ++j) { // care about error in real much more than imaginary if( abs(real(roots[i])-real(roots[j])) < tolsqrt && abs(imag(roots[i])-imag(roots[j])) < 0.002 ) { newroot += roots[j]; n += 1; visited[j] = true; } } if( n > 1 ) { newroot /= n; } // there are still cases where even the mean is not accurate enough, until a better multi-root algorithm is used, need to use the sqrt if( IKabs(imag(newroot)) < tolsqrt ) { rawroots[numroots++] = real(newroot); } } } } static inline void polyroots2(IkReal rawcoeffs[2+1], IkReal rawroots[2], int& numroots) { IkReal det = rawcoeffs[1]*rawcoeffs[1]-4*rawcoeffs[0]*rawcoeffs[2]; if( det < 0 ) { numroots=0; } else if( det == 0 ) { rawroots[0] = -0.5*rawcoeffs[1]/rawcoeffs[0]; numroots = 1; } else { det = IKsqrt(det); rawroots[0] = (-rawcoeffs[1]+det)/(2*rawcoeffs[0]); rawroots[1] = (-rawcoeffs[1]-det)/(2*rawcoeffs[0]);//rawcoeffs[2]/(rawcoeffs[0]*rawroots[0]); numroots = 2; } } static inline void polyroots4(IkReal rawcoeffs[4+1], IkReal rawroots[4], int& numroots) { using std::complex; if( rawcoeffs[0] == 0 ) { // solve with one reduced degree polyroots3(&rawcoeffs[1], &rawroots[0], numroots); return; } IKFAST_ASSERT(rawcoeffs[0] != 0); const IkReal tol = 128.0*std::numeric_limits<IkReal>::epsilon(); const IkReal tolsqrt = sqrt(std::numeric_limits<IkReal>::epsilon()); complex<IkReal> coeffs[4]; const int maxsteps = 110; for(int i = 0; i < 4; ++i) { coeffs[i] = complex<IkReal>(rawcoeffs[i+1]/rawcoeffs[0]); } complex<IkReal> roots[4]; IkReal err[4]; roots[0] = complex<IkReal>(1,0); roots[1] = complex<IkReal>(0.4,0.9); // any complex number not a root of unity works err[0] = 1.0; err[1] = 1.0; for(int i = 2; i < 4; ++i) { roots[i] = roots[i-1]*roots[1]; err[i] = 1.0; } for(int step = 0; step < maxsteps; ++step) { bool changed = false; for(int i = 0; i < 4; ++i) { if ( err[i] >= tol ) { changed = true; // evaluate complex<IkReal> x = roots[i] + coeffs[0]; for(int j = 1; j < 4; ++j) { x = roots[i] * x + coeffs[j]; } for(int j = 0; j < 4; ++j) { if( i != j ) { if( roots[i] != roots[j] ) { x /= (roots[i] - roots[j]); } } } roots[i] -= x; err[i] = abs(x); } } if( !changed ) { break; } } numroots = 0; bool visited[4] = {false}; for(int i = 0; i < 4; ++i) { if( !visited[i] ) { // might be a multiple root, in which case it will have more error than the other roots // find any neighboring roots, and take the average complex<IkReal> newroot=roots[i]; int n = 1; for(int j = i+1; j < 4; ++j) { // care about error in real much more than imaginary if( abs(real(roots[i])-real(roots[j])) < tolsqrt && abs(imag(roots[i])-imag(roots[j])) < 0.002 ) { newroot += roots[j]; n += 1; visited[j] = true; } } if( n > 1 ) { newroot /= n; } // there are still cases where even the mean is not accurate enough, until a better multi-root algorithm is used, need to use the sqrt if( IKabs(imag(newroot)) < tolsqrt ) { rawroots[numroots++] = real(newroot); } } } } }; /// solves the inverse kinematics equations. /// \param pfree is an array specifying the free joints of the chain. IKFAST_API bool ComputeIk(const IkReal* eetrans, const IkReal* eerot, const IkReal* pfree, IkSolutionListBase<IkReal>& solutions) { IKSolver solver; return solver.ComputeIk(eetrans,eerot,pfree,solutions); } IKFAST_API bool ComputeIk2(const IkReal* eetrans, const IkReal* eerot, const IkReal* pfree, IkSolutionListBase<IkReal>& solutions, void* pOpenRAVEManip) { IKSolver solver; return solver.ComputeIk(eetrans,eerot,pfree,solutions); } IKFAST_API const char* GetKinematicsHash() { return ""; } IKFAST_API const char* GetIkFastVersion() { return "0x1000004a"; } #ifdef IKFAST_NAMESPACE } // end namespace #endif #ifndef IKFAST_NO_MAIN #include <stdio.h> #include <stdlib.h> #ifdef IKFAST_NAMESPACE using namespace IKFAST_NAMESPACE; #endif int main(int argc, char** argv) { if( argc != 12+GetNumFreeParameters()+1 ) { printf("\nUsage: ./ik r00 r01 r02 t0 r10 r11 r12 t1 r20 r21 r22 t2 free0 ...\n\n" "Returns the ik solutions given the transformation of the end effector specified by\n" "a 3x3 rotation R (rXX), and a 3x1 translation (tX).\n" "There are %d free parameters that have to be specified.\n\n",GetNumFreeParameters()); return 1; } IkSolutionList<IkReal> solutions; std::vector<IkReal> vfree(GetNumFreeParameters()); IkReal eerot[9],eetrans[3]; eerot[0] = atof(argv[1]); eerot[1] = atof(argv[2]); eerot[2] = atof(argv[3]); eetrans[0] = atof(argv[4]); eerot[3] = atof(argv[5]); eerot[4] = atof(argv[6]); eerot[5] = atof(argv[7]); eetrans[1] = atof(argv[8]); eerot[6] = atof(argv[9]); eerot[7] = atof(argv[10]); eerot[8] = atof(argv[11]); eetrans[2] = atof(argv[12]); for(std::size_t i = 0; i < vfree.size(); ++i) vfree[i] = atof(argv[13+i]); bool bSuccess = ComputeIk(eetrans, eerot, vfree.size() > 0 ? &vfree[0] : NULL, solutions); if( !bSuccess ) { fprintf(stderr,"Failed to get ik solution\n"); return -1; } printf("Found %d ik solutions:\n", (int)solutions.GetNumSolutions()); std::vector<IkReal> solvalues(GetNumJoints()); for(std::size_t i = 0; i < solutions.GetNumSolutions(); ++i) { const IkSolutionBase<IkReal>& sol = solutions.GetSolution(i); printf("sol%d (free=%d): ", (int)i, (int)sol.GetFree().size()); std::vector<IkReal> vsolfree(sol.GetFree().size()); sol.GetSolution(&solvalues[0],vsolfree.size()>0?&vsolfree[0]:NULL); for( std::size_t j = 0; j < solvalues.size(); ++j) printf("%.15f, ", solvalues[j]); printf("\n"); } return 0; } #endif // start python bindings // https://github.com/caelan/ss-pybullet/blob/c5efe7ad32381a7a7a15c2bd147b5a8731d21342/pybullet_tools/ikfast/pr2/left_arm_ik.cpp#L12972 // https://github.com/yijiangh/conrob_pybullet/blob/master/utils/ikfast/kuka_kr6_r900/ikfast0x1000004a.Transform6D.0_1_2_3_4_5.cpp#L9923 static PyObject *get_ik(PyObject *self, PyObject *args) { IkSolutionList<IkReal> solutions; std::vector<IkReal> vfree(GetNumFreeParameters()); IkReal eerot[9], eetrans[3]; // First list if 3x3 rotation matrix, easier to compute in Python. // Next list is [x, y, z] translation matrix. // Last list is free joints. PyObject *rotList; // 3x3 rotation matrix PyObject *transList; // [x,y,z] PyObject *freeList; // can be empty // format 'O!': pass C object pointer with the pointer's address. if(!PyArg_ParseTuple(args, "O!O!O!", &PyList_Type, &rotList, &PyList_Type, &transList, &PyList_Type, &freeList)) { fprintf(stderr,"Failed to parse input to python objects\n"); return NULL; } for(std::size_t i = 0; i < 3; ++i) { eetrans[i] = PyFloat_AsDouble(PyList_GetItem(transList, i)); PyObject* rowList = PyList_GetItem(rotList, i); for( std::size_t j = 0; j < 3; ++j) { eerot[3*i + j] = PyFloat_AsDouble(PyList_GetItem(rowList, j)); } } for(int i = 0; i < GetNumFreeParameters(); ++i) { vfree[i] = PyFloat_AsDouble(PyList_GetItem(freeList, i)); } // call ikfast routine bool bSuccess = ComputeIk(eetrans, eerot, &vfree[0], solutions); if (!bSuccess) { //fprintf(stderr,"Failed to get ik solution\n"); return Py_BuildValue(""); // Equivalent to returning None in python } std::vector<IkReal> solvalues(GetNumJoints()); PyObject *solutionList = PyList_New(solutions.GetNumSolutions()); // convert all ikfast solutions into a python list for(std::size_t i = 0; i < solutions.GetNumSolutions(); ++i) { const IkSolutionBase<IkReal>& sol = solutions.GetSolution(i); std::vector<IkReal> vsolfree(sol.GetFree().size()); sol.GetSolution(&solvalues[0],vsolfree.size()>0?&vsolfree[0]:NULL); PyObject *individualSolution = PyList_New(GetNumJoints()); for( std::size_t j = 0; j < solvalues.size(); ++j) { // I think IkReal is just a wrapper for double. So this should work. PyList_SetItem(individualSolution, j, PyFloat_FromDouble(solvalues[j])); } PyList_SetItem(solutionList, i, individualSolution); } return solutionList; } static PyObject *get_fk(PyObject *self, PyObject *args) { std::vector<IkReal> joints(GetNumJoints()); // eerot is a flattened 3x3 rotation matrix IkReal eerot[9], eetrans[3]; PyObject *jointList; if(!PyArg_ParseTuple(args, "O!", &PyList_Type, &jointList)) { return NULL; } for(std::size_t i = 0; i < GetNumJoints(); ++i) { joints[i] = PyFloat_AsDouble(PyList_GetItem(jointList, i)); } // call ikfast routine ComputeFk(&joints[0], eetrans, eerot); // convert computed EE pose to a python object PyObject *pose = PyList_New(2); PyObject *pos = PyList_New(3); PyObject *rot = PyList_New(3); for(std::size_t i = 0; i < 3; ++i) { PyList_SetItem(pos, i, PyFloat_FromDouble(eetrans[i])); PyObject *row = PyList_New(3); for( std::size_t j = 0; j < 3; ++j) { PyList_SetItem(row, j, PyFloat_FromDouble(eerot[3*i + j])); } PyList_SetItem(rot, i, row); } PyList_SetItem(pose, 0, pos); PyList_SetItem(pose, 1, rot); return pose; } static PyMethodDef ikfast_methods[] = { {"get_ik", get_ik, METH_VARARGS, "Compute ik solutions using ikfast."}, {"get_fk", get_fk, METH_VARARGS, "Compute fk solutions using ikfast."}, {NULL, NULL, 0, NULL} // Not sure why/if this is needed. It shows up in the examples though(something about Sentinel). }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef movo_right_arm_ik_module = { PyModuleDef_HEAD_INIT, "movo_right_arm_ik", /* name of module */ NULL, /* module documentation, may be NULL */ -1, /* size of per-interpreter state of the module, or -1 if the module keeps state in global variables. */ ikfast_methods }; #define INITERROR return NULL PyMODINIT_FUNC PyInit_movo_right_arm_ik(void) #else // PY_MAJOR_VERSION < 3 #define INITERROR return PyMODINIT_FUNC initmovo_right_arm_ik(void) #endif { #if PY_MAJOR_VERSION >= 3 PyObject *module = PyModule_Create(&movo_right_arm_ik_module); #else PyObject *module = Py_InitModule("movo_right_arm_ik", ikfast_methods); #endif if (module == NULL) INITERROR; #if PY_MAJOR_VERSION >= 3 return module; #endif } // end python bindings
486,413
C++
28.848675
874
0.648334
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/pybullet_tools/ikfast/movo/movo_left_arm_ik.cpp
/// autogenerated analytical inverse kinematics code from ikfast program part of OpenRAVE /// \author Rosen Diankov /// /// Licensed under the Apache License, Version 2.0 (the "License"); /// you may not use this file except in compliance with the License. /// You may obtain a copy of the License at /// http://www.apache.org/licenses/LICENSE-2.0 /// /// Unless required by applicable law or agreed to in writing, software /// distributed under the License is distributed on an "AS IS" BASIS, /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. /// See the License for the specific language governing permissions and /// limitations under the License. /// /// ikfast version 0x1000004a generated on 2018-08-20 11:48:30.181958 /// Generated using solver transform6d /// To compile with gcc: /// gcc -lstdc++ ik.cpp /// To compile without any main function as a shared object (might need -llapack): /// gcc -fPIC -lstdc++ -DIKFAST_NO_MAIN -DIKFAST_CLIBRARY -shared -Wl,-soname,libik.so -o libik.so ik.cpp //// START //// Make sure the version number matches. //// You might need to install the dev version to get the header files. //// sudo apt-get install python3.4-dev #include "Python.h" //// END #define IKFAST_HAS_LIBRARY #include "ikfast.h" // found inside share/openrave-X.Y/python/ikfast.h using namespace ikfast; // check if the included ikfast version matches what this file was compiled with #define IKFAST_COMPILE_ASSERT(x) extern int __dummy[(int)x] IKFAST_COMPILE_ASSERT(IKFAST_VERSION==0x1000004a); #include <cmath> #include <vector> #include <limits> #include <algorithm> #include <complex> #ifndef IKFAST_ASSERT #include <stdexcept> #include <sstream> #include <iostream> #ifdef _MSC_VER #ifndef __PRETTY_FUNCTION__ #define __PRETTY_FUNCTION__ __FUNCDNAME__ #endif #endif #ifndef __PRETTY_FUNCTION__ #define __PRETTY_FUNCTION__ __func__ #endif #define IKFAST_ASSERT(b) { if( !(b) ) { std::stringstream ss; ss << "ikfast exception: " << __FILE__ << ":" << __LINE__ << ": " <<__PRETTY_FUNCTION__ << ": Assertion '" << #b << "' failed"; throw std::runtime_error(ss.str()); } } #endif #if defined(_MSC_VER) #define IKFAST_ALIGNED16(x) __declspec(align(16)) x #else #define IKFAST_ALIGNED16(x) x __attribute((aligned(16))) #endif #define IK2PI ((IkReal)6.28318530717959) #define IKPI ((IkReal)3.14159265358979) #define IKPI_2 ((IkReal)1.57079632679490) #ifdef _MSC_VER #ifndef isnan #define isnan _isnan #endif #ifndef isinf #define isinf _isinf #endif //#ifndef isfinite //#define isfinite _isfinite //#endif #endif // _MSC_VER // lapack routines extern "C" { void dgetrf_ (const int* m, const int* n, double* a, const int* lda, int* ipiv, int* info); void zgetrf_ (const int* m, const int* n, std::complex<double>* a, const int* lda, int* ipiv, int* info); void dgetri_(const int* n, const double* a, const int* lda, int* ipiv, double* work, const int* lwork, int* info); void dgesv_ (const int* n, const int* nrhs, double* a, const int* lda, int* ipiv, double* b, const int* ldb, int* info); void dgetrs_(const char *trans, const int *n, const int *nrhs, double *a, const int *lda, int *ipiv, double *b, const int *ldb, int *info); void dgeev_(const char *jobvl, const char *jobvr, const int *n, double *a, const int *lda, double *wr, double *wi,double *vl, const int *ldvl, double *vr, const int *ldvr, double *work, const int *lwork, int *info); } using namespace std; // necessary to get std math routines #ifdef IKFAST_NAMESPACE namespace IKFAST_NAMESPACE { #endif inline float IKabs(float f) { return fabsf(f); } inline double IKabs(double f) { return fabs(f); } inline float IKsqr(float f) { return f*f; } inline double IKsqr(double f) { return f*f; } inline float IKlog(float f) { return logf(f); } inline double IKlog(double f) { return log(f); } // allows asin and acos to exceed 1. has to be smaller than thresholds used for branch conds and evaluation #ifndef IKFAST_SINCOS_THRESH #define IKFAST_SINCOS_THRESH ((IkReal)1e-7) #endif // used to check input to atan2 for degenerate cases. has to be smaller than thresholds used for branch conds and evaluation #ifndef IKFAST_ATAN2_MAGTHRESH #define IKFAST_ATAN2_MAGTHRESH ((IkReal)1e-7) #endif // minimum distance of separate solutions #ifndef IKFAST_SOLUTION_THRESH #define IKFAST_SOLUTION_THRESH ((IkReal)1e-6) #endif // there are checkpoints in ikfast that are evaluated to make sure they are 0. This threshold speicfies by how much they can deviate #ifndef IKFAST_EVALCOND_THRESH #define IKFAST_EVALCOND_THRESH ((IkReal)0.00001) #endif inline float IKasin(float f) { IKFAST_ASSERT( f > -1-IKFAST_SINCOS_THRESH && f < 1+IKFAST_SINCOS_THRESH ); // any more error implies something is wrong with the solver if( f <= -1 ) return float(-IKPI_2); else if( f >= 1 ) return float(IKPI_2); return asinf(f); } inline double IKasin(double f) { IKFAST_ASSERT( f > -1-IKFAST_SINCOS_THRESH && f < 1+IKFAST_SINCOS_THRESH ); // any more error implies something is wrong with the solver if( f <= -1 ) return -IKPI_2; else if( f >= 1 ) return IKPI_2; return asin(f); } // return positive value in [0,y) inline float IKfmod(float x, float y) { while(x < 0) { x += y; } return fmodf(x,y); } // return positive value in [0,y) inline double IKfmod(double x, double y) { while(x < 0) { x += y; } return fmod(x,y); } inline float IKacos(float f) { IKFAST_ASSERT( f > -1-IKFAST_SINCOS_THRESH && f < 1+IKFAST_SINCOS_THRESH ); // any more error implies something is wrong with the solver if( f <= -1 ) return float(IKPI); else if( f >= 1 ) return float(0); return acosf(f); } inline double IKacos(double f) { IKFAST_ASSERT( f > -1-IKFAST_SINCOS_THRESH && f < 1+IKFAST_SINCOS_THRESH ); // any more error implies something is wrong with the solver if( f <= -1 ) return IKPI; else if( f >= 1 ) return 0; return acos(f); } inline float IKsin(float f) { return sinf(f); } inline double IKsin(double f) { return sin(f); } inline float IKcos(float f) { return cosf(f); } inline double IKcos(double f) { return cos(f); } inline float IKtan(float f) { return tanf(f); } inline double IKtan(double f) { return tan(f); } inline float IKsqrt(float f) { if( f <= 0.0f ) return 0.0f; return sqrtf(f); } inline double IKsqrt(double f) { if( f <= 0.0 ) return 0.0; return sqrt(f); } inline float IKatan2Simple(float fy, float fx) { return atan2f(fy,fx); } inline float IKatan2(float fy, float fx) { if( isnan(fy) ) { IKFAST_ASSERT(!isnan(fx)); // if both are nan, probably wrong value will be returned return float(IKPI_2); } else if( isnan(fx) ) { return 0; } return atan2f(fy,fx); } inline double IKatan2Simple(double fy, double fx) { return atan2(fy,fx); } inline double IKatan2(double fy, double fx) { if( isnan(fy) ) { IKFAST_ASSERT(!isnan(fx)); // if both are nan, probably wrong value will be returned return IKPI_2; } else if( isnan(fx) ) { return 0; } return atan2(fy,fx); } template <typename T> struct CheckValue { T value; bool valid; }; template <typename T> inline CheckValue<T> IKatan2WithCheck(T fy, T fx, T epsilon) { CheckValue<T> ret; ret.valid = false; ret.value = 0; if( !isnan(fy) && !isnan(fx) ) { if( IKabs(fy) >= IKFAST_ATAN2_MAGTHRESH || IKabs(fx) > IKFAST_ATAN2_MAGTHRESH ) { ret.value = IKatan2Simple(fy,fx); ret.valid = true; } } return ret; } inline float IKsign(float f) { if( f > 0 ) { return float(1); } else if( f < 0 ) { return float(-1); } return 0; } inline double IKsign(double f) { if( f > 0 ) { return 1.0; } else if( f < 0 ) { return -1.0; } return 0; } template <typename T> inline CheckValue<T> IKPowWithIntegerCheck(T f, int n) { CheckValue<T> ret; ret.valid = true; if( n == 0 ) { ret.value = 1.0; return ret; } else if( n == 1 ) { ret.value = f; return ret; } else if( n < 0 ) { if( f == 0 ) { ret.valid = false; ret.value = (T)1.0e30; return ret; } if( n == -1 ) { ret.value = T(1.0)/f; return ret; } } int num = n > 0 ? n : -n; if( num == 2 ) { ret.value = f*f; } else if( num == 3 ) { ret.value = f*f*f; } else { ret.value = 1.0; while(num>0) { if( num & 1 ) { ret.value *= f; } num >>= 1; f *= f; } } if( n < 0 ) { ret.value = T(1.0)/ret.value; } return ret; } /// solves the forward kinematics equations. /// \param pfree is an array specifying the free joints of the chain. IKFAST_API void ComputeFk(const IkReal* j, IkReal* eetrans, IkReal* eerot) { IkReal x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,x17,x18,x19,x20,x21,x22,x23,x24,x25,x26,x27,x28,x29,x30,x31,x32,x33,x34,x35,x36,x37,x38,x39,x40,x41,x42,x43,x44,x45,x46,x47,x48,x49,x50,x51,x52,x53,x54,x55,x56,x57,x58,x59,x60,x61,x62; x0=IKcos(j[2]); x1=IKsin(j[4]); x2=IKcos(j[3]); x3=IKcos(j[4]); x4=IKsin(j[2]); x5=IKsin(j[5]); x6=IKcos(j[5]); x7=IKsin(j[3]); x8=IKsin(j[6]); x9=IKcos(j[6]); x10=IKsin(j[7]); x11=IKcos(j[7]); x12=IKcos(j[1]); x13=IKsin(j[1]); x14=((0.31105)*x2); x15=((0.26375)*x6); x16=((1.0)*x7); x17=((1.0)*x0); x18=((1.0)*x12); x19=((0.26375)*x5); x20=((1.0)*x13); x21=((0.41)*x4); x22=((1.0)*x8); x23=((0.26375)*x1); x24=((1.0)*x9); x25=((1.0)*x2); x26=((0.31105)*x13); x27=(x12*x7); x28=(x1*x4); x29=(x3*x4); x30=(x0*x13); x31=(x4*x7); x32=(x12*x2); x33=(x0*x3); x34=(x1*x17); x35=(x13*x16); x36=((((-1.0)*x35))+((x0*x32))); x37=(((x2*x30))+x27); x38=((((-1.0)*x25*x29))+x34); x39=((((-1.0)*x17*x32))+x35); x40=((((-1.0)*x18*x2))+((x16*x30))); x41=(((x17*x3))+((x25*x28))); x42=((-1.0)*x41); x43=(((x2*x20))+((x0*x12*x16))); x44=((((-1.0)*x12*x16))+(((-1.0)*x13*x17*x2))); x45=(x3*x36); x46=(x3*x37); x47=(x40*x5); x48=(x43*x5); x49=(x1*x44); x50=(x42*x8); x51=(((x31*x5))+((x38*x6))); x52=(((x12*x29))+((x1*x39))); x53=((((-1.0)*x16*x4*x6))+((x5*(((((-1.0)*x2*x29))+(((1.0)*x34))))))); x54=((((-1.0)*x45))+(((-1.0)*x18*x28))); x55=(x49+((x13*x29))); x56=((((-1.0)*x46))+(((-1.0)*x20*x28))); x57=(x52*x8); x58=(x51*x9); x59=(x54*x6); x60=(((x43*x6))+((x5*((x45+((x12*x28))))))); x61=(((x56*x6))+x47); x62=(((x5*(((((-1.0)*x46))+(((-1.0)*x13*x28))))))+(((-1.0)*x40*x6))); eerot[0]=(((x51*x8))+((x41*x9))); eerot[1]=(((x11*x53))+((x10*((x58+x50))))); eerot[2]=(((x10*x53))+((x11*(((((-1.0)*x22*x42))+(((-1.0)*x24*x51))))))); eetrans[0]=((0.2844948)+((x9*(((((0.26375)*x33))+((x2*x23*x4))))))+(((0.41)*x0))+((x14*x28))+(((-0.0114)*x31))+(((0.31105)*x33))+((x8*((((x19*x31))+((x15*x38))))))); eerot[3]=(((x8*(((((-1.0)*x48))+(((-1.0)*x59))))))+((x52*x9))); eerot[4]=(((x11*x60))+(((-1.0)*x10*(((((1.0)*x57))+(((1.0)*x9*((((x6*(((((-1.0)*x45))+(((-1.0)*x12*x28))))))+x48))))))))); eerot[5]=(((x10*x60))+((x11*((((x9*((x48+x59))))+x57))))); IkReal x63=(x12*x29); eetrans[1]=((0.13335)+((x1*((((x26*x7))+(((-1.0)*x0*x12*x14))))))+(((0.0114)*x13*x2))+(((0.0114)*x0*x27))+((x12*x21))+(((0.31105)*x63))+((x8*(((((-1.0)*x19*x43))+(((-1.0)*x15*x54))))))+((x9*((((x23*x39))+(((0.26375)*x63))))))); eerot[6]=(((x9*(((((-1.0)*x49))+(((-1.0)*x20*x29))))))+((x61*x8))); eerot[7]=(((x11*x62))+((x10*((((x55*x8))+((x61*x9))))))); eerot[8]=(((x10*x62))+((x11*(((((-1.0)*x24*x61))+(((-1.0)*x22*x55))))))); eetrans[2]=((0.75007)+(((0.0114)*x32))+((x8*((((x19*x40))+((x15*x56))))))+(((-1.0)*x13*x21))+((x9*(((((-0.26375)*x13*x29))+(((-1.0)*x23*x44))))))+(((-0.0114)*x30*x7))+j[0]+((x1*(((((0.31105)*x27))+((x14*x30))))))+(((-1.0)*x26*x29))); } IKFAST_API int GetNumFreeParameters() { return 2; } IKFAST_API int* GetFreeParameters() { static int freeparams[] = {0, 3}; return freeparams; } IKFAST_API int GetNumJoints() { return 8; } IKFAST_API int GetIkRealSize() { return sizeof(IkReal); } IKFAST_API int GetIkType() { return 0x67000001; } class IKSolver { public: IkReal j1,cj1,sj1,htj1,j1mul,j2,cj2,sj2,htj2,j2mul,j4,cj4,sj4,htj4,j4mul,j5,cj5,sj5,htj5,j5mul,j6,cj6,sj6,htj6,j6mul,j7,cj7,sj7,htj7,j7mul,j0,cj0,sj0,htj0,j3,cj3,sj3,htj3,new_r00,r00,rxp0_0,new_r01,r01,rxp0_1,new_r02,r02,rxp0_2,new_r10,r10,rxp1_0,new_r11,r11,rxp1_1,new_r12,r12,rxp1_2,new_r20,r20,rxp2_0,new_r21,r21,rxp2_1,new_r22,r22,rxp2_2,new_px,px,npx,new_py,py,npy,new_pz,pz,npz,pp; unsigned char _ij1[2], _nj1,_ij2[2], _nj2,_ij4[2], _nj4,_ij5[2], _nj5,_ij6[2], _nj6,_ij7[2], _nj7,_ij0[2], _nj0,_ij3[2], _nj3; IkReal j100, cj100, sj100; unsigned char _ij100[2], _nj100; bool ComputeIk(const IkReal* eetrans, const IkReal* eerot, const IkReal* pfree, IkSolutionListBase<IkReal>& solutions) { j1=numeric_limits<IkReal>::quiet_NaN(); _ij1[0] = -1; _ij1[1] = -1; _nj1 = -1; j2=numeric_limits<IkReal>::quiet_NaN(); _ij2[0] = -1; _ij2[1] = -1; _nj2 = -1; j4=numeric_limits<IkReal>::quiet_NaN(); _ij4[0] = -1; _ij4[1] = -1; _nj4 = -1; j5=numeric_limits<IkReal>::quiet_NaN(); _ij5[0] = -1; _ij5[1] = -1; _nj5 = -1; j6=numeric_limits<IkReal>::quiet_NaN(); _ij6[0] = -1; _ij6[1] = -1; _nj6 = -1; j7=numeric_limits<IkReal>::quiet_NaN(); _ij7[0] = -1; _ij7[1] = -1; _nj7 = -1; _ij0[0] = -1; _ij0[1] = -1; _nj0 = 0; _ij3[0] = -1; _ij3[1] = -1; _nj3 = 0; for(int dummyiter = 0; dummyiter < 1; ++dummyiter) { solutions.Clear(); j0=pfree[0]; cj0=cos(pfree[0]); sj0=sin(pfree[0]), htj0=tan(pfree[0]*0.5); j3=pfree[1]; cj3=cos(pfree[1]); sj3=sin(pfree[1]), htj3=tan(pfree[1]*0.5); r00 = eerot[0*3+0]; r01 = eerot[0*3+1]; r02 = eerot[0*3+2]; r10 = eerot[1*3+0]; r11 = eerot[1*3+1]; r12 = eerot[1*3+2]; r20 = eerot[2*3+0]; r21 = eerot[2*3+1]; r22 = eerot[2*3+2]; px = eetrans[0]; py = eetrans[1]; pz = eetrans[2]; new_r00=r12; new_r01=r11; new_r02=((-1.0)*r10); new_px=((-0.13335)+(((-0.26375)*r10))+py); new_r10=((-1.0)*r22); new_r11=((-1.0)*r21); new_r12=r20; new_py=((0.75007)+(((-1.0)*pz))+(((0.26375)*r20))+j0); new_r20=((-1.0)*r02); new_r21=((-1.0)*r01); new_r22=r00; new_pz=((0.1657448)+(((0.26375)*r00))+(((-1.0)*px))); r00 = new_r00; r01 = new_r01; r02 = new_r02; r10 = new_r10; r11 = new_r11; r12 = new_r12; r20 = new_r20; r21 = new_r21; r22 = new_r22; px = new_px; py = new_py; pz = new_pz; IkReal x64=((1.0)*px); IkReal x65=((1.0)*pz); IkReal x66=((1.0)*py); pp=((px*px)+(py*py)+(pz*pz)); npx=(((px*r00))+((py*r10))+((pz*r20))); npy=(((px*r01))+((py*r11))+((pz*r21))); npz=(((px*r02))+((py*r12))+((pz*r22))); rxp0_0=((((-1.0)*r20*x66))+((pz*r10))); rxp0_1=(((px*r20))+(((-1.0)*r00*x65))); rxp0_2=((((-1.0)*r10*x64))+((py*r00))); rxp1_0=((((-1.0)*r21*x66))+((pz*r11))); rxp1_1=(((px*r21))+(((-1.0)*r01*x65))); rxp1_2=((((-1.0)*r11*x64))+((py*r01))); rxp2_0=(((pz*r12))+(((-1.0)*r22*x66))); rxp2_1=(((px*r22))+(((-1.0)*r02*x65))); rxp2_2=((((-1.0)*r12*x64))+((py*r02))); { IkReal j4array[2], cj4array[2], sj4array[2]; bool j4valid[2]={false}; _nj4 = 2; cj4array[0]=((-0.98360980314513)+(((3.92063075107523)*pp))+(((0.931149803380368)*pz))); if( cj4array[0] >= -1-IKFAST_SINCOS_THRESH && cj4array[0] <= 1+IKFAST_SINCOS_THRESH ) { j4valid[0] = j4valid[1] = true; j4array[0] = IKacos(cj4array[0]); sj4array[0] = IKsin(j4array[0]); cj4array[1] = cj4array[0]; j4array[1] = -j4array[0]; sj4array[1] = -sj4array[0]; } else if( isnan(cj4array[0]) ) { // probably any value will work j4valid[0] = true; cj4array[0] = 1; sj4array[0] = 0; j4array[0] = 0; } for(int ij4 = 0; ij4 < 2; ++ij4) { if( !j4valid[ij4] ) { continue; } _ij4[0] = ij4; _ij4[1] = -1; for(int iij4 = ij4+1; iij4 < 2; ++iij4) { if( j4valid[iij4] && IKabs(cj4array[ij4]-cj4array[iij4]) < IKFAST_SOLUTION_THRESH && IKabs(sj4array[ij4]-sj4array[iij4]) < IKFAST_SOLUTION_THRESH ) { j4valid[iij4]=false; _ij4[1] = iij4; break; } } j4 = j4array[ij4]; cj4 = cj4array[ij4]; sj4 = sj4array[ij4]; { IkReal j1eval[2]; j1eval[0]=((px*px)+(py*py)); j1eval[1]=((IKabs(px))+(IKabs(py))); if( IKabs(j1eval[0]) < 0.0000010000000000 || IKabs(j1eval[1]) < 0.0000010000000000 ) { { IkReal j2eval[2]; IkReal x67=(cj3*sj4); j2eval[0]=((1293.47491535857)+(sj3*sj3)+(((-54.5701754385965)*sj3*x67))+(((744.4760118498)*(cj4*cj4)))+(((744.4760118498)*(x67*x67)))+(((1962.61157279163)*cj4))); j2eval[1]=((IKabs(((-0.41)+(((-0.31105)*cj4)))))+(IKabs(((((-0.31105)*x67))+(((0.0114)*sj3)))))); if( IKabs(j2eval[0]) < 0.0000010000000000 || IKabs(j2eval[1]) < 0.0000010000000000 ) { { IkReal j1eval[2]; IkReal x68=px*px; IkReal x69=py*py; IkReal x70=py*py*py*py; IkReal x71=sj3*sj3*sj3*sj3; IkReal x72=cj3*cj3*cj3*cj3; IkReal x73=cj3*cj3; IkReal x74=sj3*sj3; IkReal x75=((2.0)*x74); IkReal x76=((1.0)*px*py); IkReal x77=(x69*x73); IkReal x78=(x68*x69); j1eval[0]=(((x68*x75*x77))+((x70*x73*x75))+((x70*x71))+((x70*x72))+((x72*x78))+((x71*x78))); j1eval[1]=((IKabs(((((-1.0)*x74*x76))+(((-1.0)*x73*x76)))))+(IKabs((((x69*x74))+x77)))); if( IKabs(j1eval[0]) < 0.0000010000000000 || IKabs(j1eval[1]) < 0.0000010000000000 ) { continue; // no branches [j1, j2] } else { { IkReal j1array[2], cj1array[2], sj1array[2]; bool j1valid[2]={false}; _nj1 = 2; IkReal x79=py*py; IkReal x80=cj3*cj3; IkReal x81=sj3*sj3; IkReal x82=((1.0)*px*py); IkReal x83=(((x79*x81))+((x79*x80))); IkReal x84=((((-1.0)*x81*x82))+(((-1.0)*x80*x82))); CheckValue<IkReal> x87 = IKatan2WithCheck(IkReal(x83),IkReal(x84),IKFAST_ATAN2_MAGTHRESH); if(!x87.valid){ continue; } IkReal x85=((1.0)*(x87.value)); if((((x83*x83)+(x84*x84))) < -0.00001) continue; CheckValue<IkReal> x88=IKPowWithIntegerCheck(IKabs(IKsqrt(((x83*x83)+(x84*x84)))),-1); if(!x88.valid){ continue; } if( (((x88.value)*(((((0.31105)*py*sj3*sj4))+(((0.0114)*cj3*py)))))) < -1-IKFAST_SINCOS_THRESH || (((x88.value)*(((((0.31105)*py*sj3*sj4))+(((0.0114)*cj3*py)))))) > 1+IKFAST_SINCOS_THRESH ) continue; IkReal x86=IKasin(((x88.value)*(((((0.31105)*py*sj3*sj4))+(((0.0114)*cj3*py)))))); j1array[0]=((((-1.0)*x86))+(((-1.0)*x85))); sj1array[0]=IKsin(j1array[0]); cj1array[0]=IKcos(j1array[0]); j1array[1]=((3.14159265358979)+x86+(((-1.0)*x85))); sj1array[1]=IKsin(j1array[1]); cj1array[1]=IKcos(j1array[1]); if( j1array[0] > IKPI ) { j1array[0]-=IK2PI; } else if( j1array[0] < -IKPI ) { j1array[0]+=IK2PI; } j1valid[0] = true; if( j1array[1] > IKPI ) { j1array[1]-=IK2PI; } else if( j1array[1] < -IKPI ) { j1array[1]+=IK2PI; } j1valid[1] = true; for(int ij1 = 0; ij1 < 2; ++ij1) { if( !j1valid[ij1] ) { continue; } _ij1[0] = ij1; _ij1[1] = -1; for(int iij1 = ij1+1; iij1 < 2; ++iij1) { if( j1valid[iij1] && IKabs(cj1array[ij1]-cj1array[iij1]) < IKFAST_SOLUTION_THRESH && IKabs(sj1array[ij1]-sj1array[iij1]) < IKFAST_SOLUTION_THRESH ) { j1valid[iij1]=false; _ij1[1] = iij1; break; } } j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1]; { IkReal evalcond[2]; IkReal x89=px*px; IkReal x90=cj3*cj3; IkReal x91=sj3*sj3; IkReal x92=IKcos(j1); IkReal x93=IKsin(j1); IkReal x94=((0.0114)*cj3); IkReal x95=(px*py); IkReal x96=((1.0)*x89); IkReal x97=((0.31105)*sj3*sj4); evalcond[0]=(((px*x94))+((px*x97))+((x93*(((((-1.0)*x90*x96))+(((-1.0)*x91*x96))))))+((x92*((((x90*x95))+((x91*x95))))))); evalcond[1]=((((-1.0)*px*x93))+((py*x92))+x94+x97); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH ) { continue; } } { IkReal j2eval[2]; IkReal x98=(py*sj1); IkReal x99=(cj1*px); IkReal x100=(cj3*sj4); IkReal x101=(pz*sj3); IkReal x102=((0.31105)*cj4); IkReal x103=((229.769159741459)*cj4); j2eval[0]=((((-1.0)*x103*x98))+(((-1.0)*x103*x99))+sj3+(((-302.86241920591)*x98))+(((-302.86241920591)*x99))+(((-229.769159741459)*pz*x100))+(((8.42105263157895)*x101))+(((-27.2850877192982)*x100))); j2eval[1]=IKsign(((((-0.31105)*pz*x100))+(((-1.0)*x102*x98))+(((-1.0)*x102*x99))+(((-0.41)*x98))+(((-0.41)*x99))+(((0.00135375)*sj3))+(((-0.0369371875)*x100))+(((0.0114)*x101)))); if( IKabs(j2eval[0]) < 0.0000010000000000 || IKabs(j2eval[1]) < 0.0000010000000000 ) { { IkReal j2eval[2]; IkReal x104=cj4*cj4; IkReal x105=cj3*cj3; IkReal x106=(cj3*sj3*sj4); IkReal x107=(x104*x105); j2eval[0]=((-23.7212892382056)+(((-35.9649122807018)*cj4))+(((13.6425438596491)*x107))+(((-13.6425438596491)*x104))+(((-13.6242188315186)*x105))+x106); j2eval[1]=IKsign(((-0.16822996)+(((-0.0967521025)*x104))+(((0.0967521025)*x107))+(((-0.0966221425)*x105))+(((-0.255061)*cj4))+(((0.00709194)*x106)))); if( IKabs(j2eval[0]) < 0.0000010000000000 || IKabs(j2eval[1]) < 0.0000010000000000 ) { { IkReal j2eval[2]; IkReal x108=(cj1*px); IkReal x109=(cj4*pz); IkReal x110=(cj3*sj4); IkReal x111=(py*sj1); IkReal x112=(sj3*x111); j2eval[0]=((4.27083333333333)+((sj3*x108))+(((-27.2850877192982)*x108*x110))+(((27.2850877192982)*x109))+(((3.24010416666667)*cj4))+x112+(((35.9649122807018)*pz))+(((-27.2850877192982)*x110*x111))); j2eval[1]=IKsign(((0.0486875)+(((-0.31105)*x108*x110))+(((0.41)*pz))+(((0.31105)*x109))+(((-0.31105)*x110*x111))+(((0.0369371875)*cj4))+(((0.0114)*sj3*x108))+(((0.0114)*x112)))); if( IKabs(j2eval[0]) < 0.0000010000000000 || IKabs(j2eval[1]) < 0.0000010000000000 ) { continue; // no branches [j2] } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; IkReal x113=cj1*cj1; IkReal x114=py*py; IkReal x115=(cj3*sj4); IkReal x116=(py*sj1); IkReal x117=(cj1*px); IkReal x118=((0.0114)*sj3); CheckValue<IkReal> x119=IKPowWithIntegerCheck(IKsign(((0.0486875)+(((0.31105)*cj4*pz))+(((0.41)*pz))+((x116*x118))+(((0.0369371875)*cj4))+(((-0.31105)*x115*x116))+(((-0.31105)*x115*x117))+((x117*x118)))),-1); if(!x119.valid){ continue; } CheckValue<IkReal> x120 = IKatan2WithCheck(IkReal(((((-0.0967521025)*cj4*x115))+(((0.11875)*x117))+(((0.11875)*x116))+(((0.00354597)*cj4*sj3))+((pz*x116))+((pz*x117))+(((-0.1275305)*x115))+(((0.004674)*sj3)))),IkReal(((-0.1681)+(((2.0)*x116*x117))+(((-1.0)*x113*x114))+x114+((x113*(px*px)))+(((-0.255061)*cj4))+(((-0.0967521025)*(cj4*cj4))))),IKFAST_ATAN2_MAGTHRESH); if(!x120.valid){ continue; } j2array[0]=((-1.5707963267949)+(((1.5707963267949)*(x119.value)))+(x120.value)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[6]; IkReal x121=IKcos(j2); IkReal x122=IKsin(j2); IkReal x123=((1.0)*cj3); IkReal x124=(px*sj1); IkReal x125=((0.31105)*cj4); IkReal x126=(cj1*px); IkReal x127=(py*sj1); IkReal x128=(cj1*py); IkReal x129=(pz*x122); IkReal x130=(pz*x121); IkReal x131=(sj3*x121); IkReal x132=((0.31105)*cj3*sj4); IkReal x133=(sj3*x122); IkReal x134=((1.0)*x122); IkReal x135=((0.82)*x122); evalcond[0]=((0.41)+(((0.11875)*x121))+(((-1.0)*x126*x134))+x130+x125+(((-1.0)*x127*x134))); evalcond[1]=((-0.11875)+(((-1.0)*x122*x132))+(((-0.41)*x121))+(((-1.0)*pz))+(((-1.0)*x121*x125))+(((0.0114)*x133))); evalcond[2]=((-0.0853195)+((x127*x135))+(((-0.097375)*x121))+(((-0.2375)*pz))+(((-1.0)*pp))+((x126*x135))+(((-0.82)*x130))); evalcond[3]=(((x122*x125))+(((-1.0)*x121*x132))+(((0.41)*x122))+(((-1.0)*x127))+(((-1.0)*x126))+(((0.0114)*x131))); evalcond[4]=((-0.0114)+((x127*x131))+(((-1.0)*x123*x128))+(((0.11875)*x133))+((cj3*x124))+((sj3*x129))+((x126*x131))); evalcond[5]=((((-1.0)*x121*x123*x126))+(((-1.0)*x121*x123*x127))+(((-1.0)*x123*x129))+((sj3*x124))+(((-1.0)*sj3*x128))+(((-0.31105)*sj4))+(((-0.11875)*cj3*x122))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; IkReal x1062=cj3*cj3; IkReal x1063=cj4*cj4; IkReal x1064=(py*sj1); IkReal x1065=(cj3*sj4); IkReal x1066=((0.31105)*pz); IkReal x1067=(cj1*px); IkReal x1068=((0.0114)*sj3); IkReal x1069=((0.31105)*cj4); IkReal x1070=((0.0967521025)*x1063); CheckValue<IkReal> x1071 = IKatan2WithCheck(IkReal(((((-0.41)*x1064))+(((-0.41)*x1067))+(((-1.0)*pz*x1068))+(((-0.00135375)*sj3))+(((0.0369371875)*x1065))+(((-1.0)*x1067*x1069))+(((-1.0)*x1064*x1069))+((x1065*x1066)))),IkReal(((0.0486875)+(((0.41)*pz))+((cj4*x1066))+(((0.31105)*x1064*x1065))+(((0.0369371875)*cj4))+(((0.31105)*x1065*x1067))+(((-1.0)*x1067*x1068))+(((-1.0)*x1064*x1068)))),IKFAST_ATAN2_MAGTHRESH); if(!x1071.valid){ continue; } CheckValue<IkReal> x1072=IKPowWithIntegerCheck(IKsign(((-0.16822996)+(((0.00709194)*sj3*x1065))+((x1062*x1070))+(((-0.255061)*cj4))+(((-0.0966221425)*x1062))+(((-1.0)*x1070)))),-1); if(!x1072.valid){ continue; } j2array[0]=((-1.5707963267949)+(x1071.value)+(((1.5707963267949)*(x1072.value)))); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[6]; IkReal x1073=IKcos(j2); IkReal x1074=IKsin(j2); IkReal x1075=((1.0)*cj3); IkReal x1076=(px*sj1); IkReal x1077=((0.31105)*cj4); IkReal x1078=(cj1*px); IkReal x1079=(py*sj1); IkReal x1080=(cj1*py); IkReal x1081=(pz*x1074); IkReal x1082=(pz*x1073); IkReal x1083=(sj3*x1073); IkReal x1084=((0.31105)*cj3*sj4); IkReal x1085=(sj3*x1074); IkReal x1086=((1.0)*x1074); IkReal x1087=((0.82)*x1074); evalcond[0]=((0.41)+x1077+x1082+(((-1.0)*x1078*x1086))+(((0.11875)*x1073))+(((-1.0)*x1079*x1086))); evalcond[1]=((-0.11875)+(((-1.0)*x1074*x1084))+(((-0.41)*x1073))+(((-1.0)*x1073*x1077))+(((-1.0)*pz))+(((0.0114)*x1085))); evalcond[2]=((-0.0853195)+((x1079*x1087))+((x1078*x1087))+(((-0.2375)*pz))+(((-0.82)*x1082))+(((-1.0)*pp))+(((-0.097375)*x1073))); evalcond[3]=(((x1074*x1077))+(((0.41)*x1074))+(((-1.0)*x1073*x1084))+(((0.0114)*x1083))+(((-1.0)*x1078))+(((-1.0)*x1079))); evalcond[4]=((-0.0114)+((x1079*x1083))+((sj3*x1081))+((x1078*x1083))+((cj3*x1076))+(((0.11875)*x1085))+(((-1.0)*x1075*x1080))); evalcond[5]=(((sj3*x1076))+(((-1.0)*sj3*x1080))+(((-1.0)*x1073*x1075*x1078))+(((-1.0)*x1073*x1075*x1079))+(((-1.0)*x1075*x1081))+(((-0.11875)*cj3*x1074))+(((-0.31105)*sj4))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; IkReal x1088=(cj1*px); IkReal x1089=(cj3*sj4); IkReal x1090=(py*sj1); IkReal x1091=((0.31105)*cj4); CheckValue<IkReal> x1092 = IKatan2WithCheck(IkReal(((-0.1539984375)+(((0.2375)*pz))+(pz*pz)+(((-0.255061)*cj4))+(((-0.0967521025)*(cj4*cj4))))),IkReal((((pz*x1088))+(((0.0967521025)*cj4*x1089))+(((-0.004674)*sj3))+(((-0.00354597)*cj4*sj3))+(((0.11875)*x1088))+((pz*x1090))+(((0.1275305)*x1089))+(((0.11875)*x1090)))),IKFAST_ATAN2_MAGTHRESH); if(!x1092.valid){ continue; } CheckValue<IkReal> x1093=IKPowWithIntegerCheck(IKsign(((((-1.0)*x1088*x1091))+(((-1.0)*x1090*x1091))+(((0.0114)*pz*sj3))+(((0.00135375)*sj3))+(((-0.41)*x1088))+(((-0.0369371875)*x1089))+(((-0.31105)*pz*x1089))+(((-0.41)*x1090)))),-1); if(!x1093.valid){ continue; } j2array[0]=((-1.5707963267949)+(x1092.value)+(((1.5707963267949)*(x1093.value)))); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[6]; IkReal x1094=IKcos(j2); IkReal x1095=IKsin(j2); IkReal x1096=((1.0)*cj3); IkReal x1097=(px*sj1); IkReal x1098=((0.31105)*cj4); IkReal x1099=(cj1*px); IkReal x1100=(py*sj1); IkReal x1101=(cj1*py); IkReal x1102=(pz*x1095); IkReal x1103=(pz*x1094); IkReal x1104=(sj3*x1094); IkReal x1105=((0.31105)*cj3*sj4); IkReal x1106=(sj3*x1095); IkReal x1107=((1.0)*x1095); IkReal x1108=((0.82)*x1095); evalcond[0]=((0.41)+x1103+x1098+(((-1.0)*x1099*x1107))+(((-1.0)*x1100*x1107))+(((0.11875)*x1094))); evalcond[1]=((-0.11875)+(((0.0114)*x1106))+(((-1.0)*pz))+(((-1.0)*x1094*x1098))+(((-0.41)*x1094))+(((-1.0)*x1095*x1105))); evalcond[2]=((-0.0853195)+(((-0.82)*x1103))+(((-0.2375)*pz))+(((-0.097375)*x1094))+(((-1.0)*pp))+((x1099*x1108))+((x1100*x1108))); evalcond[3]=((((0.0114)*x1104))+((x1095*x1098))+(((-1.0)*x1100))+(((-1.0)*x1099))+(((0.41)*x1095))+(((-1.0)*x1094*x1105))); evalcond[4]=((-0.0114)+((sj3*x1102))+(((0.11875)*x1106))+((x1099*x1104))+((x1100*x1104))+(((-1.0)*x1096*x1101))+((cj3*x1097))); evalcond[5]=((((-1.0)*sj3*x1101))+(((-1.0)*x1094*x1096*x1100))+(((-0.11875)*cj3*x1095))+((sj3*x1097))+(((-1.0)*x1094*x1096*x1099))+(((-1.0)*x1096*x1102))+(((-0.31105)*sj4))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } } } } else { { IkReal j2array[2], cj2array[2], sj2array[2]; bool j2valid[2]={false}; _nj2 = 2; IkReal x1109=((-0.41)+(((-0.31105)*cj4))); IkReal x1110=((((0.0114)*sj3))+(((-0.31105)*cj3*sj4))); CheckValue<IkReal> x1113 = IKatan2WithCheck(IkReal(x1109),IkReal(x1110),IKFAST_ATAN2_MAGTHRESH); if(!x1113.valid){ continue; } IkReal x1111=((1.0)*(x1113.value)); if((((x1110*x1110)+(x1109*x1109))) < -0.00001) continue; CheckValue<IkReal> x1114=IKPowWithIntegerCheck(IKabs(IKsqrt(((x1110*x1110)+(x1109*x1109)))),-1); if(!x1114.valid){ continue; } if( (((-1.0)*(x1114.value)*(((-0.11875)+(((-1.0)*pz)))))) < -1-IKFAST_SINCOS_THRESH || (((-1.0)*(x1114.value)*(((-0.11875)+(((-1.0)*pz)))))) > 1+IKFAST_SINCOS_THRESH ) continue; IkReal x1112=((-1.0)*(IKasin(((-1.0)*(x1114.value)*(((-0.11875)+(((-1.0)*pz)))))))); j2array[0]=((((-1.0)*x1112))+(((-1.0)*x1111))); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); j2array[1]=((3.14159265358979)+(((1.0)*x1112))+(((-1.0)*x1111))); sj2array[1]=IKsin(j2array[1]); cj2array[1]=IKcos(j2array[1]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; if( j2array[1] > IKPI ) { j2array[1]-=IK2PI; } else if( j2array[1] < -IKPI ) { j2array[1]+=IK2PI; } j2valid[1] = true; for(int ij2 = 0; ij2 < 2; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 2; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal j1eval[3]; IkReal x1115=((0.31105)*py); IkReal x1116=((0.31105)*px); IkReal x1117=(cj2*py); IkReal x1118=(cj2*px); IkReal x1119=(sj2*sj3*sj4); IkReal x1120=((0.0114)*cj3*sj2); IkReal x1121=((((-1.0)*sj2*(pz*pz)))+((pp*sj2))); j1eval[0]=x1121; j1eval[1]=IKsign(x1121); j1eval[2]=((IKabs(((((0.11875)*x1118))+((cj4*x1116))+(((-1.0)*py*x1120))+(((0.41)*px))+((pz*x1118))+(((-1.0)*x1115*x1119)))))+(IKabs(((((0.11875)*x1117))+((cj4*x1115))+((px*x1120))+(((0.41)*py))+((x1116*x1119))+((pz*x1117)))))); if( IKabs(j1eval[0]) < 0.0000010000000000 || IKabs(j1eval[1]) < 0.0000010000000000 || IKabs(j1eval[2]) < 0.0000010000000000 ) { { IkReal j1eval[2]; IkReal x1122=(pp+(((-1.0)*(pz*pz)))); j1eval[0]=x1122; j1eval[1]=IKsign(x1122); if( IKabs(j1eval[0]) < 0.0000010000000000 || IKabs(j1eval[1]) < 0.0000010000000000 ) { { IkReal j1eval[2]; IkReal x1123=pz*pz; IkReal x1124=(pp*sj2); IkReal x1125=(sj2*x1123); j1eval[0]=(x1124+(((-1.0)*x1125))); j1eval[1]=IKsign(((((41.0)*x1124))+(((-41.0)*x1125)))); if( IKabs(j1eval[0]) < 0.0000010000000000 || IKabs(j1eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j2))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j1eval[3]; sj2=0; cj2=1.0; j2=0; IkReal x1126=((0.0114)*py); IkReal x1127=((0.31105)*sj4); IkReal x1128=(cj3*px); IkReal x1129=(px*sj3); IkReal x1130=(pp+(((-1.0)*(pz*pz)))); j1eval[0]=x1130; j1eval[1]=((IKabs(((((0.0114)*x1129))+(((-1.0)*py*sj3*x1127))+(((-1.0)*x1127*x1128))+(((-1.0)*cj3*x1126)))))+(IKabs((((x1127*x1129))+(((0.0114)*x1128))+((sj3*x1126))+(((-1.0)*cj3*py*x1127)))))); j1eval[2]=IKsign(x1130); if( IKabs(j1eval[0]) < 0.0000010000000000 || IKabs(j1eval[1]) < 0.0000010000000000 || IKabs(j1eval[2]) < 0.0000010000000000 ) { { IkReal j1eval[3]; sj2=0; cj2=1.0; j2=0; IkReal x1131=pz*pz; IkReal x1132=cj3*cj3; IkReal x1133=((6221.0)*sj4); IkReal x1134=((5000.0)*cj3); IkReal x1135=(cj3*px*sj3); IkReal x1136=(cj3*py*sj3); IkReal x1137=(py*x1132); IkReal x1138=(px*x1132); j1eval[0]=(((cj3*x1131))+(((-1.0)*cj3*pp))); j1eval[1]=IKsign((((x1131*x1134))+(((-1.0)*pp*x1134)))); j1eval[2]=((IKabs(((((228.0)*x1137))+(((-228.0)*x1135))+((x1133*x1138))+((x1133*x1136)))))+(IKabs(((((-228.0)*x1136))+(((-228.0)*x1138))+((x1133*x1137))+(((-1.0)*x1133*x1135)))))); if( IKabs(j1eval[0]) < 0.0000010000000000 || IKabs(j1eval[1]) < 0.0000010000000000 || IKabs(j1eval[2]) < 0.0000010000000000 ) { { IkReal j1eval[2]; sj2=0; cj2=1.0; j2=0; IkReal x1139=pz*pz; IkReal x1140=(pp*sj3); IkReal x1141=(sj3*x1139); j1eval[0]=(x1140+(((-1.0)*x1141))); j1eval[1]=IKsign(((((5000.0)*x1140))+(((-5000.0)*x1141)))); if( IKabs(j1eval[0]) < 0.0000010000000000 || IKabs(j1eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j3))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j1eval[3]; sj2=0; cj2=1.0; j2=0; sj3=0; cj3=1.0; j3=0; IkReal x1142=pz*pz; IkReal x1143=((6221.0)*sj4); j1eval[0]=((((-1.0)*x1142))+pp); j1eval[1]=IKsign(((((-20000.0)*x1142))+(((20000.0)*pp)))); j1eval[2]=((IKabs(((((-228.0)*py))+(((-1.0)*px*x1143)))))+(IKabs(((((228.0)*px))+(((-1.0)*py*x1143)))))); if( IKabs(j1eval[0]) < 0.0000010000000000 || IKabs(j1eval[1]) < 0.0000010000000000 || IKabs(j1eval[2]) < 0.0000010000000000 ) { continue; // no branches [j1] } else { { IkReal j1array[1], cj1array[1], sj1array[1]; bool j1valid[1]={false}; _nj1 = 1; IkReal x1144=((6221.0)*sj4); CheckValue<IkReal> x1145 = IKatan2WithCheck(IkReal(((((228.0)*px))+(((-1.0)*py*x1144)))),IkReal(((((-228.0)*py))+(((-1.0)*px*x1144)))),IKFAST_ATAN2_MAGTHRESH); if(!x1145.valid){ continue; } CheckValue<IkReal> x1146=IKPowWithIntegerCheck(IKsign(((((-20000.0)*(pz*pz)))+(((20000.0)*pp)))),-1); if(!x1146.valid){ continue; } j1array[0]=((-1.5707963267949)+(x1145.value)+(((1.5707963267949)*(x1146.value)))); sj1array[0]=IKsin(j1array[0]); cj1array[0]=IKcos(j1array[0]); if( j1array[0] > IKPI ) { j1array[0]-=IK2PI; } else if( j1array[0] < -IKPI ) { j1array[0]+=IK2PI; } j1valid[0] = true; for(int ij1 = 0; ij1 < 1; ++ij1) { if( !j1valid[ij1] ) { continue; } _ij1[0] = ij1; _ij1[1] = -1; for(int iij1 = ij1+1; iij1 < 1; ++iij1) { if( j1valid[iij1] && IKabs(cj1array[ij1]-cj1array[iij1]) < IKFAST_SOLUTION_THRESH && IKabs(sj1array[ij1]-sj1array[iij1]) < IKFAST_SOLUTION_THRESH ) { j1valid[iij1]=false; _ij1[1] = iij1; break; } } j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1]; { IkReal evalcond[2]; IkReal x1147=IKcos(j1); IkReal x1148=IKsin(j1); IkReal x1149=((1.0)*px); evalcond[0]=((0.0114)+((py*x1147))+(((-1.0)*x1148*x1149))); evalcond[1]=((((-1.0)*py*x1148))+(((-1.0)*x1147*x1149))+(((-0.31105)*sj4))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j3)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j1eval[3]; sj2=0; cj2=1.0; j2=0; sj3=0; cj3=-1.0; j3=3.14159265358979; IkReal x1150=pz*pz; IkReal x1151=((6221.0)*sj4); j1eval[0]=((((-1.0)*x1150))+pp); j1eval[1]=IKsign(((((-20000.0)*x1150))+(((20000.0)*pp)))); j1eval[2]=((IKabs(((((-228.0)*px))+((py*x1151)))))+(IKabs(((((228.0)*py))+((px*x1151)))))); if( IKabs(j1eval[0]) < 0.0000010000000000 || IKabs(j1eval[1]) < 0.0000010000000000 || IKabs(j1eval[2]) < 0.0000010000000000 ) { continue; // no branches [j1] } else { { IkReal j1array[1], cj1array[1], sj1array[1]; bool j1valid[1]={false}; _nj1 = 1; IkReal x1152=((6221.0)*sj4); CheckValue<IkReal> x1153 = IKatan2WithCheck(IkReal(((((-228.0)*px))+((py*x1152)))),IkReal(((((228.0)*py))+((px*x1152)))),IKFAST_ATAN2_MAGTHRESH); if(!x1153.valid){ continue; } CheckValue<IkReal> x1154=IKPowWithIntegerCheck(IKsign(((((-20000.0)*(pz*pz)))+(((20000.0)*pp)))),-1); if(!x1154.valid){ continue; } j1array[0]=((-1.5707963267949)+(x1153.value)+(((1.5707963267949)*(x1154.value)))); sj1array[0]=IKsin(j1array[0]); cj1array[0]=IKcos(j1array[0]); if( j1array[0] > IKPI ) { j1array[0]-=IK2PI; } else if( j1array[0] < -IKPI ) { j1array[0]+=IK2PI; } j1valid[0] = true; for(int ij1 = 0; ij1 < 1; ++ij1) { if( !j1valid[ij1] ) { continue; } _ij1[0] = ij1; _ij1[1] = -1; for(int iij1 = ij1+1; iij1 < 1; ++iij1) { if( j1valid[iij1] && IKabs(cj1array[ij1]-cj1array[iij1]) < IKFAST_SOLUTION_THRESH && IKabs(sj1array[ij1]-sj1array[iij1]) < IKFAST_SOLUTION_THRESH ) { j1valid[iij1]=false; _ij1[1] = iij1; break; } } j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1]; { IkReal evalcond[2]; IkReal x1155=IKcos(j1); IkReal x1156=IKsin(j1); IkReal x1157=((1.0)*px); evalcond[0]=((-0.0114)+(((-1.0)*x1156*x1157))+((py*x1155))); evalcond[1]=((((-1.0)*x1155*x1157))+(((-1.0)*py*x1156))+(((0.31105)*sj4))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j3)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j1eval[3]; sj2=0; cj2=1.0; j2=0; sj3=1.0; cj3=0; j3=1.5707963267949; IkReal x1158=pz*pz; IkReal x1159=((6221.0)*sj4); j1eval[0]=((((-1.0)*x1158))+pp); j1eval[1]=IKsign(((((-20000.0)*x1158))+(((20000.0)*pp)))); j1eval[2]=((IKabs(((((228.0)*px))+(((-1.0)*py*x1159)))))+(IKabs(((((228.0)*py))+((px*x1159)))))); if( IKabs(j1eval[0]) < 0.0000010000000000 || IKabs(j1eval[1]) < 0.0000010000000000 || IKabs(j1eval[2]) < 0.0000010000000000 ) { continue; // no branches [j1] } else { { IkReal j1array[1], cj1array[1], sj1array[1]; bool j1valid[1]={false}; _nj1 = 1; IkReal x1160=((6221.0)*sj4); CheckValue<IkReal> x1161 = IKatan2WithCheck(IkReal((((px*x1160))+(((228.0)*py)))),IkReal(((((228.0)*px))+(((-1.0)*py*x1160)))),IKFAST_ATAN2_MAGTHRESH); if(!x1161.valid){ continue; } CheckValue<IkReal> x1162=IKPowWithIntegerCheck(IKsign(((((-20000.0)*(pz*pz)))+(((20000.0)*pp)))),-1); if(!x1162.valid){ continue; } j1array[0]=((-1.5707963267949)+(x1161.value)+(((1.5707963267949)*(x1162.value)))); sj1array[0]=IKsin(j1array[0]); cj1array[0]=IKcos(j1array[0]); if( j1array[0] > IKPI ) { j1array[0]-=IK2PI; } else if( j1array[0] < -IKPI ) { j1array[0]+=IK2PI; } j1valid[0] = true; for(int ij1 = 0; ij1 < 1; ++ij1) { if( !j1valid[ij1] ) { continue; } _ij1[0] = ij1; _ij1[1] = -1; for(int iij1 = ij1+1; iij1 < 1; ++iij1) { if( j1valid[iij1] && IKabs(cj1array[ij1]-cj1array[iij1]) < IKFAST_SOLUTION_THRESH && IKabs(sj1array[ij1]-sj1array[iij1]) < IKFAST_SOLUTION_THRESH ) { j1valid[iij1]=false; _ij1[1] = iij1; break; } } j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1]; { IkReal evalcond[2]; IkReal x1163=IKcos(j1); IkReal x1164=IKsin(j1); IkReal x1165=((1.0)*px); evalcond[0]=((0.0114)+(((-1.0)*x1163*x1165))+(((-1.0)*py*x1164))); evalcond[1]=(((py*x1163))+(((-1.0)*x1164*x1165))+(((0.31105)*sj4))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j3)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j1eval[3]; sj2=0; cj2=1.0; j2=0; sj3=-1.0; cj3=0; j3=-1.5707963267949; IkReal x1166=pz*pz; IkReal x1167=((6221.0)*sj4); j1eval[0]=(x1166+(((-1.0)*pp))); j1eval[1]=IKsign(((((-20000.0)*pp))+(((20000.0)*x1166)))); j1eval[2]=((IKabs(((((228.0)*px))+(((-1.0)*py*x1167)))))+(IKabs((((px*x1167))+(((228.0)*py)))))); if( IKabs(j1eval[0]) < 0.0000010000000000 || IKabs(j1eval[1]) < 0.0000010000000000 || IKabs(j1eval[2]) < 0.0000010000000000 ) { continue; // no branches [j1] } else { { IkReal j1array[1], cj1array[1], sj1array[1]; bool j1valid[1]={false}; _nj1 = 1; IkReal x1168=((6221.0)*sj4); CheckValue<IkReal> x1169 = IKatan2WithCheck(IkReal((((px*x1168))+(((228.0)*py)))),IkReal(((((228.0)*px))+(((-1.0)*py*x1168)))),IKFAST_ATAN2_MAGTHRESH); if(!x1169.valid){ continue; } CheckValue<IkReal> x1170=IKPowWithIntegerCheck(IKsign(((((-20000.0)*pp))+(((20000.0)*(pz*pz))))),-1); if(!x1170.valid){ continue; } j1array[0]=((-1.5707963267949)+(x1169.value)+(((1.5707963267949)*(x1170.value)))); sj1array[0]=IKsin(j1array[0]); cj1array[0]=IKcos(j1array[0]); if( j1array[0] > IKPI ) { j1array[0]-=IK2PI; } else if( j1array[0] < -IKPI ) { j1array[0]+=IK2PI; } j1valid[0] = true; for(int ij1 = 0; ij1 < 1; ++ij1) { if( !j1valid[ij1] ) { continue; } _ij1[0] = ij1; _ij1[1] = -1; for(int iij1 = ij1+1; iij1 < 1; ++iij1) { if( j1valid[iij1] && IKabs(cj1array[ij1]-cj1array[iij1]) < IKFAST_SOLUTION_THRESH && IKabs(sj1array[ij1]-sj1array[iij1]) < IKFAST_SOLUTION_THRESH ) { j1valid[iij1]=false; _ij1[1] = iij1; break; } } j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1]; { IkReal evalcond[2]; IkReal x1171=IKcos(j1); IkReal x1172=IKsin(j1); IkReal x1173=((1.0)*px); evalcond[0]=((-0.0114)+(((-1.0)*x1171*x1173))+(((-1.0)*py*x1172))); evalcond[1]=((((-1.0)*x1172*x1173))+((py*x1171))+(((-0.31105)*sj4))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j1] } } while(0); if( bgotonextstatement ) { } } } } } } } else { { IkReal j1array[1], cj1array[1], sj1array[1]; bool j1valid[1]={false}; _nj1 = 1; IkReal x1174=cj3*cj3; IkReal x1175=((1555.25)*sj4); IkReal x1176=((5000.0)*sj3); IkReal x1177=((57.0)*py); IkReal x1178=((57.0)*px); IkReal x1179=(cj3*sj3); IkReal x1180=(py*x1174); IkReal x1181=(px*x1174); CheckValue<IkReal> x1182 = IKatan2WithCheck(IkReal(((((-1.0)*py*x1175*x1179))+(((-1.0)*x1175*x1181))+x1177+((px*x1175))+((x1178*x1179))+(((-1.0)*x1174*x1177)))),IkReal(((((-1.0)*px*x1175*x1179))+x1178+((x1175*x1180))+(((-1.0)*py*x1175))+(((-1.0)*x1177*x1179))+(((-1.0)*x1174*x1178)))),IKFAST_ATAN2_MAGTHRESH); if(!x1182.valid){ continue; } CheckValue<IkReal> x1183=IKPowWithIntegerCheck(IKsign(((((-1.0)*x1176*(pz*pz)))+((pp*x1176)))),-1); if(!x1183.valid){ continue; } j1array[0]=((-1.5707963267949)+(x1182.value)+(((1.5707963267949)*(x1183.value)))); sj1array[0]=IKsin(j1array[0]); cj1array[0]=IKcos(j1array[0]); if( j1array[0] > IKPI ) { j1array[0]-=IK2PI; } else if( j1array[0] < -IKPI ) { j1array[0]+=IK2PI; } j1valid[0] = true; for(int ij1 = 0; ij1 < 1; ++ij1) { if( !j1valid[ij1] ) { continue; } _ij1[0] = ij1; _ij1[1] = -1; for(int iij1 = ij1+1; iij1 < 1; ++iij1) { if( j1valid[iij1] && IKabs(cj1array[ij1]-cj1array[iij1]) < IKFAST_SOLUTION_THRESH && IKabs(sj1array[ij1]-sj1array[iij1]) < IKFAST_SOLUTION_THRESH ) { j1valid[iij1]=false; _ij1[1] = iij1; break; } } j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1]; { IkReal evalcond[4]; IkReal x1184=IKcos(j1); IkReal x1185=IKsin(j1); IkReal x1186=(py*sj3); IkReal x1187=((0.31105)*sj4); IkReal x1188=(cj3*py); IkReal x1189=((1.0)*x1184); IkReal x1190=((1.0)*x1185); IkReal x1191=(px*x1185); evalcond[0]=(((py*x1184))+(((0.0114)*cj3))+((sj3*x1187))+(((-1.0)*px*x1190))); evalcond[1]=((((-1.0)*py*x1190))+(((-1.0)*cj3*x1187))+(((-1.0)*px*x1189))+(((0.0114)*sj3))); evalcond[2]=((-0.0114)+(((-1.0)*x1188*x1189))+((x1185*x1186))+((px*sj3*x1184))+((cj3*x1191))); evalcond[3]=((((-1.0)*x1188*x1190))+(((-1.0)*x1186*x1189))+(((-1.0)*x1187))+((sj3*x1191))+(((-1.0)*cj3*px*x1189))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j1array[1], cj1array[1], sj1array[1]; bool j1valid[1]={false}; _nj1 = 1; IkReal x1192=cj3*cj3; IkReal x1193=((1555.25)*sj4); IkReal x1194=((5000.0)*cj3); IkReal x1195=(py*x1192); IkReal x1196=(cj3*py*sj3); IkReal x1197=(px*x1192); IkReal x1198=(cj3*px*sj3); CheckValue<IkReal> x1199 = IKatan2WithCheck(IkReal(((((-1.0)*x1193*x1198))+(((-57.0)*x1196))+(((-57.0)*x1197))+((x1193*x1195)))),IkReal(((((57.0)*x1195))+(((-57.0)*x1198))+((x1193*x1196))+((x1193*x1197)))),IKFAST_ATAN2_MAGTHRESH); if(!x1199.valid){ continue; } CheckValue<IkReal> x1200=IKPowWithIntegerCheck(IKsign(((((-1.0)*pp*x1194))+((x1194*(pz*pz))))),-1); if(!x1200.valid){ continue; } j1array[0]=((-1.5707963267949)+(x1199.value)+(((1.5707963267949)*(x1200.value)))); sj1array[0]=IKsin(j1array[0]); cj1array[0]=IKcos(j1array[0]); if( j1array[0] > IKPI ) { j1array[0]-=IK2PI; } else if( j1array[0] < -IKPI ) { j1array[0]+=IK2PI; } j1valid[0] = true; for(int ij1 = 0; ij1 < 1; ++ij1) { if( !j1valid[ij1] ) { continue; } _ij1[0] = ij1; _ij1[1] = -1; for(int iij1 = ij1+1; iij1 < 1; ++iij1) { if( j1valid[iij1] && IKabs(cj1array[ij1]-cj1array[iij1]) < IKFAST_SOLUTION_THRESH && IKabs(sj1array[ij1]-sj1array[iij1]) < IKFAST_SOLUTION_THRESH ) { j1valid[iij1]=false; _ij1[1] = iij1; break; } } j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1]; { IkReal evalcond[4]; IkReal x1201=IKcos(j1); IkReal x1202=IKsin(j1); IkReal x1203=(py*sj3); IkReal x1204=((0.31105)*sj4); IkReal x1205=(cj3*py); IkReal x1206=((1.0)*x1201); IkReal x1207=((1.0)*x1202); IkReal x1208=(px*x1202); evalcond[0]=((((0.0114)*cj3))+((py*x1201))+((sj3*x1204))+(((-1.0)*px*x1207))); evalcond[1]=((((-1.0)*cj3*x1204))+(((-1.0)*px*x1206))+(((0.0114)*sj3))+(((-1.0)*py*x1207))); evalcond[2]=((-0.0114)+((x1202*x1203))+(((-1.0)*x1205*x1206))+((px*sj3*x1201))+((cj3*x1208))); evalcond[3]=((((-1.0)*x1205*x1207))+(((-1.0)*x1203*x1206))+((sj3*x1208))+(((-1.0)*x1204))+(((-1.0)*cj3*px*x1206))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j1array[1], cj1array[1], sj1array[1]; bool j1valid[1]={false}; _nj1 = 1; IkReal x1209=((0.0114)*py); IkReal x1210=((0.31105)*sj4); IkReal x1211=(cj3*px); IkReal x1212=(px*sj3); CheckValue<IkReal> x1213 = IKatan2WithCheck(IkReal(((((-1.0)*cj3*py*x1210))+(((0.0114)*x1211))+((x1210*x1212))+((sj3*x1209)))),IkReal(((((0.0114)*x1212))+(((-1.0)*cj3*x1209))+(((-1.0)*x1210*x1211))+(((-1.0)*py*sj3*x1210)))),IKFAST_ATAN2_MAGTHRESH); if(!x1213.valid){ continue; } CheckValue<IkReal> x1214=IKPowWithIntegerCheck(IKsign((pp+(((-1.0)*(pz*pz))))),-1); if(!x1214.valid){ continue; } j1array[0]=((-1.5707963267949)+(x1213.value)+(((1.5707963267949)*(x1214.value)))); sj1array[0]=IKsin(j1array[0]); cj1array[0]=IKcos(j1array[0]); if( j1array[0] > IKPI ) { j1array[0]-=IK2PI; } else if( j1array[0] < -IKPI ) { j1array[0]+=IK2PI; } j1valid[0] = true; for(int ij1 = 0; ij1 < 1; ++ij1) { if( !j1valid[ij1] ) { continue; } _ij1[0] = ij1; _ij1[1] = -1; for(int iij1 = ij1+1; iij1 < 1; ++iij1) { if( j1valid[iij1] && IKabs(cj1array[ij1]-cj1array[iij1]) < IKFAST_SOLUTION_THRESH && IKabs(sj1array[ij1]-sj1array[iij1]) < IKFAST_SOLUTION_THRESH ) { j1valid[iij1]=false; _ij1[1] = iij1; break; } } j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1]; { IkReal evalcond[4]; IkReal x1215=IKcos(j1); IkReal x1216=IKsin(j1); IkReal x1217=(py*sj3); IkReal x1218=((0.31105)*sj4); IkReal x1219=(cj3*py); IkReal x1220=((1.0)*x1215); IkReal x1221=((1.0)*x1216); IkReal x1222=(px*x1216); evalcond[0]=((((-1.0)*px*x1221))+(((0.0114)*cj3))+((sj3*x1218))+((py*x1215))); evalcond[1]=((((-1.0)*px*x1220))+(((-1.0)*cj3*x1218))+(((-1.0)*py*x1221))+(((0.0114)*sj3))); evalcond[2]=((-0.0114)+((px*sj3*x1215))+((cj3*x1222))+((x1216*x1217))+(((-1.0)*x1219*x1220))); evalcond[3]=(((sj3*x1222))+(((-1.0)*cj3*px*x1220))+(((-1.0)*x1217*x1220))+(((-1.0)*x1218))+(((-1.0)*x1219*x1221))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j2)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j1eval[3]; sj2=0; cj2=-1.0; j2=3.14159265358979; IkReal x1223=((0.0114)*py); IkReal x1224=((0.31105)*sj4); IkReal x1225=(cj3*px); IkReal x1226=(px*sj3); IkReal x1227=(pp+(((-1.0)*(pz*pz)))); j1eval[0]=x1227; j1eval[1]=((IKabs((((x1224*x1225))+(((-1.0)*py*sj3*x1224))+(((-0.0114)*x1226))+(((-1.0)*cj3*x1223)))))+(IKabs(((((0.0114)*x1225))+((x1224*x1226))+(((-1.0)*sj3*x1223))+((cj3*py*x1224)))))); j1eval[2]=IKsign(x1227); if( IKabs(j1eval[0]) < 0.0000010000000000 || IKabs(j1eval[1]) < 0.0000010000000000 || IKabs(j1eval[2]) < 0.0000010000000000 ) { { IkReal j1eval[3]; sj2=0; cj2=-1.0; j2=3.14159265358979; IkReal x1228=cj3*cj3; IkReal x1229=pz*pz; IkReal x1230=(cj3*pp); IkReal x1231=(cj3*x1229); IkReal x1232=((228.0)*cj3*sj3); IkReal x1233=((228.0)*x1228); IkReal x1234=((6221.0)*sj4*x1228); IkReal x1235=((6221.0)*cj3*sj3*sj4); j1eval[0]=((((-1.0)*x1231))+x1230); j1eval[1]=((IKabs((((py*x1234))+(((-1.0)*py*x1232))+((px*x1235))+((px*x1233)))))+(IKabs(((((-1.0)*px*x1232))+(((-1.0)*py*x1233))+(((-1.0)*py*x1235))+((px*x1234)))))); j1eval[2]=IKsign(((((-20000.0)*x1231))+(((20000.0)*x1230)))); if( IKabs(j1eval[0]) < 0.0000010000000000 || IKabs(j1eval[1]) < 0.0000010000000000 || IKabs(j1eval[2]) < 0.0000010000000000 ) { { IkReal j1eval[3]; sj2=0; cj2=-1.0; j2=3.14159265358979; IkReal x1236=cj3*cj3; IkReal x1237=pz*pz; IkReal x1238=((6221.0)*sj4); IkReal x1239=((5000.0)*cj3); IkReal x1240=(cj3*px*sj3); IkReal x1241=(cj3*py*sj3); IkReal x1242=(py*x1236); IkReal x1243=(px*x1236); j1eval[0]=(((cj3*x1237))+(((-1.0)*cj3*pp))); j1eval[1]=((IKabs(((((-1.0)*x1238*x1243))+((x1238*x1241))+(((228.0)*x1242))+(((228.0)*x1240)))))+(IKabs(((((-1.0)*x1238*x1242))+(((-1.0)*x1238*x1240))+(((228.0)*x1241))+(((-228.0)*x1243)))))); j1eval[2]=IKsign(((((-1.0)*pp*x1239))+((x1237*x1239)))); if( IKabs(j1eval[0]) < 0.0000010000000000 || IKabs(j1eval[1]) < 0.0000010000000000 || IKabs(j1eval[2]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j3)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j1eval[3]; sj2=0; cj2=-1.0; j2=3.14159265358979; sj3=1.0; cj3=0; j3=1.5707963267949; IkReal x1244=pz*pz; IkReal x1245=((6221.0)*sj4); j1eval[0]=((((-1.0)*x1244))+pp); j1eval[1]=IKsign(((((20000.0)*pp))+(((-20000.0)*x1244)))); j1eval[2]=((IKabs(((((-228.0)*py))+((px*x1245)))))+(IKabs(((((-1.0)*py*x1245))+(((-228.0)*px)))))); if( IKabs(j1eval[0]) < 0.0000010000000000 || IKabs(j1eval[1]) < 0.0000010000000000 || IKabs(j1eval[2]) < 0.0000010000000000 ) { continue; // no branches [j1] } else { { IkReal j1array[1], cj1array[1], sj1array[1]; bool j1valid[1]={false}; _nj1 = 1; IkReal x1246=((6221.0)*sj4); CheckValue<IkReal> x1247 = IKatan2WithCheck(IkReal(((((-228.0)*py))+((px*x1246)))),IkReal(((((-1.0)*py*x1246))+(((-228.0)*px)))),IKFAST_ATAN2_MAGTHRESH); if(!x1247.valid){ continue; } CheckValue<IkReal> x1248=IKPowWithIntegerCheck(IKsign(((((-20000.0)*(pz*pz)))+(((20000.0)*pp)))),-1); if(!x1248.valid){ continue; } j1array[0]=((-1.5707963267949)+(x1247.value)+(((1.5707963267949)*(x1248.value)))); sj1array[0]=IKsin(j1array[0]); cj1array[0]=IKcos(j1array[0]); if( j1array[0] > IKPI ) { j1array[0]-=IK2PI; } else if( j1array[0] < -IKPI ) { j1array[0]+=IK2PI; } j1valid[0] = true; for(int ij1 = 0; ij1 < 1; ++ij1) { if( !j1valid[ij1] ) { continue; } _ij1[0] = ij1; _ij1[1] = -1; for(int iij1 = ij1+1; iij1 < 1; ++iij1) { if( j1valid[iij1] && IKabs(cj1array[ij1]-cj1array[iij1]) < IKFAST_SOLUTION_THRESH && IKabs(sj1array[ij1]-sj1array[iij1]) < IKFAST_SOLUTION_THRESH ) { j1valid[iij1]=false; _ij1[1] = iij1; break; } } j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1]; { IkReal evalcond[2]; IkReal x1249=IKcos(j1); IkReal x1250=IKsin(j1); IkReal x1251=((1.0)*px); evalcond[0]=((-0.0114)+(((-1.0)*x1249*x1251))+(((-1.0)*py*x1250))); evalcond[1]=(((py*x1249))+(((-1.0)*x1250*x1251))+(((0.31105)*sj4))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j3)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j1eval[3]; sj2=0; cj2=-1.0; j2=3.14159265358979; sj3=-1.0; cj3=0; j3=-1.5707963267949; IkReal x1252=pz*pz; IkReal x1253=((6221.0)*sj4); j1eval[0]=(pp+(((-1.0)*x1252))); j1eval[1]=IKsign(((((20000.0)*pp))+(((-20000.0)*x1252)))); j1eval[2]=((IKabs(((((228.0)*py))+(((-1.0)*px*x1253)))))+(IKabs(((((228.0)*px))+((py*x1253)))))); if( IKabs(j1eval[0]) < 0.0000010000000000 || IKabs(j1eval[1]) < 0.0000010000000000 || IKabs(j1eval[2]) < 0.0000010000000000 ) { continue; // no branches [j1] } else { { IkReal j1array[1], cj1array[1], sj1array[1]; bool j1valid[1]={false}; _nj1 = 1; IkReal x1254=((6221.0)*sj4); CheckValue<IkReal> x1255 = IKatan2WithCheck(IkReal(((((228.0)*py))+(((-1.0)*px*x1254)))),IkReal(((((228.0)*px))+((py*x1254)))),IKFAST_ATAN2_MAGTHRESH); if(!x1255.valid){ continue; } CheckValue<IkReal> x1256=IKPowWithIntegerCheck(IKsign(((((-20000.0)*(pz*pz)))+(((20000.0)*pp)))),-1); if(!x1256.valid){ continue; } j1array[0]=((-1.5707963267949)+(x1255.value)+(((1.5707963267949)*(x1256.value)))); sj1array[0]=IKsin(j1array[0]); cj1array[0]=IKcos(j1array[0]); if( j1array[0] > IKPI ) { j1array[0]-=IK2PI; } else if( j1array[0] < -IKPI ) { j1array[0]+=IK2PI; } j1valid[0] = true; for(int ij1 = 0; ij1 < 1; ++ij1) { if( !j1valid[ij1] ) { continue; } _ij1[0] = ij1; _ij1[1] = -1; for(int iij1 = ij1+1; iij1 < 1; ++iij1) { if( j1valid[iij1] && IKabs(cj1array[ij1]-cj1array[iij1]) < IKFAST_SOLUTION_THRESH && IKabs(sj1array[ij1]-sj1array[iij1]) < IKFAST_SOLUTION_THRESH ) { j1valid[iij1]=false; _ij1[1] = iij1; break; } } j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1]; { IkReal evalcond[2]; IkReal x1257=IKcos(j1); IkReal x1258=IKsin(j1); IkReal x1259=((1.0)*px); evalcond[0]=((0.0114)+(((-1.0)*py*x1258))+(((-1.0)*x1257*x1259))); evalcond[1]=((((-1.0)*x1258*x1259))+(((-0.31105)*sj4))+((py*x1257))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j1] } } while(0); if( bgotonextstatement ) { } } } } } else { { IkReal j1array[1], cj1array[1], sj1array[1]; bool j1valid[1]={false}; _nj1 = 1; IkReal x1260=cj3*cj3; IkReal x1261=((1555.25)*sj4); IkReal x1262=((5000.0)*cj3); IkReal x1263=(py*x1260); IkReal x1264=(cj3*py*sj3); IkReal x1265=(px*x1260); IkReal x1266=(cj3*px*sj3); CheckValue<IkReal> x1267=IKPowWithIntegerCheck(IKsign(((((-1.0)*pp*x1262))+((x1262*(pz*pz))))),-1); if(!x1267.valid){ continue; } CheckValue<IkReal> x1268 = IKatan2WithCheck(IkReal(((((-1.0)*x1261*x1263))+(((-1.0)*x1261*x1266))+(((-57.0)*x1265))+(((57.0)*x1264)))),IkReal(((((-1.0)*x1261*x1265))+((x1261*x1264))+(((57.0)*x1263))+(((57.0)*x1266)))),IKFAST_ATAN2_MAGTHRESH); if(!x1268.valid){ continue; } j1array[0]=((-1.5707963267949)+(((1.5707963267949)*(x1267.value)))+(x1268.value)); sj1array[0]=IKsin(j1array[0]); cj1array[0]=IKcos(j1array[0]); if( j1array[0] > IKPI ) { j1array[0]-=IK2PI; } else if( j1array[0] < -IKPI ) { j1array[0]+=IK2PI; } j1valid[0] = true; for(int ij1 = 0; ij1 < 1; ++ij1) { if( !j1valid[ij1] ) { continue; } _ij1[0] = ij1; _ij1[1] = -1; for(int iij1 = ij1+1; iij1 < 1; ++iij1) { if( j1valid[iij1] && IKabs(cj1array[ij1]-cj1array[iij1]) < IKFAST_SOLUTION_THRESH && IKabs(sj1array[ij1]-sj1array[iij1]) < IKFAST_SOLUTION_THRESH ) { j1valid[iij1]=false; _ij1[1] = iij1; break; } } j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1]; { IkReal evalcond[4]; IkReal x1269=IKcos(j1); IkReal x1270=IKsin(j1); IkReal x1271=((1.0)*py); IkReal x1272=((1.0)*px); IkReal x1273=((0.31105)*sj4); IkReal x1274=(sj3*x1269); IkReal x1275=(cj3*x1269); IkReal x1276=(cj3*x1270); IkReal x1277=(sj3*x1270); evalcond[0]=(((sj3*x1273))+(((-1.0)*x1270*x1272))+(((0.0114)*cj3))+((py*x1269))); evalcond[1]=((((-0.0114)*sj3))+(((-1.0)*x1270*x1271))+(((-1.0)*x1269*x1272))+((cj3*x1273))); evalcond[2]=((-0.0114)+(((-1.0)*x1271*x1277))+(((-1.0)*x1271*x1275))+(((-1.0)*x1272*x1274))+((px*x1276))); evalcond[3]=(((py*x1276))+(((-1.0)*x1273))+(((-1.0)*x1271*x1274))+((px*x1277))+((px*x1275))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j1array[1], cj1array[1], sj1array[1]; bool j1valid[1]={false}; _nj1 = 1; IkReal x1278=cj3*cj3; IkReal x1279=((6221.0)*sj4); IkReal x1280=((20000.0)*cj3); IkReal x1281=(cj3*px*sj3); IkReal x1282=(cj3*py*sj3); IkReal x1283=(px*x1278); IkReal x1284=(py*x1278); CheckValue<IkReal> x1285 = IKatan2WithCheck(IkReal(((((-228.0)*x1282))+((x1279*x1284))+((x1279*x1281))+(((228.0)*x1283)))),IkReal(((((-228.0)*x1281))+(((-228.0)*x1284))+((x1279*x1283))+(((-1.0)*x1279*x1282)))),IKFAST_ATAN2_MAGTHRESH); if(!x1285.valid){ continue; } CheckValue<IkReal> x1286=IKPowWithIntegerCheck(IKsign((((pp*x1280))+(((-1.0)*x1280*(pz*pz))))),-1); if(!x1286.valid){ continue; } j1array[0]=((-1.5707963267949)+(x1285.value)+(((1.5707963267949)*(x1286.value)))); sj1array[0]=IKsin(j1array[0]); cj1array[0]=IKcos(j1array[0]); if( j1array[0] > IKPI ) { j1array[0]-=IK2PI; } else if( j1array[0] < -IKPI ) { j1array[0]+=IK2PI; } j1valid[0] = true; for(int ij1 = 0; ij1 < 1; ++ij1) { if( !j1valid[ij1] ) { continue; } _ij1[0] = ij1; _ij1[1] = -1; for(int iij1 = ij1+1; iij1 < 1; ++iij1) { if( j1valid[iij1] && IKabs(cj1array[ij1]-cj1array[iij1]) < IKFAST_SOLUTION_THRESH && IKabs(sj1array[ij1]-sj1array[iij1]) < IKFAST_SOLUTION_THRESH ) { j1valid[iij1]=false; _ij1[1] = iij1; break; } } j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1]; { IkReal evalcond[4]; IkReal x1287=IKcos(j1); IkReal x1288=IKsin(j1); IkReal x1289=((1.0)*py); IkReal x1290=((1.0)*px); IkReal x1291=((0.31105)*sj4); IkReal x1292=(sj3*x1287); IkReal x1293=(cj3*x1287); IkReal x1294=(cj3*x1288); IkReal x1295=(sj3*x1288); evalcond[0]=(((sj3*x1291))+(((-1.0)*x1288*x1290))+(((0.0114)*cj3))+((py*x1287))); evalcond[1]=((((-1.0)*x1287*x1290))+(((-0.0114)*sj3))+((cj3*x1291))+(((-1.0)*x1288*x1289))); evalcond[2]=((-0.0114)+(((-1.0)*x1289*x1295))+(((-1.0)*x1289*x1293))+(((-1.0)*x1290*x1292))+((px*x1294))); evalcond[3]=((((-1.0)*x1291))+(((-1.0)*x1289*x1292))+((py*x1294))+((px*x1293))+((px*x1295))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j1array[1], cj1array[1], sj1array[1]; bool j1valid[1]={false}; _nj1 = 1; IkReal x1296=((0.0114)*py); IkReal x1297=((0.31105)*sj4); IkReal x1298=(cj3*px); IkReal x1299=(px*sj3); CheckValue<IkReal> x1300 = IKatan2WithCheck(IkReal((((x1297*x1299))+(((-1.0)*sj3*x1296))+((cj3*py*x1297))+(((0.0114)*x1298)))),IkReal((((x1297*x1298))+(((-0.0114)*x1299))+(((-1.0)*py*sj3*x1297))+(((-1.0)*cj3*x1296)))),IKFAST_ATAN2_MAGTHRESH); if(!x1300.valid){ continue; } CheckValue<IkReal> x1301=IKPowWithIntegerCheck(IKsign((pp+(((-1.0)*(pz*pz))))),-1); if(!x1301.valid){ continue; } j1array[0]=((-1.5707963267949)+(x1300.value)+(((1.5707963267949)*(x1301.value)))); sj1array[0]=IKsin(j1array[0]); cj1array[0]=IKcos(j1array[0]); if( j1array[0] > IKPI ) { j1array[0]-=IK2PI; } else if( j1array[0] < -IKPI ) { j1array[0]+=IK2PI; } j1valid[0] = true; for(int ij1 = 0; ij1 < 1; ++ij1) { if( !j1valid[ij1] ) { continue; } _ij1[0] = ij1; _ij1[1] = -1; for(int iij1 = ij1+1; iij1 < 1; ++iij1) { if( j1valid[iij1] && IKabs(cj1array[ij1]-cj1array[iij1]) < IKFAST_SOLUTION_THRESH && IKabs(sj1array[ij1]-sj1array[iij1]) < IKFAST_SOLUTION_THRESH ) { j1valid[iij1]=false; _ij1[1] = iij1; break; } } j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1]; { IkReal evalcond[4]; IkReal x1302=IKcos(j1); IkReal x1303=IKsin(j1); IkReal x1304=((1.0)*py); IkReal x1305=((1.0)*px); IkReal x1306=((0.31105)*sj4); IkReal x1307=(sj3*x1302); IkReal x1308=(cj3*x1302); IkReal x1309=(cj3*x1303); IkReal x1310=(sj3*x1303); evalcond[0]=(((py*x1302))+((sj3*x1306))+(((-1.0)*x1303*x1305))+(((0.0114)*cj3))); evalcond[1]=((((-0.0114)*sj3))+(((-1.0)*x1303*x1304))+((cj3*x1306))+(((-1.0)*x1302*x1305))); evalcond[2]=((-0.0114)+(((-1.0)*x1304*x1310))+((px*x1309))+(((-1.0)*x1305*x1307))+(((-1.0)*x1304*x1308))); evalcond[3]=(((px*x1308))+((py*x1309))+((px*x1310))+(((-1.0)*x1306))+(((-1.0)*x1304*x1307))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j1] } } while(0); if( bgotonextstatement ) { } } } } } else { { IkReal j1array[1], cj1array[1], sj1array[1]; bool j1valid[1]={false}; _nj1 = 1; IkReal x1311=(px*sj2); IkReal x1312=((0.4674)*cj3); IkReal x1313=(cj2*py); IkReal x1314=((41.0)*pz); IkReal x1315=((50.0)*pp); IkReal x1316=((11.875)*pz); IkReal x1317=((41.0)*sj2); IkReal x1318=(cj2*px); IkReal x1319=(py*sj2); IkReal x1320=((12.75305)*sj3*sj4); CheckValue<IkReal> x1321 = IKatan2WithCheck(IkReal((((x1311*x1312))+(((4.86875)*x1313))+((x1313*x1314))+((py*x1316))+((py*x1315))+(((4.265975)*py))+((x1311*x1320)))),IkReal(((((-1.0)*x1319*x1320))+((x1314*x1318))+(((4.86875)*x1318))+((px*x1315))+((px*x1316))+(((4.265975)*px))+(((-1.0)*x1312*x1319)))),IKFAST_ATAN2_MAGTHRESH); if(!x1321.valid){ continue; } CheckValue<IkReal> x1322=IKPowWithIntegerCheck(IKsign((((pp*x1317))+(((-1.0)*pz*sj2*x1314)))),-1); if(!x1322.valid){ continue; } j1array[0]=((-1.5707963267949)+(x1321.value)+(((1.5707963267949)*(x1322.value)))); sj1array[0]=IKsin(j1array[0]); cj1array[0]=IKcos(j1array[0]); if( j1array[0] > IKPI ) { j1array[0]-=IK2PI; } else if( j1array[0] < -IKPI ) { j1array[0]+=IK2PI; } j1valid[0] = true; for(int ij1 = 0; ij1 < 1; ++ij1) { if( !j1valid[ij1] ) { continue; } _ij1[0] = ij1; _ij1[1] = -1; for(int iij1 = ij1+1; iij1 < 1; ++iij1) { if( j1valid[iij1] && IKabs(cj1array[ij1]-cj1array[iij1]) < IKFAST_SOLUTION_THRESH && IKabs(sj1array[ij1]-sj1array[iij1]) < IKFAST_SOLUTION_THRESH ) { j1valid[iij1]=false; _ij1[1] = iij1; break; } } j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1]; { IkReal evalcond[6]; IkReal x1323=IKcos(j1); IkReal x1324=IKsin(j1); IkReal x1325=((0.31105)*sj4); IkReal x1326=((1.0)*cj3); IkReal x1327=(pz*sj2); IkReal x1328=((0.31105)*cj4); IkReal x1329=(cj2*sj3); IkReal x1330=((0.82)*sj2); IkReal x1331=((1.0)*sj2); IkReal x1332=(cj2*pz); IkReal x1333=((0.11875)*sj2); IkReal x1334=(px*x1323); IkReal x1335=(px*x1324); IkReal x1336=(py*x1323); IkReal x1337=(py*x1324); IkReal x1338=(cj2*x1337); evalcond[0]=(x1336+((sj3*x1325))+(((-1.0)*x1335))+(((0.0114)*cj3))); evalcond[1]=((0.41)+x1328+x1332+(((0.11875)*cj2))+(((-1.0)*x1331*x1337))+(((-1.0)*x1331*x1334))); evalcond[2]=((-0.0853195)+(((-0.2375)*pz))+(((-0.82)*x1332))+(((-1.0)*pp))+(((-0.097375)*cj2))+((x1330*x1334))+((x1330*x1337))); evalcond[3]=(((sj2*x1328))+(((-1.0)*cj2*cj3*x1325))+(((-1.0)*x1334))+(((-1.0)*x1337))+(((0.41)*sj2))+(((0.0114)*x1329))); evalcond[4]=((-0.0114)+(((-1.0)*x1326*x1336))+((x1329*x1337))+((x1329*x1334))+((sj3*x1327))+((sj3*x1333))+((cj3*x1335))); evalcond[5]=((((-1.0)*x1326*x1338))+(((-1.0)*cj3*x1333))+(((-1.0)*x1325))+(((-1.0)*cj2*x1326*x1334))+(((-1.0)*x1326*x1327))+((sj3*x1335))+(((-1.0)*sj3*x1336))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j1array[1], cj1array[1], sj1array[1]; bool j1valid[1]={false}; _nj1 = 1; IkReal x1339=((0.0114)*cj3); IkReal x1340=((0.31105)*py); IkReal x1341=(sj3*sj4); IkReal x1342=((0.41)*sj2); IkReal x1343=(cj4*sj2); IkReal x1344=((0.31105)*px); IkReal x1345=(cj2*cj3*sj4); IkReal x1346=((0.0114)*cj2*sj3); CheckValue<IkReal> x1347=IKPowWithIntegerCheck(IKsign((pp+(((-1.0)*(pz*pz))))),-1); if(!x1347.valid){ continue; } CheckValue<IkReal> x1348 = IKatan2WithCheck(IkReal((((px*x1339))+(((-1.0)*x1340*x1345))+((x1340*x1343))+((x1341*x1344))+((py*x1346))+((py*x1342)))),IkReal(((((-1.0)*x1340*x1341))+(((-1.0)*py*x1339))+((px*x1346))+((px*x1342))+((x1343*x1344))+(((-1.0)*x1344*x1345)))),IKFAST_ATAN2_MAGTHRESH); if(!x1348.valid){ continue; } j1array[0]=((-1.5707963267949)+(((1.5707963267949)*(x1347.value)))+(x1348.value)); sj1array[0]=IKsin(j1array[0]); cj1array[0]=IKcos(j1array[0]); if( j1array[0] > IKPI ) { j1array[0]-=IK2PI; } else if( j1array[0] < -IKPI ) { j1array[0]+=IK2PI; } j1valid[0] = true; for(int ij1 = 0; ij1 < 1; ++ij1) { if( !j1valid[ij1] ) { continue; } _ij1[0] = ij1; _ij1[1] = -1; for(int iij1 = ij1+1; iij1 < 1; ++iij1) { if( j1valid[iij1] && IKabs(cj1array[ij1]-cj1array[iij1]) < IKFAST_SOLUTION_THRESH && IKabs(sj1array[ij1]-sj1array[iij1]) < IKFAST_SOLUTION_THRESH ) { j1valid[iij1]=false; _ij1[1] = iij1; break; } } j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1]; { IkReal evalcond[6]; IkReal x1349=IKcos(j1); IkReal x1350=IKsin(j1); IkReal x1351=((0.31105)*sj4); IkReal x1352=((1.0)*cj3); IkReal x1353=(pz*sj2); IkReal x1354=((0.31105)*cj4); IkReal x1355=(cj2*sj3); IkReal x1356=((0.82)*sj2); IkReal x1357=((1.0)*sj2); IkReal x1358=(cj2*pz); IkReal x1359=((0.11875)*sj2); IkReal x1360=(px*x1349); IkReal x1361=(px*x1350); IkReal x1362=(py*x1349); IkReal x1363=(py*x1350); IkReal x1364=(cj2*x1363); evalcond[0]=(x1362+(((-1.0)*x1361))+(((0.0114)*cj3))+((sj3*x1351))); evalcond[1]=((0.41)+x1358+x1354+(((0.11875)*cj2))+(((-1.0)*x1357*x1360))+(((-1.0)*x1357*x1363))); evalcond[2]=((-0.0853195)+((x1356*x1363))+((x1356*x1360))+(((-0.82)*x1358))+(((-0.2375)*pz))+(((-1.0)*pp))+(((-0.097375)*cj2))); evalcond[3]=((((-1.0)*x1363))+(((-1.0)*x1360))+(((0.41)*sj2))+(((-1.0)*cj2*cj3*x1351))+((sj2*x1354))+(((0.0114)*x1355))); evalcond[4]=((-0.0114)+(((-1.0)*x1352*x1362))+((x1355*x1360))+((x1355*x1363))+((sj3*x1359))+((sj3*x1353))+((cj3*x1361))); evalcond[5]=((((-1.0)*x1352*x1364))+(((-1.0)*x1351))+(((-1.0)*x1352*x1353))+(((-1.0)*cj2*x1352*x1360))+(((-1.0)*cj3*x1359))+(((-1.0)*sj3*x1362))+((sj3*x1361))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j1array[1], cj1array[1], sj1array[1]; bool j1valid[1]={false}; _nj1 = 1; IkReal x1365=(py*sj2); IkReal x1366=((0.0114)*cj3); IkReal x1367=(cj2*pz); IkReal x1368=(px*sj2); IkReal x1369=((0.31105)*cj4); IkReal x1370=((0.11875)*cj2); IkReal x1371=((0.31105)*sj3*sj4); CheckValue<IkReal> x1372 = IKatan2WithCheck(IkReal((((x1366*x1368))+((py*x1370))+(((0.41)*py))+((x1368*x1371))+((py*x1369))+((py*x1367)))),IkReal(((((-1.0)*x1365*x1371))+((px*x1370))+(((0.41)*px))+((px*x1369))+((px*x1367))+(((-1.0)*x1365*x1366)))),IKFAST_ATAN2_MAGTHRESH); if(!x1372.valid){ continue; } CheckValue<IkReal> x1373=IKPowWithIntegerCheck(IKsign(((((-1.0)*sj2*(pz*pz)))+((pp*sj2)))),-1); if(!x1373.valid){ continue; } j1array[0]=((-1.5707963267949)+(x1372.value)+(((1.5707963267949)*(x1373.value)))); sj1array[0]=IKsin(j1array[0]); cj1array[0]=IKcos(j1array[0]); if( j1array[0] > IKPI ) { j1array[0]-=IK2PI; } else if( j1array[0] < -IKPI ) { j1array[0]+=IK2PI; } j1valid[0] = true; for(int ij1 = 0; ij1 < 1; ++ij1) { if( !j1valid[ij1] ) { continue; } _ij1[0] = ij1; _ij1[1] = -1; for(int iij1 = ij1+1; iij1 < 1; ++iij1) { if( j1valid[iij1] && IKabs(cj1array[ij1]-cj1array[iij1]) < IKFAST_SOLUTION_THRESH && IKabs(sj1array[ij1]-sj1array[iij1]) < IKFAST_SOLUTION_THRESH ) { j1valid[iij1]=false; _ij1[1] = iij1; break; } } j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1]; { IkReal evalcond[6]; IkReal x1374=IKcos(j1); IkReal x1375=IKsin(j1); IkReal x1376=((0.31105)*sj4); IkReal x1377=((1.0)*cj3); IkReal x1378=(pz*sj2); IkReal x1379=((0.31105)*cj4); IkReal x1380=(cj2*sj3); IkReal x1381=((0.82)*sj2); IkReal x1382=((1.0)*sj2); IkReal x1383=(cj2*pz); IkReal x1384=((0.11875)*sj2); IkReal x1385=(px*x1374); IkReal x1386=(px*x1375); IkReal x1387=(py*x1374); IkReal x1388=(py*x1375); IkReal x1389=(cj2*x1388); evalcond[0]=(x1387+((sj3*x1376))+(((0.0114)*cj3))+(((-1.0)*x1386))); evalcond[1]=((0.41)+x1379+x1383+(((0.11875)*cj2))+(((-1.0)*x1382*x1388))+(((-1.0)*x1382*x1385))); evalcond[2]=((-0.0853195)+((x1381*x1388))+((x1381*x1385))+(((-0.2375)*pz))+(((-1.0)*pp))+(((-0.097375)*cj2))+(((-0.82)*x1383))); evalcond[3]=(((sj2*x1379))+(((0.0114)*x1380))+(((0.41)*sj2))+(((-1.0)*cj2*cj3*x1376))+(((-1.0)*x1385))+(((-1.0)*x1388))); evalcond[4]=((-0.0114)+((x1380*x1388))+((x1380*x1385))+((cj3*x1386))+((sj3*x1378))+(((-1.0)*x1377*x1387))+((sj3*x1384))); evalcond[5]=((((-1.0)*x1377*x1389))+(((-1.0)*sj3*x1387))+(((-1.0)*x1376))+(((-1.0)*cj2*x1377*x1385))+((sj3*x1386))+(((-1.0)*cj3*x1384))+(((-1.0)*x1377*x1378))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } } } } else { { IkReal j1array[2], cj1array[2], sj1array[2]; bool j1valid[2]={false}; _nj1 = 2; CheckValue<IkReal> x1392 = IKatan2WithCheck(IkReal(py),IkReal(((-1.0)*px)),IKFAST_ATAN2_MAGTHRESH); if(!x1392.valid){ continue; } IkReal x1390=((1.0)*(x1392.value)); if((((px*px)+(py*py))) < -0.00001) continue; CheckValue<IkReal> x1393=IKPowWithIntegerCheck(IKabs(IKsqrt(((px*px)+(py*py)))),-1); if(!x1393.valid){ continue; } if( (((x1393.value)*(((((0.31105)*sj3*sj4))+(((0.0114)*cj3)))))) < -1-IKFAST_SINCOS_THRESH || (((x1393.value)*(((((0.31105)*sj3*sj4))+(((0.0114)*cj3)))))) > 1+IKFAST_SINCOS_THRESH ) continue; IkReal x1391=IKasin(((x1393.value)*(((((0.31105)*sj3*sj4))+(((0.0114)*cj3)))))); j1array[0]=((((-1.0)*x1391))+(((-1.0)*x1390))); sj1array[0]=IKsin(j1array[0]); cj1array[0]=IKcos(j1array[0]); j1array[1]=((3.14159265358979)+x1391+(((-1.0)*x1390))); sj1array[1]=IKsin(j1array[1]); cj1array[1]=IKcos(j1array[1]); if( j1array[0] > IKPI ) { j1array[0]-=IK2PI; } else if( j1array[0] < -IKPI ) { j1array[0]+=IK2PI; } j1valid[0] = true; if( j1array[1] > IKPI ) { j1array[1]-=IK2PI; } else if( j1array[1] < -IKPI ) { j1array[1]+=IK2PI; } j1valid[1] = true; for(int ij1 = 0; ij1 < 2; ++ij1) { if( !j1valid[ij1] ) { continue; } _ij1[0] = ij1; _ij1[1] = -1; for(int iij1 = ij1+1; iij1 < 2; ++iij1) { if( j1valid[iij1] && IKabs(cj1array[ij1]-cj1array[iij1]) < IKFAST_SOLUTION_THRESH && IKabs(sj1array[ij1]-sj1array[iij1]) < IKFAST_SOLUTION_THRESH ) { j1valid[iij1]=false; _ij1[1] = iij1; break; } } j1 = j1array[ij1]; cj1 = cj1array[ij1]; sj1 = sj1array[ij1]; { IkReal j2eval[2]; IkReal x1394=(py*sj1); IkReal x1395=(cj1*px); IkReal x1396=(cj3*sj4); IkReal x1397=(pz*sj3); IkReal x1398=((0.31105)*cj4); IkReal x1399=((229.769159741459)*cj4); j2eval[0]=((((-302.86241920591)*x1394))+(((-302.86241920591)*x1395))+sj3+(((8.42105263157895)*x1397))+(((-1.0)*x1394*x1399))+(((-1.0)*x1395*x1399))+(((-27.2850877192982)*x1396))+(((-229.769159741459)*pz*x1396))); j2eval[1]=IKsign(((((0.0114)*x1397))+(((-1.0)*x1394*x1398))+(((-1.0)*x1395*x1398))+(((0.00135375)*sj3))+(((-0.41)*x1394))+(((-0.41)*x1395))+(((-0.31105)*pz*x1396))+(((-0.0369371875)*x1396)))); if( IKabs(j2eval[0]) < 0.0000010000000000 || IKabs(j2eval[1]) < 0.0000010000000000 ) { { IkReal j2eval[2]; IkReal x1400=cj4*cj4; IkReal x1401=cj3*cj3; IkReal x1402=(cj3*sj3*sj4); IkReal x1403=(x1400*x1401); j2eval[0]=((-23.7212892382056)+(((-35.9649122807018)*cj4))+(((-13.6242188315186)*x1401))+(((13.6425438596491)*x1403))+x1402+(((-13.6425438596491)*x1400))); j2eval[1]=IKsign(((-0.16822996)+(((0.00709194)*x1402))+(((-0.0966221425)*x1401))+(((0.0967521025)*x1403))+(((-0.255061)*cj4))+(((-0.0967521025)*x1400)))); if( IKabs(j2eval[0]) < 0.0000010000000000 || IKabs(j2eval[1]) < 0.0000010000000000 ) { { IkReal j2eval[2]; IkReal x1404=(cj1*px); IkReal x1405=(cj4*pz); IkReal x1406=(cj3*sj4); IkReal x1407=(py*sj1); IkReal x1408=(sj3*x1407); j2eval[0]=((4.27083333333333)+(((3.24010416666667)*cj4))+(((27.2850877192982)*x1405))+((sj3*x1404))+(((35.9649122807018)*pz))+x1408+(((-27.2850877192982)*x1406*x1407))+(((-27.2850877192982)*x1404*x1406))); j2eval[1]=IKsign(((0.0486875)+(((0.31105)*x1405))+(((-0.31105)*x1404*x1406))+(((0.0114)*x1408))+(((-0.31105)*x1406*x1407))+(((0.0114)*sj3*x1404))+(((0.41)*pz))+(((0.0369371875)*cj4)))); if( IKabs(j2eval[0]) < 0.0000010000000000 || IKabs(j2eval[1]) < 0.0000010000000000 ) { continue; // no branches [j2] } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; IkReal x1409=cj1*cj1; IkReal x1410=py*py; IkReal x1411=(cj3*sj4); IkReal x1412=(py*sj1); IkReal x1413=(cj1*px); IkReal x1414=((0.0114)*sj3); CheckValue<IkReal> x1415 = IKatan2WithCheck(IkReal((((pz*x1413))+((pz*x1412))+(((0.00354597)*cj4*sj3))+(((0.11875)*x1413))+(((0.11875)*x1412))+(((-0.0967521025)*cj4*x1411))+(((0.004674)*sj3))+(((-0.1275305)*x1411)))),IkReal(((-0.1681)+(((2.0)*x1412*x1413))+(((-0.255061)*cj4))+x1410+(((-1.0)*x1409*x1410))+((x1409*(px*px)))+(((-0.0967521025)*(cj4*cj4))))),IKFAST_ATAN2_MAGTHRESH); if(!x1415.valid){ continue; } CheckValue<IkReal> x1416=IKPowWithIntegerCheck(IKsign(((0.0486875)+((x1413*x1414))+((x1412*x1414))+(((0.31105)*cj4*pz))+(((0.41)*pz))+(((-0.31105)*x1411*x1412))+(((-0.31105)*x1411*x1413))+(((0.0369371875)*cj4)))),-1); if(!x1416.valid){ continue; } j2array[0]=((-1.5707963267949)+(x1415.value)+(((1.5707963267949)*(x1416.value)))); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[6]; IkReal x1417=IKcos(j2); IkReal x1418=IKsin(j2); IkReal x1419=((1.0)*cj3); IkReal x1420=(px*sj1); IkReal x1421=((0.31105)*cj4); IkReal x1422=(cj1*px); IkReal x1423=(py*sj1); IkReal x1424=(cj1*py); IkReal x1425=(pz*x1418); IkReal x1426=(pz*x1417); IkReal x1427=(sj3*x1417); IkReal x1428=((0.31105)*cj3*sj4); IkReal x1429=(sj3*x1418); IkReal x1430=((1.0)*x1418); IkReal x1431=((0.82)*x1418); evalcond[0]=((0.41)+(((0.11875)*x1417))+(((-1.0)*x1422*x1430))+x1421+x1426+(((-1.0)*x1423*x1430))); evalcond[1]=((-0.11875)+(((-1.0)*x1417*x1421))+(((-0.41)*x1417))+(((-1.0)*x1418*x1428))+(((-1.0)*pz))+(((0.0114)*x1429))); evalcond[2]=((-0.0853195)+(((-0.2375)*pz))+(((-1.0)*pp))+(((-0.097375)*x1417))+(((-0.82)*x1426))+((x1422*x1431))+((x1423*x1431))); evalcond[3]=((((-1.0)*x1417*x1428))+(((-1.0)*x1423))+(((-1.0)*x1422))+((x1418*x1421))+(((0.41)*x1418))+(((0.0114)*x1427))); evalcond[4]=((-0.0114)+((x1422*x1427))+((x1423*x1427))+((cj3*x1420))+(((-1.0)*x1419*x1424))+(((0.11875)*x1429))+((sj3*x1425))); evalcond[5]=((((-1.0)*x1417*x1419*x1422))+(((-1.0)*x1417*x1419*x1423))+(((-1.0)*sj3*x1424))+(((-1.0)*x1419*x1425))+(((-0.11875)*cj3*x1418))+((sj3*x1420))+(((-0.31105)*sj4))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; IkReal x1432=cj3*cj3; IkReal x1433=cj4*cj4; IkReal x1434=(py*sj1); IkReal x1435=(cj3*sj4); IkReal x1436=((0.31105)*pz); IkReal x1437=(cj1*px); IkReal x1438=((0.0114)*sj3); IkReal x1439=((0.31105)*cj4); IkReal x1440=((0.0967521025)*x1433); CheckValue<IkReal> x1441=IKPowWithIntegerCheck(IKsign(((-0.16822996)+(((0.00709194)*sj3*x1435))+(((-0.0966221425)*x1432))+(((-0.255061)*cj4))+(((-1.0)*x1440))+((x1432*x1440)))),-1); if(!x1441.valid){ continue; } CheckValue<IkReal> x1442 = IKatan2WithCheck(IkReal(((((-1.0)*x1437*x1439))+(((-1.0)*x1434*x1439))+(((-0.41)*x1437))+(((-0.41)*x1434))+((x1435*x1436))+(((-0.00135375)*sj3))+(((-1.0)*pz*x1438))+(((0.0369371875)*x1435)))),IkReal(((0.0486875)+(((-1.0)*x1437*x1438))+(((0.31105)*x1434*x1435))+(((-1.0)*x1434*x1438))+((cj4*x1436))+(((0.31105)*x1435*x1437))+(((0.41)*pz))+(((0.0369371875)*cj4)))),IKFAST_ATAN2_MAGTHRESH); if(!x1442.valid){ continue; } j2array[0]=((-1.5707963267949)+(((1.5707963267949)*(x1441.value)))+(x1442.value)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[6]; IkReal x1443=IKcos(j2); IkReal x1444=IKsin(j2); IkReal x1445=((1.0)*cj3); IkReal x1446=(px*sj1); IkReal x1447=((0.31105)*cj4); IkReal x1448=(cj1*px); IkReal x1449=(py*sj1); IkReal x1450=(cj1*py); IkReal x1451=(pz*x1444); IkReal x1452=(pz*x1443); IkReal x1453=(sj3*x1443); IkReal x1454=((0.31105)*cj3*sj4); IkReal x1455=(sj3*x1444); IkReal x1456=((1.0)*x1444); IkReal x1457=((0.82)*x1444); evalcond[0]=((0.41)+(((-1.0)*x1448*x1456))+x1452+x1447+(((0.11875)*x1443))+(((-1.0)*x1449*x1456))); evalcond[1]=((-0.11875)+(((0.0114)*x1455))+(((-1.0)*pz))+(((-0.41)*x1443))+(((-1.0)*x1443*x1447))+(((-1.0)*x1444*x1454))); evalcond[2]=((-0.0853195)+(((-0.097375)*x1443))+(((-0.82)*x1452))+(((-0.2375)*pz))+((x1448*x1457))+(((-1.0)*pp))+((x1449*x1457))); evalcond[3]=(((x1444*x1447))+(((0.41)*x1444))+(((-1.0)*x1449))+(((-1.0)*x1448))+(((0.0114)*x1453))+(((-1.0)*x1443*x1454))); evalcond[4]=((-0.0114)+(((0.11875)*x1455))+((sj3*x1451))+(((-1.0)*x1445*x1450))+((x1448*x1453))+((cj3*x1446))+((x1449*x1453))); evalcond[5]=((((-1.0)*sj3*x1450))+(((-1.0)*x1445*x1451))+(((-0.11875)*cj3*x1444))+((sj3*x1446))+(((-1.0)*x1443*x1445*x1448))+(((-1.0)*x1443*x1445*x1449))+(((-0.31105)*sj4))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j2array[1], cj2array[1], sj2array[1]; bool j2valid[1]={false}; _nj2 = 1; IkReal x1458=(cj1*px); IkReal x1459=(cj3*sj4); IkReal x1460=(py*sj1); IkReal x1461=((0.31105)*cj4); CheckValue<IkReal> x1462=IKPowWithIntegerCheck(IKsign(((((-0.41)*x1458))+(((-1.0)*x1458*x1461))+(((0.0114)*pz*sj3))+(((0.00135375)*sj3))+(((-0.0369371875)*x1459))+(((-0.41)*x1460))+(((-1.0)*x1460*x1461))+(((-0.31105)*pz*x1459)))),-1); if(!x1462.valid){ continue; } CheckValue<IkReal> x1463 = IKatan2WithCheck(IkReal(((-0.1539984375)+(((0.2375)*pz))+(pz*pz)+(((-0.255061)*cj4))+(((-0.0967521025)*(cj4*cj4))))),IkReal(((((0.11875)*x1458))+((pz*x1460))+(((-0.004674)*sj3))+((pz*x1458))+(((0.11875)*x1460))+(((0.0967521025)*cj4*x1459))+(((0.1275305)*x1459))+(((-0.00354597)*cj4*sj3)))),IKFAST_ATAN2_MAGTHRESH); if(!x1463.valid){ continue; } j2array[0]=((-1.5707963267949)+(((1.5707963267949)*(x1462.value)))+(x1463.value)); sj2array[0]=IKsin(j2array[0]); cj2array[0]=IKcos(j2array[0]); if( j2array[0] > IKPI ) { j2array[0]-=IK2PI; } else if( j2array[0] < -IKPI ) { j2array[0]+=IK2PI; } j2valid[0] = true; for(int ij2 = 0; ij2 < 1; ++ij2) { if( !j2valid[ij2] ) { continue; } _ij2[0] = ij2; _ij2[1] = -1; for(int iij2 = ij2+1; iij2 < 1; ++iij2) { if( j2valid[iij2] && IKabs(cj2array[ij2]-cj2array[iij2]) < IKFAST_SOLUTION_THRESH && IKabs(sj2array[ij2]-sj2array[iij2]) < IKFAST_SOLUTION_THRESH ) { j2valid[iij2]=false; _ij2[1] = iij2; break; } } j2 = j2array[ij2]; cj2 = cj2array[ij2]; sj2 = sj2array[ij2]; { IkReal evalcond[6]; IkReal x1464=IKcos(j2); IkReal x1465=IKsin(j2); IkReal x1466=((1.0)*cj3); IkReal x1467=(px*sj1); IkReal x1468=((0.31105)*cj4); IkReal x1469=(cj1*px); IkReal x1470=(py*sj1); IkReal x1471=(cj1*py); IkReal x1472=(pz*x1465); IkReal x1473=(pz*x1464); IkReal x1474=(sj3*x1464); IkReal x1475=((0.31105)*cj3*sj4); IkReal x1476=(sj3*x1465); IkReal x1477=((1.0)*x1465); IkReal x1478=((0.82)*x1465); evalcond[0]=((0.41)+(((-1.0)*x1470*x1477))+(((0.11875)*x1464))+(((-1.0)*x1469*x1477))+x1468+x1473); evalcond[1]=((-0.11875)+(((-1.0)*x1464*x1468))+(((-1.0)*x1465*x1475))+(((-1.0)*pz))+(((-0.41)*x1464))+(((0.0114)*x1476))); evalcond[2]=((-0.0853195)+(((-0.2375)*pz))+(((-0.82)*x1473))+((x1470*x1478))+(((-1.0)*pp))+(((-0.097375)*x1464))+((x1469*x1478))); evalcond[3]=(((x1465*x1468))+(((-1.0)*x1470))+(((0.41)*x1465))+(((-1.0)*x1469))+(((0.0114)*x1474))+(((-1.0)*x1464*x1475))); evalcond[4]=((-0.0114)+((cj3*x1467))+((x1470*x1474))+((sj3*x1472))+(((-1.0)*x1466*x1471))+((x1469*x1474))+(((0.11875)*x1476))); evalcond[5]=(((sj3*x1467))+(((-1.0)*x1464*x1466*x1469))+(((-1.0)*x1464*x1466*x1470))+(((-1.0)*sj3*x1471))+(((-1.0)*x1466*x1472))+(((-0.11875)*cj3*x1465))+(((-0.31105)*sj4))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } } } } } } return solutions.GetNumSolutions()>0; } inline void rotationfunction0(IkSolutionListBase<IkReal>& solutions) { for(int rotationiter = 0; rotationiter < 1; ++rotationiter) { IkReal x136=((1.0)*sj2); IkReal x137=((1.0)*sj3); IkReal x138=(cj2*cj4); IkReal x139=(cj1*sj3); IkReal x140=(sj2*sj4); IkReal x141=(cj2*sj4); IkReal x142=(((cj3*x138))+x140); IkReal x143=((((-1.0)*x141))+((cj3*cj4*sj2))); IkReal x144=((((-1.0)*cj2*sj1*x137))+((cj1*cj3))); IkReal x145=(((cj3*x141))+(((-1.0)*cj4*x136))); IkReal x146=(((cj3*x140))+x138); IkReal x147=((((-1.0)*cj1*cj2*x137))+(((-1.0)*cj3*sj1))); IkReal x148=(((sj1*x142))+((cj4*x139))); IkReal x149=(((cj1*x142))+(((-1.0)*cj4*sj1*x137))); IkReal x150=((((-1.0)*sj1*sj4*x137))+((cj1*x145))); IkReal x151=(((sj1*x145))+((sj4*x139))); new_r00=(((r20*x143))+((r00*x149))+((r10*x148))); new_r01=(((r01*x149))+((r21*x143))+((r11*x148))); new_r02=(((r02*x149))+((r22*x143))+((r12*x148))); new_r10=(((r00*x147))+(((-1.0)*r20*sj3*x136))+((r10*x144))); new_r11=(((r01*x147))+(((-1.0)*r21*sj3*x136))+((r11*x144))); new_r12=((((-1.0)*r22*sj3*x136))+((r02*x147))+((r12*x144))); new_r20=(((r20*x146))+((r00*x150))+((r10*x151))); new_r21=(((r01*x150))+((r21*x146))+((r11*x151))); new_r22=(((r02*x150))+((r22*x146))+((r12*x151))); { IkReal j6array[2], cj6array[2], sj6array[2]; bool j6valid[2]={false}; _nj6 = 2; cj6array[0]=new_r22; if( cj6array[0] >= -1-IKFAST_SINCOS_THRESH && cj6array[0] <= 1+IKFAST_SINCOS_THRESH ) { j6valid[0] = j6valid[1] = true; j6array[0] = IKacos(cj6array[0]); sj6array[0] = IKsin(j6array[0]); cj6array[1] = cj6array[0]; j6array[1] = -j6array[0]; sj6array[1] = -sj6array[0]; } else if( isnan(cj6array[0]) ) { // probably any value will work j6valid[0] = true; cj6array[0] = 1; sj6array[0] = 0; j6array[0] = 0; } for(int ij6 = 0; ij6 < 2; ++ij6) { if( !j6valid[ij6] ) { continue; } _ij6[0] = ij6; _ij6[1] = -1; for(int iij6 = ij6+1; iij6 < 2; ++iij6) { if( j6valid[iij6] && IKabs(cj6array[ij6]-cj6array[iij6]) < IKFAST_SOLUTION_THRESH && IKabs(sj6array[ij6]-sj6array[iij6]) < IKFAST_SOLUTION_THRESH ) { j6valid[iij6]=false; _ij6[1] = iij6; break; } } j6 = j6array[ij6]; cj6 = cj6array[ij6]; sj6 = sj6array[ij6]; { IkReal j7eval[3]; j7eval[0]=sj6; j7eval[1]=IKsign(sj6); j7eval[2]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(j7eval[0]) < 0.0000010000000000 || IKabs(j7eval[1]) < 0.0000010000000000 || IKabs(j7eval[2]) < 0.0000010000000000 ) { { IkReal j5eval[3]; j5eval[0]=sj6; j5eval[1]=((IKabs(new_r12))+(IKabs(new_r02))); j5eval[2]=IKsign(sj6); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 || IKabs(j5eval[2]) < 0.0000010000000000 ) { { IkReal j5eval[2]; j5eval[0]=new_r12; j5eval[1]=sj6; if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[5]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j6))), 6.28318530717959))); evalcond[1]=new_r02; evalcond[2]=new_r12; evalcond[3]=new_r20; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; IkReal j7mul = 1; j7=0; j5mul=-1.0; if( IKabs(((-1.0)*new_r10)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r00)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r10))+IKsqr(((-1.0)*new_r00))-1) <= IKFAST_SINCOS_THRESH ) continue; j5=IKatan2(((-1.0)*new_r10), ((-1.0)*new_r00)); { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].fmul = j5mul; vinfos[5].freeind = 0; vinfos[5].maxsolutions = 0; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].fmul = j7mul; vinfos[7].freeind = 0; vinfos[7].maxsolutions = 0; std::vector<int> vfree(1); vfree[0] = 7; solutions.AddSolution(vinfos,vfree); } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j6)))), 6.28318530717959))); evalcond[1]=new_r02; evalcond[2]=new_r12; evalcond[3]=new_r20; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; IkReal j7mul = 1; j7=0; j5mul=1.0; if( IKabs(new_r10) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r11)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r10)+IKsqr(((-1.0)*new_r11))-1) <= IKFAST_SINCOS_THRESH ) continue; j5=IKatan2(new_r10, ((-1.0)*new_r11)); { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].fmul = j5mul; vinfos[5].freeind = 0; vinfos[5].maxsolutions = 0; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].fmul = j7mul; vinfos[7].freeind = 0; vinfos[7].maxsolutions = 0; std::vector<int> vfree(1); vfree[0] = 7; solutions.AddSolution(vinfos,vfree); } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5eval[1]; new_r21=0; new_r20=0; new_r02=0; new_r12=0; IkReal x152=new_r22*new_r22; IkReal x153=((16.0)*new_r10); IkReal x154=((16.0)*new_r01); IkReal x155=((16.0)*new_r22); IkReal x156=((8.0)*new_r11); IkReal x157=((8.0)*new_r00); IkReal x158=(x152*x153); IkReal x159=(x152*x154); j5eval[0]=((IKabs(((((-1.0)*x158))+x153)))+(IKabs((((x152*x156))+(((-1.0)*new_r22*x157)))))+(IKabs(((((-1.0)*x157))+((new_r22*x156)))))+(IKabs(((((-1.0)*x153))+x158)))+(IKabs(((((-1.0)*x159))+x154)))+(IKabs(((((-32.0)*new_r00*x152))+((new_r11*x155))+(((16.0)*new_r00)))))+(IKabs(((((-1.0)*x154))+x159)))+(IKabs(((((32.0)*new_r11))+(((-1.0)*new_r00*x155))+(((-16.0)*new_r11*x152)))))); if( IKabs(j5eval[0]) < 0.0000000100000000 ) { continue; // no branches [j5, j7] } else { IkReal op[4+1], zeror[4]; int numroots; IkReal j5evalpoly[1]; IkReal x160=new_r22*new_r22; IkReal x161=((16.0)*new_r10); IkReal x162=(new_r11*new_r22); IkReal x163=(x160*x161); IkReal x164=((((8.0)*x162))+(((-8.0)*new_r00))); op[0]=x164; op[1]=((((-1.0)*x163))+x161); op[2]=((((-32.0)*new_r00*x160))+(((16.0)*new_r00))+(((16.0)*x162))); op[3]=((((-1.0)*x161))+x163); op[4]=x164; polyroots4(op,zeror,numroots); IkReal j5array[4], cj5array[4], sj5array[4], tempj5array[1]; int numsolutions = 0; for(int ij5 = 0; ij5 < numroots; ++ij5) { IkReal htj5 = zeror[ij5]; tempj5array[0]=((2.0)*(atan(htj5))); for(int kj5 = 0; kj5 < 1; ++kj5) { j5array[numsolutions] = tempj5array[kj5]; if( j5array[numsolutions] > IKPI ) { j5array[numsolutions]-=IK2PI; } else if( j5array[numsolutions] < -IKPI ) { j5array[numsolutions]+=IK2PI; } sj5array[numsolutions] = IKsin(j5array[numsolutions]); cj5array[numsolutions] = IKcos(j5array[numsolutions]); numsolutions++; } } bool j5valid[4]={true,true,true,true}; _nj5 = 4; for(int ij5 = 0; ij5 < numsolutions; ++ij5) { if( !j5valid[ij5] ) { continue; } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; htj5 = IKtan(j5/2); IkReal x165=((16.0)*new_r01); IkReal x166=new_r22*new_r22; IkReal x167=(new_r00*new_r22); IkReal x168=((8.0)*x167); IkReal x169=(new_r11*x166); IkReal x170=(x165*x166); IkReal x171=((8.0)*x169); j5evalpoly[0]=((((htj5*htj5*htj5*htj5)*(((((-1.0)*x168))+x171))))+(((-1.0)*x168))+x171+(((htj5*htj5)*(((((32.0)*new_r11))+(((-16.0)*x167))+(((-16.0)*x169))))))+((htj5*(((((-1.0)*x170))+x165))))+(((htj5*htj5*htj5)*(((((-1.0)*x165))+x170))))); if( IKabs(j5evalpoly[0]) > 0.0000001000000000 ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < numsolutions; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } { IkReal j7eval[3]; new_r21=0; new_r20=0; new_r02=0; new_r12=0; IkReal x172=cj5*cj5; IkReal x173=new_r22*new_r22; IkReal x174=((1.0)*new_r10); IkReal x175=(new_r22*sj5); IkReal x176=(x173+x172+(((-1.0)*x172*x173))); j7eval[0]=x176; j7eval[1]=((IKabs(((((-1.0)*cj5*x174))+((new_r11*x175)))))+(IKabs(((((-1.0)*x174*x175))+(((-1.0)*cj5*new_r11)))))); j7eval[2]=IKsign(x176); if( IKabs(j7eval[0]) < 0.0000010000000000 || IKabs(j7eval[1]) < 0.0000010000000000 || IKabs(j7eval[2]) < 0.0000010000000000 ) { { IkReal j7eval[1]; new_r21=0; new_r20=0; new_r02=0; new_r12=0; j7eval[0]=new_r22; if( IKabs(j7eval[0]) < 0.0000010000000000 ) { { IkReal j7eval[1]; new_r21=0; new_r20=0; new_r02=0; new_r12=0; j7eval[0]=cj5; if( IKabs(j7eval[0]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j5)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; if( IKabs(new_r00) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r01) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r00)+IKsqr(new_r01)-1) <= IKFAST_SINCOS_THRESH ) continue; j7array[0]=IKatan2(new_r00, new_r01); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[4]; IkReal x177=IKsin(j7); IkReal x178=IKcos(j7); evalcond[0]=x177; evalcond[1]=((-1.0)*x178); evalcond[2]=(x177+(((-1.0)*new_r00))); evalcond[3]=(x178+(((-1.0)*new_r01))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j5)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; if( IKabs(((-1.0)*new_r00)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r01)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r00))+IKsqr(((-1.0)*new_r01))-1) <= IKFAST_SINCOS_THRESH ) continue; j7array[0]=IKatan2(((-1.0)*new_r00), ((-1.0)*new_r01)); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[4]; IkReal x179=IKsin(j7); IkReal x180=IKcos(j7); evalcond[0]=x179; evalcond[1]=(x179+new_r00); evalcond[2]=(x180+new_r01); evalcond[3]=((-1.0)*x180); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { IkReal x181=new_r22*new_r22; CheckValue<IkReal> x182=IKPowWithIntegerCheck(((1.0)+(((-1.0)*x181))),-1); if(!x182.valid){ continue; } if((((-1.0)*x181*(x182.value))) < -0.00001) continue; IkReal gconst12=IKsqrt(((-1.0)*x181*(x182.value))); evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.0)+(IKsign(sj5)))))+(IKabs((cj5+(((-1.0)*gconst12)))))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j7eval[1]; IkReal x183=new_r22*new_r22; new_r21=0; new_r20=0; new_r02=0; new_r12=0; if((((1.0)+(((-1.0)*(gconst12*gconst12))))) < -0.00001) continue; sj5=IKsqrt(((1.0)+(((-1.0)*(gconst12*gconst12))))); cj5=gconst12; if( (gconst12) < -1-IKFAST_SINCOS_THRESH || (gconst12) > 1+IKFAST_SINCOS_THRESH ) continue; j5=IKacos(gconst12); CheckValue<IkReal> x184=IKPowWithIntegerCheck(((1.0)+(((-1.0)*x183))),-1); if(!x184.valid){ continue; } if((((-1.0)*x183*(x184.value))) < -0.00001) continue; IkReal gconst12=IKsqrt(((-1.0)*x183*(x184.value))); j7eval[0]=((IKabs(new_r11))+(IKabs(new_r10))); if( IKabs(j7eval[0]) < 0.0000010000000000 ) { { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; CheckValue<IkReal> x185=IKPowWithIntegerCheck(gconst12,-1); if(!x185.valid){ continue; } if((((1.0)+(((-1.0)*(gconst12*gconst12))))) < -0.00001) continue; if( IKabs(((-1.0)*new_r10*(x185.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs((((new_r01*(IKsqrt(((1.0)+(((-1.0)*(gconst12*gconst12))))))))+(((-1.0)*gconst12*new_r11)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r10*(x185.value)))+IKsqr((((new_r01*(IKsqrt(((1.0)+(((-1.0)*(gconst12*gconst12))))))))+(((-1.0)*gconst12*new_r11))))-1) <= IKFAST_SINCOS_THRESH ) continue; j7array[0]=IKatan2(((-1.0)*new_r10*(x185.value)), (((new_r01*(IKsqrt(((1.0)+(((-1.0)*(gconst12*gconst12))))))))+(((-1.0)*gconst12*new_r11)))); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[8]; IkReal x186=IKsin(j7); IkReal x187=IKcos(j7); if((((1.0)+(((-1.0)*(gconst12*gconst12))))) < -0.00001) continue; IkReal x188=IKsqrt(((1.0)+(((-1.0)*(gconst12*gconst12))))); IkReal x189=((1.0)*x188); evalcond[0]=x186; evalcond[1]=((-1.0)*x187); evalcond[2]=(((gconst12*x186))+new_r10); evalcond[3]=(((gconst12*x187))+new_r11); evalcond[4]=((((-1.0)*x186*x189))+new_r00); evalcond[5]=((((-1.0)*x187*x189))+new_r01); evalcond[6]=(x186+(((-1.0)*new_r00*x189))+((gconst12*new_r10))); evalcond[7]=(x187+(((-1.0)*new_r01*x189))+((gconst12*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } else { { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; CheckValue<IkReal> x190 = IKatan2WithCheck(IkReal(((-1.0)*new_r10)),IkReal(((-1.0)*new_r11)),IKFAST_ATAN2_MAGTHRESH); if(!x190.valid){ continue; } CheckValue<IkReal> x191=IKPowWithIntegerCheck(IKsign(gconst12),-1); if(!x191.valid){ continue; } j7array[0]=((-1.5707963267949)+(x190.value)+(((1.5707963267949)*(x191.value)))); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[8]; IkReal x192=IKsin(j7); IkReal x193=IKcos(j7); if((((1.0)+(((-1.0)*(gconst12*gconst12))))) < -0.00001) continue; IkReal x194=IKsqrt(((1.0)+(((-1.0)*(gconst12*gconst12))))); IkReal x195=((1.0)*x194); evalcond[0]=x192; evalcond[1]=((-1.0)*x193); evalcond[2]=(((gconst12*x192))+new_r10); evalcond[3]=(((gconst12*x193))+new_r11); evalcond[4]=((((-1.0)*x192*x195))+new_r00); evalcond[5]=(new_r01+(((-1.0)*x193*x195))); evalcond[6]=(x192+(((-1.0)*new_r00*x195))+((gconst12*new_r10))); evalcond[7]=(x193+(((-1.0)*new_r01*x195))+((gconst12*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { IkReal x196=new_r22*new_r22; CheckValue<IkReal> x197=IKPowWithIntegerCheck(((1.0)+(((-1.0)*x196))),-1); if(!x197.valid){ continue; } if((((-1.0)*x196*(x197.value))) < -0.00001) continue; IkReal gconst12=IKsqrt(((-1.0)*x196*(x197.value))); evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs((cj5+(((-1.0)*gconst12)))))+(IKabs(((1.0)+(IKsign(sj5)))))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j7eval[1]; IkReal x198=new_r22*new_r22; new_r21=0; new_r20=0; new_r02=0; new_r12=0; if((((1.0)+(((-1.0)*(gconst12*gconst12))))) < -0.00001) continue; sj5=((-1.0)*(IKsqrt(((1.0)+(((-1.0)*(gconst12*gconst12))))))); cj5=gconst12; if( (gconst12) < -1-IKFAST_SINCOS_THRESH || (gconst12) > 1+IKFAST_SINCOS_THRESH ) continue; j5=((-1.0)*(IKacos(gconst12))); CheckValue<IkReal> x199=IKPowWithIntegerCheck(((1.0)+(((-1.0)*x198))),-1); if(!x199.valid){ continue; } if((((-1.0)*x198*(x199.value))) < -0.00001) continue; IkReal gconst12=IKsqrt(((-1.0)*x198*(x199.value))); j7eval[0]=((IKabs(new_r11))+(IKabs(new_r10))); if( IKabs(j7eval[0]) < 0.0000010000000000 ) { { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; CheckValue<IkReal> x200=IKPowWithIntegerCheck(gconst12,-1); if(!x200.valid){ continue; } if((((1.0)+(((-1.0)*(gconst12*gconst12))))) < -0.00001) continue; if( IKabs(((-1.0)*new_r10*(x200.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((((-1.0)*new_r01*(IKsqrt(((1.0)+(((-1.0)*(gconst12*gconst12))))))))+(((-1.0)*gconst12*new_r11)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r10*(x200.value)))+IKsqr(((((-1.0)*new_r01*(IKsqrt(((1.0)+(((-1.0)*(gconst12*gconst12))))))))+(((-1.0)*gconst12*new_r11))))-1) <= IKFAST_SINCOS_THRESH ) continue; j7array[0]=IKatan2(((-1.0)*new_r10*(x200.value)), ((((-1.0)*new_r01*(IKsqrt(((1.0)+(((-1.0)*(gconst12*gconst12))))))))+(((-1.0)*gconst12*new_r11)))); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[8]; IkReal x201=IKsin(j7); IkReal x202=IKcos(j7); if((((1.0)+(((-1.0)*(gconst12*gconst12))))) < -0.00001) continue; IkReal x203=IKsqrt(((1.0)+(((-1.0)*(gconst12*gconst12))))); evalcond[0]=x201; evalcond[1]=((-1.0)*x202); evalcond[2]=(((gconst12*x201))+new_r10); evalcond[3]=(((gconst12*x202))+new_r11); evalcond[4]=(((x201*x203))+new_r00); evalcond[5]=(((x202*x203))+new_r01); evalcond[6]=(((new_r00*x203))+x201+((gconst12*new_r10))); evalcond[7]=(((new_r01*x203))+x202+((gconst12*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } else { { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; CheckValue<IkReal> x204 = IKatan2WithCheck(IkReal(((-1.0)*new_r10)),IkReal(((-1.0)*new_r11)),IKFAST_ATAN2_MAGTHRESH); if(!x204.valid){ continue; } CheckValue<IkReal> x205=IKPowWithIntegerCheck(IKsign(gconst12),-1); if(!x205.valid){ continue; } j7array[0]=((-1.5707963267949)+(x204.value)+(((1.5707963267949)*(x205.value)))); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[8]; IkReal x206=IKsin(j7); IkReal x207=IKcos(j7); if((((1.0)+(((-1.0)*(gconst12*gconst12))))) < -0.00001) continue; IkReal x208=IKsqrt(((1.0)+(((-1.0)*(gconst12*gconst12))))); evalcond[0]=x206; evalcond[1]=((-1.0)*x207); evalcond[2]=(((gconst12*x206))+new_r10); evalcond[3]=(((gconst12*x207))+new_r11); evalcond[4]=(new_r00+((x206*x208))); evalcond[5]=(new_r01+((x207*x208))); evalcond[6]=(((new_r00*x208))+x206+((gconst12*new_r10))); evalcond[7]=(((new_r01*x208))+x207+((gconst12*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { IkReal x209=new_r22*new_r22; CheckValue<IkReal> x210=IKPowWithIntegerCheck(((1.0)+(((-1.0)*x209))),-1); if(!x210.valid){ continue; } if((((-1.0)*x209*(x210.value))) < -0.00001) continue; IkReal gconst13=((-1.0)*(IKsqrt(((-1.0)*x209*(x210.value))))); evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.0)+(IKsign(sj5)))))+(IKabs((cj5+(((-1.0)*gconst13)))))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j7eval[1]; IkReal x211=new_r22*new_r22; new_r21=0; new_r20=0; new_r02=0; new_r12=0; if((((1.0)+(((-1.0)*(gconst13*gconst13))))) < -0.00001) continue; sj5=IKsqrt(((1.0)+(((-1.0)*(gconst13*gconst13))))); cj5=gconst13; if( (gconst13) < -1-IKFAST_SINCOS_THRESH || (gconst13) > 1+IKFAST_SINCOS_THRESH ) continue; j5=IKacos(gconst13); CheckValue<IkReal> x212=IKPowWithIntegerCheck(((1.0)+(((-1.0)*x211))),-1); if(!x212.valid){ continue; } if((((-1.0)*x211*(x212.value))) < -0.00001) continue; IkReal gconst13=((-1.0)*(IKsqrt(((-1.0)*x211*(x212.value))))); j7eval[0]=((IKabs(new_r11))+(IKabs(new_r10))); if( IKabs(j7eval[0]) < 0.0000010000000000 ) { { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; CheckValue<IkReal> x213=IKPowWithIntegerCheck(gconst13,-1); if(!x213.valid){ continue; } if((((1.0)+(((-1.0)*(gconst13*gconst13))))) < -0.00001) continue; if( IKabs(((-1.0)*new_r10*(x213.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((((-1.0)*gconst13*new_r11))+((new_r01*(IKsqrt(((1.0)+(((-1.0)*(gconst13*gconst13)))))))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r10*(x213.value)))+IKsqr(((((-1.0)*gconst13*new_r11))+((new_r01*(IKsqrt(((1.0)+(((-1.0)*(gconst13*gconst13))))))))))-1) <= IKFAST_SINCOS_THRESH ) continue; j7array[0]=IKatan2(((-1.0)*new_r10*(x213.value)), ((((-1.0)*gconst13*new_r11))+((new_r01*(IKsqrt(((1.0)+(((-1.0)*(gconst13*gconst13)))))))))); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[8]; IkReal x214=IKsin(j7); IkReal x215=IKcos(j7); if((((1.0)+(((-1.0)*(gconst13*gconst13))))) < -0.00001) continue; IkReal x216=IKsqrt(((1.0)+(((-1.0)*(gconst13*gconst13))))); IkReal x217=((1.0)*x216); evalcond[0]=x214; evalcond[1]=((-1.0)*x215); evalcond[2]=(((gconst13*x214))+new_r10); evalcond[3]=(((gconst13*x215))+new_r11); evalcond[4]=((((-1.0)*x214*x217))+new_r00); evalcond[5]=(new_r01+(((-1.0)*x215*x217))); evalcond[6]=(x214+((gconst13*new_r10))+(((-1.0)*new_r00*x217))); evalcond[7]=(x215+((gconst13*new_r11))+(((-1.0)*new_r01*x217))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } else { { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; CheckValue<IkReal> x218 = IKatan2WithCheck(IkReal(((-1.0)*new_r10)),IkReal(((-1.0)*new_r11)),IKFAST_ATAN2_MAGTHRESH); if(!x218.valid){ continue; } CheckValue<IkReal> x219=IKPowWithIntegerCheck(IKsign(gconst13),-1); if(!x219.valid){ continue; } j7array[0]=((-1.5707963267949)+(x218.value)+(((1.5707963267949)*(x219.value)))); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[8]; IkReal x220=IKsin(j7); IkReal x221=IKcos(j7); if((((1.0)+(((-1.0)*(gconst13*gconst13))))) < -0.00001) continue; IkReal x222=IKsqrt(((1.0)+(((-1.0)*(gconst13*gconst13))))); IkReal x223=((1.0)*x222); evalcond[0]=x220; evalcond[1]=((-1.0)*x221); evalcond[2]=(((gconst13*x220))+new_r10); evalcond[3]=(((gconst13*x221))+new_r11); evalcond[4]=((((-1.0)*x220*x223))+new_r00); evalcond[5]=((((-1.0)*x221*x223))+new_r01); evalcond[6]=(x220+((gconst13*new_r10))+(((-1.0)*new_r00*x223))); evalcond[7]=((((-1.0)*new_r01*x223))+x221+((gconst13*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { IkReal x224=new_r22*new_r22; CheckValue<IkReal> x225=IKPowWithIntegerCheck(((1.0)+(((-1.0)*x224))),-1); if(!x225.valid){ continue; } if((((-1.0)*x224*(x225.value))) < -0.00001) continue; IkReal gconst13=((-1.0)*(IKsqrt(((-1.0)*x224*(x225.value))))); evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.0)+(IKsign(sj5)))))+(IKabs((cj5+(((-1.0)*gconst13)))))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j7eval[1]; IkReal x226=new_r22*new_r22; new_r21=0; new_r20=0; new_r02=0; new_r12=0; if((((1.0)+(((-1.0)*(gconst13*gconst13))))) < -0.00001) continue; sj5=((-1.0)*(IKsqrt(((1.0)+(((-1.0)*(gconst13*gconst13))))))); cj5=gconst13; if( (gconst13) < -1-IKFAST_SINCOS_THRESH || (gconst13) > 1+IKFAST_SINCOS_THRESH ) continue; j5=((-1.0)*(IKacos(gconst13))); CheckValue<IkReal> x227=IKPowWithIntegerCheck(((1.0)+(((-1.0)*x226))),-1); if(!x227.valid){ continue; } if((((-1.0)*x226*(x227.value))) < -0.00001) continue; IkReal gconst13=((-1.0)*(IKsqrt(((-1.0)*x226*(x227.value))))); j7eval[0]=((IKabs(new_r11))+(IKabs(new_r10))); if( IKabs(j7eval[0]) < 0.0000010000000000 ) { { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; CheckValue<IkReal> x228=IKPowWithIntegerCheck(gconst13,-1); if(!x228.valid){ continue; } if((((1.0)+(((-1.0)*(gconst13*gconst13))))) < -0.00001) continue; if( IKabs(((-1.0)*new_r10*(x228.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((((-1.0)*gconst13*new_r11))+(((-1.0)*new_r01*(IKsqrt(((1.0)+(((-1.0)*(gconst13*gconst13)))))))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r10*(x228.value)))+IKsqr(((((-1.0)*gconst13*new_r11))+(((-1.0)*new_r01*(IKsqrt(((1.0)+(((-1.0)*(gconst13*gconst13))))))))))-1) <= IKFAST_SINCOS_THRESH ) continue; j7array[0]=IKatan2(((-1.0)*new_r10*(x228.value)), ((((-1.0)*gconst13*new_r11))+(((-1.0)*new_r01*(IKsqrt(((1.0)+(((-1.0)*(gconst13*gconst13)))))))))); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[8]; IkReal x229=IKsin(j7); IkReal x230=IKcos(j7); if((((1.0)+(((-1.0)*(gconst13*gconst13))))) < -0.00001) continue; IkReal x231=IKsqrt(((1.0)+(((-1.0)*(gconst13*gconst13))))); evalcond[0]=x229; evalcond[1]=((-1.0)*x230); evalcond[2]=(((gconst13*x229))+new_r10); evalcond[3]=(((gconst13*x230))+new_r11); evalcond[4]=(((x229*x231))+new_r00); evalcond[5]=(((x230*x231))+new_r01); evalcond[6]=(((new_r00*x231))+x229+((gconst13*new_r10))); evalcond[7]=(((new_r01*x231))+x230+((gconst13*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } else { { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; CheckValue<IkReal> x232 = IKatan2WithCheck(IkReal(((-1.0)*new_r10)),IkReal(((-1.0)*new_r11)),IKFAST_ATAN2_MAGTHRESH); if(!x232.valid){ continue; } CheckValue<IkReal> x233=IKPowWithIntegerCheck(IKsign(gconst13),-1); if(!x233.valid){ continue; } j7array[0]=((-1.5707963267949)+(x232.value)+(((1.5707963267949)*(x233.value)))); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[8]; IkReal x234=IKsin(j7); IkReal x235=IKcos(j7); if((((1.0)+(((-1.0)*(gconst13*gconst13))))) < -0.00001) continue; IkReal x236=IKsqrt(((1.0)+(((-1.0)*(gconst13*gconst13))))); evalcond[0]=x234; evalcond[1]=((-1.0)*x235); evalcond[2]=(((gconst13*x234))+new_r10); evalcond[3]=(((gconst13*x235))+new_r11); evalcond[4]=(((x234*x236))+new_r00); evalcond[5]=(((x235*x236))+new_r01); evalcond[6]=(((new_r00*x236))+x234+((gconst13*new_r10))); evalcond[7]=(((new_r01*x236))+x235+((gconst13*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j7] } } while(0); if( bgotonextstatement ) { } } } } } } } } } else { { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; IkReal x237=(new_r01*new_r22); IkReal x238=(cj5*new_r11); CheckValue<IkReal> x239=IKPowWithIntegerCheck(cj5,-1); if(!x239.valid){ continue; } if( IKabs(((x239.value)*((((x237*(cj5*cj5)))+((new_r22*sj5*x238))+(((-1.0)*new_r10))+(((-1.0)*x237)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs((((new_r01*sj5))+(((-1.0)*x238)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((x239.value)*((((x237*(cj5*cj5)))+((new_r22*sj5*x238))+(((-1.0)*new_r10))+(((-1.0)*x237))))))+IKsqr((((new_r01*sj5))+(((-1.0)*x238))))-1) <= IKFAST_SINCOS_THRESH ) continue; j7array[0]=IKatan2(((x239.value)*((((x237*(cj5*cj5)))+((new_r22*sj5*x238))+(((-1.0)*new_r10))+(((-1.0)*x237))))), (((new_r01*sj5))+(((-1.0)*x238)))); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[10]; IkReal x240=IKcos(j7); IkReal x241=IKsin(j7); IkReal x242=(new_r11*sj5); IkReal x243=(new_r10*sj5); IkReal x244=(cj5*new_r22); IkReal x245=((1.0)*new_r01); IkReal x246=((1.0)*new_r22); IkReal x247=((1.0)*new_r00); IkReal x248=((1.0)*x241); IkReal x249=(sj5*x240); evalcond[0]=(((cj5*new_r10))+x241+(((-1.0)*sj5*x247))); evalcond[1]=(((cj5*new_r11))+x240+(((-1.0)*sj5*x245))); evalcond[2]=(((cj5*new_r00))+((new_r22*x240))+x243); evalcond[3]=(((cj5*x241))+((new_r22*x249))+new_r10); evalcond[4]=(((cj5*new_r01))+(((-1.0)*x241*x246))+x242); evalcond[5]=(((x240*x244))+new_r00+(((-1.0)*sj5*x248))); evalcond[6]=(((cj5*x240))+new_r11+(((-1.0)*sj5*x241*x246))); evalcond[7]=((((-1.0)*x242*x246))+x241+(((-1.0)*x244*x245))); evalcond[8]=((((-1.0)*x249))+new_r01+(((-1.0)*x244*x248))); evalcond[9]=((((-1.0)*x240))+(((-1.0)*x243*x246))+(((-1.0)*x244*x247))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; IkReal x250=((1.0)*new_r10); CheckValue<IkReal> x251=IKPowWithIntegerCheck(new_r22,-1); if(!x251.valid){ continue; } if( IKabs(((((-1.0)*cj5*x250))+((new_r00*sj5)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((x251.value)*(((((-1.0)*cj5*new_r00))+(((-1.0)*sj5*x250)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*cj5*x250))+((new_r00*sj5))))+IKsqr(((x251.value)*(((((-1.0)*cj5*new_r00))+(((-1.0)*sj5*x250))))))-1) <= IKFAST_SINCOS_THRESH ) continue; j7array[0]=IKatan2(((((-1.0)*cj5*x250))+((new_r00*sj5))), ((x251.value)*(((((-1.0)*cj5*new_r00))+(((-1.0)*sj5*x250)))))); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[10]; IkReal x252=IKcos(j7); IkReal x253=IKsin(j7); IkReal x254=(new_r11*sj5); IkReal x255=(new_r10*sj5); IkReal x256=(cj5*new_r22); IkReal x257=((1.0)*new_r01); IkReal x258=((1.0)*new_r22); IkReal x259=((1.0)*new_r00); IkReal x260=((1.0)*x253); IkReal x261=(sj5*x252); evalcond[0]=(((cj5*new_r10))+x253+(((-1.0)*sj5*x259))); evalcond[1]=(((cj5*new_r11))+x252+(((-1.0)*sj5*x257))); evalcond[2]=(((cj5*new_r00))+x255+((new_r22*x252))); evalcond[3]=(((new_r22*x261))+((cj5*x253))+new_r10); evalcond[4]=(((cj5*new_r01))+x254+(((-1.0)*x253*x258))); evalcond[5]=(((x252*x256))+new_r00+(((-1.0)*sj5*x260))); evalcond[6]=((((-1.0)*sj5*x253*x258))+((cj5*x252))+new_r11); evalcond[7]=((((-1.0)*x256*x257))+(((-1.0)*x254*x258))+x253); evalcond[8]=((((-1.0)*x261))+new_r01+(((-1.0)*x256*x260))); evalcond[9]=((((-1.0)*x255*x258))+(((-1.0)*x256*x259))+(((-1.0)*x252))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; IkReal x262=cj5*cj5; IkReal x263=new_r22*new_r22; IkReal x264=((1.0)*cj5); IkReal x265=(new_r22*sj5); CheckValue<IkReal> x266=IKPowWithIntegerCheck(IKsign(((((-1.0)*x262*x263))+x263+x262)),-1); if(!x266.valid){ continue; } CheckValue<IkReal> x267 = IKatan2WithCheck(IkReal(((((-1.0)*new_r10*x264))+((new_r11*x265)))),IkReal(((((-1.0)*new_r10*x265))+(((-1.0)*new_r11*x264)))),IKFAST_ATAN2_MAGTHRESH); if(!x267.valid){ continue; } j7array[0]=((-1.5707963267949)+(((1.5707963267949)*(x266.value)))+(x267.value)); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[10]; IkReal x268=IKcos(j7); IkReal x269=IKsin(j7); IkReal x270=(new_r11*sj5); IkReal x271=(new_r10*sj5); IkReal x272=(cj5*new_r22); IkReal x273=((1.0)*new_r01); IkReal x274=((1.0)*new_r22); IkReal x275=((1.0)*new_r00); IkReal x276=((1.0)*x269); IkReal x277=(sj5*x268); evalcond[0]=(((cj5*new_r10))+x269+(((-1.0)*sj5*x275))); evalcond[1]=(((cj5*new_r11))+x268+(((-1.0)*sj5*x273))); evalcond[2]=(((new_r22*x268))+((cj5*new_r00))+x271); evalcond[3]=(((cj5*x269))+((new_r22*x277))+new_r10); evalcond[4]=(((cj5*new_r01))+(((-1.0)*x269*x274))+x270); evalcond[5]=(new_r00+(((-1.0)*sj5*x276))+((x268*x272))); evalcond[6]=(((cj5*x268))+new_r11+(((-1.0)*sj5*x269*x274))); evalcond[7]=((((-1.0)*x272*x273))+x269+(((-1.0)*x270*x274))); evalcond[8]=((((-1.0)*x272*x276))+(((-1.0)*x277))+new_r01); evalcond[9]=((((-1.0)*x272*x275))+(((-1.0)*x268))+(((-1.0)*x271*x274))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j5, j7] } } while(0); if( bgotonextstatement ) { } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x279=IKPowWithIntegerCheck(sj6,-1); if(!x279.valid){ continue; } IkReal x278=x279.value; CheckValue<IkReal> x280=IKPowWithIntegerCheck(new_r12,-1); if(!x280.valid){ continue; } if( IKabs((x278*(x280.value)*(((-1.0)+(new_r02*new_r02)+(cj6*cj6))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r02*x278)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((x278*(x280.value)*(((-1.0)+(new_r02*new_r02)+(cj6*cj6)))))+IKsqr(((-1.0)*new_r02*x278))-1) <= IKFAST_SINCOS_THRESH ) continue; j5array[0]=IKatan2((x278*(x280.value)*(((-1.0)+(new_r02*new_r02)+(cj6*cj6)))), ((-1.0)*new_r02*x278)); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x281=IKcos(j5); IkReal x282=IKsin(j5); IkReal x283=((1.0)*cj6); IkReal x284=(new_r02*x281); IkReal x285=(sj6*x281); IkReal x286=(sj6*x282); IkReal x287=(new_r12*x282); evalcond[0]=(x285+new_r02); evalcond[1]=(x286+new_r12); evalcond[2]=(((new_r12*x281))+(((-1.0)*new_r02*x282))); evalcond[3]=(sj6+x287+x284); evalcond[4]=((((-1.0)*new_r20*x283))+((new_r00*x285))+((new_r10*x286))); evalcond[5]=((((-1.0)*new_r21*x283))+((new_r11*x286))+((new_r01*x285))); evalcond[6]=((1.0)+((sj6*x284))+(((-1.0)*new_r22*x283))+((new_r12*x286))); evalcond[7]=((((-1.0)*new_r22*sj6))+(((-1.0)*x283*x284))+(((-1.0)*x283*x287))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { IkReal j7eval[3]; j7eval[0]=sj6; j7eval[1]=IKsign(sj6); j7eval[2]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(j7eval[0]) < 0.0000010000000000 || IKabs(j7eval[1]) < 0.0000010000000000 || IKabs(j7eval[2]) < 0.0000010000000000 ) { { IkReal j7eval[2]; j7eval[0]=cj5; j7eval[1]=sj6; if( IKabs(j7eval[0]) < 0.0000010000000000 || IKabs(j7eval[1]) < 0.0000010000000000 ) { { IkReal j7eval[2]; j7eval[0]=sj5; j7eval[1]=sj6; if( IKabs(j7eval[0]) < 0.0000010000000000 || IKabs(j7eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[5]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j5))), 6.28318530717959))); evalcond[1]=new_r12; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; if( IKabs(((-1.0)*new_r10)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r11)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r10))+IKsqr(((-1.0)*new_r11))-1) <= IKFAST_SINCOS_THRESH ) continue; j7array[0]=IKatan2(((-1.0)*new_r10), ((-1.0)*new_r11)); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[8]; IkReal x288=IKcos(j7); IkReal x289=IKsin(j7); IkReal x290=((1.0)*cj6); IkReal x291=((1.0)*sj6); evalcond[0]=(x289+new_r10); evalcond[1]=(x288+new_r11); evalcond[2]=(((sj6*x288))+new_r20); evalcond[3]=(((cj6*x288))+new_r00); evalcond[4]=((((-1.0)*x289*x291))+new_r21); evalcond[5]=((((-1.0)*x289*x290))+new_r01); evalcond[6]=((((-1.0)*new_r01*x290))+(((-1.0)*new_r21*x291))+x289); evalcond[7]=((((-1.0)*new_r20*x291))+(((-1.0)*x288))+(((-1.0)*new_r00*x290))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j5)))), 6.28318530717959))); evalcond[1]=new_r12; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; if( IKabs(new_r10) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r11) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r10)+IKsqr(new_r11)-1) <= IKFAST_SINCOS_THRESH ) continue; j7array[0]=IKatan2(new_r10, new_r11); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[8]; IkReal x293=IKcos(j7); IkReal x294=IKsin(j7); IkReal x295=((1.0)*sj6); IkReal x296=((1.0)*x294); evalcond[0]=(((sj6*x293))+new_r20); evalcond[1]=(x294+(((-1.0)*new_r10))); evalcond[2]=(x293+(((-1.0)*new_r11))); evalcond[3]=(new_r21+(((-1.0)*x294*x295))); evalcond[4]=(((cj6*x293))+(((-1.0)*new_r00))); evalcond[5]=((((-1.0)*new_r01))+(((-1.0)*cj6*x296))); evalcond[6]=((((-1.0)*new_r21*x295))+x294+((cj6*new_r01))); evalcond[7]=((((-1.0)*x293))+(((-1.0)*new_r20*x295))+((cj6*new_r00))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j6))), 6.28318530717959))); evalcond[1]=new_r02; evalcond[2]=new_r12; evalcond[3]=new_r20; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; IkReal x297=((1.0)*new_r10); if( IKabs(((((-1.0)*cj5*x297))+((new_r00*sj5)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((((-1.0)*cj5*new_r00))+(((-1.0)*sj5*x297)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*cj5*x297))+((new_r00*sj5))))+IKsqr(((((-1.0)*cj5*new_r00))+(((-1.0)*sj5*x297))))-1) <= IKFAST_SINCOS_THRESH ) continue; j7array[0]=IKatan2(((((-1.0)*cj5*x297))+((new_r00*sj5))), ((((-1.0)*cj5*new_r00))+(((-1.0)*sj5*x297)))); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[8]; IkReal x298=IKcos(j7); IkReal x299=IKsin(j7); IkReal x300=((1.0)*sj5); IkReal x301=(cj5*x298); IkReal x302=(cj5*x299); IkReal x303=(x299*x300); evalcond[0]=(((new_r10*sj5))+((cj5*new_r00))+x298); evalcond[1]=(((cj5*new_r10))+x299+(((-1.0)*new_r00*x300))); evalcond[2]=(((cj5*new_r11))+x298+(((-1.0)*new_r01*x300))); evalcond[3]=(((sj5*x298))+x302+new_r10); evalcond[4]=((((-1.0)*x299))+((new_r11*sj5))+((cj5*new_r01))); evalcond[5]=(x301+new_r00+(((-1.0)*x303))); evalcond[6]=(x301+new_r11+(((-1.0)*x303))); evalcond[7]=((((-1.0)*x298*x300))+(((-1.0)*x302))+new_r01); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j6)))), 6.28318530717959))); evalcond[1]=new_r02; evalcond[2]=new_r12; evalcond[3]=new_r20; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; IkReal x304=((1.0)*cj5); if( IKabs(((((-1.0)*new_r11*sj5))+(((-1.0)*new_r10*x304)))) < IKFAST_ATAN2_MAGTHRESH && IKabs((((new_r10*sj5))+(((-1.0)*new_r11*x304)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*new_r11*sj5))+(((-1.0)*new_r10*x304))))+IKsqr((((new_r10*sj5))+(((-1.0)*new_r11*x304))))-1) <= IKFAST_SINCOS_THRESH ) continue; j7array[0]=IKatan2(((((-1.0)*new_r11*sj5))+(((-1.0)*new_r10*x304))), (((new_r10*sj5))+(((-1.0)*new_r11*x304)))); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[8]; IkReal x305=IKsin(j7); IkReal x306=IKcos(j7); IkReal x307=((1.0)*sj5); IkReal x308=(cj5*x305); IkReal x309=(cj5*x306); IkReal x310=(x306*x307); evalcond[0]=(((new_r11*sj5))+((cj5*new_r01))+x305); evalcond[1]=(((cj5*new_r10))+x305+(((-1.0)*new_r00*x307))); evalcond[2]=(((cj5*new_r11))+x306+(((-1.0)*new_r01*x307))); evalcond[3]=(((new_r10*sj5))+((cj5*new_r00))+(((-1.0)*x306))); evalcond[4]=(((sj5*x305))+x309+new_r11); evalcond[5]=(x308+(((-1.0)*x310))+new_r10); evalcond[6]=(x308+(((-1.0)*x310))+new_r01); evalcond[7]=((((-1.0)*x309))+(((-1.0)*x305*x307))+new_r00); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j5)))), 6.28318530717959))); evalcond[1]=new_r02; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; if( IKabs(new_r00) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r01) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r00)+IKsqr(new_r01)-1) <= IKFAST_SINCOS_THRESH ) continue; j7array[0]=IKatan2(new_r00, new_r01); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[8]; IkReal x311=IKcos(j7); IkReal x312=IKsin(j7); IkReal x313=((1.0)*cj6); IkReal x314=((1.0)*sj6); evalcond[0]=(((sj6*x311))+new_r20); evalcond[1]=(x312+(((-1.0)*new_r00))); evalcond[2]=(x311+(((-1.0)*new_r01))); evalcond[3]=(((cj6*x311))+new_r10); evalcond[4]=((((-1.0)*x312*x314))+new_r21); evalcond[5]=((((-1.0)*x312*x313))+new_r11); evalcond[6]=((((-1.0)*new_r21*x314))+(((-1.0)*new_r11*x313))+x312); evalcond[7]=((((-1.0)*new_r20*x314))+(((-1.0)*new_r10*x313))+(((-1.0)*x311))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j5)))), 6.28318530717959))); evalcond[1]=new_r02; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; if( IKabs(((-1.0)*new_r00)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r01)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r00))+IKsqr(((-1.0)*new_r01))-1) <= IKFAST_SINCOS_THRESH ) continue; j7array[0]=IKatan2(((-1.0)*new_r00), ((-1.0)*new_r01)); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[8]; IkReal x316=IKcos(j7); IkReal x317=IKsin(j7); IkReal x318=((1.0)*sj6); IkReal x319=((1.0)*x317); evalcond[0]=(x317+new_r00); evalcond[1]=(x316+new_r01); evalcond[2]=(((sj6*x316))+new_r20); evalcond[3]=(new_r21+(((-1.0)*x317*x318))); evalcond[4]=(((cj6*x316))+(((-1.0)*new_r10))); evalcond[5]=((((-1.0)*new_r11))+(((-1.0)*cj6*x319))); evalcond[6]=((((-1.0)*new_r21*x318))+x317+((cj6*new_r11))); evalcond[7]=((((-1.0)*new_r20*x318))+((cj6*new_r10))+(((-1.0)*x316))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j7eval[1]; new_r21=0; new_r20=0; new_r02=0; new_r12=0; j7eval[0]=1.0; if( IKabs(j7eval[0]) < 0.0000000100000000 ) { continue; // no branches [j7] } else { IkReal op[2+1], zeror[2]; int numroots; op[0]=-1.0; op[1]=0; op[2]=1.0; polyroots2(op,zeror,numroots); IkReal j7array[2], cj7array[2], sj7array[2], tempj7array[1]; int numsolutions = 0; for(int ij7 = 0; ij7 < numroots; ++ij7) { IkReal htj7 = zeror[ij7]; tempj7array[0]=((2.0)*(atan(htj7))); for(int kj7 = 0; kj7 < 1; ++kj7) { j7array[numsolutions] = tempj7array[kj7]; if( j7array[numsolutions] > IKPI ) { j7array[numsolutions]-=IK2PI; } else if( j7array[numsolutions] < -IKPI ) { j7array[numsolutions]+=IK2PI; } sj7array[numsolutions] = IKsin(j7array[numsolutions]); cj7array[numsolutions] = IKcos(j7array[numsolutions]); numsolutions++; } } bool j7valid[2]={true,true}; _nj7 = 2; for(int ij7 = 0; ij7 < numsolutions; ++ij7) { if( !j7valid[ij7] ) { continue; } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; htj7 = IKtan(j7/2); _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < numsolutions; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j7] } } while(0); if( bgotonextstatement ) { } } } } } } } } } } else { { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; CheckValue<IkReal> x321=IKPowWithIntegerCheck(sj6,-1); if(!x321.valid){ continue; } IkReal x320=x321.value; CheckValue<IkReal> x322=IKPowWithIntegerCheck(sj5,-1); if(!x322.valid){ continue; } if( IKabs((x320*(x322.value)*((((new_r00*sj6))+(((-1.0)*cj5*cj6*new_r20)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20*x320)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((x320*(x322.value)*((((new_r00*sj6))+(((-1.0)*cj5*cj6*new_r20))))))+IKsqr(((-1.0)*new_r20*x320))-1) <= IKFAST_SINCOS_THRESH ) continue; j7array[0]=IKatan2((x320*(x322.value)*((((new_r00*sj6))+(((-1.0)*cj5*cj6*new_r20))))), ((-1.0)*new_r20*x320)); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[12]; IkReal x323=IKsin(j7); IkReal x324=IKcos(j7); IkReal x325=(new_r10*sj5); IkReal x326=((1.0)*new_r01); IkReal x327=(cj5*cj6); IkReal x328=(new_r11*sj5); IkReal x329=((1.0)*sj6); IkReal x330=((1.0)*new_r00); IkReal x331=((1.0)*cj6); IkReal x332=(cj5*x324); IkReal x333=(sj5*x324); IkReal x334=((1.0)*x323); evalcond[0]=(((sj6*x324))+new_r20); evalcond[1]=((((-1.0)*x323*x329))+new_r21); evalcond[2]=((((-1.0)*sj5*x330))+((cj5*new_r10))+x323); evalcond[3]=(((cj5*new_r11))+x324+(((-1.0)*sj5*x326))); evalcond[4]=(((cj5*new_r00))+x325+((cj6*x324))); evalcond[5]=(((cj5*x323))+((cj6*x333))+new_r10); evalcond[6]=(((cj5*new_r01))+x328+(((-1.0)*x323*x331))); evalcond[7]=((((-1.0)*sj5*x334))+((x324*x327))+new_r00); evalcond[8]=((((-1.0)*sj5*x323*x331))+x332+new_r11); evalcond[9]=((((-1.0)*x333))+new_r01+(((-1.0)*x327*x334))); evalcond[10]=((((-1.0)*x326*x327))+(((-1.0)*x328*x331))+x323+(((-1.0)*new_r21*x329))); evalcond[11]=((((-1.0)*x324))+(((-1.0)*x327*x330))+(((-1.0)*x325*x331))+(((-1.0)*new_r20*x329))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; CheckValue<IkReal> x336=IKPowWithIntegerCheck(sj6,-1); if(!x336.valid){ continue; } IkReal x335=x336.value; CheckValue<IkReal> x337=IKPowWithIntegerCheck(cj5,-1); if(!x337.valid){ continue; } if( IKabs((x335*(x337.value)*((((cj6*new_r20*sj5))+(((-1.0)*new_r10*sj6)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20*x335)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((x335*(x337.value)*((((cj6*new_r20*sj5))+(((-1.0)*new_r10*sj6))))))+IKsqr(((-1.0)*new_r20*x335))-1) <= IKFAST_SINCOS_THRESH ) continue; j7array[0]=IKatan2((x335*(x337.value)*((((cj6*new_r20*sj5))+(((-1.0)*new_r10*sj6))))), ((-1.0)*new_r20*x335)); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[12]; IkReal x338=IKsin(j7); IkReal x339=IKcos(j7); IkReal x340=(new_r10*sj5); IkReal x341=((1.0)*new_r01); IkReal x342=(cj5*cj6); IkReal x343=(new_r11*sj5); IkReal x344=((1.0)*sj6); IkReal x345=((1.0)*new_r00); IkReal x346=((1.0)*cj6); IkReal x347=(cj5*x339); IkReal x348=(sj5*x339); IkReal x349=((1.0)*x338); evalcond[0]=(((sj6*x339))+new_r20); evalcond[1]=(new_r21+(((-1.0)*x338*x344))); evalcond[2]=((((-1.0)*sj5*x345))+((cj5*new_r10))+x338); evalcond[3]=((((-1.0)*sj5*x341))+((cj5*new_r11))+x339); evalcond[4]=(((cj5*new_r00))+x340+((cj6*x339))); evalcond[5]=(((cj6*x348))+((cj5*x338))+new_r10); evalcond[6]=(((cj5*new_r01))+x343+(((-1.0)*x338*x346))); evalcond[7]=((((-1.0)*sj5*x349))+new_r00+((x339*x342))); evalcond[8]=(x347+(((-1.0)*sj5*x338*x346))+new_r11); evalcond[9]=(new_r01+(((-1.0)*x342*x349))+(((-1.0)*x348))); evalcond[10]=(x338+(((-1.0)*x341*x342))+(((-1.0)*x343*x346))+(((-1.0)*new_r21*x344))); evalcond[11]=((((-1.0)*x339))+(((-1.0)*x340*x346))+(((-1.0)*new_r20*x344))+(((-1.0)*x342*x345))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; CheckValue<IkReal> x350=IKPowWithIntegerCheck(IKsign(sj6),-1); if(!x350.valid){ continue; } CheckValue<IkReal> x351 = IKatan2WithCheck(IkReal(new_r21),IkReal(((-1.0)*new_r20)),IKFAST_ATAN2_MAGTHRESH); if(!x351.valid){ continue; } j7array[0]=((-1.5707963267949)+(((1.5707963267949)*(x350.value)))+(x351.value)); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[12]; IkReal x352=IKsin(j7); IkReal x353=IKcos(j7); IkReal x354=(new_r10*sj5); IkReal x355=((1.0)*new_r01); IkReal x356=(cj5*cj6); IkReal x357=(new_r11*sj5); IkReal x358=((1.0)*sj6); IkReal x359=((1.0)*new_r00); IkReal x360=((1.0)*cj6); IkReal x361=(cj5*x353); IkReal x362=(sj5*x353); IkReal x363=((1.0)*x352); evalcond[0]=(((sj6*x353))+new_r20); evalcond[1]=(new_r21+(((-1.0)*x352*x358))); evalcond[2]=(((cj5*new_r10))+x352+(((-1.0)*sj5*x359))); evalcond[3]=(((cj5*new_r11))+x353+(((-1.0)*sj5*x355))); evalcond[4]=(((cj5*new_r00))+x354+((cj6*x353))); evalcond[5]=(((cj5*x352))+((cj6*x362))+new_r10); evalcond[6]=(((cj5*new_r01))+(((-1.0)*x352*x360))+x357); evalcond[7]=((((-1.0)*sj5*x363))+((x353*x356))+new_r00); evalcond[8]=(x361+(((-1.0)*sj5*x352*x360))+new_r11); evalcond[9]=((((-1.0)*x362))+(((-1.0)*x356*x363))+new_r01); evalcond[10]=(x352+(((-1.0)*new_r21*x358))+(((-1.0)*x357*x360))+(((-1.0)*x355*x356))); evalcond[11]=((((-1.0)*x354*x360))+(((-1.0)*x356*x359))+(((-1.0)*x353))+(((-1.0)*new_r20*x358))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x364=IKPowWithIntegerCheck(IKsign(sj6),-1); if(!x364.valid){ continue; } CheckValue<IkReal> x365 = IKatan2WithCheck(IkReal(((-1.0)*new_r12)),IkReal(((-1.0)*new_r02)),IKFAST_ATAN2_MAGTHRESH); if(!x365.valid){ continue; } j5array[0]=((-1.5707963267949)+(((1.5707963267949)*(x364.value)))+(x365.value)); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x366=IKcos(j5); IkReal x367=IKsin(j5); IkReal x368=((1.0)*cj6); IkReal x369=(new_r02*x366); IkReal x370=(sj6*x366); IkReal x371=(sj6*x367); IkReal x372=(new_r12*x367); evalcond[0]=(x370+new_r02); evalcond[1]=(x371+new_r12); evalcond[2]=((((-1.0)*new_r02*x367))+((new_r12*x366))); evalcond[3]=(sj6+x372+x369); evalcond[4]=((((-1.0)*new_r20*x368))+((new_r00*x370))+((new_r10*x371))); evalcond[5]=(((new_r01*x370))+((new_r11*x371))+(((-1.0)*new_r21*x368))); evalcond[6]=((1.0)+((new_r12*x371))+(((-1.0)*new_r22*x368))+((sj6*x369))); evalcond[7]=((((-1.0)*x368*x372))+(((-1.0)*new_r22*sj6))+(((-1.0)*x368*x369))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { IkReal j7eval[3]; j7eval[0]=sj6; j7eval[1]=IKsign(sj6); j7eval[2]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(j7eval[0]) < 0.0000010000000000 || IKabs(j7eval[1]) < 0.0000010000000000 || IKabs(j7eval[2]) < 0.0000010000000000 ) { { IkReal j7eval[2]; j7eval[0]=cj5; j7eval[1]=sj6; if( IKabs(j7eval[0]) < 0.0000010000000000 || IKabs(j7eval[1]) < 0.0000010000000000 ) { { IkReal j7eval[2]; j7eval[0]=sj5; j7eval[1]=sj6; if( IKabs(j7eval[0]) < 0.0000010000000000 || IKabs(j7eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[5]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j5))), 6.28318530717959))); evalcond[1]=new_r12; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; if( IKabs(((-1.0)*new_r10)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r11)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r10))+IKsqr(((-1.0)*new_r11))-1) <= IKFAST_SINCOS_THRESH ) continue; j7array[0]=IKatan2(((-1.0)*new_r10), ((-1.0)*new_r11)); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[8]; IkReal x373=IKcos(j7); IkReal x374=IKsin(j7); IkReal x375=((1.0)*cj6); IkReal x376=((1.0)*sj6); evalcond[0]=(x374+new_r10); evalcond[1]=(x373+new_r11); evalcond[2]=(((sj6*x373))+new_r20); evalcond[3]=(((cj6*x373))+new_r00); evalcond[4]=((((-1.0)*x374*x376))+new_r21); evalcond[5]=((((-1.0)*x374*x375))+new_r01); evalcond[6]=((((-1.0)*new_r21*x376))+x374+(((-1.0)*new_r01*x375))); evalcond[7]=((((-1.0)*new_r00*x375))+(((-1.0)*x373))+(((-1.0)*new_r20*x376))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j5)))), 6.28318530717959))); evalcond[1]=new_r12; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; if( IKabs(new_r10) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r11) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r10)+IKsqr(new_r11)-1) <= IKFAST_SINCOS_THRESH ) continue; j7array[0]=IKatan2(new_r10, new_r11); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[8]; IkReal x378=IKcos(j7); IkReal x379=IKsin(j7); IkReal x380=((1.0)*sj6); IkReal x381=((1.0)*x379); evalcond[0]=(((sj6*x378))+new_r20); evalcond[1]=(x379+(((-1.0)*new_r10))); evalcond[2]=(x378+(((-1.0)*new_r11))); evalcond[3]=((((-1.0)*x379*x380))+new_r21); evalcond[4]=(((cj6*x378))+(((-1.0)*new_r00))); evalcond[5]=((((-1.0)*cj6*x381))+(((-1.0)*new_r01))); evalcond[6]=(x379+(((-1.0)*new_r21*x380))+((cj6*new_r01))); evalcond[7]=((((-1.0)*x378))+(((-1.0)*new_r20*x380))+((cj6*new_r00))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j6))), 6.28318530717959))); evalcond[1]=new_r02; evalcond[2]=new_r12; evalcond[3]=new_r20; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; IkReal x382=((1.0)*new_r10); if( IKabs((((new_r00*sj5))+(((-1.0)*cj5*x382)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((((-1.0)*sj5*x382))+(((-1.0)*cj5*new_r00)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((((new_r00*sj5))+(((-1.0)*cj5*x382))))+IKsqr(((((-1.0)*sj5*x382))+(((-1.0)*cj5*new_r00))))-1) <= IKFAST_SINCOS_THRESH ) continue; j7array[0]=IKatan2((((new_r00*sj5))+(((-1.0)*cj5*x382))), ((((-1.0)*sj5*x382))+(((-1.0)*cj5*new_r00)))); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[8]; IkReal x383=IKcos(j7); IkReal x384=IKsin(j7); IkReal x385=((1.0)*sj5); IkReal x386=(cj5*x383); IkReal x387=(cj5*x384); IkReal x388=(x384*x385); evalcond[0]=(((new_r10*sj5))+((cj5*new_r00))+x383); evalcond[1]=(((cj5*new_r10))+(((-1.0)*new_r00*x385))+x384); evalcond[2]=(((cj5*new_r11))+(((-1.0)*new_r01*x385))+x383); evalcond[3]=(((sj5*x383))+x387+new_r10); evalcond[4]=(((new_r11*sj5))+((cj5*new_r01))+(((-1.0)*x384))); evalcond[5]=(x386+(((-1.0)*x388))+new_r00); evalcond[6]=(x386+(((-1.0)*x388))+new_r11); evalcond[7]=((((-1.0)*x387))+new_r01+(((-1.0)*x383*x385))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j6)))), 6.28318530717959))); evalcond[1]=new_r02; evalcond[2]=new_r12; evalcond[3]=new_r20; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; IkReal x389=((1.0)*cj5); if( IKabs(((((-1.0)*new_r10*x389))+(((-1.0)*new_r11*sj5)))) < IKFAST_ATAN2_MAGTHRESH && IKabs((((new_r10*sj5))+(((-1.0)*new_r11*x389)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*new_r10*x389))+(((-1.0)*new_r11*sj5))))+IKsqr((((new_r10*sj5))+(((-1.0)*new_r11*x389))))-1) <= IKFAST_SINCOS_THRESH ) continue; j7array[0]=IKatan2(((((-1.0)*new_r10*x389))+(((-1.0)*new_r11*sj5))), (((new_r10*sj5))+(((-1.0)*new_r11*x389)))); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[8]; IkReal x390=IKsin(j7); IkReal x391=IKcos(j7); IkReal x392=((1.0)*sj5); IkReal x393=(cj5*x390); IkReal x394=(cj5*x391); IkReal x395=(x391*x392); evalcond[0]=(((new_r11*sj5))+((cj5*new_r01))+x390); evalcond[1]=(((cj5*new_r10))+x390+(((-1.0)*new_r00*x392))); evalcond[2]=((((-1.0)*new_r01*x392))+((cj5*new_r11))+x391); evalcond[3]=((((-1.0)*x391))+((new_r10*sj5))+((cj5*new_r00))); evalcond[4]=(x394+((sj5*x390))+new_r11); evalcond[5]=((((-1.0)*x395))+x393+new_r10); evalcond[6]=((((-1.0)*x395))+x393+new_r01); evalcond[7]=((((-1.0)*x394))+(((-1.0)*x390*x392))+new_r00); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j5)))), 6.28318530717959))); evalcond[1]=new_r02; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; if( IKabs(new_r00) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r01) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r00)+IKsqr(new_r01)-1) <= IKFAST_SINCOS_THRESH ) continue; j7array[0]=IKatan2(new_r00, new_r01); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[8]; IkReal x396=IKcos(j7); IkReal x397=IKsin(j7); IkReal x398=((1.0)*cj6); IkReal x399=((1.0)*sj6); evalcond[0]=(((sj6*x396))+new_r20); evalcond[1]=(x397+(((-1.0)*new_r00))); evalcond[2]=(x396+(((-1.0)*new_r01))); evalcond[3]=(new_r10+((cj6*x396))); evalcond[4]=((((-1.0)*x397*x399))+new_r21); evalcond[5]=((((-1.0)*x397*x398))+new_r11); evalcond[6]=((((-1.0)*new_r21*x399))+x397+(((-1.0)*new_r11*x398))); evalcond[7]=((((-1.0)*x396))+(((-1.0)*new_r10*x398))+(((-1.0)*new_r20*x399))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j5)))), 6.28318530717959))); evalcond[1]=new_r02; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; if( IKabs(((-1.0)*new_r00)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r01)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r00))+IKsqr(((-1.0)*new_r01))-1) <= IKFAST_SINCOS_THRESH ) continue; j7array[0]=IKatan2(((-1.0)*new_r00), ((-1.0)*new_r01)); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[8]; IkReal x401=IKcos(j7); IkReal x402=IKsin(j7); IkReal x403=((1.0)*sj6); IkReal x404=((1.0)*x402); evalcond[0]=(x402+new_r00); evalcond[1]=(x401+new_r01); evalcond[2]=(((sj6*x401))+new_r20); evalcond[3]=((((-1.0)*x402*x403))+new_r21); evalcond[4]=((((-1.0)*new_r10))+((cj6*x401))); evalcond[5]=((((-1.0)*cj6*x404))+(((-1.0)*new_r11))); evalcond[6]=(((cj6*new_r11))+x402+(((-1.0)*new_r21*x403))); evalcond[7]=((((-1.0)*new_r20*x403))+((cj6*new_r10))+(((-1.0)*x401))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j7eval[1]; new_r21=0; new_r20=0; new_r02=0; new_r12=0; j7eval[0]=1.0; if( IKabs(j7eval[0]) < 0.0000000100000000 ) { continue; // no branches [j7] } else { IkReal op[2+1], zeror[2]; int numroots; op[0]=-1.0; op[1]=0; op[2]=1.0; polyroots2(op,zeror,numroots); IkReal j7array[2], cj7array[2], sj7array[2], tempj7array[1]; int numsolutions = 0; for(int ij7 = 0; ij7 < numroots; ++ij7) { IkReal htj7 = zeror[ij7]; tempj7array[0]=((2.0)*(atan(htj7))); for(int kj7 = 0; kj7 < 1; ++kj7) { j7array[numsolutions] = tempj7array[kj7]; if( j7array[numsolutions] > IKPI ) { j7array[numsolutions]-=IK2PI; } else if( j7array[numsolutions] < -IKPI ) { j7array[numsolutions]+=IK2PI; } sj7array[numsolutions] = IKsin(j7array[numsolutions]); cj7array[numsolutions] = IKcos(j7array[numsolutions]); numsolutions++; } } bool j7valid[2]={true,true}; _nj7 = 2; for(int ij7 = 0; ij7 < numsolutions; ++ij7) { if( !j7valid[ij7] ) { continue; } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; htj7 = IKtan(j7/2); _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < numsolutions; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j7] } } while(0); if( bgotonextstatement ) { } } } } } } } } } } else { { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; CheckValue<IkReal> x406=IKPowWithIntegerCheck(sj6,-1); if(!x406.valid){ continue; } IkReal x405=x406.value; CheckValue<IkReal> x407=IKPowWithIntegerCheck(sj5,-1); if(!x407.valid){ continue; } if( IKabs((x405*(x407.value)*((((new_r00*sj6))+(((-1.0)*cj5*cj6*new_r20)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20*x405)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((x405*(x407.value)*((((new_r00*sj6))+(((-1.0)*cj5*cj6*new_r20))))))+IKsqr(((-1.0)*new_r20*x405))-1) <= IKFAST_SINCOS_THRESH ) continue; j7array[0]=IKatan2((x405*(x407.value)*((((new_r00*sj6))+(((-1.0)*cj5*cj6*new_r20))))), ((-1.0)*new_r20*x405)); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[12]; IkReal x408=IKsin(j7); IkReal x409=IKcos(j7); IkReal x410=(new_r10*sj5); IkReal x411=((1.0)*new_r01); IkReal x412=(cj5*cj6); IkReal x413=(new_r11*sj5); IkReal x414=((1.0)*sj6); IkReal x415=((1.0)*new_r00); IkReal x416=((1.0)*cj6); IkReal x417=(cj5*x409); IkReal x418=(sj5*x409); IkReal x419=((1.0)*x408); evalcond[0]=(((sj6*x409))+new_r20); evalcond[1]=(new_r21+(((-1.0)*x408*x414))); evalcond[2]=((((-1.0)*sj5*x415))+((cj5*new_r10))+x408); evalcond[3]=((((-1.0)*sj5*x411))+((cj5*new_r11))+x409); evalcond[4]=(((cj5*new_r00))+x410+((cj6*x409))); evalcond[5]=(((cj6*x418))+((cj5*x408))+new_r10); evalcond[6]=(((cj5*new_r01))+x413+(((-1.0)*x408*x416))); evalcond[7]=((((-1.0)*sj5*x419))+((x409*x412))+new_r00); evalcond[8]=((((-1.0)*sj5*x408*x416))+x417+new_r11); evalcond[9]=((((-1.0)*x412*x419))+new_r01+(((-1.0)*x418))); evalcond[10]=(x408+(((-1.0)*new_r21*x414))+(((-1.0)*x411*x412))+(((-1.0)*x413*x416))); evalcond[11]=((((-1.0)*x412*x415))+(((-1.0)*new_r20*x414))+(((-1.0)*x410*x416))+(((-1.0)*x409))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; CheckValue<IkReal> x421=IKPowWithIntegerCheck(sj6,-1); if(!x421.valid){ continue; } IkReal x420=x421.value; CheckValue<IkReal> x422=IKPowWithIntegerCheck(cj5,-1); if(!x422.valid){ continue; } if( IKabs((x420*(x422.value)*((((cj6*new_r20*sj5))+(((-1.0)*new_r10*sj6)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20*x420)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((x420*(x422.value)*((((cj6*new_r20*sj5))+(((-1.0)*new_r10*sj6))))))+IKsqr(((-1.0)*new_r20*x420))-1) <= IKFAST_SINCOS_THRESH ) continue; j7array[0]=IKatan2((x420*(x422.value)*((((cj6*new_r20*sj5))+(((-1.0)*new_r10*sj6))))), ((-1.0)*new_r20*x420)); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[12]; IkReal x423=IKsin(j7); IkReal x424=IKcos(j7); IkReal x425=(new_r10*sj5); IkReal x426=((1.0)*new_r01); IkReal x427=(cj5*cj6); IkReal x428=(new_r11*sj5); IkReal x429=((1.0)*sj6); IkReal x430=((1.0)*new_r00); IkReal x431=((1.0)*cj6); IkReal x432=(cj5*x424); IkReal x433=(sj5*x424); IkReal x434=((1.0)*x423); evalcond[0]=(((sj6*x424))+new_r20); evalcond[1]=(new_r21+(((-1.0)*x423*x429))); evalcond[2]=((((-1.0)*sj5*x430))+((cj5*new_r10))+x423); evalcond[3]=((((-1.0)*sj5*x426))+((cj5*new_r11))+x424); evalcond[4]=(((cj5*new_r00))+((cj6*x424))+x425); evalcond[5]=(((cj5*x423))+((cj6*x433))+new_r10); evalcond[6]=(((cj5*new_r01))+x428+(((-1.0)*x423*x431))); evalcond[7]=(((x424*x427))+(((-1.0)*sj5*x434))+new_r00); evalcond[8]=((((-1.0)*sj5*x423*x431))+x432+new_r11); evalcond[9]=((((-1.0)*x427*x434))+(((-1.0)*x433))+new_r01); evalcond[10]=((((-1.0)*x426*x427))+x423+(((-1.0)*x428*x431))+(((-1.0)*new_r21*x429))); evalcond[11]=((((-1.0)*x424))+(((-1.0)*x427*x430))+(((-1.0)*x425*x431))+(((-1.0)*new_r20*x429))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; CheckValue<IkReal> x435=IKPowWithIntegerCheck(IKsign(sj6),-1); if(!x435.valid){ continue; } CheckValue<IkReal> x436 = IKatan2WithCheck(IkReal(new_r21),IkReal(((-1.0)*new_r20)),IKFAST_ATAN2_MAGTHRESH); if(!x436.valid){ continue; } j7array[0]=((-1.5707963267949)+(((1.5707963267949)*(x435.value)))+(x436.value)); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[12]; IkReal x437=IKsin(j7); IkReal x438=IKcos(j7); IkReal x439=(new_r10*sj5); IkReal x440=((1.0)*new_r01); IkReal x441=(cj5*cj6); IkReal x442=(new_r11*sj5); IkReal x443=((1.0)*sj6); IkReal x444=((1.0)*new_r00); IkReal x445=((1.0)*cj6); IkReal x446=(cj5*x438); IkReal x447=(sj5*x438); IkReal x448=((1.0)*x437); evalcond[0]=(((sj6*x438))+new_r20); evalcond[1]=((((-1.0)*x437*x443))+new_r21); evalcond[2]=((((-1.0)*sj5*x444))+((cj5*new_r10))+x437); evalcond[3]=((((-1.0)*sj5*x440))+((cj5*new_r11))+x438); evalcond[4]=(((cj5*new_r00))+x439+((cj6*x438))); evalcond[5]=(((cj5*x437))+((cj6*x447))+new_r10); evalcond[6]=((((-1.0)*x437*x445))+((cj5*new_r01))+x442); evalcond[7]=((((-1.0)*sj5*x448))+((x438*x441))+new_r00); evalcond[8]=((((-1.0)*sj5*x437*x445))+x446+new_r11); evalcond[9]=((((-1.0)*x447))+new_r01+(((-1.0)*x441*x448))); evalcond[10]=(x437+(((-1.0)*x440*x441))+(((-1.0)*new_r21*x443))+(((-1.0)*x442*x445))); evalcond[11]=((((-1.0)*x438))+(((-1.0)*x439*x445))+(((-1.0)*new_r20*x443))+(((-1.0)*x441*x444))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } } } } else { { IkReal j7array[1], cj7array[1], sj7array[1]; bool j7valid[1]={false}; _nj7 = 1; CheckValue<IkReal> x449=IKPowWithIntegerCheck(IKsign(sj6),-1); if(!x449.valid){ continue; } CheckValue<IkReal> x450 = IKatan2WithCheck(IkReal(new_r21),IkReal(((-1.0)*new_r20)),IKFAST_ATAN2_MAGTHRESH); if(!x450.valid){ continue; } j7array[0]=((-1.5707963267949)+(((1.5707963267949)*(x449.value)))+(x450.value)); sj7array[0]=IKsin(j7array[0]); cj7array[0]=IKcos(j7array[0]); if( j7array[0] > IKPI ) { j7array[0]-=IK2PI; } else if( j7array[0] < -IKPI ) { j7array[0]+=IK2PI; } j7valid[0] = true; for(int ij7 = 0; ij7 < 1; ++ij7) { if( !j7valid[ij7] ) { continue; } _ij7[0] = ij7; _ij7[1] = -1; for(int iij7 = ij7+1; iij7 < 1; ++iij7) { if( j7valid[iij7] && IKabs(cj7array[ij7]-cj7array[iij7]) < IKFAST_SOLUTION_THRESH && IKabs(sj7array[ij7]-sj7array[iij7]) < IKFAST_SOLUTION_THRESH ) { j7valid[iij7]=false; _ij7[1] = iij7; break; } } j7 = j7array[ij7]; cj7 = cj7array[ij7]; sj7 = sj7array[ij7]; { IkReal evalcond[2]; evalcond[0]=(((sj6*(IKcos(j7))))+new_r20); evalcond[1]=((((-1.0)*sj6*(IKsin(j7))))+new_r21); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH ) { continue; } } { IkReal j5eval[3]; j5eval[0]=sj6; j5eval[1]=((IKabs(new_r12))+(IKabs(new_r02))); j5eval[2]=IKsign(sj6); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 || IKabs(j5eval[2]) < 0.0000010000000000 ) { { IkReal j5eval[2]; j5eval[0]=new_r12; j5eval[1]=sj6; if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[5]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j6))), 6.28318530717959))); evalcond[1]=new_r02; evalcond[2]=new_r12; evalcond[3]=new_r20; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5eval[3]; sj6=0; cj6=1.0; j6=0; IkReal x451=((1.0)*new_r10); IkReal x452=((new_r10*new_r10)+(new_r00*new_r00)); j5eval[0]=x452; j5eval[1]=IKsign(x452); j5eval[2]=((IKabs(((((-1.0)*cj7*new_r00))+(((-1.0)*sj7*x451)))))+(IKabs(((((-1.0)*cj7*x451))+((new_r00*sj7)))))); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 || IKabs(j5eval[2]) < 0.0000010000000000 ) { { IkReal j5eval[3]; sj6=0; cj6=1.0; j6=0; IkReal x453=((1.0)*cj7); IkReal x454=(((new_r10*new_r11))+((new_r00*new_r01))); j5eval[0]=x454; j5eval[1]=IKsign(x454); j5eval[2]=((IKabs(((((-1.0)*new_r10*x453))+(((-1.0)*new_r01*x453)))))+(IKabs(((((-1.0)*new_r11*x453))+((cj7*new_r00)))))); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 || IKabs(j5eval[2]) < 0.0000010000000000 ) { { IkReal j5eval[3]; sj6=0; cj6=1.0; j6=0; IkReal x455=((1.0)*new_r10); IkReal x456=((((-1.0)*sj7*x455))+((cj7*new_r00))); j5eval[0]=x456; j5eval[1]=IKsign(x456); j5eval[2]=((IKabs(((((-1.0)*new_r00*x455))+((cj7*sj7)))))+(IKabs(((((-1.0)*(cj7*cj7)))+(new_r10*new_r10))))); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 || IKabs(j5eval[2]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { IkReal x459 = ((new_r10*new_r10)+(new_r00*new_r00)); if(IKabs(x459)==0){ continue; } IkReal x457=pow(x459,-0.5); IkReal x458=((-1.0)*x457); CheckValue<IkReal> x460 = IKatan2WithCheck(IkReal(new_r00),IkReal(((-1.0)*new_r10)),IKFAST_ATAN2_MAGTHRESH); if(!x460.valid){ continue; } IkReal gconst1=(new_r00*x458); IkReal gconst2=(new_r10*x458); CheckValue<IkReal> x461 = IKatan2WithCheck(IkReal(new_r00),IkReal(((-1.0)*new_r10)),IKFAST_ATAN2_MAGTHRESH); if(!x461.valid){ continue; } evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((x461.value)+j7)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5eval[2]; CheckValue<IkReal> x465 = IKatan2WithCheck(IkReal(new_r00),IkReal(((-1.0)*new_r10)),IKFAST_ATAN2_MAGTHRESH); if(!x465.valid){ continue; } IkReal x462=((-1.0)*(x465.value)); IkReal x463=x457; IkReal x464=((-1.0)*x463); sj6=0; cj6=1.0; j6=0; sj7=gconst1; cj7=gconst2; j7=x462; IkReal gconst1=(new_r00*x464); IkReal gconst2=(new_r10*x464); IkReal x466=((new_r10*new_r10)+(new_r00*new_r00)); j5eval[0]=x466; j5eval[1]=IKsign(x466); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 ) { { IkReal j5eval[3]; CheckValue<IkReal> x470 = IKatan2WithCheck(IkReal(new_r00),IkReal(((-1.0)*new_r10)),IKFAST_ATAN2_MAGTHRESH); if(!x470.valid){ continue; } IkReal x467=((-1.0)*(x470.value)); IkReal x468=x457; IkReal x469=((-1.0)*x468); sj6=0; cj6=1.0; j6=0; sj7=gconst1; cj7=gconst2; j7=x467; IkReal gconst1=(new_r00*x469); IkReal gconst2=(new_r10*x469); IkReal x471=new_r10*new_r10; IkReal x472=(((new_r10*new_r11))+((new_r00*new_r01))); IkReal x473=x457; IkReal x474=(new_r10*x473); j5eval[0]=x472; j5eval[1]=IKsign(x472); j5eval[2]=((IKabs((((new_r11*x474))+(((-1.0)*new_r00*x474)))))+(IKabs((((x471*x473))+((new_r01*x474)))))); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 || IKabs(j5eval[2]) < 0.0000010000000000 ) { { IkReal j5eval[1]; CheckValue<IkReal> x478 = IKatan2WithCheck(IkReal(new_r00),IkReal(((-1.0)*new_r10)),IKFAST_ATAN2_MAGTHRESH); if(!x478.valid){ continue; } IkReal x475=((-1.0)*(x478.value)); IkReal x476=x457; IkReal x477=((-1.0)*x476); sj6=0; cj6=1.0; j6=0; sj7=gconst1; cj7=gconst2; j7=x475; IkReal gconst1=(new_r00*x477); IkReal gconst2=(new_r10*x477); IkReal x479=new_r10*new_r10; IkReal x480=new_r00*new_r00; CheckValue<IkReal> x487=IKPowWithIntegerCheck((x480+x479),-1); if(!x487.valid){ continue; } IkReal x481=x487.value; IkReal x482=(x479*x481); CheckValue<IkReal> x488=IKPowWithIntegerCheck(((((-1.0)*x480))+(((-1.0)*x479))),-1); if(!x488.valid){ continue; } IkReal x483=x488.value; IkReal x484=((1.0)*x483); IkReal x485=(new_r00*x484); j5eval[0]=((IKabs(((((-1.0)*x482))+((x480*x482))+((x481*(x480*x480))))))+(IKabs(((((-1.0)*new_r10*x485))+(((-1.0)*new_r10*x485*(new_r00*new_r00)))+(((-1.0)*x485*(new_r10*new_r10*new_r10))))))); if( IKabs(j5eval[0]) < 0.0000010000000000 ) { continue; // no branches [j5] } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x489 = IKatan2WithCheck(IkReal(((((-1.0)*(gconst2*gconst2)))+(new_r00*new_r00))),IkReal(((((-1.0)*gconst1*gconst2))+(((-1.0)*new_r00*new_r10)))),IKFAST_ATAN2_MAGTHRESH); if(!x489.valid){ continue; } CheckValue<IkReal> x490=IKPowWithIntegerCheck(IKsign((((gconst2*new_r10))+((gconst1*new_r00)))),-1); if(!x490.valid){ continue; } j5array[0]=((-1.5707963267949)+(x489.value)+(((1.5707963267949)*(x490.value)))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x491=IKsin(j5); IkReal x492=IKcos(j5); IkReal x493=((1.0)*gconst1); IkReal x494=(gconst2*x492); IkReal x495=(gconst2*x491); IkReal x496=((1.0)*x491); IkReal x497=(x491*x493); evalcond[0]=(gconst2+((new_r10*x491))+((new_r00*x492))); evalcond[1]=(x495+((gconst1*x492))+new_r10); evalcond[2]=((((-1.0)*new_r00*x496))+gconst1+((new_r10*x492))); evalcond[3]=((((-1.0)*new_r01*x496))+gconst2+((new_r11*x492))); evalcond[4]=((((-1.0)*x497))+x494+new_r00); evalcond[5]=((((-1.0)*x497))+x494+new_r11); evalcond[6]=((((-1.0)*x493))+((new_r11*x491))+((new_r01*x492))); evalcond[7]=((((-1.0)*x495))+new_r01+(((-1.0)*x492*x493))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; IkReal x498=((1.0)*gconst2); CheckValue<IkReal> x499 = IKatan2WithCheck(IkReal((((gconst2*new_r00))+(((-1.0)*new_r11*x498)))),IkReal(((((-1.0)*new_r01*x498))+(((-1.0)*new_r10*x498)))),IKFAST_ATAN2_MAGTHRESH); if(!x499.valid){ continue; } CheckValue<IkReal> x500=IKPowWithIntegerCheck(IKsign((((new_r10*new_r11))+((new_r00*new_r01)))),-1); if(!x500.valid){ continue; } j5array[0]=((-1.5707963267949)+(x499.value)+(((1.5707963267949)*(x500.value)))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x501=IKsin(j5); IkReal x502=IKcos(j5); IkReal x503=((1.0)*gconst1); IkReal x504=(gconst2*x502); IkReal x505=(gconst2*x501); IkReal x506=((1.0)*x501); IkReal x507=(x501*x503); evalcond[0]=(gconst2+((new_r10*x501))+((new_r00*x502))); evalcond[1]=(((gconst1*x502))+x505+new_r10); evalcond[2]=((((-1.0)*new_r00*x506))+gconst1+((new_r10*x502))); evalcond[3]=((((-1.0)*new_r01*x506))+gconst2+((new_r11*x502))); evalcond[4]=((((-1.0)*x507))+x504+new_r00); evalcond[5]=((((-1.0)*x507))+x504+new_r11); evalcond[6]=((((-1.0)*x503))+((new_r11*x501))+((new_r01*x502))); evalcond[7]=((((-1.0)*x502*x503))+new_r01+(((-1.0)*x505))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; IkReal x508=((1.0)*new_r10); CheckValue<IkReal> x509=IKPowWithIntegerCheck(IKsign(((new_r10*new_r10)+(new_r00*new_r00))),-1); if(!x509.valid){ continue; } CheckValue<IkReal> x510 = IKatan2WithCheck(IkReal((((gconst1*new_r00))+(((-1.0)*gconst2*x508)))),IkReal(((((-1.0)*gconst1*x508))+(((-1.0)*gconst2*new_r00)))),IKFAST_ATAN2_MAGTHRESH); if(!x510.valid){ continue; } j5array[0]=((-1.5707963267949)+(((1.5707963267949)*(x509.value)))+(x510.value)); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x511=IKsin(j5); IkReal x512=IKcos(j5); IkReal x513=((1.0)*gconst1); IkReal x514=(gconst2*x512); IkReal x515=(gconst2*x511); IkReal x516=((1.0)*x511); IkReal x517=(x511*x513); evalcond[0]=(((new_r00*x512))+((new_r10*x511))+gconst2); evalcond[1]=(((gconst1*x512))+x515+new_r10); evalcond[2]=(((new_r10*x512))+gconst1+(((-1.0)*new_r00*x516))); evalcond[3]=(((new_r11*x512))+gconst2+(((-1.0)*new_r01*x516))); evalcond[4]=(x514+new_r00+(((-1.0)*x517))); evalcond[5]=(x514+new_r11+(((-1.0)*x517))); evalcond[6]=(((new_r01*x512))+((new_r11*x511))+(((-1.0)*x513))); evalcond[7]=((((-1.0)*x515))+(((-1.0)*x512*x513))+new_r01); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { IkReal x520 = ((new_r10*new_r10)+(new_r00*new_r00)); if(IKabs(x520)==0){ continue; } IkReal x518=pow(x520,-0.5); IkReal x519=((1.0)*x518); CheckValue<IkReal> x521 = IKatan2WithCheck(IkReal(new_r00),IkReal(((-1.0)*new_r10)),IKFAST_ATAN2_MAGTHRESH); if(!x521.valid){ continue; } IkReal gconst4=(new_r00*x519); IkReal gconst5=(new_r10*x519); CheckValue<IkReal> x522 = IKatan2WithCheck(IkReal(new_r00),IkReal(((-1.0)*new_r10)),IKFAST_ATAN2_MAGTHRESH); if(!x522.valid){ continue; } evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+(x522.value)+j7)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5eval[2]; CheckValue<IkReal> x526 = IKatan2WithCheck(IkReal(new_r00),IkReal(((-1.0)*new_r10)),IKFAST_ATAN2_MAGTHRESH); if(!x526.valid){ continue; } IkReal x523=((1.0)*(x526.value)); IkReal x524=x518; IkReal x525=((1.0)*x524); sj6=0; cj6=1.0; j6=0; sj7=gconst4; cj7=gconst5; j7=((3.14159265)+(((-1.0)*x523))); IkReal gconst4=(new_r00*x525); IkReal gconst5=(new_r10*x525); IkReal x527=((new_r10*new_r10)+(new_r00*new_r00)); j5eval[0]=x527; j5eval[1]=IKsign(x527); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 ) { { IkReal j5eval[3]; CheckValue<IkReal> x531 = IKatan2WithCheck(IkReal(new_r00),IkReal(((-1.0)*new_r10)),IKFAST_ATAN2_MAGTHRESH); if(!x531.valid){ continue; } IkReal x528=((1.0)*(x531.value)); IkReal x529=x518; IkReal x530=((1.0)*x529); sj6=0; cj6=1.0; j6=0; sj7=gconst4; cj7=gconst5; j7=((3.14159265)+(((-1.0)*x528))); IkReal gconst4=(new_r00*x530); IkReal gconst5=(new_r10*x530); IkReal x532=new_r10*new_r10; IkReal x533=(new_r10*new_r11); IkReal x534=(((new_r00*new_r01))+x533); IkReal x535=x518; IkReal x536=((1.0)*x535); j5eval[0]=x534; j5eval[1]=((IKabs(((((-1.0)*new_r01*new_r10*x536))+(((-1.0)*x532*x536)))))+(IKabs(((((-1.0)*x533*x536))+((new_r00*new_r10*x535)))))); j5eval[2]=IKsign(x534); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 || IKabs(j5eval[2]) < 0.0000010000000000 ) { { IkReal j5eval[1]; CheckValue<IkReal> x540 = IKatan2WithCheck(IkReal(new_r00),IkReal(((-1.0)*new_r10)),IKFAST_ATAN2_MAGTHRESH); if(!x540.valid){ continue; } IkReal x537=((1.0)*(x540.value)); IkReal x538=x518; IkReal x539=((1.0)*x538); sj6=0; cj6=1.0; j6=0; sj7=gconst4; cj7=gconst5; j7=((3.14159265)+(((-1.0)*x537))); IkReal gconst4=(new_r00*x539); IkReal gconst5=(new_r10*x539); IkReal x541=new_r10*new_r10; IkReal x542=new_r00*new_r00; CheckValue<IkReal> x549=IKPowWithIntegerCheck((x541+x542),-1); if(!x549.valid){ continue; } IkReal x543=x549.value; IkReal x544=(x541*x543); CheckValue<IkReal> x550=IKPowWithIntegerCheck(((((-1.0)*x541))+(((-1.0)*x542))),-1); if(!x550.valid){ continue; } IkReal x545=x550.value; IkReal x546=((1.0)*x545); IkReal x547=(new_r00*x546); j5eval[0]=((IKabs(((((-1.0)*x544))+((x542*x544))+((x543*(x542*x542))))))+(IKabs(((((-1.0)*new_r10*x547))+(((-1.0)*new_r10*x547*(new_r00*new_r00)))+(((-1.0)*x547*(new_r10*new_r10*new_r10))))))); if( IKabs(j5eval[0]) < 0.0000010000000000 ) { continue; // no branches [j5] } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x551=IKPowWithIntegerCheck(IKsign((((gconst4*new_r00))+((gconst5*new_r10)))),-1); if(!x551.valid){ continue; } CheckValue<IkReal> x552 = IKatan2WithCheck(IkReal(((((-1.0)*(gconst5*gconst5)))+(new_r00*new_r00))),IkReal(((((-1.0)*gconst4*gconst5))+(((-1.0)*new_r00*new_r10)))),IKFAST_ATAN2_MAGTHRESH); if(!x552.valid){ continue; } j5array[0]=((-1.5707963267949)+(((1.5707963267949)*(x551.value)))+(x552.value)); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x553=IKsin(j5); IkReal x554=IKcos(j5); IkReal x555=((1.0)*gconst4); IkReal x556=(gconst5*x554); IkReal x557=((1.0)*x553); IkReal x558=(x553*x555); evalcond[0]=(((new_r10*x553))+gconst5+((new_r00*x554))); evalcond[1]=(((gconst5*x553))+((gconst4*x554))+new_r10); evalcond[2]=(((new_r10*x554))+gconst4+(((-1.0)*new_r00*x557))); evalcond[3]=(((new_r11*x554))+gconst5+(((-1.0)*new_r01*x557))); evalcond[4]=((((-1.0)*x558))+x556+new_r00); evalcond[5]=((((-1.0)*x558))+x556+new_r11); evalcond[6]=(((new_r11*x553))+(((-1.0)*x555))+((new_r01*x554))); evalcond[7]=((((-1.0)*x554*x555))+new_r01+(((-1.0)*gconst5*x557))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; IkReal x559=((1.0)*gconst5); CheckValue<IkReal> x560 = IKatan2WithCheck(IkReal((((gconst5*new_r00))+(((-1.0)*new_r11*x559)))),IkReal(((((-1.0)*new_r10*x559))+(((-1.0)*new_r01*x559)))),IKFAST_ATAN2_MAGTHRESH); if(!x560.valid){ continue; } CheckValue<IkReal> x561=IKPowWithIntegerCheck(IKsign((((new_r10*new_r11))+((new_r00*new_r01)))),-1); if(!x561.valid){ continue; } j5array[0]=((-1.5707963267949)+(x560.value)+(((1.5707963267949)*(x561.value)))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x562=IKsin(j5); IkReal x563=IKcos(j5); IkReal x564=((1.0)*gconst4); IkReal x565=(gconst5*x563); IkReal x566=((1.0)*x562); IkReal x567=(x562*x564); evalcond[0]=(gconst5+((new_r00*x563))+((new_r10*x562))); evalcond[1]=(((gconst5*x562))+((gconst4*x563))+new_r10); evalcond[2]=((((-1.0)*new_r00*x566))+gconst4+((new_r10*x563))); evalcond[3]=(gconst5+((new_r11*x563))+(((-1.0)*new_r01*x566))); evalcond[4]=(x565+new_r00+(((-1.0)*x567))); evalcond[5]=(x565+new_r11+(((-1.0)*x567))); evalcond[6]=(((new_r01*x563))+((new_r11*x562))+(((-1.0)*x564))); evalcond[7]=((((-1.0)*gconst5*x566))+(((-1.0)*x563*x564))+new_r01); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; IkReal x568=((1.0)*new_r10); CheckValue<IkReal> x569=IKPowWithIntegerCheck(IKsign(((new_r10*new_r10)+(new_r00*new_r00))),-1); if(!x569.valid){ continue; } CheckValue<IkReal> x570 = IKatan2WithCheck(IkReal((((gconst4*new_r00))+(((-1.0)*gconst5*x568)))),IkReal(((((-1.0)*gconst4*x568))+(((-1.0)*gconst5*new_r00)))),IKFAST_ATAN2_MAGTHRESH); if(!x570.valid){ continue; } j5array[0]=((-1.5707963267949)+(((1.5707963267949)*(x569.value)))+(x570.value)); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x571=IKsin(j5); IkReal x572=IKcos(j5); IkReal x573=((1.0)*gconst4); IkReal x574=(gconst5*x572); IkReal x575=((1.0)*x571); IkReal x576=(x571*x573); evalcond[0]=(((new_r00*x572))+((new_r10*x571))+gconst5); evalcond[1]=(((gconst5*x571))+((gconst4*x572))+new_r10); evalcond[2]=(((new_r10*x572))+gconst4+(((-1.0)*new_r00*x575))); evalcond[3]=(((new_r11*x572))+gconst5+(((-1.0)*new_r01*x575))); evalcond[4]=((((-1.0)*x576))+x574+new_r00); evalcond[5]=((((-1.0)*x576))+x574+new_r11); evalcond[6]=(((new_r11*x571))+((new_r01*x572))+(((-1.0)*x573))); evalcond[7]=((((-1.0)*gconst5*x575))+new_r01+(((-1.0)*x572*x573))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j7)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; if( IKabs(new_r00) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r10)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r00)+IKsqr(((-1.0)*new_r10))-1) <= IKFAST_SINCOS_THRESH ) continue; j5array[0]=IKatan2(new_r00, ((-1.0)*new_r10)); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x577=IKcos(j5); IkReal x578=IKsin(j5); IkReal x579=((1.0)*x578); evalcond[0]=(x577+new_r10); evalcond[1]=((((-1.0)*x579))+new_r00); evalcond[2]=((((-1.0)*x579))+new_r11); evalcond[3]=((((-1.0)*x577))+new_r01); evalcond[4]=(((new_r00*x577))+((new_r10*x578))); evalcond[5]=(((new_r11*x577))+(((-1.0)*new_r01*x579))); evalcond[6]=((-1.0)+((new_r11*x578))+((new_r01*x577))); evalcond[7]=((1.0)+((new_r10*x577))+(((-1.0)*new_r00*x579))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j7)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; if( IKabs(((-1.0)*new_r00)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r01)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r00))+IKsqr(((-1.0)*new_r01))-1) <= IKFAST_SINCOS_THRESH ) continue; j5array[0]=IKatan2(((-1.0)*new_r00), ((-1.0)*new_r01)); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x580=IKsin(j5); IkReal x581=IKcos(j5); IkReal x582=((1.0)*x580); evalcond[0]=(x580+new_r00); evalcond[1]=(x580+new_r11); evalcond[2]=(x581+new_r01); evalcond[3]=((((-1.0)*x581))+new_r10); evalcond[4]=(((new_r00*x581))+((new_r10*x580))); evalcond[5]=((((-1.0)*new_r01*x582))+((new_r11*x581))); evalcond[6]=((1.0)+((new_r01*x581))+((new_r11*x580))); evalcond[7]=((-1.0)+(((-1.0)*new_r00*x582))+((new_r10*x581))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((new_r10*new_r10)+(new_r00*new_r00)); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5eval[1]; sj6=0; cj6=1.0; j6=0; new_r10=0; new_r00=0; j5eval[0]=((IKabs(new_r11))+(IKabs(new_r01))); if( IKabs(j5eval[0]) < 0.0000010000000000 ) { continue; // 3 cases reached } else { { IkReal j5array[2], cj5array[2], sj5array[2]; bool j5valid[2]={false}; _nj5 = 2; CheckValue<IkReal> x584 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x584.valid){ continue; } IkReal x583=x584.value; j5array[0]=((-1.0)*x583); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); j5array[1]=((3.14159265358979)+(((-1.0)*x583))); sj5array[1]=IKsin(j5array[1]); cj5array[1]=IKcos(j5array[1]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; if( j5array[1] > IKPI ) { j5array[1]-=IK2PI; } else if( j5array[1] < -IKPI ) { j5array[1]+=IK2PI; } j5valid[1] = true; for(int ij5 = 0; ij5 < 2; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 2; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[1]; evalcond[0]=(((new_r11*(IKcos(j5))))+(((-1.0)*new_r01*(IKsin(j5))))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r10))+(IKabs(new_r00))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5eval[1]; sj6=0; cj6=1.0; j6=0; new_r00=0; new_r10=0; new_r21=0; new_r22=0; j5eval[0]=((IKabs(new_r11))+(IKabs(new_r01))); if( IKabs(j5eval[0]) < 0.0000010000000000 ) { continue; // no branches [j5] } else { { IkReal j5array[2], cj5array[2], sj5array[2]; bool j5valid[2]={false}; _nj5 = 2; CheckValue<IkReal> x586 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x586.valid){ continue; } IkReal x585=x586.value; j5array[0]=((-1.0)*x585); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); j5array[1]=((3.14159265358979)+(((-1.0)*x585))); sj5array[1]=IKsin(j5array[1]); cj5array[1]=IKcos(j5array[1]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; if( j5array[1] > IKPI ) { j5array[1]-=IK2PI; } else if( j5array[1] < -IKPI ) { j5array[1]+=IK2PI; } j5valid[1] = true; for(int ij5 = 0; ij5 < 2; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 2; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[1]; evalcond[0]=(((new_r11*(IKcos(j5))))+(((-1.0)*new_r01*(IKsin(j5))))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j5] } } while(0); if( bgotonextstatement ) { } } } } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; IkReal x587=((1.0)*new_r10); CheckValue<IkReal> x588=IKPowWithIntegerCheck(IKsign(((((-1.0)*sj7*x587))+((cj7*new_r00)))),-1); if(!x588.valid){ continue; } CheckValue<IkReal> x589 = IKatan2WithCheck(IkReal((((cj7*sj7))+(((-1.0)*new_r00*x587)))),IkReal(((((-1.0)*(cj7*cj7)))+(new_r10*new_r10))),IKFAST_ATAN2_MAGTHRESH); if(!x589.valid){ continue; } j5array[0]=((-1.5707963267949)+(((1.5707963267949)*(x588.value)))+(x589.value)); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x590=IKcos(j5); IkReal x591=IKsin(j5); IkReal x592=((1.0)*sj7); IkReal x593=(cj7*x590); IkReal x594=((1.0)*x591); IkReal x595=(x591*x592); evalcond[0]=(cj7+((new_r10*x591))+((new_r00*x590))); evalcond[1]=(((sj7*x590))+new_r10+((cj7*x591))); evalcond[2]=(sj7+(((-1.0)*new_r00*x594))+((new_r10*x590))); evalcond[3]=(cj7+((new_r11*x590))+(((-1.0)*new_r01*x594))); evalcond[4]=((((-1.0)*x595))+x593+new_r00); evalcond[5]=((((-1.0)*x595))+x593+new_r11); evalcond[6]=(((new_r11*x591))+((new_r01*x590))+(((-1.0)*x592))); evalcond[7]=((((-1.0)*x590*x592))+(((-1.0)*cj7*x594))+new_r01); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; IkReal x596=((1.0)*cj7); CheckValue<IkReal> x597 = IKatan2WithCheck(IkReal(((((-1.0)*new_r11*x596))+((cj7*new_r00)))),IkReal(((((-1.0)*new_r10*x596))+(((-1.0)*new_r01*x596)))),IKFAST_ATAN2_MAGTHRESH); if(!x597.valid){ continue; } CheckValue<IkReal> x598=IKPowWithIntegerCheck(IKsign((((new_r10*new_r11))+((new_r00*new_r01)))),-1); if(!x598.valid){ continue; } j5array[0]=((-1.5707963267949)+(x597.value)+(((1.5707963267949)*(x598.value)))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x599=IKcos(j5); IkReal x600=IKsin(j5); IkReal x601=((1.0)*sj7); IkReal x602=(cj7*x599); IkReal x603=((1.0)*x600); IkReal x604=(x600*x601); evalcond[0]=(cj7+((new_r00*x599))+((new_r10*x600))); evalcond[1]=(((cj7*x600))+((sj7*x599))+new_r10); evalcond[2]=(sj7+((new_r10*x599))+(((-1.0)*new_r00*x603))); evalcond[3]=(cj7+((new_r11*x599))+(((-1.0)*new_r01*x603))); evalcond[4]=(x602+(((-1.0)*x604))+new_r00); evalcond[5]=(x602+(((-1.0)*x604))+new_r11); evalcond[6]=(((new_r11*x600))+((new_r01*x599))+(((-1.0)*x601))); evalcond[7]=((((-1.0)*x599*x601))+new_r01+(((-1.0)*cj7*x603))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; IkReal x605=((1.0)*new_r10); CheckValue<IkReal> x606=IKPowWithIntegerCheck(IKsign(((new_r10*new_r10)+(new_r00*new_r00))),-1); if(!x606.valid){ continue; } CheckValue<IkReal> x607 = IKatan2WithCheck(IkReal((((new_r00*sj7))+(((-1.0)*cj7*x605)))),IkReal(((((-1.0)*sj7*x605))+(((-1.0)*cj7*new_r00)))),IKFAST_ATAN2_MAGTHRESH); if(!x607.valid){ continue; } j5array[0]=((-1.5707963267949)+(((1.5707963267949)*(x606.value)))+(x607.value)); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x608=IKcos(j5); IkReal x609=IKsin(j5); IkReal x610=((1.0)*sj7); IkReal x611=(cj7*x608); IkReal x612=((1.0)*x609); IkReal x613=(x609*x610); evalcond[0]=(cj7+((new_r10*x609))+((new_r00*x608))); evalcond[1]=(((cj7*x609))+((sj7*x608))+new_r10); evalcond[2]=(sj7+((new_r10*x608))+(((-1.0)*new_r00*x612))); evalcond[3]=(cj7+((new_r11*x608))+(((-1.0)*new_r01*x612))); evalcond[4]=((((-1.0)*x613))+x611+new_r00); evalcond[5]=((((-1.0)*x613))+x611+new_r11); evalcond[6]=(((new_r11*x609))+(((-1.0)*x610))+((new_r01*x608))); evalcond[7]=(new_r01+(((-1.0)*cj7*x612))+(((-1.0)*x608*x610))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j6)))), 6.28318530717959))); evalcond[1]=new_r02; evalcond[2]=new_r12; evalcond[3]=new_r20; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5eval[3]; sj6=0; cj6=-1.0; j6=3.14159265358979; IkReal x614=((1.0)*sj7); IkReal x615=(((new_r10*new_r11))+((new_r00*new_r01))); j5eval[0]=x615; j5eval[1]=IKsign(x615); j5eval[2]=((IKabs((((new_r01*sj7))+(((-1.0)*new_r10*x614)))))+(IKabs(((((-1.0)*new_r11*x614))+(((-1.0)*new_r00*x614)))))); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 || IKabs(j5eval[2]) < 0.0000010000000000 ) { { IkReal j5eval[3]; sj6=0; cj6=-1.0; j6=3.14159265358979; IkReal x616=((1.0)*new_r11); IkReal x617=((new_r01*new_r01)+(new_r11*new_r11)); j5eval[0]=x617; j5eval[1]=((IKabs(((((-1.0)*sj7*x616))+((cj7*new_r01)))))+(IKabs(((((-1.0)*new_r01*sj7))+(((-1.0)*cj7*x616)))))); j5eval[2]=IKsign(x617); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 || IKabs(j5eval[2]) < 0.0000010000000000 ) { { IkReal j5eval[3]; sj6=0; cj6=-1.0; j6=3.14159265358979; IkReal x618=(((new_r11*sj7))+((cj7*new_r01))); j5eval[0]=x618; j5eval[1]=IKsign(x618); j5eval[2]=((IKabs(((-1.0)+(cj7*cj7)+((new_r01*new_r10)))))+(IKabs(((((-1.0)*cj7*sj7))+(((-1.0)*new_r10*new_r11)))))); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 || IKabs(j5eval[2]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { IkReal x620 = ((new_r01*new_r01)+(new_r11*new_r11)); if(IKabs(x620)==0){ continue; } IkReal x619=pow(x620,-0.5); CheckValue<IkReal> x621 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x621.valid){ continue; } IkReal gconst7=((-1.0)*new_r01*x619); IkReal gconst8=(new_r11*x619); CheckValue<IkReal> x622 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x622.valid){ continue; } evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((x622.value)+j7)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5eval[3]; CheckValue<IkReal> x625 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x625.valid){ continue; } IkReal x623=((-1.0)*(x625.value)); IkReal x624=x619; sj6=0; cj6=-1.0; j6=3.14159265358979; sj7=gconst7; cj7=gconst8; j7=x623; IkReal gconst7=((-1.0)*new_r01*x624); IkReal gconst8=(new_r11*x624); IkReal x626=new_r01*new_r01; IkReal x627=(new_r00*new_r01); IkReal x628=(((new_r10*new_r11))+x627); IkReal x629=x619; IkReal x630=(new_r01*x629); j5eval[0]=x628; j5eval[1]=IKsign(x628); j5eval[2]=((IKabs((((new_r11*x630))+((x627*x629)))))+(IKabs((((new_r10*x630))+(((-1.0)*x626*x629)))))); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 || IKabs(j5eval[2]) < 0.0000010000000000 ) { { IkReal j5eval[2]; CheckValue<IkReal> x633 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x633.valid){ continue; } IkReal x631=((-1.0)*(x633.value)); IkReal x632=x619; sj6=0; cj6=-1.0; j6=3.14159265358979; sj7=gconst7; cj7=gconst8; j7=x631; IkReal gconst7=((-1.0)*new_r01*x632); IkReal gconst8=(new_r11*x632); IkReal x634=((new_r01*new_r01)+(new_r11*new_r11)); j5eval[0]=x634; j5eval[1]=IKsign(x634); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 ) { { IkReal j5eval[1]; CheckValue<IkReal> x637 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x637.valid){ continue; } IkReal x635=((-1.0)*(x637.value)); IkReal x636=x619; sj6=0; cj6=-1.0; j6=3.14159265358979; sj7=gconst7; cj7=gconst8; j7=x635; IkReal gconst7=((-1.0)*new_r01*x636); IkReal gconst8=(new_r11*x636); IkReal x638=new_r01*new_r01; IkReal x639=new_r11*new_r11; IkReal x640=((1.0)*x638); CheckValue<IkReal> x646=IKPowWithIntegerCheck((x638+x639),-1); if(!x646.valid){ continue; } IkReal x641=x646.value; CheckValue<IkReal> x647=IKPowWithIntegerCheck(((((-1.0)*x640))+(((-1.0)*x639))),-1); if(!x647.valid){ continue; } IkReal x642=x647.value; IkReal x643=((1.0)*x642); IkReal x644=(new_r11*x643); j5eval[0]=((IKabs((((x641*(x639*x639)))+((x638*x639*x641))+(((-1.0)*x640*x641)))))+(IKabs(((((-1.0)*x644*(new_r01*new_r01*new_r01)))+(((-1.0)*new_r01*x644*(new_r11*new_r11)))+(((-1.0)*new_r01*x644)))))); if( IKabs(j5eval[0]) < 0.0000010000000000 ) { { IkReal evalcond[2]; bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r11))+(IKabs(new_r00))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5eval[1]; CheckValue<IkReal> x649 = IKatan2WithCheck(IkReal(new_r01),IkReal(0),IKFAST_ATAN2_MAGTHRESH); if(!x649.valid){ continue; } IkReal x648=((-1.0)*(x649.value)); sj6=0; cj6=-1.0; j6=3.14159265358979; sj7=gconst7; cj7=gconst8; j7=x648; new_r11=0; new_r00=0; IkReal x650 = new_r01*new_r01; if(IKabs(x650)==0){ continue; } IkReal gconst7=((-1.0)*new_r01*(pow(x650,-0.5))); j5eval[0]=new_r10; if( IKabs(j5eval[0]) < 0.0000010000000000 ) { { IkReal j5array[2], cj5array[2], sj5array[2]; bool j5valid[2]={false}; _nj5 = 2; CheckValue<IkReal> x651=IKPowWithIntegerCheck(gconst7,-1); if(!x651.valid){ continue; } cj5array[0]=((-1.0)*new_r10*(x651.value)); if( cj5array[0] >= -1-IKFAST_SINCOS_THRESH && cj5array[0] <= 1+IKFAST_SINCOS_THRESH ) { j5valid[0] = j5valid[1] = true; j5array[0] = IKacos(cj5array[0]); sj5array[0] = IKsin(j5array[0]); cj5array[1] = cj5array[0]; j5array[1] = -j5array[0]; sj5array[1] = -sj5array[0]; } else if( isnan(cj5array[0]) ) { // probably any value will work j5valid[0] = true; cj5array[0] = 1; sj5array[0] = 0; j5array[0] = 0; } for(int ij5 = 0; ij5 < 2; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 2; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[6]; IkReal x652=IKsin(j5); IkReal x653=IKcos(j5); IkReal x654=((-1.0)*x652); evalcond[0]=(new_r10*x652); evalcond[1]=(new_r01*x654); evalcond[2]=(gconst7*x654); evalcond[3]=(gconst7+((new_r10*x653))); evalcond[4]=(gconst7+((new_r01*x653))); evalcond[5]=(((gconst7*x653))+new_r01); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } else { { IkReal j5array[2], cj5array[2], sj5array[2]; bool j5valid[2]={false}; _nj5 = 2; CheckValue<IkReal> x655=IKPowWithIntegerCheck(new_r10,-1); if(!x655.valid){ continue; } cj5array[0]=((-1.0)*gconst7*(x655.value)); if( cj5array[0] >= -1-IKFAST_SINCOS_THRESH && cj5array[0] <= 1+IKFAST_SINCOS_THRESH ) { j5valid[0] = j5valid[1] = true; j5array[0] = IKacos(cj5array[0]); sj5array[0] = IKsin(j5array[0]); cj5array[1] = cj5array[0]; j5array[1] = -j5array[0]; sj5array[1] = -sj5array[0]; } else if( isnan(cj5array[0]) ) { // probably any value will work j5valid[0] = true; cj5array[0] = 1; sj5array[0] = 0; j5array[0] = 0; } for(int ij5 = 0; ij5 < 2; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 2; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[6]; IkReal x656=IKsin(j5); IkReal x657=IKcos(j5); IkReal x658=(gconst7*x657); IkReal x659=((-1.0)*x656); evalcond[0]=(new_r10*x656); evalcond[1]=(new_r01*x659); evalcond[2]=(gconst7*x659); evalcond[3]=(x658+new_r10); evalcond[4]=(gconst7+((new_r01*x657))); evalcond[5]=(x658+new_r01); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r10))+(IKabs(new_r00))); evalcond[1]=gconst7; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5eval[3]; CheckValue<IkReal> x661 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x661.valid){ continue; } IkReal x660=((-1.0)*(x661.value)); sj6=0; cj6=-1.0; j6=3.14159265358979; sj7=gconst7; cj7=gconst8; j7=x660; new_r00=0; new_r10=0; new_r21=0; new_r22=0; IkReal gconst7=((-1.0)*new_r01); IkReal gconst8=new_r11; j5eval[0]=-1.0; j5eval[1]=((IKabs((new_r01*new_r11)))+(IKabs(((1.0)+(((-1.0)*(new_r01*new_r01))))))); j5eval[2]=-1.0; if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 || IKabs(j5eval[2]) < 0.0000010000000000 ) { { IkReal j5eval[3]; CheckValue<IkReal> x663 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x663.valid){ continue; } IkReal x662=((-1.0)*(x663.value)); sj6=0; cj6=-1.0; j6=3.14159265358979; sj7=gconst7; cj7=gconst8; j7=x662; new_r00=0; new_r10=0; new_r21=0; new_r22=0; IkReal gconst7=((-1.0)*new_r01); IkReal gconst8=new_r11; j5eval[0]=-1.0; j5eval[1]=((IKabs((new_r01*new_r11)))+(IKabs(((1.0)+(((-1.0)*(new_r01*new_r01))))))); j5eval[2]=-1.0; if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 || IKabs(j5eval[2]) < 0.0000010000000000 ) { { IkReal j5eval[3]; CheckValue<IkReal> x665 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x665.valid){ continue; } IkReal x664=((-1.0)*(x665.value)); sj6=0; cj6=-1.0; j6=3.14159265358979; sj7=gconst7; cj7=gconst8; j7=x664; new_r00=0; new_r10=0; new_r21=0; new_r22=0; IkReal gconst7=((-1.0)*new_r01); IkReal gconst8=new_r11; j5eval[0]=1.0; j5eval[1]=((((0.5)*(IKabs(((-1.0)+(((2.0)*(new_r01*new_r01))))))))+(IKabs((new_r01*new_r11)))); j5eval[2]=1.0; if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 || IKabs(j5eval[2]) < 0.0000010000000000 ) { continue; // 3 cases reached } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; IkReal x666=((1.0)*new_r11); CheckValue<IkReal> x667=IKPowWithIntegerCheck(IKsign(((new_r01*new_r01)+(new_r11*new_r11))),-1); if(!x667.valid){ continue; } CheckValue<IkReal> x668 = IKatan2WithCheck(IkReal((((gconst8*new_r01))+(((-1.0)*gconst7*x666)))),IkReal(((((-1.0)*gconst7*new_r01))+(((-1.0)*gconst8*x666)))),IKFAST_ATAN2_MAGTHRESH); if(!x668.valid){ continue; } j5array[0]=((-1.5707963267949)+(((1.5707963267949)*(x667.value)))+(x668.value)); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[6]; IkReal x669=IKsin(j5); IkReal x670=IKcos(j5); IkReal x671=(gconst7*x670); IkReal x672=((1.0)*x669); IkReal x673=(gconst8*x670); IkReal x674=(gconst8*x672); evalcond[0]=(x671+(((-1.0)*x674))); evalcond[1]=(((new_r01*x670))+gconst7+((new_r11*x669))); evalcond[2]=(((gconst7*x669))+x673+new_r11); evalcond[3]=(((new_r11*x670))+(((-1.0)*new_r01*x672))+gconst8); evalcond[4]=((((-1.0)*x673))+(((-1.0)*gconst7*x672))); evalcond[5]=(x671+new_r01+(((-1.0)*x674))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x675 = IKatan2WithCheck(IkReal((gconst7*new_r11)),IkReal((gconst8*new_r11)),IKFAST_ATAN2_MAGTHRESH); if(!x675.valid){ continue; } CheckValue<IkReal> x676=IKPowWithIntegerCheck(IKsign(((((-1.0)*(gconst8*gconst8)))+(((-1.0)*(gconst7*gconst7))))),-1); if(!x676.valid){ continue; } j5array[0]=((-1.5707963267949)+(x675.value)+(((1.5707963267949)*(x676.value)))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[6]; IkReal x677=IKsin(j5); IkReal x678=IKcos(j5); IkReal x679=(gconst7*x678); IkReal x680=((1.0)*x677); IkReal x681=(gconst8*x678); IkReal x682=(gconst8*x680); evalcond[0]=((((-1.0)*x682))+x679); evalcond[1]=(((new_r11*x677))+((new_r01*x678))+gconst7); evalcond[2]=(((gconst7*x677))+x681+new_r11); evalcond[3]=(((new_r11*x678))+(((-1.0)*new_r01*x680))+gconst8); evalcond[4]=((((-1.0)*gconst7*x680))+(((-1.0)*x681))); evalcond[5]=((((-1.0)*x682))+x679+new_r01); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x683 = IKatan2WithCheck(IkReal((gconst7*gconst8)),IkReal(gconst8*gconst8),IKFAST_ATAN2_MAGTHRESH); if(!x683.valid){ continue; } CheckValue<IkReal> x684=IKPowWithIntegerCheck(IKsign(((((-1.0)*gconst8*new_r11))+((gconst7*new_r01)))),-1); if(!x684.valid){ continue; } j5array[0]=((-1.5707963267949)+(x683.value)+(((1.5707963267949)*(x684.value)))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[6]; IkReal x685=IKsin(j5); IkReal x686=IKcos(j5); IkReal x687=(gconst7*x686); IkReal x688=((1.0)*x685); IkReal x689=(gconst8*x686); IkReal x690=(gconst8*x688); evalcond[0]=(x687+(((-1.0)*x690))); evalcond[1]=(gconst7+((new_r01*x686))+((new_r11*x685))); evalcond[2]=(((gconst7*x685))+x689+new_r11); evalcond[3]=((((-1.0)*new_r01*x688))+gconst8+((new_r11*x686))); evalcond[4]=((((-1.0)*gconst7*x688))+(((-1.0)*x689))); evalcond[5]=(x687+(((-1.0)*x690))+new_r01); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r10))+(IKabs(new_r01))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5array[2], cj5array[2], sj5array[2]; bool j5valid[2]={false}; _nj5 = 2; CheckValue<IkReal> x691=IKPowWithIntegerCheck(gconst8,-1); if(!x691.valid){ continue; } cj5array[0]=(new_r00*(x691.value)); if( cj5array[0] >= -1-IKFAST_SINCOS_THRESH && cj5array[0] <= 1+IKFAST_SINCOS_THRESH ) { j5valid[0] = j5valid[1] = true; j5array[0] = IKacos(cj5array[0]); sj5array[0] = IKsin(j5array[0]); cj5array[1] = cj5array[0]; j5array[1] = -j5array[0]; sj5array[1] = -sj5array[0]; } else if( isnan(cj5array[0]) ) { // probably any value will work j5valid[0] = true; cj5array[0] = 1; sj5array[0] = 0; j5array[0] = 0; } for(int ij5 = 0; ij5 < 2; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 2; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[6]; IkReal x692=IKsin(j5); IkReal x693=IKcos(j5); IkReal x694=((-1.0)*x692); evalcond[0]=(new_r11*x692); evalcond[1]=(new_r00*x694); evalcond[2]=(gconst8*x694); evalcond[3]=(gconst8+((new_r11*x693))); evalcond[4]=(((gconst8*x693))+new_r11); evalcond[5]=((((-1.0)*gconst8))+((new_r00*x693))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r00))+(IKabs(new_r01))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5eval[1]; CheckValue<IkReal> x696 = IKatan2WithCheck(IkReal(0),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x696.valid){ continue; } IkReal x695=((-1.0)*(x696.value)); sj6=0; cj6=-1.0; j6=3.14159265358979; sj7=gconst7; cj7=gconst8; j7=x695; new_r00=0; new_r01=0; new_r12=0; new_r22=0; IkReal gconst7=0; IkReal x697 = ((1.0)+(((-1.0)*(new_r10*new_r10)))); if(IKabs(x697)==0){ continue; } IkReal gconst8=(new_r11*(pow(x697,-0.5))); j5eval[0]=((IKabs(new_r11))+(IKabs(new_r10))); if( IKabs(j5eval[0]) < 0.0000010000000000 ) { { IkReal j5eval[1]; CheckValue<IkReal> x699 = IKatan2WithCheck(IkReal(0),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x699.valid){ continue; } IkReal x698=((-1.0)*(x699.value)); sj6=0; cj6=-1.0; j6=3.14159265358979; sj7=gconst7; cj7=gconst8; j7=x698; new_r00=0; new_r01=0; new_r12=0; new_r22=0; IkReal gconst7=0; IkReal x700 = ((1.0)+(((-1.0)*(new_r10*new_r10)))); if(IKabs(x700)==0){ continue; } IkReal gconst8=(new_r11*(pow(x700,-0.5))); j5eval[0]=new_r11; if( IKabs(j5eval[0]) < 0.0000010000000000 ) { { IkReal j5eval[2]; CheckValue<IkReal> x702 = IKatan2WithCheck(IkReal(0),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x702.valid){ continue; } IkReal x701=((-1.0)*(x702.value)); sj6=0; cj6=-1.0; j6=3.14159265358979; sj7=gconst7; cj7=gconst8; j7=x701; new_r00=0; new_r01=0; new_r12=0; new_r22=0; IkReal x703 = ((1.0)+(((-1.0)*(new_r10*new_r10)))); if(IKabs(x703)==0){ continue; } IkReal gconst8=(new_r11*(pow(x703,-0.5))); j5eval[0]=new_r10; j5eval[1]=new_r11; if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 ) { continue; // 3 cases reached } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x704=IKPowWithIntegerCheck(new_r10,-1); if(!x704.valid){ continue; } CheckValue<IkReal> x705=IKPowWithIntegerCheck(new_r11,-1); if(!x705.valid){ continue; } if( IKabs((gconst8*(x704.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*gconst8*(x705.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((gconst8*(x704.value)))+IKsqr(((-1.0)*gconst8*(x705.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j5array[0]=IKatan2((gconst8*(x704.value)), ((-1.0)*gconst8*(x705.value))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x706=IKcos(j5); IkReal x707=IKsin(j5); IkReal x708=(gconst8*x707); IkReal x709=(gconst8*x706); evalcond[0]=(new_r10*x706); evalcond[1]=(new_r11*x707); evalcond[2]=((-1.0)*x709); evalcond[3]=((-1.0)*x708); evalcond[4]=(gconst8+((new_r11*x706))); evalcond[5]=(x709+new_r11); evalcond[6]=((((-1.0)*x708))+new_r10); evalcond[7]=((((-1.0)*gconst8))+((new_r10*x707))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x710=IKPowWithIntegerCheck(gconst8,-1); if(!x710.valid){ continue; } CheckValue<IkReal> x711=IKPowWithIntegerCheck(new_r11,-1); if(!x711.valid){ continue; } if( IKabs((new_r10*(x710.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*gconst8*(x711.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((new_r10*(x710.value)))+IKsqr(((-1.0)*gconst8*(x711.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j5array[0]=IKatan2((new_r10*(x710.value)), ((-1.0)*gconst8*(x711.value))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x712=IKcos(j5); IkReal x713=IKsin(j5); IkReal x714=(gconst8*x713); IkReal x715=(gconst8*x712); evalcond[0]=(new_r10*x712); evalcond[1]=(new_r11*x713); evalcond[2]=((-1.0)*x715); evalcond[3]=((-1.0)*x714); evalcond[4]=(gconst8+((new_r11*x712))); evalcond[5]=(x715+new_r11); evalcond[6]=((((-1.0)*x714))+new_r10); evalcond[7]=((((-1.0)*gconst8))+((new_r10*x713))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x716 = IKatan2WithCheck(IkReal(new_r10),IkReal(((-1.0)*new_r11)),IKFAST_ATAN2_MAGTHRESH); if(!x716.valid){ continue; } CheckValue<IkReal> x717=IKPowWithIntegerCheck(IKsign(gconst8),-1); if(!x717.valid){ continue; } j5array[0]=((-1.5707963267949)+(x716.value)+(((1.5707963267949)*(x717.value)))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x718=IKcos(j5); IkReal x719=IKsin(j5); IkReal x720=(gconst8*x719); IkReal x721=(gconst8*x718); evalcond[0]=(new_r10*x718); evalcond[1]=(new_r11*x719); evalcond[2]=((-1.0)*x721); evalcond[3]=((-1.0)*x720); evalcond[4]=(gconst8+((new_r11*x718))); evalcond[5]=(x721+new_r11); evalcond[6]=((((-1.0)*x720))+new_r10); evalcond[7]=((((-1.0)*gconst8))+((new_r10*x719))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=IKabs(new_r01); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5eval[1]; CheckValue<IkReal> x723 = IKatan2WithCheck(IkReal(0),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x723.valid){ continue; } IkReal x722=((-1.0)*(x723.value)); sj6=0; cj6=-1.0; j6=3.14159265358979; sj7=gconst7; cj7=gconst8; j7=x722; new_r01=0; IkReal gconst7=0; IkReal x724 = new_r11*new_r11; if(IKabs(x724)==0){ continue; } IkReal gconst8=(new_r11*(pow(x724,-0.5))); j5eval[0]=((IKabs(new_r10))+(IKabs(new_r00))); if( IKabs(j5eval[0]) < 0.0000010000000000 ) { { IkReal j5eval[1]; CheckValue<IkReal> x726 = IKatan2WithCheck(IkReal(0),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x726.valid){ continue; } IkReal x725=((-1.0)*(x726.value)); sj6=0; cj6=-1.0; j6=3.14159265358979; sj7=gconst7; cj7=gconst8; j7=x725; new_r01=0; IkReal gconst7=0; IkReal x727 = new_r11*new_r11; if(IKabs(x727)==0){ continue; } IkReal gconst8=(new_r11*(pow(x727,-0.5))); j5eval[0]=((IKabs(new_r11))+(IKabs(new_r10))); if( IKabs(j5eval[0]) < 0.0000010000000000 ) { { IkReal j5eval[1]; CheckValue<IkReal> x729 = IKatan2WithCheck(IkReal(0),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x729.valid){ continue; } IkReal x728=((-1.0)*(x729.value)); sj6=0; cj6=-1.0; j6=3.14159265358979; sj7=gconst7; cj7=gconst8; j7=x728; new_r01=0; IkReal x730 = new_r11*new_r11; if(IKabs(x730)==0){ continue; } IkReal gconst8=(new_r11*(pow(x730,-0.5))); j5eval[0]=new_r11; if( IKabs(j5eval[0]) < 0.0000010000000000 ) { continue; // 3 cases reached } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x731=IKPowWithIntegerCheck(gconst8,-1); if(!x731.valid){ continue; } CheckValue<IkReal> x732=IKPowWithIntegerCheck(new_r11,-1); if(!x732.valid){ continue; } if( IKabs((new_r10*(x731.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*gconst8*(x732.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((new_r10*(x731.value)))+IKsqr(((-1.0)*gconst8*(x732.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j5array[0]=IKatan2((new_r10*(x731.value)), ((-1.0)*gconst8*(x732.value))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x733=IKsin(j5); IkReal x734=IKcos(j5); IkReal x735=((1.0)*gconst8); evalcond[0]=(new_r11*x733); evalcond[1]=((-1.0)*gconst8*x733); evalcond[2]=(gconst8+((new_r11*x734))); evalcond[3]=(((gconst8*x734))+new_r11); evalcond[4]=((((-1.0)*x733*x735))+new_r10); evalcond[5]=((((-1.0)*x734*x735))+new_r00); evalcond[6]=((((-1.0)*new_r00*x733))+((new_r10*x734))); evalcond[7]=(((new_r00*x734))+(((-1.0)*x735))+((new_r10*x733))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x736 = IKatan2WithCheck(IkReal(new_r10),IkReal(((-1.0)*new_r11)),IKFAST_ATAN2_MAGTHRESH); if(!x736.valid){ continue; } CheckValue<IkReal> x737=IKPowWithIntegerCheck(IKsign(gconst8),-1); if(!x737.valid){ continue; } j5array[0]=((-1.5707963267949)+(x736.value)+(((1.5707963267949)*(x737.value)))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x738=IKsin(j5); IkReal x739=IKcos(j5); IkReal x740=((1.0)*gconst8); evalcond[0]=(new_r11*x738); evalcond[1]=((-1.0)*gconst8*x738); evalcond[2]=(gconst8+((new_r11*x739))); evalcond[3]=(((gconst8*x739))+new_r11); evalcond[4]=((((-1.0)*x738*x740))+new_r10); evalcond[5]=((((-1.0)*x739*x740))+new_r00); evalcond[6]=((((-1.0)*new_r00*x738))+((new_r10*x739))); evalcond[7]=(((new_r00*x739))+(((-1.0)*x740))+((new_r10*x738))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x741=IKPowWithIntegerCheck(IKsign(gconst8),-1); if(!x741.valid){ continue; } CheckValue<IkReal> x742 = IKatan2WithCheck(IkReal(new_r10),IkReal(new_r00),IKFAST_ATAN2_MAGTHRESH); if(!x742.valid){ continue; } j5array[0]=((-1.5707963267949)+(((1.5707963267949)*(x741.value)))+(x742.value)); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x743=IKsin(j5); IkReal x744=IKcos(j5); IkReal x745=((1.0)*gconst8); evalcond[0]=(new_r11*x743); evalcond[1]=((-1.0)*gconst8*x743); evalcond[2]=(gconst8+((new_r11*x744))); evalcond[3]=(((gconst8*x744))+new_r11); evalcond[4]=(new_r10+(((-1.0)*x743*x745))); evalcond[5]=((((-1.0)*x744*x745))+new_r00); evalcond[6]=((((-1.0)*new_r00*x743))+((new_r10*x744))); evalcond[7]=(((new_r10*x743))+((new_r00*x744))+(((-1.0)*x745))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j5] } } while(0); if( bgotonextstatement ) { } } } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; IkReal x746=((1.0)*new_r11); CheckValue<IkReal> x747 = IKatan2WithCheck(IkReal(((((-1.0)*new_r01*x746))+((gconst7*gconst8)))),IkReal(((((-1.0)*(gconst7*gconst7)))+(new_r11*new_r11))),IKFAST_ATAN2_MAGTHRESH); if(!x747.valid){ continue; } CheckValue<IkReal> x748=IKPowWithIntegerCheck(IKsign(((((-1.0)*gconst8*x746))+((gconst7*new_r01)))),-1); if(!x748.valid){ continue; } j5array[0]=((-1.5707963267949)+(x747.value)+(((1.5707963267949)*(x748.value)))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x749=IKsin(j5); IkReal x750=IKcos(j5); IkReal x751=((1.0)*gconst8); IkReal x752=(gconst7*x750); IkReal x753=((1.0)*x749); IkReal x754=(x749*x751); evalcond[0]=(gconst7+((new_r01*x750))+((new_r11*x749))); evalcond[1]=(((gconst8*x750))+new_r11+((gconst7*x749))); evalcond[2]=(gconst7+(((-1.0)*new_r00*x753))+((new_r10*x750))); evalcond[3]=((((-1.0)*new_r01*x753))+gconst8+((new_r11*x750))); evalcond[4]=(x752+new_r10+(((-1.0)*x754))); evalcond[5]=(x752+new_r01+(((-1.0)*x754))); evalcond[6]=(((new_r00*x750))+((new_r10*x749))+(((-1.0)*x751))); evalcond[7]=((((-1.0)*x750*x751))+(((-1.0)*gconst7*x753))+new_r00); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; IkReal x755=((1.0)*new_r11); CheckValue<IkReal> x756=IKPowWithIntegerCheck(IKsign(((new_r01*new_r01)+(new_r11*new_r11))),-1); if(!x756.valid){ continue; } CheckValue<IkReal> x757 = IKatan2WithCheck(IkReal((((gconst8*new_r01))+(((-1.0)*gconst7*x755)))),IkReal(((((-1.0)*gconst7*new_r01))+(((-1.0)*gconst8*x755)))),IKFAST_ATAN2_MAGTHRESH); if(!x757.valid){ continue; } j5array[0]=((-1.5707963267949)+(((1.5707963267949)*(x756.value)))+(x757.value)); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x758=IKsin(j5); IkReal x759=IKcos(j5); IkReal x760=((1.0)*gconst8); IkReal x761=(gconst7*x759); IkReal x762=((1.0)*x758); IkReal x763=(x758*x760); evalcond[0]=(gconst7+((new_r11*x758))+((new_r01*x759))); evalcond[1]=(((gconst8*x759))+((gconst7*x758))+new_r11); evalcond[2]=((((-1.0)*new_r00*x762))+gconst7+((new_r10*x759))); evalcond[3]=(gconst8+((new_r11*x759))+(((-1.0)*new_r01*x762))); evalcond[4]=((((-1.0)*x763))+x761+new_r10); evalcond[5]=((((-1.0)*x763))+x761+new_r01); evalcond[6]=((((-1.0)*x760))+((new_r00*x759))+((new_r10*x758))); evalcond[7]=((((-1.0)*gconst7*x762))+new_r00+(((-1.0)*x759*x760))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; IkReal x764=((1.0)*gconst7); CheckValue<IkReal> x765 = IKatan2WithCheck(IkReal(((((-1.0)*new_r10*x764))+((gconst7*new_r01)))),IkReal(((((-1.0)*new_r00*x764))+(((-1.0)*new_r11*x764)))),IKFAST_ATAN2_MAGTHRESH); if(!x765.valid){ continue; } CheckValue<IkReal> x766=IKPowWithIntegerCheck(IKsign((((new_r10*new_r11))+((new_r00*new_r01)))),-1); if(!x766.valid){ continue; } j5array[0]=((-1.5707963267949)+(x765.value)+(((1.5707963267949)*(x766.value)))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x767=IKsin(j5); IkReal x768=IKcos(j5); IkReal x769=((1.0)*gconst8); IkReal x770=(gconst7*x768); IkReal x771=((1.0)*x767); IkReal x772=(x767*x769); evalcond[0]=(((new_r11*x767))+gconst7+((new_r01*x768))); evalcond[1]=(((gconst7*x767))+((gconst8*x768))+new_r11); evalcond[2]=(((new_r10*x768))+(((-1.0)*new_r00*x771))+gconst7); evalcond[3]=(((new_r11*x768))+(((-1.0)*new_r01*x771))+gconst8); evalcond[4]=(x770+(((-1.0)*x772))+new_r10); evalcond[5]=(x770+(((-1.0)*x772))+new_r01); evalcond[6]=(((new_r10*x767))+(((-1.0)*x769))+((new_r00*x768))); evalcond[7]=((((-1.0)*gconst7*x771))+new_r00+(((-1.0)*x768*x769))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { IkReal x774 = ((new_r01*new_r01)+(new_r11*new_r11)); if(IKabs(x774)==0){ continue; } IkReal x773=pow(x774,-0.5); CheckValue<IkReal> x775 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x775.valid){ continue; } IkReal gconst10=((1.0)*new_r01*x773); IkReal gconst11=((-1.0)*new_r11*x773); CheckValue<IkReal> x776 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x776.valid){ continue; } evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+(x776.value)+j7)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5eval[3]; CheckValue<IkReal> x779 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x779.valid){ continue; } IkReal x777=((1.0)*(x779.value)); IkReal x778=x773; sj6=0; cj6=-1.0; j6=3.14159265358979; sj7=gconst10; cj7=gconst11; j7=((3.14159265)+(((-1.0)*x777))); IkReal gconst10=((1.0)*new_r01*x778); IkReal gconst11=((-1.0)*new_r11*x778); IkReal x780=new_r01*new_r01; IkReal x781=(((new_r10*new_r11))+((new_r00*new_r01))); IkReal x782=x773; IkReal x783=((1.0)*new_r01*x782); j5eval[0]=x781; j5eval[1]=((IKabs(((((-1.0)*new_r11*x783))+(((-1.0)*new_r00*x783)))))+(IKabs(((((-1.0)*new_r10*x783))+((x780*x782)))))); j5eval[2]=IKsign(x781); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 || IKabs(j5eval[2]) < 0.0000010000000000 ) { { IkReal j5eval[2]; CheckValue<IkReal> x786 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x786.valid){ continue; } IkReal x784=((1.0)*(x786.value)); IkReal x785=x773; sj6=0; cj6=-1.0; j6=3.14159265358979; sj7=gconst10; cj7=gconst11; j7=((3.14159265)+(((-1.0)*x784))); IkReal gconst10=((1.0)*new_r01*x785); IkReal gconst11=((-1.0)*new_r11*x785); IkReal x787=((new_r01*new_r01)+(new_r11*new_r11)); j5eval[0]=x787; j5eval[1]=IKsign(x787); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 ) { { IkReal j5eval[1]; CheckValue<IkReal> x790 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x790.valid){ continue; } IkReal x788=((1.0)*(x790.value)); IkReal x789=x773; sj6=0; cj6=-1.0; j6=3.14159265358979; sj7=gconst10; cj7=gconst11; j7=((3.14159265)+(((-1.0)*x788))); IkReal gconst10=((1.0)*new_r01*x789); IkReal gconst11=((-1.0)*new_r11*x789); IkReal x791=new_r01*new_r01; IkReal x792=new_r11*new_r11; IkReal x793=((1.0)*x791); CheckValue<IkReal> x799=IKPowWithIntegerCheck((x791+x792),-1); if(!x799.valid){ continue; } IkReal x794=x799.value; CheckValue<IkReal> x800=IKPowWithIntegerCheck(((((-1.0)*x793))+(((-1.0)*x792))),-1); if(!x800.valid){ continue; } IkReal x795=x800.value; IkReal x796=((1.0)*x795); IkReal x797=(new_r11*x796); j5eval[0]=((IKabs(((((-1.0)*x793*x794))+((x794*(x792*x792)))+((x791*x792*x794)))))+(IKabs(((((-1.0)*new_r01*x797))+(((-1.0)*x797*(new_r01*new_r01*new_r01)))+(((-1.0)*new_r01*x797*(new_r11*new_r11))))))); if( IKabs(j5eval[0]) < 0.0000010000000000 ) { { IkReal evalcond[2]; bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r11))+(IKabs(new_r00))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5eval[1]; CheckValue<IkReal> x802 = IKatan2WithCheck(IkReal(new_r01),IkReal(0),IKFAST_ATAN2_MAGTHRESH); if(!x802.valid){ continue; } IkReal x801=((1.0)*(x802.value)); sj6=0; cj6=-1.0; j6=3.14159265358979; sj7=gconst10; cj7=gconst11; j7=((3.14159265)+(((-1.0)*x801))); new_r11=0; new_r00=0; IkReal x803 = new_r01*new_r01; if(IKabs(x803)==0){ continue; } IkReal gconst10=((1.0)*new_r01*(pow(x803,-0.5))); j5eval[0]=new_r10; if( IKabs(j5eval[0]) < 0.0000010000000000 ) { { IkReal j5array[2], cj5array[2], sj5array[2]; bool j5valid[2]={false}; _nj5 = 2; CheckValue<IkReal> x804=IKPowWithIntegerCheck(gconst10,-1); if(!x804.valid){ continue; } cj5array[0]=((-1.0)*new_r10*(x804.value)); if( cj5array[0] >= -1-IKFAST_SINCOS_THRESH && cj5array[0] <= 1+IKFAST_SINCOS_THRESH ) { j5valid[0] = j5valid[1] = true; j5array[0] = IKacos(cj5array[0]); sj5array[0] = IKsin(j5array[0]); cj5array[1] = cj5array[0]; j5array[1] = -j5array[0]; sj5array[1] = -sj5array[0]; } else if( isnan(cj5array[0]) ) { // probably any value will work j5valid[0] = true; cj5array[0] = 1; sj5array[0] = 0; j5array[0] = 0; } for(int ij5 = 0; ij5 < 2; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 2; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[6]; IkReal x805=IKsin(j5); IkReal x806=IKcos(j5); IkReal x807=((-1.0)*x805); evalcond[0]=(new_r10*x805); evalcond[1]=(new_r01*x807); evalcond[2]=(gconst10*x807); evalcond[3]=(gconst10+((new_r10*x806))); evalcond[4]=(gconst10+((new_r01*x806))); evalcond[5]=(((gconst10*x806))+new_r01); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } else { { IkReal j5array[2], cj5array[2], sj5array[2]; bool j5valid[2]={false}; _nj5 = 2; CheckValue<IkReal> x808=IKPowWithIntegerCheck(new_r10,-1); if(!x808.valid){ continue; } cj5array[0]=((-1.0)*gconst10*(x808.value)); if( cj5array[0] >= -1-IKFAST_SINCOS_THRESH && cj5array[0] <= 1+IKFAST_SINCOS_THRESH ) { j5valid[0] = j5valid[1] = true; j5array[0] = IKacos(cj5array[0]); sj5array[0] = IKsin(j5array[0]); cj5array[1] = cj5array[0]; j5array[1] = -j5array[0]; sj5array[1] = -sj5array[0]; } else if( isnan(cj5array[0]) ) { // probably any value will work j5valid[0] = true; cj5array[0] = 1; sj5array[0] = 0; j5array[0] = 0; } for(int ij5 = 0; ij5 < 2; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 2; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[6]; IkReal x809=IKsin(j5); IkReal x810=IKcos(j5); IkReal x811=(gconst10*x810); IkReal x812=((-1.0)*x809); evalcond[0]=(new_r10*x809); evalcond[1]=(new_r01*x812); evalcond[2]=(gconst10*x812); evalcond[3]=(new_r10+x811); evalcond[4]=(((new_r01*x810))+gconst10); evalcond[5]=(new_r01+x811); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r10))+(IKabs(new_r00))); evalcond[1]=gconst10; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5eval[3]; CheckValue<IkReal> x814 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x814.valid){ continue; } IkReal x813=((1.0)*(x814.value)); sj6=0; cj6=-1.0; j6=3.14159265358979; sj7=gconst10; cj7=gconst11; j7=((3.14159265)+(((-1.0)*x813))); new_r00=0; new_r10=0; new_r21=0; new_r22=0; IkReal gconst10=((1.0)*new_r01); IkReal gconst11=((-1.0)*new_r11); j5eval[0]=1.0; j5eval[1]=1.0; j5eval[2]=((IKabs(((1.0)+(((-1.0)*(new_r01*new_r01))))))+(IKabs(((1.0)*new_r01*new_r11)))); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 || IKabs(j5eval[2]) < 0.0000010000000000 ) { { IkReal j5eval[3]; CheckValue<IkReal> x816 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x816.valid){ continue; } IkReal x815=((1.0)*(x816.value)); sj6=0; cj6=-1.0; j6=3.14159265358979; sj7=gconst10; cj7=gconst11; j7=((3.14159265)+(((-1.0)*x815))); new_r00=0; new_r10=0; new_r21=0; new_r22=0; IkReal gconst10=((1.0)*new_r01); IkReal gconst11=((-1.0)*new_r11); j5eval[0]=-1.0; j5eval[1]=-1.0; j5eval[2]=((IKabs(((-1.0)+(new_r01*new_r01))))+(IKabs(((1.0)*new_r01*new_r11)))); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 || IKabs(j5eval[2]) < 0.0000010000000000 ) { { IkReal j5eval[3]; CheckValue<IkReal> x818 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x818.valid){ continue; } IkReal x817=((1.0)*(x818.value)); sj6=0; cj6=-1.0; j6=3.14159265358979; sj7=gconst10; cj7=gconst11; j7=((3.14159265)+(((-1.0)*x817))); new_r00=0; new_r10=0; new_r21=0; new_r22=0; IkReal gconst10=((1.0)*new_r01); IkReal gconst11=((-1.0)*new_r11); j5eval[0]=1.0; j5eval[1]=1.0; j5eval[2]=((IKabs(((2.0)*new_r01*new_r11)))+(IKabs(((1.0)+(((-2.0)*(new_r01*new_r01))))))); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 || IKabs(j5eval[2]) < 0.0000010000000000 ) { continue; // 3 cases reached } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; IkReal x819=((1.0)*new_r11); CheckValue<IkReal> x820 = IKatan2WithCheck(IkReal((((gconst11*new_r01))+(((-1.0)*gconst10*x819)))),IkReal(((((-1.0)*gconst11*x819))+(((-1.0)*gconst10*new_r01)))),IKFAST_ATAN2_MAGTHRESH); if(!x820.valid){ continue; } CheckValue<IkReal> x821=IKPowWithIntegerCheck(IKsign(((new_r01*new_r01)+(new_r11*new_r11))),-1); if(!x821.valid){ continue; } j5array[0]=((-1.5707963267949)+(x820.value)+(((1.5707963267949)*(x821.value)))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[6]; IkReal x822=IKsin(j5); IkReal x823=IKcos(j5); IkReal x824=((1.0)*gconst11); IkReal x825=(gconst10*x823); IkReal x826=(gconst10*x822); IkReal x827=(x822*x824); evalcond[0]=((((-1.0)*x827))+x825); evalcond[1]=(((new_r01*x823))+gconst10+((new_r11*x822))); evalcond[2]=(((gconst11*x823))+new_r11+x826); evalcond[3]=((((-1.0)*new_r01*x822))+gconst11+((new_r11*x823))); evalcond[4]=((((-1.0)*x823*x824))+(((-1.0)*x826))); evalcond[5]=((((-1.0)*x827))+new_r01+x825); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x828=IKPowWithIntegerCheck(IKsign(((((-1.0)*(gconst11*gconst11)))+(((-1.0)*(gconst10*gconst10))))),-1); if(!x828.valid){ continue; } CheckValue<IkReal> x829 = IKatan2WithCheck(IkReal((gconst10*new_r11)),IkReal((gconst11*new_r11)),IKFAST_ATAN2_MAGTHRESH); if(!x829.valid){ continue; } j5array[0]=((-1.5707963267949)+(((1.5707963267949)*(x828.value)))+(x829.value)); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[6]; IkReal x830=IKsin(j5); IkReal x831=IKcos(j5); IkReal x832=((1.0)*gconst11); IkReal x833=(gconst10*x831); IkReal x834=(gconst10*x830); IkReal x835=(x830*x832); evalcond[0]=((((-1.0)*x835))+x833); evalcond[1]=(((new_r11*x830))+((new_r01*x831))+gconst10); evalcond[2]=(((gconst11*x831))+new_r11+x834); evalcond[3]=(((new_r11*x831))+(((-1.0)*new_r01*x830))+gconst11); evalcond[4]=((((-1.0)*x834))+(((-1.0)*x831*x832))); evalcond[5]=((((-1.0)*x835))+new_r01+x833); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x836=IKPowWithIntegerCheck(IKsign((((gconst10*new_r01))+(((-1.0)*gconst11*new_r11)))),-1); if(!x836.valid){ continue; } CheckValue<IkReal> x837 = IKatan2WithCheck(IkReal((gconst10*gconst11)),IkReal(gconst11*gconst11),IKFAST_ATAN2_MAGTHRESH); if(!x837.valid){ continue; } j5array[0]=((-1.5707963267949)+(((1.5707963267949)*(x836.value)))+(x837.value)); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[6]; IkReal x838=IKsin(j5); IkReal x839=IKcos(j5); IkReal x840=((1.0)*gconst11); IkReal x841=(gconst10*x839); IkReal x842=(gconst10*x838); IkReal x843=(x838*x840); evalcond[0]=((((-1.0)*x843))+x841); evalcond[1]=(((new_r11*x838))+((new_r01*x839))+gconst10); evalcond[2]=(((gconst11*x839))+new_r11+x842); evalcond[3]=(((new_r11*x839))+(((-1.0)*new_r01*x838))+gconst11); evalcond[4]=((((-1.0)*x842))+(((-1.0)*x839*x840))); evalcond[5]=((((-1.0)*x843))+new_r01+x841); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r10))+(IKabs(new_r01))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5array[2], cj5array[2], sj5array[2]; bool j5valid[2]={false}; _nj5 = 2; CheckValue<IkReal> x844=IKPowWithIntegerCheck(gconst11,-1); if(!x844.valid){ continue; } cj5array[0]=(new_r00*(x844.value)); if( cj5array[0] >= -1-IKFAST_SINCOS_THRESH && cj5array[0] <= 1+IKFAST_SINCOS_THRESH ) { j5valid[0] = j5valid[1] = true; j5array[0] = IKacos(cj5array[0]); sj5array[0] = IKsin(j5array[0]); cj5array[1] = cj5array[0]; j5array[1] = -j5array[0]; sj5array[1] = -sj5array[0]; } else if( isnan(cj5array[0]) ) { // probably any value will work j5valid[0] = true; cj5array[0] = 1; sj5array[0] = 0; j5array[0] = 0; } for(int ij5 = 0; ij5 < 2; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 2; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[6]; IkReal x845=IKsin(j5); IkReal x846=IKcos(j5); IkReal x847=((-1.0)*x845); evalcond[0]=(new_r11*x845); evalcond[1]=(new_r00*x847); evalcond[2]=(gconst11*x847); evalcond[3]=(gconst11+((new_r11*x846))); evalcond[4]=(((gconst11*x846))+new_r11); evalcond[5]=(((new_r00*x846))+(((-1.0)*gconst11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r00))+(IKabs(new_r01))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5eval[1]; CheckValue<IkReal> x849 = IKatan2WithCheck(IkReal(0),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x849.valid){ continue; } IkReal x848=((1.0)*(x849.value)); sj6=0; cj6=-1.0; j6=3.14159265358979; sj7=gconst10; cj7=gconst11; j7=((3.14159265)+(((-1.0)*x848))); new_r00=0; new_r01=0; new_r12=0; new_r22=0; IkReal gconst10=0; IkReal x850 = ((1.0)+(((-1.0)*(new_r10*new_r10)))); if(IKabs(x850)==0){ continue; } IkReal gconst11=((-1.0)*new_r11*(pow(x850,-0.5))); j5eval[0]=((IKabs(new_r11))+(IKabs(new_r10))); if( IKabs(j5eval[0]) < 0.0000010000000000 ) { { IkReal j5eval[1]; CheckValue<IkReal> x852 = IKatan2WithCheck(IkReal(0),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x852.valid){ continue; } IkReal x851=((1.0)*(x852.value)); sj6=0; cj6=-1.0; j6=3.14159265358979; sj7=gconst10; cj7=gconst11; j7=((3.14159265)+(((-1.0)*x851))); new_r00=0; new_r01=0; new_r12=0; new_r22=0; IkReal gconst10=0; IkReal x853 = ((1.0)+(((-1.0)*(new_r10*new_r10)))); if(IKabs(x853)==0){ continue; } IkReal gconst11=((-1.0)*new_r11*(pow(x853,-0.5))); j5eval[0]=new_r11; if( IKabs(j5eval[0]) < 0.0000010000000000 ) { { IkReal j5eval[2]; CheckValue<IkReal> x855 = IKatan2WithCheck(IkReal(0),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x855.valid){ continue; } IkReal x854=((1.0)*(x855.value)); sj6=0; cj6=-1.0; j6=3.14159265358979; sj7=gconst10; cj7=gconst11; j7=((3.14159265)+(((-1.0)*x854))); new_r00=0; new_r01=0; new_r12=0; new_r22=0; IkReal x856 = ((1.0)+(((-1.0)*(new_r10*new_r10)))); if(IKabs(x856)==0){ continue; } IkReal gconst11=((-1.0)*new_r11*(pow(x856,-0.5))); j5eval[0]=new_r10; j5eval[1]=new_r11; if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 ) { continue; // 3 cases reached } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x857=IKPowWithIntegerCheck(new_r10,-1); if(!x857.valid){ continue; } CheckValue<IkReal> x858=IKPowWithIntegerCheck(new_r11,-1); if(!x858.valid){ continue; } if( IKabs((gconst11*(x857.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*gconst11*(x858.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((gconst11*(x857.value)))+IKsqr(((-1.0)*gconst11*(x858.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j5array[0]=IKatan2((gconst11*(x857.value)), ((-1.0)*gconst11*(x858.value))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x859=IKcos(j5); IkReal x860=IKsin(j5); IkReal x861=(gconst11*x860); IkReal x862=(gconst11*x859); evalcond[0]=(new_r10*x859); evalcond[1]=(new_r11*x860); evalcond[2]=((-1.0)*x862); evalcond[3]=((-1.0)*x861); evalcond[4]=(gconst11+((new_r11*x859))); evalcond[5]=(new_r11+x862); evalcond[6]=((((-1.0)*x861))+new_r10); evalcond[7]=(((new_r10*x860))+(((-1.0)*gconst11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x863=IKPowWithIntegerCheck(gconst11,-1); if(!x863.valid){ continue; } CheckValue<IkReal> x864=IKPowWithIntegerCheck(new_r11,-1); if(!x864.valid){ continue; } if( IKabs((new_r10*(x863.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*gconst11*(x864.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((new_r10*(x863.value)))+IKsqr(((-1.0)*gconst11*(x864.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j5array[0]=IKatan2((new_r10*(x863.value)), ((-1.0)*gconst11*(x864.value))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x865=IKcos(j5); IkReal x866=IKsin(j5); IkReal x867=(gconst11*x866); IkReal x868=(gconst11*x865); evalcond[0]=(new_r10*x865); evalcond[1]=(new_r11*x866); evalcond[2]=((-1.0)*x868); evalcond[3]=((-1.0)*x867); evalcond[4]=(gconst11+((new_r11*x865))); evalcond[5]=(new_r11+x868); evalcond[6]=((((-1.0)*x867))+new_r10); evalcond[7]=(((new_r10*x866))+(((-1.0)*gconst11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x869=IKPowWithIntegerCheck(IKsign(gconst11),-1); if(!x869.valid){ continue; } CheckValue<IkReal> x870 = IKatan2WithCheck(IkReal(new_r10),IkReal(((-1.0)*new_r11)),IKFAST_ATAN2_MAGTHRESH); if(!x870.valid){ continue; } j5array[0]=((-1.5707963267949)+(((1.5707963267949)*(x869.value)))+(x870.value)); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x871=IKcos(j5); IkReal x872=IKsin(j5); IkReal x873=(gconst11*x872); IkReal x874=(gconst11*x871); evalcond[0]=(new_r10*x871); evalcond[1]=(new_r11*x872); evalcond[2]=((-1.0)*x874); evalcond[3]=((-1.0)*x873); evalcond[4]=(gconst11+((new_r11*x871))); evalcond[5]=(new_r11+x874); evalcond[6]=((((-1.0)*x873))+new_r10); evalcond[7]=(((new_r10*x872))+(((-1.0)*gconst11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=IKabs(new_r01); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5eval[1]; CheckValue<IkReal> x876 = IKatan2WithCheck(IkReal(0),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x876.valid){ continue; } IkReal x875=((1.0)*(x876.value)); sj6=0; cj6=-1.0; j6=3.14159265358979; sj7=gconst10; cj7=gconst11; j7=((3.14159265)+(((-1.0)*x875))); new_r01=0; IkReal gconst10=0; IkReal x877 = new_r11*new_r11; if(IKabs(x877)==0){ continue; } IkReal gconst11=((-1.0)*new_r11*(pow(x877,-0.5))); j5eval[0]=((IKabs(new_r10))+(IKabs(new_r00))); if( IKabs(j5eval[0]) < 0.0000010000000000 ) { { IkReal j5eval[1]; CheckValue<IkReal> x879 = IKatan2WithCheck(IkReal(0),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x879.valid){ continue; } IkReal x878=((1.0)*(x879.value)); sj6=0; cj6=-1.0; j6=3.14159265358979; sj7=gconst10; cj7=gconst11; j7=((3.14159265)+(((-1.0)*x878))); new_r01=0; IkReal gconst10=0; IkReal x880 = new_r11*new_r11; if(IKabs(x880)==0){ continue; } IkReal gconst11=((-1.0)*new_r11*(pow(x880,-0.5))); j5eval[0]=((IKabs(new_r11))+(IKabs(new_r10))); if( IKabs(j5eval[0]) < 0.0000010000000000 ) { { IkReal j5eval[1]; CheckValue<IkReal> x882 = IKatan2WithCheck(IkReal(0),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x882.valid){ continue; } IkReal x881=((1.0)*(x882.value)); sj6=0; cj6=-1.0; j6=3.14159265358979; sj7=gconst10; cj7=gconst11; j7=((3.14159265)+(((-1.0)*x881))); new_r01=0; IkReal x883 = new_r11*new_r11; if(IKabs(x883)==0){ continue; } IkReal gconst11=((-1.0)*new_r11*(pow(x883,-0.5))); j5eval[0]=new_r11; if( IKabs(j5eval[0]) < 0.0000010000000000 ) { continue; // 3 cases reached } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x884=IKPowWithIntegerCheck(gconst11,-1); if(!x884.valid){ continue; } CheckValue<IkReal> x885=IKPowWithIntegerCheck(new_r11,-1); if(!x885.valid){ continue; } if( IKabs((new_r10*(x884.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*gconst11*(x885.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((new_r10*(x884.value)))+IKsqr(((-1.0)*gconst11*(x885.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j5array[0]=IKatan2((new_r10*(x884.value)), ((-1.0)*gconst11*(x885.value))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x886=IKsin(j5); IkReal x887=IKcos(j5); IkReal x888=(gconst11*x886); IkReal x889=(gconst11*x887); evalcond[0]=(new_r11*x886); evalcond[1]=((-1.0)*x888); evalcond[2]=(((new_r11*x887))+gconst11); evalcond[3]=(new_r11+x889); evalcond[4]=((((-1.0)*x888))+new_r10); evalcond[5]=((((-1.0)*x889))+new_r00); evalcond[6]=((((-1.0)*new_r00*x886))+((new_r10*x887))); evalcond[7]=(((new_r10*x886))+((new_r00*x887))+(((-1.0)*gconst11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x890=IKPowWithIntegerCheck(IKsign(gconst11),-1); if(!x890.valid){ continue; } CheckValue<IkReal> x891 = IKatan2WithCheck(IkReal(new_r10),IkReal(((-1.0)*new_r11)),IKFAST_ATAN2_MAGTHRESH); if(!x891.valid){ continue; } j5array[0]=((-1.5707963267949)+(((1.5707963267949)*(x890.value)))+(x891.value)); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x892=IKsin(j5); IkReal x893=IKcos(j5); IkReal x894=(gconst11*x892); IkReal x895=(gconst11*x893); evalcond[0]=(new_r11*x892); evalcond[1]=((-1.0)*x894); evalcond[2]=(((new_r11*x893))+gconst11); evalcond[3]=(new_r11+x895); evalcond[4]=((((-1.0)*x894))+new_r10); evalcond[5]=((((-1.0)*x895))+new_r00); evalcond[6]=((((-1.0)*new_r00*x892))+((new_r10*x893))); evalcond[7]=(((new_r00*x893))+((new_r10*x892))+(((-1.0)*gconst11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x896=IKPowWithIntegerCheck(IKsign(gconst11),-1); if(!x896.valid){ continue; } CheckValue<IkReal> x897 = IKatan2WithCheck(IkReal(new_r10),IkReal(new_r00),IKFAST_ATAN2_MAGTHRESH); if(!x897.valid){ continue; } j5array[0]=((-1.5707963267949)+(((1.5707963267949)*(x896.value)))+(x897.value)); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x898=IKsin(j5); IkReal x899=IKcos(j5); IkReal x900=(gconst11*x898); IkReal x901=(gconst11*x899); evalcond[0]=(new_r11*x898); evalcond[1]=((-1.0)*x900); evalcond[2]=(((new_r11*x899))+gconst11); evalcond[3]=(new_r11+x901); evalcond[4]=((((-1.0)*x900))+new_r10); evalcond[5]=((((-1.0)*x901))+new_r00); evalcond[6]=((((-1.0)*new_r00*x898))+((new_r10*x899))); evalcond[7]=(((new_r00*x899))+((new_r10*x898))+(((-1.0)*gconst11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j5] } } while(0); if( bgotonextstatement ) { } } } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; IkReal x902=((1.0)*new_r11); CheckValue<IkReal> x903 = IKatan2WithCheck(IkReal((((gconst10*gconst11))+(((-1.0)*new_r01*x902)))),IkReal(((new_r11*new_r11)+(((-1.0)*(gconst10*gconst10))))),IKFAST_ATAN2_MAGTHRESH); if(!x903.valid){ continue; } CheckValue<IkReal> x904=IKPowWithIntegerCheck(IKsign(((((-1.0)*gconst11*x902))+((gconst10*new_r01)))),-1); if(!x904.valid){ continue; } j5array[0]=((-1.5707963267949)+(x903.value)+(((1.5707963267949)*(x904.value)))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x905=IKsin(j5); IkReal x906=IKcos(j5); IkReal x907=((1.0)*gconst11); IkReal x908=(gconst10*x906); IkReal x909=(gconst10*x905); IkReal x910=((1.0)*x905); IkReal x911=(x905*x907); evalcond[0]=(gconst10+((new_r11*x905))+((new_r01*x906))); evalcond[1]=(((gconst11*x906))+new_r11+x909); evalcond[2]=(gconst10+((new_r10*x906))+(((-1.0)*new_r00*x910))); evalcond[3]=(gconst11+((new_r11*x906))+(((-1.0)*new_r01*x910))); evalcond[4]=((((-1.0)*x911))+new_r10+x908); evalcond[5]=((((-1.0)*x911))+new_r01+x908); evalcond[6]=((((-1.0)*x907))+((new_r10*x905))+((new_r00*x906))); evalcond[7]=((((-1.0)*x909))+new_r00+(((-1.0)*x906*x907))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; IkReal x912=((1.0)*new_r11); CheckValue<IkReal> x913 = IKatan2WithCheck(IkReal((((gconst11*new_r01))+(((-1.0)*gconst10*x912)))),IkReal(((((-1.0)*gconst10*new_r01))+(((-1.0)*gconst11*x912)))),IKFAST_ATAN2_MAGTHRESH); if(!x913.valid){ continue; } CheckValue<IkReal> x914=IKPowWithIntegerCheck(IKsign(((new_r01*new_r01)+(new_r11*new_r11))),-1); if(!x914.valid){ continue; } j5array[0]=((-1.5707963267949)+(x913.value)+(((1.5707963267949)*(x914.value)))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x915=IKsin(j5); IkReal x916=IKcos(j5); IkReal x917=((1.0)*gconst11); IkReal x918=(gconst10*x916); IkReal x919=(gconst10*x915); IkReal x920=((1.0)*x915); IkReal x921=(x915*x917); evalcond[0]=(gconst10+((new_r11*x915))+((new_r01*x916))); evalcond[1]=(((gconst11*x916))+new_r11+x919); evalcond[2]=(gconst10+((new_r10*x916))+(((-1.0)*new_r00*x920))); evalcond[3]=(gconst11+((new_r11*x916))+(((-1.0)*new_r01*x920))); evalcond[4]=((((-1.0)*x921))+new_r10+x918); evalcond[5]=((((-1.0)*x921))+new_r01+x918); evalcond[6]=((((-1.0)*x917))+((new_r10*x915))+((new_r00*x916))); evalcond[7]=((((-1.0)*x919))+new_r00+(((-1.0)*x916*x917))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; IkReal x922=((1.0)*gconst10); CheckValue<IkReal> x923 = IKatan2WithCheck(IkReal(((((-1.0)*new_r10*x922))+((gconst10*new_r01)))),IkReal(((((-1.0)*new_r11*x922))+(((-1.0)*new_r00*x922)))),IKFAST_ATAN2_MAGTHRESH); if(!x923.valid){ continue; } CheckValue<IkReal> x924=IKPowWithIntegerCheck(IKsign((((new_r10*new_r11))+((new_r00*new_r01)))),-1); if(!x924.valid){ continue; } j5array[0]=((-1.5707963267949)+(x923.value)+(((1.5707963267949)*(x924.value)))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x925=IKsin(j5); IkReal x926=IKcos(j5); IkReal x927=((1.0)*gconst11); IkReal x928=(gconst10*x926); IkReal x929=(gconst10*x925); IkReal x930=((1.0)*x925); IkReal x931=(x925*x927); evalcond[0]=(gconst10+((new_r01*x926))+((new_r11*x925))); evalcond[1]=(((gconst11*x926))+new_r11+x929); evalcond[2]=(gconst10+(((-1.0)*new_r00*x930))+((new_r10*x926))); evalcond[3]=(gconst11+(((-1.0)*new_r01*x930))+((new_r11*x926))); evalcond[4]=(new_r10+x928+(((-1.0)*x931))); evalcond[5]=(new_r01+x928+(((-1.0)*x931))); evalcond[6]=((((-1.0)*x927))+((new_r00*x926))+((new_r10*x925))); evalcond[7]=((((-1.0)*x929))+(((-1.0)*x926*x927))+new_r00); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((new_r01*new_r01)+(new_r11*new_r11)); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5eval[1]; sj6=0; cj6=-1.0; j6=3.14159265358979; new_r01=0; new_r11=0; j5eval[0]=((IKabs(new_r10))+(IKabs(new_r00))); if( IKabs(j5eval[0]) < 0.0000010000000000 ) { continue; // 3 cases reached } else { { IkReal j5array[2], cj5array[2], sj5array[2]; bool j5valid[2]={false}; _nj5 = 2; CheckValue<IkReal> x933 = IKatan2WithCheck(IkReal(new_r00),IkReal(new_r10),IKFAST_ATAN2_MAGTHRESH); if(!x933.valid){ continue; } IkReal x932=x933.value; j5array[0]=((-1.0)*x932); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); j5array[1]=((3.14159265358979)+(((-1.0)*x932))); sj5array[1]=IKsin(j5array[1]); cj5array[1]=IKcos(j5array[1]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; if( j5array[1] > IKPI ) { j5array[1]-=IK2PI; } else if( j5array[1] < -IKPI ) { j5array[1]+=IK2PI; } j5valid[1] = true; for(int ij5 = 0; ij5 < 2; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 2; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[1]; evalcond[0]=((((-1.0)*new_r00*(IKsin(j5))))+((new_r10*(IKcos(j5))))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j7))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; if( IKabs(new_r10) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r11)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r10)+IKsqr(((-1.0)*new_r11))-1) <= IKFAST_SINCOS_THRESH ) continue; j5array[0]=IKatan2(new_r10, ((-1.0)*new_r11)); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x934=IKcos(j5); IkReal x935=IKsin(j5); IkReal x936=((1.0)*x935); evalcond[0]=(new_r11+x934); evalcond[1]=(new_r10+(((-1.0)*x936))); evalcond[2]=((((-1.0)*x934))+new_r00); evalcond[3]=(new_r01+(((-1.0)*x936))); evalcond[4]=(((new_r01*x934))+((new_r11*x935))); evalcond[5]=((((-1.0)*new_r00*x936))+((new_r10*x934))); evalcond[6]=((-1.0)+((new_r00*x934))+((new_r10*x935))); evalcond[7]=((1.0)+(((-1.0)*new_r01*x936))+((new_r11*x934))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j7)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; if( IKabs(((-1.0)*new_r10)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r00)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r10))+IKsqr(((-1.0)*new_r00))-1) <= IKFAST_SINCOS_THRESH ) continue; j5array[0]=IKatan2(((-1.0)*new_r10), ((-1.0)*new_r00)); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x937=IKsin(j5); IkReal x938=IKcos(j5); IkReal x939=((1.0)*x937); evalcond[0]=(new_r10+x937); evalcond[1]=(new_r00+x938); evalcond[2]=(new_r01+x937); evalcond[3]=((((-1.0)*x938))+new_r11); evalcond[4]=(((new_r01*x938))+((new_r11*x937))); evalcond[5]=((((-1.0)*new_r00*x939))+((new_r10*x938))); evalcond[6]=((1.0)+((new_r00*x938))+((new_r10*x937))); evalcond[7]=((-1.0)+(((-1.0)*new_r01*x939))+((new_r11*x938))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r11))+(IKabs(new_r00))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5eval[3]; sj6=0; cj6=-1.0; j6=3.14159265358979; new_r11=0; new_r00=0; j5eval[0]=new_r01; j5eval[1]=IKsign(new_r01); j5eval[2]=((IKabs(cj7))+(IKabs(sj7))); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 || IKabs(j5eval[2]) < 0.0000010000000000 ) { { IkReal j5eval[3]; sj6=0; cj6=-1.0; j6=3.14159265358979; new_r11=0; new_r00=0; j5eval[0]=new_r10; j5eval[1]=IKsign(new_r10); j5eval[2]=((IKabs(cj7))+(IKabs(sj7))); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 || IKabs(j5eval[2]) < 0.0000010000000000 ) { { IkReal j5eval[2]; sj6=0; cj6=-1.0; j6=3.14159265358979; new_r11=0; new_r00=0; j5eval[0]=new_r01; j5eval[1]=new_r10; if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 ) { continue; // no branches [j5] } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x940=IKPowWithIntegerCheck(new_r01,-1); if(!x940.valid){ continue; } CheckValue<IkReal> x941=IKPowWithIntegerCheck(new_r10,-1); if(!x941.valid){ continue; } if( IKabs((cj7*(x940.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*sj7*(x941.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((cj7*(x940.value)))+IKsqr(((-1.0)*sj7*(x941.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j5array[0]=IKatan2((cj7*(x940.value)), ((-1.0)*sj7*(x941.value))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[7]; IkReal x942=IKcos(j5); IkReal x943=IKsin(j5); IkReal x944=((1.0)*cj7); IkReal x945=(sj7*x942); IkReal x946=((1.0)*x943); IkReal x947=(x943*x944); evalcond[0]=(sj7+((new_r10*x942))); evalcond[1]=(sj7+((new_r01*x942))); evalcond[2]=(cj7+(((-1.0)*new_r01*x946))); evalcond[3]=((((-1.0)*x944))+((new_r10*x943))); evalcond[4]=((((-1.0)*x947))+new_r10+x945); evalcond[5]=((((-1.0)*x942*x944))+(((-1.0)*sj7*x946))); evalcond[6]=((((-1.0)*x947))+new_r01+x945); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x948 = IKatan2WithCheck(IkReal(cj7),IkReal(((-1.0)*sj7)),IKFAST_ATAN2_MAGTHRESH); if(!x948.valid){ continue; } CheckValue<IkReal> x949=IKPowWithIntegerCheck(IKsign(new_r10),-1); if(!x949.valid){ continue; } j5array[0]=((-1.5707963267949)+(x948.value)+(((1.5707963267949)*(x949.value)))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[7]; IkReal x950=IKcos(j5); IkReal x951=IKsin(j5); IkReal x952=((1.0)*cj7); IkReal x953=(sj7*x950); IkReal x954=((1.0)*x951); IkReal x955=(x951*x952); evalcond[0]=(((new_r10*x950))+sj7); evalcond[1]=(sj7+((new_r01*x950))); evalcond[2]=(cj7+(((-1.0)*new_r01*x954))); evalcond[3]=(((new_r10*x951))+(((-1.0)*x952))); evalcond[4]=(new_r10+(((-1.0)*x955))+x953); evalcond[5]=((((-1.0)*x950*x952))+(((-1.0)*sj7*x954))); evalcond[6]=(new_r01+(((-1.0)*x955))+x953); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x956=IKPowWithIntegerCheck(IKsign(new_r01),-1); if(!x956.valid){ continue; } CheckValue<IkReal> x957 = IKatan2WithCheck(IkReal(cj7),IkReal(((-1.0)*sj7)),IKFAST_ATAN2_MAGTHRESH); if(!x957.valid){ continue; } j5array[0]=((-1.5707963267949)+(((1.5707963267949)*(x956.value)))+(x957.value)); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[7]; IkReal x958=IKcos(j5); IkReal x959=IKsin(j5); IkReal x960=((1.0)*cj7); IkReal x961=(sj7*x958); IkReal x962=((1.0)*x959); IkReal x963=(x959*x960); evalcond[0]=(((new_r10*x958))+sj7); evalcond[1]=(sj7+((new_r01*x958))); evalcond[2]=(cj7+(((-1.0)*new_r01*x962))); evalcond[3]=(((new_r10*x959))+(((-1.0)*x960))); evalcond[4]=(new_r10+x961+(((-1.0)*x963))); evalcond[5]=((((-1.0)*x958*x960))+(((-1.0)*sj7*x962))); evalcond[6]=(new_r01+x961+(((-1.0)*x963))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r11))+(IKabs(new_r01))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5eval[1]; sj6=0; cj6=-1.0; j6=3.14159265358979; new_r11=0; new_r01=0; new_r22=0; new_r20=0; j5eval[0]=((IKabs(new_r10))+(IKabs(new_r00))); if( IKabs(j5eval[0]) < 0.0000010000000000 ) { continue; // no branches [j5] } else { { IkReal j5array[2], cj5array[2], sj5array[2]; bool j5valid[2]={false}; _nj5 = 2; CheckValue<IkReal> x965 = IKatan2WithCheck(IkReal(new_r00),IkReal(new_r10),IKFAST_ATAN2_MAGTHRESH); if(!x965.valid){ continue; } IkReal x964=x965.value; j5array[0]=((-1.0)*x964); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); j5array[1]=((3.14159265358979)+(((-1.0)*x964))); sj5array[1]=IKsin(j5array[1]); cj5array[1]=IKcos(j5array[1]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; if( j5array[1] > IKPI ) { j5array[1]-=IK2PI; } else if( j5array[1] < -IKPI ) { j5array[1]+=IK2PI; } j5valid[1] = true; for(int ij5 = 0; ij5 < 2; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 2; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[1]; evalcond[0]=((((-1.0)*new_r00*(IKsin(j5))))+((new_r10*(IKcos(j5))))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r10))+(IKabs(new_r00))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5eval[1]; sj6=0; cj6=-1.0; j6=3.14159265358979; new_r00=0; new_r10=0; new_r21=0; new_r22=0; j5eval[0]=((IKabs(new_r11))+(IKabs(new_r01))); if( IKabs(j5eval[0]) < 0.0000010000000000 ) { continue; // no branches [j5] } else { { IkReal j5array[2], cj5array[2], sj5array[2]; bool j5valid[2]={false}; _nj5 = 2; CheckValue<IkReal> x967 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x967.valid){ continue; } IkReal x966=x967.value; j5array[0]=((-1.0)*x966); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); j5array[1]=((3.14159265358979)+(((-1.0)*x966))); sj5array[1]=IKsin(j5array[1]); cj5array[1]=IKcos(j5array[1]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; if( j5array[1] > IKPI ) { j5array[1]-=IK2PI; } else if( j5array[1] < -IKPI ) { j5array[1]+=IK2PI; } j5valid[1] = true; for(int ij5 = 0; ij5 < 2; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 2; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[1]; evalcond[0]=(((new_r11*(IKcos(j5))))+(((-1.0)*new_r01*(IKsin(j5))))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r10))+(IKabs(new_r01))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5eval[3]; sj6=0; cj6=-1.0; j6=3.14159265358979; new_r01=0; new_r10=0; j5eval[0]=new_r11; j5eval[1]=((IKabs(cj7))+(IKabs(sj7))); j5eval[2]=IKsign(new_r11); if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 || IKabs(j5eval[2]) < 0.0000010000000000 ) { { IkReal j5eval[2]; sj6=0; cj6=-1.0; j6=3.14159265358979; new_r01=0; new_r10=0; j5eval[0]=new_r00; j5eval[1]=new_r11; if( IKabs(j5eval[0]) < 0.0000010000000000 || IKabs(j5eval[1]) < 0.0000010000000000 ) { continue; // no branches [j5] } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x968=IKPowWithIntegerCheck(new_r00,-1); if(!x968.valid){ continue; } CheckValue<IkReal> x969=IKPowWithIntegerCheck(new_r11,-1); if(!x969.valid){ continue; } if( IKabs((sj7*(x968.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*cj7*(x969.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((sj7*(x968.value)))+IKsqr(((-1.0)*cj7*(x969.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j5array[0]=IKatan2((sj7*(x968.value)), ((-1.0)*cj7*(x969.value))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[7]; IkReal x970=IKsin(j5); IkReal x971=IKcos(j5); IkReal x972=((1.0)*cj7); IkReal x973=((1.0)*x970); evalcond[0]=(cj7+((new_r11*x971))); evalcond[1]=(sj7+((new_r11*x970))); evalcond[2]=(sj7+(((-1.0)*new_r00*x973))); evalcond[3]=((((-1.0)*x972))+((new_r00*x971))); evalcond[4]=(((sj7*x971))+(((-1.0)*x970*x972))); evalcond[5]=(((cj7*x971))+((sj7*x970))+new_r11); evalcond[6]=((((-1.0)*x971*x972))+(((-1.0)*sj7*x973))+new_r00); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x974 = IKatan2WithCheck(IkReal(((-1.0)*sj7)),IkReal(((-1.0)*cj7)),IKFAST_ATAN2_MAGTHRESH); if(!x974.valid){ continue; } CheckValue<IkReal> x975=IKPowWithIntegerCheck(IKsign(new_r11),-1); if(!x975.valid){ continue; } j5array[0]=((-1.5707963267949)+(x974.value)+(((1.5707963267949)*(x975.value)))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[7]; IkReal x976=IKsin(j5); IkReal x977=IKcos(j5); IkReal x978=((1.0)*cj7); IkReal x979=((1.0)*x976); evalcond[0]=(cj7+((new_r11*x977))); evalcond[1]=(sj7+((new_r11*x976))); evalcond[2]=(sj7+(((-1.0)*new_r00*x979))); evalcond[3]=((((-1.0)*x978))+((new_r00*x977))); evalcond[4]=(((sj7*x977))+(((-1.0)*x976*x978))); evalcond[5]=(((cj7*x977))+((sj7*x976))+new_r11); evalcond[6]=((((-1.0)*sj7*x979))+new_r00+(((-1.0)*x977*x978))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j5] } } while(0); if( bgotonextstatement ) { } } } } } } } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x980=IKPowWithIntegerCheck(IKsign((((new_r11*sj7))+((cj7*new_r01)))),-1); if(!x980.valid){ continue; } CheckValue<IkReal> x981 = IKatan2WithCheck(IkReal(((-1.0)+(cj7*cj7)+((new_r01*new_r10)))),IkReal(((((-1.0)*cj7*sj7))+(((-1.0)*new_r10*new_r11)))),IKFAST_ATAN2_MAGTHRESH); if(!x981.valid){ continue; } j5array[0]=((-1.5707963267949)+(((1.5707963267949)*(x980.value)))+(x981.value)); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x982=IKcos(j5); IkReal x983=IKsin(j5); IkReal x984=((1.0)*cj7); IkReal x985=(sj7*x982); IkReal x986=((1.0)*x983); IkReal x987=(x983*x984); evalcond[0]=(sj7+((new_r11*x983))+((new_r01*x982))); evalcond[1]=(((cj7*x982))+((sj7*x983))+new_r11); evalcond[2]=(sj7+(((-1.0)*new_r00*x986))+((new_r10*x982))); evalcond[3]=(cj7+(((-1.0)*new_r01*x986))+((new_r11*x982))); evalcond[4]=((((-1.0)*x987))+new_r10+x985); evalcond[5]=((((-1.0)*x987))+new_r01+x985); evalcond[6]=(((new_r00*x982))+(((-1.0)*x984))+((new_r10*x983))); evalcond[7]=((((-1.0)*x982*x984))+(((-1.0)*sj7*x986))+new_r00); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; IkReal x988=((1.0)*sj7); CheckValue<IkReal> x989=IKPowWithIntegerCheck(IKsign(((new_r01*new_r01)+(new_r11*new_r11))),-1); if(!x989.valid){ continue; } CheckValue<IkReal> x990 = IKatan2WithCheck(IkReal(((((-1.0)*new_r11*x988))+((cj7*new_r01)))),IkReal(((((-1.0)*new_r01*x988))+(((-1.0)*cj7*new_r11)))),IKFAST_ATAN2_MAGTHRESH); if(!x990.valid){ continue; } j5array[0]=((-1.5707963267949)+(((1.5707963267949)*(x989.value)))+(x990.value)); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x991=IKcos(j5); IkReal x992=IKsin(j5); IkReal x993=((1.0)*cj7); IkReal x994=(sj7*x991); IkReal x995=((1.0)*x992); IkReal x996=(x992*x993); evalcond[0]=(sj7+((new_r11*x992))+((new_r01*x991))); evalcond[1]=(((sj7*x992))+((cj7*x991))+new_r11); evalcond[2]=(sj7+(((-1.0)*new_r00*x995))+((new_r10*x991))); evalcond[3]=(cj7+((new_r11*x991))+(((-1.0)*new_r01*x995))); evalcond[4]=((((-1.0)*x996))+new_r10+x994); evalcond[5]=((((-1.0)*x996))+new_r01+x994); evalcond[6]=(((new_r10*x992))+(((-1.0)*x993))+((new_r00*x991))); evalcond[7]=((((-1.0)*sj7*x995))+(((-1.0)*x991*x993))+new_r00); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; IkReal x997=((1.0)*sj7); CheckValue<IkReal> x998 = IKatan2WithCheck(IkReal(((((-1.0)*new_r10*x997))+((new_r01*sj7)))),IkReal(((((-1.0)*new_r11*x997))+(((-1.0)*new_r00*x997)))),IKFAST_ATAN2_MAGTHRESH); if(!x998.valid){ continue; } CheckValue<IkReal> x999=IKPowWithIntegerCheck(IKsign((((new_r10*new_r11))+((new_r00*new_r01)))),-1); if(!x999.valid){ continue; } j5array[0]=((-1.5707963267949)+(x998.value)+(((1.5707963267949)*(x999.value)))); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[8]; IkReal x1000=IKcos(j5); IkReal x1001=IKsin(j5); IkReal x1002=((1.0)*cj7); IkReal x1003=(sj7*x1000); IkReal x1004=((1.0)*x1001); IkReal x1005=(x1001*x1002); evalcond[0]=(sj7+((new_r11*x1001))+((new_r01*x1000))); evalcond[1]=(((cj7*x1000))+new_r11+((sj7*x1001))); evalcond[2]=(sj7+((new_r10*x1000))+(((-1.0)*new_r00*x1004))); evalcond[3]=(cj7+((new_r11*x1000))+(((-1.0)*new_r01*x1004))); evalcond[4]=(x1003+(((-1.0)*x1005))+new_r10); evalcond[5]=(x1003+(((-1.0)*x1005))+new_r01); evalcond[6]=((((-1.0)*x1002))+((new_r10*x1001))+((new_r00*x1000))); evalcond[7]=(new_r00+(((-1.0)*x1000*x1002))+(((-1.0)*sj7*x1004))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r12))+(IKabs(new_r02))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j5eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; j5eval[0]=((IKabs(new_r10))+(IKabs(new_r00))); if( IKabs(j5eval[0]) < 0.0000010000000000 ) { { IkReal j5eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; j5eval[0]=((IKabs(new_r11))+(IKabs(new_r01))); if( IKabs(j5eval[0]) < 0.0000010000000000 ) { { IkReal j5eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; j5eval[0]=((IKabs((new_r11*new_r22)))+(IKabs((new_r01*new_r22)))); if( IKabs(j5eval[0]) < 0.0000010000000000 ) { continue; // no branches [j5] } else { { IkReal j5array[2], cj5array[2], sj5array[2]; bool j5valid[2]={false}; _nj5 = 2; IkReal x1006=((-1.0)*new_r22); CheckValue<IkReal> x1008 = IKatan2WithCheck(IkReal((new_r01*x1006)),IkReal((new_r11*x1006)),IKFAST_ATAN2_MAGTHRESH); if(!x1008.valid){ continue; } IkReal x1007=x1008.value; j5array[0]=((-1.0)*x1007); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); j5array[1]=((3.14159265358979)+(((-1.0)*x1007))); sj5array[1]=IKsin(j5array[1]); cj5array[1]=IKcos(j5array[1]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; if( j5array[1] > IKPI ) { j5array[1]-=IK2PI; } else if( j5array[1] < -IKPI ) { j5array[1]+=IK2PI; } j5valid[1] = true; for(int ij5 = 0; ij5 < 2; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 2; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[5]; IkReal x1009=IKsin(j5); IkReal x1010=IKcos(j5); IkReal x1011=((1.0)*new_r22); IkReal x1012=(new_r10*x1009); IkReal x1013=(new_r00*x1010); IkReal x1014=((1.0)*x1009); evalcond[0]=(x1012+x1013); evalcond[1]=(((new_r11*x1009))+((new_r01*x1010))); evalcond[2]=(((new_r10*x1010))+(((-1.0)*new_r00*x1014))); evalcond[3]=(((new_r11*x1010))+(((-1.0)*new_r01*x1014))); evalcond[4]=((((-1.0)*x1011*x1013))+(((-1.0)*x1011*x1012))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j5array[2], cj5array[2], sj5array[2]; bool j5valid[2]={false}; _nj5 = 2; CheckValue<IkReal> x1016 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x1016.valid){ continue; } IkReal x1015=x1016.value; j5array[0]=((-1.0)*x1015); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); j5array[1]=((3.14159265358979)+(((-1.0)*x1015))); sj5array[1]=IKsin(j5array[1]); cj5array[1]=IKcos(j5array[1]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; if( j5array[1] > IKPI ) { j5array[1]-=IK2PI; } else if( j5array[1] < -IKPI ) { j5array[1]+=IK2PI; } j5valid[1] = true; for(int ij5 = 0; ij5 < 2; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 2; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[5]; IkReal x1017=IKcos(j5); IkReal x1018=IKsin(j5); IkReal x1019=((1.0)*new_r22); IkReal x1020=(new_r10*x1018); IkReal x1021=(new_r00*x1017); IkReal x1022=((1.0)*x1018); evalcond[0]=(x1021+x1020); evalcond[1]=((((-1.0)*new_r00*x1022))+((new_r10*x1017))); evalcond[2]=(((new_r11*x1017))+(((-1.0)*new_r01*x1022))); evalcond[3]=((((-1.0)*new_r01*x1017*x1019))+(((-1.0)*new_r11*x1018*x1019))); evalcond[4]=((((-1.0)*x1019*x1020))+(((-1.0)*x1019*x1021))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j5array[2], cj5array[2], sj5array[2]; bool j5valid[2]={false}; _nj5 = 2; CheckValue<IkReal> x1024 = IKatan2WithCheck(IkReal(new_r00),IkReal(new_r10),IKFAST_ATAN2_MAGTHRESH); if(!x1024.valid){ continue; } IkReal x1023=x1024.value; j5array[0]=((-1.0)*x1023); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); j5array[1]=((3.14159265358979)+(((-1.0)*x1023))); sj5array[1]=IKsin(j5array[1]); cj5array[1]=IKcos(j5array[1]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; if( j5array[1] > IKPI ) { j5array[1]-=IK2PI; } else if( j5array[1] < -IKPI ) { j5array[1]+=IK2PI; } j5valid[1] = true; for(int ij5 = 0; ij5 < 2; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 2; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[5]; IkReal x1025=IKcos(j5); IkReal x1026=IKsin(j5); IkReal x1027=((1.0)*new_r22); IkReal x1028=(new_r11*x1026); IkReal x1029=(new_r01*x1025); IkReal x1030=((1.0)*x1026); evalcond[0]=(x1029+x1028); evalcond[1]=(((new_r10*x1025))+(((-1.0)*new_r00*x1030))); evalcond[2]=(((new_r11*x1025))+(((-1.0)*new_r01*x1030))); evalcond[3]=((((-1.0)*x1027*x1028))+(((-1.0)*x1027*x1029))); evalcond[4]=((((-1.0)*new_r10*x1026*x1027))+(((-1.0)*new_r00*x1025*x1027))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j5] } } while(0); if( bgotonextstatement ) { } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x1032=IKPowWithIntegerCheck(sj6,-1); if(!x1032.valid){ continue; } IkReal x1031=x1032.value; CheckValue<IkReal> x1033=IKPowWithIntegerCheck(new_r12,-1); if(!x1033.valid){ continue; } if( IKabs((x1031*(x1033.value)*(((-1.0)+(new_r02*new_r02)+(cj6*cj6))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r02*x1031)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((x1031*(x1033.value)*(((-1.0)+(new_r02*new_r02)+(cj6*cj6)))))+IKsqr(((-1.0)*new_r02*x1031))-1) <= IKFAST_SINCOS_THRESH ) continue; j5array[0]=IKatan2((x1031*(x1033.value)*(((-1.0)+(new_r02*new_r02)+(cj6*cj6)))), ((-1.0)*new_r02*x1031)); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[18]; IkReal x1034=IKcos(j5); IkReal x1035=IKsin(j5); IkReal x1036=((1.0)*cj6); IkReal x1037=((1.0)*sj6); IkReal x1038=(cj6*cj7); IkReal x1039=(new_r10*x1035); IkReal x1040=(new_r02*x1034); IkReal x1041=(new_r01*x1034); IkReal x1042=(sj7*x1034); IkReal x1043=((1.0)*x1035); IkReal x1044=(new_r12*x1035); IkReal x1045=(new_r00*x1034); IkReal x1046=(new_r11*x1035); evalcond[0]=(((sj6*x1034))+new_r02); evalcond[1]=(((sj6*x1035))+new_r12); evalcond[2]=(((new_r12*x1034))+(((-1.0)*new_r02*x1043))); evalcond[3]=(sj6+x1040+x1044); evalcond[4]=(sj7+((new_r10*x1034))+(((-1.0)*new_r00*x1043))); evalcond[5]=(cj7+((new_r11*x1034))+(((-1.0)*new_r01*x1043))); evalcond[6]=(x1042+((x1035*x1038))+new_r10); evalcond[7]=(x1045+x1038+x1039); evalcond[8]=((((-1.0)*sj7*x1043))+((x1034*x1038))+new_r00); evalcond[9]=(((cj7*x1034))+(((-1.0)*sj7*x1035*x1036))+new_r11); evalcond[10]=(x1041+x1046+(((-1.0)*sj7*x1036))); evalcond[11]=((((-1.0)*cj7*x1043))+new_r01+(((-1.0)*x1036*x1042))); evalcond[12]=(((sj6*x1039))+((sj6*x1045))+(((-1.0)*new_r20*x1036))); evalcond[13]=(((sj6*x1041))+((sj6*x1046))+(((-1.0)*new_r21*x1036))); evalcond[14]=((1.0)+(((-1.0)*new_r22*x1036))+((sj6*x1040))+((sj6*x1044))); evalcond[15]=((((-1.0)*new_r22*x1037))+(((-1.0)*x1036*x1044))+(((-1.0)*x1036*x1040))); evalcond[16]=(sj7+(((-1.0)*new_r21*x1037))+(((-1.0)*x1036*x1046))+(((-1.0)*x1036*x1041))); evalcond[17]=((((-1.0)*x1036*x1039))+(((-1.0)*new_r20*x1037))+(((-1.0)*x1036*x1045))+(((-1.0)*cj7))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[12]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[13]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[14]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[15]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[16]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[17]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j5array[1], cj5array[1], sj5array[1]; bool j5valid[1]={false}; _nj5 = 1; CheckValue<IkReal> x1047=IKPowWithIntegerCheck(IKsign(sj6),-1); if(!x1047.valid){ continue; } CheckValue<IkReal> x1048 = IKatan2WithCheck(IkReal(((-1.0)*new_r12)),IkReal(((-1.0)*new_r02)),IKFAST_ATAN2_MAGTHRESH); if(!x1048.valid){ continue; } j5array[0]=((-1.5707963267949)+(((1.5707963267949)*(x1047.value)))+(x1048.value)); sj5array[0]=IKsin(j5array[0]); cj5array[0]=IKcos(j5array[0]); if( j5array[0] > IKPI ) { j5array[0]-=IK2PI; } else if( j5array[0] < -IKPI ) { j5array[0]+=IK2PI; } j5valid[0] = true; for(int ij5 = 0; ij5 < 1; ++ij5) { if( !j5valid[ij5] ) { continue; } _ij5[0] = ij5; _ij5[1] = -1; for(int iij5 = ij5+1; iij5 < 1; ++iij5) { if( j5valid[iij5] && IKabs(cj5array[ij5]-cj5array[iij5]) < IKFAST_SOLUTION_THRESH && IKabs(sj5array[ij5]-sj5array[iij5]) < IKFAST_SOLUTION_THRESH ) { j5valid[iij5]=false; _ij5[1] = iij5; break; } } j5 = j5array[ij5]; cj5 = cj5array[ij5]; sj5 = sj5array[ij5]; { IkReal evalcond[18]; IkReal x1049=IKcos(j5); IkReal x1050=IKsin(j5); IkReal x1051=((1.0)*cj6); IkReal x1052=((1.0)*sj6); IkReal x1053=(cj6*cj7); IkReal x1054=(new_r10*x1050); IkReal x1055=(new_r02*x1049); IkReal x1056=(new_r01*x1049); IkReal x1057=(sj7*x1049); IkReal x1058=((1.0)*x1050); IkReal x1059=(new_r12*x1050); IkReal x1060=(new_r00*x1049); IkReal x1061=(new_r11*x1050); evalcond[0]=(((sj6*x1049))+new_r02); evalcond[1]=(((sj6*x1050))+new_r12); evalcond[2]=((((-1.0)*new_r02*x1058))+((new_r12*x1049))); evalcond[3]=(sj6+x1055+x1059); evalcond[4]=(sj7+(((-1.0)*new_r00*x1058))+((new_r10*x1049))); evalcond[5]=(cj7+(((-1.0)*new_r01*x1058))+((new_r11*x1049))); evalcond[6]=(x1057+((x1050*x1053))+new_r10); evalcond[7]=(x1053+x1054+x1060); evalcond[8]=((((-1.0)*sj7*x1058))+((x1049*x1053))+new_r00); evalcond[9]=(((cj7*x1049))+(((-1.0)*sj7*x1050*x1051))+new_r11); evalcond[10]=((((-1.0)*sj7*x1051))+x1056+x1061); evalcond[11]=((((-1.0)*cj7*x1058))+new_r01+(((-1.0)*x1051*x1057))); evalcond[12]=(((sj6*x1060))+(((-1.0)*new_r20*x1051))+((sj6*x1054))); evalcond[13]=((((-1.0)*new_r21*x1051))+((sj6*x1061))+((sj6*x1056))); evalcond[14]=((1.0)+(((-1.0)*new_r22*x1051))+((sj6*x1055))+((sj6*x1059))); evalcond[15]=((((-1.0)*new_r22*x1052))+(((-1.0)*x1051*x1059))+(((-1.0)*x1051*x1055))); evalcond[16]=(sj7+(((-1.0)*new_r21*x1052))+(((-1.0)*x1051*x1061))+(((-1.0)*x1051*x1056))); evalcond[17]=((((-1.0)*new_r20*x1052))+(((-1.0)*x1051*x1060))+(((-1.0)*cj7))+(((-1.0)*x1051*x1054))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[12]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[13]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[14]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[15]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[16]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[17]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j0; vinfos[0].indices[0] = _ij0[0]; vinfos[0].indices[1] = _ij0[1]; vinfos[0].maxsolutions = _nj0; vinfos[1].jointtype = 1; vinfos[1].foffset = j1; vinfos[1].indices[0] = _ij1[0]; vinfos[1].indices[1] = _ij1[1]; vinfos[1].maxsolutions = _nj1; vinfos[2].jointtype = 1; vinfos[2].foffset = j2; vinfos[2].indices[0] = _ij2[0]; vinfos[2].indices[1] = _ij2[1]; vinfos[2].maxsolutions = _nj2; vinfos[3].jointtype = 1; vinfos[3].foffset = j3; vinfos[3].indices[0] = _ij3[0]; vinfos[3].indices[1] = _ij3[1]; vinfos[3].maxsolutions = _nj3; vinfos[4].jointtype = 1; vinfos[4].foffset = j4; vinfos[4].indices[0] = _ij4[0]; vinfos[4].indices[1] = _ij4[1]; vinfos[4].maxsolutions = _nj4; vinfos[5].jointtype = 1; vinfos[5].foffset = j5; vinfos[5].indices[0] = _ij5[0]; vinfos[5].indices[1] = _ij5[1]; vinfos[5].maxsolutions = _nj5; vinfos[6].jointtype = 1; vinfos[6].foffset = j6; vinfos[6].indices[0] = _ij6[0]; vinfos[6].indices[1] = _ij6[1]; vinfos[6].maxsolutions = _nj6; vinfos[7].jointtype = 1; vinfos[7].foffset = j7; vinfos[7].indices[0] = _ij7[0]; vinfos[7].indices[1] = _ij7[1]; vinfos[7].maxsolutions = _nj7; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } } } } } } }static inline void polyroots3(IkReal rawcoeffs[3+1], IkReal rawroots[3], int& numroots) { using std::complex; if( rawcoeffs[0] == 0 ) { // solve with one reduced degree polyroots2(&rawcoeffs[1], &rawroots[0], numroots); return; } IKFAST_ASSERT(rawcoeffs[0] != 0); const IkReal tol = 128.0*std::numeric_limits<IkReal>::epsilon(); const IkReal tolsqrt = sqrt(std::numeric_limits<IkReal>::epsilon()); complex<IkReal> coeffs[3]; const int maxsteps = 110; for(int i = 0; i < 3; ++i) { coeffs[i] = complex<IkReal>(rawcoeffs[i+1]/rawcoeffs[0]); } complex<IkReal> roots[3]; IkReal err[3]; roots[0] = complex<IkReal>(1,0); roots[1] = complex<IkReal>(0.4,0.9); // any complex number not a root of unity works err[0] = 1.0; err[1] = 1.0; for(int i = 2; i < 3; ++i) { roots[i] = roots[i-1]*roots[1]; err[i] = 1.0; } for(int step = 0; step < maxsteps; ++step) { bool changed = false; for(int i = 0; i < 3; ++i) { if ( err[i] >= tol ) { changed = true; // evaluate complex<IkReal> x = roots[i] + coeffs[0]; for(int j = 1; j < 3; ++j) { x = roots[i] * x + coeffs[j]; } for(int j = 0; j < 3; ++j) { if( i != j ) { if( roots[i] != roots[j] ) { x /= (roots[i] - roots[j]); } } } roots[i] -= x; err[i] = abs(x); } } if( !changed ) { break; } } numroots = 0; bool visited[3] = {false}; for(int i = 0; i < 3; ++i) { if( !visited[i] ) { // might be a multiple root, in which case it will have more error than the other roots // find any neighboring roots, and take the average complex<IkReal> newroot=roots[i]; int n = 1; for(int j = i+1; j < 3; ++j) { // care about error in real much more than imaginary if( abs(real(roots[i])-real(roots[j])) < tolsqrt && abs(imag(roots[i])-imag(roots[j])) < 0.002 ) { newroot += roots[j]; n += 1; visited[j] = true; } } if( n > 1 ) { newroot /= n; } // there are still cases where even the mean is not accurate enough, until a better multi-root algorithm is used, need to use the sqrt if( IKabs(imag(newroot)) < tolsqrt ) { rawroots[numroots++] = real(newroot); } } } } static inline void polyroots2(IkReal rawcoeffs[2+1], IkReal rawroots[2], int& numroots) { IkReal det = rawcoeffs[1]*rawcoeffs[1]-4*rawcoeffs[0]*rawcoeffs[2]; if( det < 0 ) { numroots=0; } else if( det == 0 ) { rawroots[0] = -0.5*rawcoeffs[1]/rawcoeffs[0]; numroots = 1; } else { det = IKsqrt(det); rawroots[0] = (-rawcoeffs[1]+det)/(2*rawcoeffs[0]); rawroots[1] = (-rawcoeffs[1]-det)/(2*rawcoeffs[0]);//rawcoeffs[2]/(rawcoeffs[0]*rawroots[0]); numroots = 2; } } static inline void polyroots4(IkReal rawcoeffs[4+1], IkReal rawroots[4], int& numroots) { using std::complex; if( rawcoeffs[0] == 0 ) { // solve with one reduced degree polyroots3(&rawcoeffs[1], &rawroots[0], numroots); return; } IKFAST_ASSERT(rawcoeffs[0] != 0); const IkReal tol = 128.0*std::numeric_limits<IkReal>::epsilon(); const IkReal tolsqrt = sqrt(std::numeric_limits<IkReal>::epsilon()); complex<IkReal> coeffs[4]; const int maxsteps = 110; for(int i = 0; i < 4; ++i) { coeffs[i] = complex<IkReal>(rawcoeffs[i+1]/rawcoeffs[0]); } complex<IkReal> roots[4]; IkReal err[4]; roots[0] = complex<IkReal>(1,0); roots[1] = complex<IkReal>(0.4,0.9); // any complex number not a root of unity works err[0] = 1.0; err[1] = 1.0; for(int i = 2; i < 4; ++i) { roots[i] = roots[i-1]*roots[1]; err[i] = 1.0; } for(int step = 0; step < maxsteps; ++step) { bool changed = false; for(int i = 0; i < 4; ++i) { if ( err[i] >= tol ) { changed = true; // evaluate complex<IkReal> x = roots[i] + coeffs[0]; for(int j = 1; j < 4; ++j) { x = roots[i] * x + coeffs[j]; } for(int j = 0; j < 4; ++j) { if( i != j ) { if( roots[i] != roots[j] ) { x /= (roots[i] - roots[j]); } } } roots[i] -= x; err[i] = abs(x); } } if( !changed ) { break; } } numroots = 0; bool visited[4] = {false}; for(int i = 0; i < 4; ++i) { if( !visited[i] ) { // might be a multiple root, in which case it will have more error than the other roots // find any neighboring roots, and take the average complex<IkReal> newroot=roots[i]; int n = 1; for(int j = i+1; j < 4; ++j) { // care about error in real much more than imaginary if( abs(real(roots[i])-real(roots[j])) < tolsqrt && abs(imag(roots[i])-imag(roots[j])) < 0.002 ) { newroot += roots[j]; n += 1; visited[j] = true; } } if( n > 1 ) { newroot /= n; } // there are still cases where even the mean is not accurate enough, until a better multi-root algorithm is used, need to use the sqrt if( IKabs(imag(newroot)) < tolsqrt ) { rawroots[numroots++] = real(newroot); } } } } }; /// solves the inverse kinematics equations. /// \param pfree is an array specifying the free joints of the chain. IKFAST_API bool ComputeIk(const IkReal* eetrans, const IkReal* eerot, const IkReal* pfree, IkSolutionListBase<IkReal>& solutions) { IKSolver solver; return solver.ComputeIk(eetrans,eerot,pfree,solutions); } IKFAST_API bool ComputeIk2(const IkReal* eetrans, const IkReal* eerot, const IkReal* pfree, IkSolutionListBase<IkReal>& solutions, void* pOpenRAVEManip) { IKSolver solver; return solver.ComputeIk(eetrans,eerot,pfree,solutions); } IKFAST_API const char* GetKinematicsHash() { return ""; } IKFAST_API const char* GetIkFastVersion() { return "0x1000004a"; } #ifdef IKFAST_NAMESPACE } // end namespace #endif #ifndef IKFAST_NO_MAIN #include <stdio.h> #include <stdlib.h> #ifdef IKFAST_NAMESPACE using namespace IKFAST_NAMESPACE; #endif int main(int argc, char** argv) { if( argc != 12+GetNumFreeParameters()+1 ) { printf("\nUsage: ./ik r00 r01 r02 t0 r10 r11 r12 t1 r20 r21 r22 t2 free0 ...\n\n" "Returns the ik solutions given the transformation of the end effector specified by\n" "a 3x3 rotation R (rXX), and a 3x1 translation (tX).\n" "There are %d free parameters that have to be specified.\n\n",GetNumFreeParameters()); return 1; } IkSolutionList<IkReal> solutions; std::vector<IkReal> vfree(GetNumFreeParameters()); IkReal eerot[9],eetrans[3]; eerot[0] = atof(argv[1]); eerot[1] = atof(argv[2]); eerot[2] = atof(argv[3]); eetrans[0] = atof(argv[4]); eerot[3] = atof(argv[5]); eerot[4] = atof(argv[6]); eerot[5] = atof(argv[7]); eetrans[1] = atof(argv[8]); eerot[6] = atof(argv[9]); eerot[7] = atof(argv[10]); eerot[8] = atof(argv[11]); eetrans[2] = atof(argv[12]); for(std::size_t i = 0; i < vfree.size(); ++i) vfree[i] = atof(argv[13+i]); bool bSuccess = ComputeIk(eetrans, eerot, vfree.size() > 0 ? &vfree[0] : NULL, solutions); if( !bSuccess ) { fprintf(stderr,"Failed to get ik solution\n"); return -1; } printf("Found %d ik solutions:\n", (int)solutions.GetNumSolutions()); std::vector<IkReal> solvalues(GetNumJoints()); for(std::size_t i = 0; i < solutions.GetNumSolutions(); ++i) { const IkSolutionBase<IkReal>& sol = solutions.GetSolution(i); printf("sol%d (free=%d): ", (int)i, (int)sol.GetFree().size()); std::vector<IkReal> vsolfree(sol.GetFree().size()); sol.GetSolution(&solvalues[0],vsolfree.size()>0?&vsolfree[0]:NULL); for( std::size_t j = 0; j < solvalues.size(); ++j) printf("%.15f, ", solvalues[j]); printf("\n"); } return 0; } #endif // start python bindings // https://github.com/caelan/ss-pybullet/blob/c5efe7ad32381a7a7a15c2bd147b5a8731d21342/pybullet_tools/ikfast/pr2/left_arm_ik.cpp#L12972 // https://github.com/yijiangh/conrob_pybullet/blob/master/utils/ikfast/kuka_kr6_r900/ikfast0x1000004a.Transform6D.0_1_2_3_4_5.cpp#L9923 static PyObject *get_ik(PyObject *self, PyObject *args) { IkSolutionList<IkReal> solutions; std::vector<IkReal> vfree(GetNumFreeParameters()); IkReal eerot[9], eetrans[3]; // First list if 3x3 rotation matrix, easier to compute in Python. // Next list is [x, y, z] translation matrix. // Last list is free joints. PyObject *rotList; // 3x3 rotation matrix PyObject *transList; // [x,y,z] PyObject *freeList; // can be empty // format 'O!': pass C object pointer with the pointer's address. if(!PyArg_ParseTuple(args, "O!O!O!", &PyList_Type, &rotList, &PyList_Type, &transList, &PyList_Type, &freeList)) { fprintf(stderr,"Failed to parse input to python objects\n"); return NULL; } for(std::size_t i = 0; i < 3; ++i) { eetrans[i] = PyFloat_AsDouble(PyList_GetItem(transList, i)); PyObject* rowList = PyList_GetItem(rotList, i); for( std::size_t j = 0; j < 3; ++j) { eerot[3*i + j] = PyFloat_AsDouble(PyList_GetItem(rowList, j)); } } for(int i = 0; i < GetNumFreeParameters(); ++i) { vfree[i] = PyFloat_AsDouble(PyList_GetItem(freeList, i)); } // call ikfast routine bool bSuccess = ComputeIk(eetrans, eerot, &vfree[0], solutions); if (!bSuccess) { //fprintf(stderr,"Failed to get ik solution\n"); return Py_BuildValue(""); // Equivalent to returning None in python } std::vector<IkReal> solvalues(GetNumJoints()); PyObject *solutionList = PyList_New(solutions.GetNumSolutions()); // convert all ikfast solutions into a python list for(std::size_t i = 0; i < solutions.GetNumSolutions(); ++i) { const IkSolutionBase<IkReal>& sol = solutions.GetSolution(i); std::vector<IkReal> vsolfree(sol.GetFree().size()); sol.GetSolution(&solvalues[0],vsolfree.size()>0?&vsolfree[0]:NULL); PyObject *individualSolution = PyList_New(GetNumJoints()); for( std::size_t j = 0; j < solvalues.size(); ++j) { // I think IkReal is just a wrapper for double. So this should work. PyList_SetItem(individualSolution, j, PyFloat_FromDouble(solvalues[j])); } PyList_SetItem(solutionList, i, individualSolution); } return solutionList; } static PyObject *get_fk(PyObject *self, PyObject *args) { std::vector<IkReal> joints(GetNumJoints()); // eerot is a flattened 3x3 rotation matrix IkReal eerot[9], eetrans[3]; PyObject *jointList; if(!PyArg_ParseTuple(args, "O!", &PyList_Type, &jointList)) { return NULL; } for(std::size_t i = 0; i < GetNumJoints(); ++i) { joints[i] = PyFloat_AsDouble(PyList_GetItem(jointList, i)); } // call ikfast routine ComputeFk(&joints[0], eetrans, eerot); // convert computed EE pose to a python object PyObject *pose = PyList_New(2); PyObject *pos = PyList_New(3); PyObject *rot = PyList_New(3); for(std::size_t i = 0; i < 3; ++i) { PyList_SetItem(pos, i, PyFloat_FromDouble(eetrans[i])); PyObject *row = PyList_New(3); for( std::size_t j = 0; j < 3; ++j) { PyList_SetItem(row, j, PyFloat_FromDouble(eerot[3*i + j])); } PyList_SetItem(rot, i, row); } PyList_SetItem(pose, 0, pos); PyList_SetItem(pose, 1, rot); return pose; } static PyMethodDef ikfast_methods[] = { {"get_ik", get_ik, METH_VARARGS, "Compute ik solutions using ikfast."}, {"get_fk", get_fk, METH_VARARGS, "Compute fk solutions using ikfast."}, {NULL, NULL, 0, NULL} // Not sure why/if this is needed. It shows up in the examples though(something about Sentinel). }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef movo_left_arm_ik_module = { PyModuleDef_HEAD_INIT, "movo_left_arm_ik", /* name of module */ NULL, /* module documentation, may be NULL */ -1, /* size of per-interpreter state of the module, or -1 if the module keeps state in global variables. */ ikfast_methods }; #define INITERROR return NULL PyMODINIT_FUNC PyInit_movo_left_arm_ik(void) #else // PY_MAJOR_VERSION < 3 #define INITERROR return PyMODINIT_FUNC initmovo_left_arm_ik(void) #endif { #if PY_MAJOR_VERSION >= 3 PyObject *module = PyModule_Create(&movo_left_arm_ik_module); #else PyObject *module = Py_InitModule("movo_left_arm_ik", ikfast_methods); #endif if (module == NULL) INITERROR; #if PY_MAJOR_VERSION >= 3 return module; #endif } // end python bindings
474,188
C++
28.137827
874
0.639616
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/pybullet_tools/ikfast/movo/setup.py
#!/usr/bin/env python from __future__ import print_function import sys import os import argparse sys.path.append(os.path.join(os.pardir, os.pardir, os.pardir)) from pybullet_tools.ikfast.compile import compile_ikfast # Build C++ extension by running: 'python setup.py' # see: https://docs.python.org/3/extending/building.html ARMS = ['left', 'right'] def main(): parser = argparse.ArgumentParser() parser.add_argument('-a', '--arms', nargs='+', type=str, default=ARMS, choices=ARMS, #required=True, help='Which arms to compile') args = parser.parse_args() sys.argv[:] = sys.argv[:1] + ['build'] # Must come after argparse for arm in args.arms: compile_ikfast(module_name='movo_{}_arm_ik'.format(arm), cpp_filename='movo_{}_arm_ik.cpp'.format(arm)) if __name__ == '__main__': main()
893
Python
27.838709
69
0.618141
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/pybullet_tools/ikfast/pr2/ik.py
import random from ..utils import get_ik_limits, compute_forward_kinematics, compute_inverse_kinematics, select_solution, \ USE_ALL, USE_CURRENT from ...pr2_utils import PR2_TOOL_FRAMES, get_torso_arm_joints, get_gripper_link, get_arm_joints, side_from_arm from ...utils import multiply, get_link_pose, link_from_name, get_joint_positions, \ joint_from_name, invert, get_custom_limits, all_between, sub_inverse_kinematics, set_joint_positions, \ get_joint_positions, pairwise_collision from ...ikfast.utils import IKFastInfo #from ...ikfast.ikfast import closest_inverse_kinematics # TODO: use these functions instead # TODO: deprecate IK_FRAME = { 'left': 'l_gripper_tool_frame', 'right': 'r_gripper_tool_frame', } BASE_FRAME = 'base_link' TORSO_JOINT = 'torso_lift_joint' UPPER_JOINT = { 'left': 'l_upper_arm_roll_joint', # Third arm joint 'right': 'r_upper_arm_roll_joint', } ##################################### PR2_URDF = "models/pr2_description/pr2.urdf" # 87 joints #PR2_URDF = "models/pr2_description/pr2_hpn.urdf" #PR2_URDF = "models/pr2_description/pr2_kinect.urdf" DRAKE_PR2_URDF = "models/drake/pr2_description/urdf/pr2_simplified.urdf" PR2_INFOS = {arm: IKFastInfo(module_name='pr2.ik{}'.format(arm.capitalize()), base_link=BASE_FRAME, ee_link=IK_FRAME[arm], free_joints=[TORSO_JOINT, UPPER_JOINT[arm]]) for arm in IK_FRAME} def get_if_info(arm): side = side_from_arm(arm) return PR2_INFOS[side] ##################################### def get_tool_pose(robot, arm): from .ikLeft import leftFK from .ikRight import rightFK arm_fk = {'left': leftFK, 'right': rightFK} # TODO: compute static transform from base_footprint -> base_link ik_joints = get_torso_arm_joints(robot, arm) conf = get_joint_positions(robot, ik_joints) assert len(conf) == 8 base_from_tool = compute_forward_kinematics(arm_fk[arm], conf) #quat = quat if quat.real >= 0 else -quat # solves q and -q being same rotation world_from_base = get_link_pose(robot, link_from_name(robot, BASE_FRAME)) return multiply(world_from_base, base_from_tool) ##################################### def is_ik_compiled(): try: from .ikLeft import leftIK from .ikRight import rightIK return True except ImportError: return False def get_ik_generator(robot, arm, ik_pose, torso_limits=USE_ALL, upper_limits=USE_ALL, custom_limits={}): from .ikLeft import leftIK from .ikRight import rightIK arm_ik = {'left': leftIK, 'right': rightIK} world_from_base = get_link_pose(robot, link_from_name(robot, BASE_FRAME)) base_from_ik = multiply(invert(world_from_base), ik_pose) sampled_joints = [joint_from_name(robot, name) for name in [TORSO_JOINT, UPPER_JOINT[arm]]] sampled_limits = [get_ik_limits(robot, joint, limits) for joint, limits in zip(sampled_joints, [torso_limits, upper_limits])] arm_joints = get_torso_arm_joints(robot, arm) min_limits, max_limits = get_custom_limits(robot, arm_joints, custom_limits) while True: sampled_values = [random.uniform(*limits) for limits in sampled_limits] confs = compute_inverse_kinematics(arm_ik[arm], base_from_ik, sampled_values) solutions = [q for q in confs if all_between(min_limits, q, max_limits)] # TODO: return just the closest solution #print(len(confs), len(solutions)) yield solutions if all(lower == upper for lower, upper in sampled_limits): break def get_tool_from_ik(robot, arm): # TODO: change PR2_TOOL_FRAMES[arm] to be IK_LINK[arm] world_from_tool = get_link_pose(robot, link_from_name(robot, PR2_TOOL_FRAMES[arm])) world_from_ik = get_link_pose(robot, link_from_name(robot, IK_FRAME[arm])) return multiply(invert(world_from_tool), world_from_ik) def sample_tool_ik(robot, arm, tool_pose, nearby_conf=USE_ALL, max_attempts=25, **kwargs): ik_pose = multiply(tool_pose, get_tool_from_ik(robot, arm)) generator = get_ik_generator(robot, arm, ik_pose, **kwargs) arm_joints = get_torso_arm_joints(robot, arm) for _ in range(max_attempts): try: solutions = next(generator) # TODO: sort by distance from the current solution when attempting? if solutions: return select_solution(robot, arm_joints, solutions, nearby_conf=nearby_conf) except StopIteration: break return None def pr2_inverse_kinematics(robot, arm, gripper_pose, obstacles=[], custom_limits={}, **kwargs): arm_link = get_gripper_link(robot, arm) arm_joints = get_arm_joints(robot, arm) if is_ik_compiled(): ik_joints = get_torso_arm_joints(robot, arm) torso_arm_conf = sample_tool_ik(robot, arm, gripper_pose, custom_limits=custom_limits, torso_limits=USE_CURRENT, **kwargs) if torso_arm_conf is None: return None set_joint_positions(robot, ik_joints, torso_arm_conf) else: arm_conf = sub_inverse_kinematics(robot, arm_joints[0], arm_link, gripper_pose, custom_limits=custom_limits) if arm_conf is None: return None if any(pairwise_collision(robot, b) for b in obstacles): return None return get_joint_positions(robot, arm_joints)
5,341
Python
41.736
129
0.656057
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/pybullet_tools/ikfast/pr2/right_arm_ik.cpp
/// autogenerated analytical inverse kinematics code from ikfast program part of OpenRAVE /// \author Rosen Diankov /// /// Licensed under the Apache License, Version 2.0 (the "License"); /// you may not use this file except in compliance with the License. /// You may obtain a copy of the License at /// http://www.apache.org/licenses/LICENSE-2.0 /// /// Unless required by applicable law or agreed to in writing, software /// distributed under the License is distributed on an "AS IS" BASIS, /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. /// See the License for the specific language governing permissions and /// limitations under the License. /// /// ikfast version 0x1000004a generated on 2018-07-20 15:34:20.766183 /// Generated using solver transform6d /// To compile with gcc: /// gcc -lstdc++ ik.cpp /// To compile without any main function as a shared object (might need -llapack): /// gcc -fPIC -lstdc++ -DIKFAST_NO_MAIN -DIKFAST_CLIBRARY -shared -Wl,-soname,libik.so -o libik.so ik.cpp //// START //// Make sure the version number matches. //// You might need to install the dev version to get the header files. //// sudo apt-get install python3.4-dev #include "Python.h" //// END #define IKFAST_HAS_LIBRARY #include "ikfast.h" // found inside share/openrave-X.Y/python/ikfast.h using namespace ikfast; // check if the included ikfast version matches what this file was compiled with #define IKFAST_COMPILE_ASSERT(x) extern int __dummy[(int)x] IKFAST_COMPILE_ASSERT(IKFAST_VERSION==0x1000004a); #include <cmath> #include <vector> #include <limits> #include <algorithm> #include <complex> #ifndef IKFAST_ASSERT #include <stdexcept> #include <sstream> #include <iostream> #ifdef _MSC_VER #ifndef __PRETTY_FUNCTION__ #define __PRETTY_FUNCTION__ __FUNCDNAME__ #endif #endif #ifndef __PRETTY_FUNCTION__ #define __PRETTY_FUNCTION__ __func__ #endif #define IKFAST_ASSERT(b) { if( !(b) ) { std::stringstream ss; ss << "ikfast exception: " << __FILE__ << ":" << __LINE__ << ": " <<__PRETTY_FUNCTION__ << ": Assertion '" << #b << "' failed"; throw std::runtime_error(ss.str()); } } #endif #if defined(_MSC_VER) #define IKFAST_ALIGNED16(x) __declspec(align(16)) x #else #define IKFAST_ALIGNED16(x) x __attribute((aligned(16))) #endif #define IK2PI ((IkReal)6.28318530717959) #define IKPI ((IkReal)3.14159265358979) #define IKPI_2 ((IkReal)1.57079632679490) #ifdef _MSC_VER #ifndef isnan #define isnan _isnan #endif #ifndef isinf #define isinf _isinf #endif //#ifndef isfinite //#define isfinite _isfinite //#endif #endif // _MSC_VER // lapack routines extern "C" { void dgetrf_ (const int* m, const int* n, double* a, const int* lda, int* ipiv, int* info); void zgetrf_ (const int* m, const int* n, std::complex<double>* a, const int* lda, int* ipiv, int* info); void dgetri_(const int* n, const double* a, const int* lda, int* ipiv, double* work, const int* lwork, int* info); void dgesv_ (const int* n, const int* nrhs, double* a, const int* lda, int* ipiv, double* b, const int* ldb, int* info); void dgetrs_(const char *trans, const int *n, const int *nrhs, double *a, const int *lda, int *ipiv, double *b, const int *ldb, int *info); void dgeev_(const char *jobvl, const char *jobvr, const int *n, double *a, const int *lda, double *wr, double *wi,double *vl, const int *ldvl, double *vr, const int *ldvr, double *work, const int *lwork, int *info); } using namespace std; // necessary to get std math routines #ifdef IKFAST_NAMESPACE namespace IKFAST_NAMESPACE { #endif inline float IKabs(float f) { return fabsf(f); } inline double IKabs(double f) { return fabs(f); } inline float IKsqr(float f) { return f*f; } inline double IKsqr(double f) { return f*f; } inline float IKlog(float f) { return logf(f); } inline double IKlog(double f) { return log(f); } // allows asin and acos to exceed 1. has to be smaller than thresholds used for branch conds and evaluation #ifndef IKFAST_SINCOS_THRESH #define IKFAST_SINCOS_THRESH ((IkReal)1e-7) #endif // used to check input to atan2 for degenerate cases. has to be smaller than thresholds used for branch conds and evaluation #ifndef IKFAST_ATAN2_MAGTHRESH #define IKFAST_ATAN2_MAGTHRESH ((IkReal)1e-7) #endif // minimum distance of separate solutions #ifndef IKFAST_SOLUTION_THRESH #define IKFAST_SOLUTION_THRESH ((IkReal)1e-6) #endif // there are checkpoints in ikfast that are evaluated to make sure they are 0. This threshold speicfies by how much they can deviate #ifndef IKFAST_EVALCOND_THRESH #define IKFAST_EVALCOND_THRESH ((IkReal)0.00001) #endif inline float IKasin(float f) { IKFAST_ASSERT( f > -1-IKFAST_SINCOS_THRESH && f < 1+IKFAST_SINCOS_THRESH ); // any more error implies something is wrong with the solver if( f <= -1 ) return float(-IKPI_2); else if( f >= 1 ) return float(IKPI_2); return asinf(f); } inline double IKasin(double f) { IKFAST_ASSERT( f > -1-IKFAST_SINCOS_THRESH && f < 1+IKFAST_SINCOS_THRESH ); // any more error implies something is wrong with the solver if( f <= -1 ) return -IKPI_2; else if( f >= 1 ) return IKPI_2; return asin(f); } // return positive value in [0,y) inline float IKfmod(float x, float y) { while(x < 0) { x += y; } return fmodf(x,y); } // return positive value in [0,y) inline double IKfmod(double x, double y) { while(x < 0) { x += y; } return fmod(x,y); } inline float IKacos(float f) { IKFAST_ASSERT( f > -1-IKFAST_SINCOS_THRESH && f < 1+IKFAST_SINCOS_THRESH ); // any more error implies something is wrong with the solver if( f <= -1 ) return float(IKPI); else if( f >= 1 ) return float(0); return acosf(f); } inline double IKacos(double f) { IKFAST_ASSERT( f > -1-IKFAST_SINCOS_THRESH && f < 1+IKFAST_SINCOS_THRESH ); // any more error implies something is wrong with the solver if( f <= -1 ) return IKPI; else if( f >= 1 ) return 0; return acos(f); } inline float IKsin(float f) { return sinf(f); } inline double IKsin(double f) { return sin(f); } inline float IKcos(float f) { return cosf(f); } inline double IKcos(double f) { return cos(f); } inline float IKtan(float f) { return tanf(f); } inline double IKtan(double f) { return tan(f); } inline float IKsqrt(float f) { if( f <= 0.0f ) return 0.0f; return sqrtf(f); } inline double IKsqrt(double f) { if( f <= 0.0 ) return 0.0; return sqrt(f); } inline float IKatan2Simple(float fy, float fx) { return atan2f(fy,fx); } inline float IKatan2(float fy, float fx) { if( isnan(fy) ) { IKFAST_ASSERT(!isnan(fx)); // if both are nan, probably wrong value will be returned return float(IKPI_2); } else if( isnan(fx) ) { return 0; } return atan2f(fy,fx); } inline double IKatan2Simple(double fy, double fx) { return atan2(fy,fx); } inline double IKatan2(double fy, double fx) { if( isnan(fy) ) { IKFAST_ASSERT(!isnan(fx)); // if both are nan, probably wrong value will be returned return IKPI_2; } else if( isnan(fx) ) { return 0; } return atan2(fy,fx); } template <typename T> struct CheckValue { T value; bool valid; }; template <typename T> inline CheckValue<T> IKatan2WithCheck(T fy, T fx, T epsilon) { CheckValue<T> ret; ret.valid = false; ret.value = 0; if( !isnan(fy) && !isnan(fx) ) { if( IKabs(fy) >= IKFAST_ATAN2_MAGTHRESH || IKabs(fx) > IKFAST_ATAN2_MAGTHRESH ) { ret.value = IKatan2Simple(fy,fx); ret.valid = true; } } return ret; } inline float IKsign(float f) { if( f > 0 ) { return float(1); } else if( f < 0 ) { return float(-1); } return 0; } inline double IKsign(double f) { if( f > 0 ) { return 1.0; } else if( f < 0 ) { return -1.0; } return 0; } template <typename T> inline CheckValue<T> IKPowWithIntegerCheck(T f, int n) { CheckValue<T> ret; ret.valid = true; if( n == 0 ) { ret.value = 1.0; return ret; } else if( n == 1 ) { ret.value = f; return ret; } else if( n < 0 ) { if( f == 0 ) { ret.valid = false; ret.value = (T)1.0e30; return ret; } if( n == -1 ) { ret.value = T(1.0)/f; return ret; } } int num = n > 0 ? n : -n; if( num == 2 ) { ret.value = f*f; } else if( num == 3 ) { ret.value = f*f*f; } else { ret.value = 1.0; while(num>0) { if( num & 1 ) { ret.value *= f; } num >>= 1; f *= f; } } if( n < 0 ) { ret.value = T(1.0)/ret.value; } return ret; } /// solves the forward kinematics equations. /// \param pfree is an array specifying the free joints of the chain. IKFAST_API void ComputeFk(const IkReal* j, IkReal* eetrans, IkReal* eerot) { IkReal x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,x17,x18,x19,x20,x21,x22,x23,x24,x25,x26,x27,x28,x29,x30,x31,x32,x33,x34,x36,x37,x38,x39,x41,x42,x43,x44,x45,x46,x47,x48,x49,x50,x51,x52,x54,x55,x56,x57,x58,x59,x60,x61,x62,x63,x64,x65,x66; x0=IKcos(j[1]); x1=IKcos(j[4]); x2=IKcos(j[2]); x3=IKsin(j[4]); x4=IKsin(j[2]); x5=IKsin(j[3]); x6=IKcos(j[3]); x7=IKsin(j[1]); x8=IKcos(j[5]); x9=IKsin(j[5]); x10=IKsin(j[6]); x11=IKcos(j[6]); x12=IKsin(j[7]); x13=IKcos(j[7]); x14=((1.0)*x1); x15=((1.0)*x3); x16=((0.18)*x8); x17=((1.0)*x6); x18=((0.321)*x5); x19=((1.0)*x8); x20=((0.18)*x9); x21=((0.18)*x3); x22=((0.18)*x1); x23=((0.321)*x1); x24=((1.0)*x9); x25=((1.0)*x10); x26=((0.321)*x6); x27=((1.0)*x11); x28=(x2*x7); x29=((-1.0)*x3); x30=(x0*x4); x31=(x2*x5); x32=((-1.0)*x10); x33=(x0*x2); x34=((-1.0)*x1); x36=((-1.0)*x11); x37=(x5*x7); x38=(x2*x6); x39=(x4*x7); x41=(x15*x33); x42=(x14*x38); x43=(((x30*x5))+(((-1.0)*x17*x7))); x44=(((x0*x5))+(((-1.0)*x17*x39))); x45=(((x0*x6))+((x37*x4))); x46=((((-1.0)*x42))+((x3*x4))); x47=(x42+(((-1.0)*x15*x4))); x48=((((-1.0)*x37))+(((-1.0)*x17*x30))); x49=(x43*x9); x50=(((x14*x4))+((x15*x38))); x51=(x45*x9); x52=(x45*x8); x54=(x47*x9); x55=(x1*x48); x56=(((x31*x9))+((x46*x8))); x57=((((-1.0)*x14*x44))+((x15*x28))); x58=(((x28*x29))+((x1*x44))); x59=(((x29*x33))+x55); x60=(x58*x8); x61=(x57*x9); x62=(x59*x8); x63=(x51+x60); x64=(x49+x62); x65=((((-1.0)*x27*x56))+(((-1.0)*x25*x50))); x66=(((x36*x63))+((x32*((((x29*x44))+((x28*x34))))))); eerot[0]=(((x11*((((x3*x48))+((x1*x33))))))+((x10*((x49+((x8*(((((-1.0)*x41))+x55))))))))); eerot[1]=(((x13*((((x9*((((x34*x48))+x41))))+((x43*x8))))))+(((-1.0)*x12*((((x27*x64))+((x25*(((((-1.0)*x15*x48))+(((-1.0)*x14*x33))))))))))); eerot[2]=(((x13*((((x36*x64))+((x32*((((x29*x48))+((x33*x34))))))))))+(((-1.0)*x12*((((x24*(((((-1.0)*x14*x48))+x41))))+((x19*x43))))))); eetrans[0]=((-0.05)+((x10*((((x20*x43))+((x16*x59))))))+((x23*x33))+(((0.1)*x0))+((x3*(((((-1.0)*x18*x7))+(((-1.0)*x26*x30))))))+(((0.4)*x33))+((x11*((((x22*x33))+((x21*x48))))))); eerot[3]=(((x11*((((x1*x28))+((x3*x44))))))+((x10*x63))); eerot[4]=(((x12*x66))+((x13*((x52+x61))))); eerot[5]=(((x12*(((((-1.0)*x19*x45))+(((-1.0)*x24*x57))))))+((x13*x66))); eetrans[1]=((-0.188)+(((0.1)*x7))+((x10*((((x20*x45))+((x16*x58))))))+((x23*x28))+(((0.4)*x28))+((x11*((((x22*x28))+((x21*x44))))))+((x3*((((x0*x18))+(((-1.0)*x26*x39))))))); eerot[6]=((((-1.0)*x11*x50))+((x10*x56))); eerot[7]=(((x13*((((x31*x8))+x54))))+((x12*x65))); eerot[8]=(((x13*x65))+((x12*(((((-1.0)*x24*x47))+(((-1.0)*x19*x31))))))); IkReal x67=((1.0)*x4); eetrans[2]=((0.739675)+((x11*(((((-1.0)*x21*x38))+(((-1.0)*x22*x67))))))+((x10*((((x20*x31))+((x16*x46))))))+(((-1.0)*x2*x26*x3))+(((-1.0)*x23*x67))+(((-0.4)*x4))+j[0]); } IKFAST_API int GetNumFreeParameters() { return 2; } IKFAST_API int* GetFreeParameters() { static int freeparams[] = {0, 3}; return freeparams; } IKFAST_API int GetNumJoints() { return 8; } IKFAST_API int GetIkRealSize() { return sizeof(IkReal); } IKFAST_API int GetIkType() { return 0x67000001; } class IKSolver { public: IkReal j27,cj27,sj27,htj27,j27mul,j28,cj28,sj28,htj28,j28mul,j30,cj30,sj30,htj30,j30mul,j31,cj31,sj31,htj31,j31mul,j32,cj32,sj32,htj32,j32mul,j33,cj33,sj33,htj33,j33mul,j12,cj12,sj12,htj12,j29,cj29,sj29,htj29,new_r00,r00,rxp0_0,new_r01,r01,rxp0_1,new_r02,r02,rxp0_2,new_r10,r10,rxp1_0,new_r11,r11,rxp1_1,new_r12,r12,rxp1_2,new_r20,r20,rxp2_0,new_r21,r21,rxp2_1,new_r22,r22,rxp2_2,new_px,px,npx,new_py,py,npy,new_pz,pz,npz,pp; unsigned char _ij27[2], _nj27,_ij28[2], _nj28,_ij30[2], _nj30,_ij31[2], _nj31,_ij32[2], _nj32,_ij33[2], _nj33,_ij12[2], _nj12,_ij29[2], _nj29; IkReal j100, cj100, sj100; unsigned char _ij100[2], _nj100; bool ComputeIk(const IkReal* eetrans, const IkReal* eerot, const IkReal* pfree, IkSolutionListBase<IkReal>& solutions) { j27=numeric_limits<IkReal>::quiet_NaN(); _ij27[0] = -1; _ij27[1] = -1; _nj27 = -1; j28=numeric_limits<IkReal>::quiet_NaN(); _ij28[0] = -1; _ij28[1] = -1; _nj28 = -1; j30=numeric_limits<IkReal>::quiet_NaN(); _ij30[0] = -1; _ij30[1] = -1; _nj30 = -1; j31=numeric_limits<IkReal>::quiet_NaN(); _ij31[0] = -1; _ij31[1] = -1; _nj31 = -1; j32=numeric_limits<IkReal>::quiet_NaN(); _ij32[0] = -1; _ij32[1] = -1; _nj32 = -1; j33=numeric_limits<IkReal>::quiet_NaN(); _ij33[0] = -1; _ij33[1] = -1; _nj33 = -1; _ij12[0] = -1; _ij12[1] = -1; _nj12 = 0; _ij29[0] = -1; _ij29[1] = -1; _nj29 = 0; for(int dummyiter = 0; dummyiter < 1; ++dummyiter) { solutions.Clear(); j12=pfree[0]; cj12=cos(pfree[0]); sj12=sin(pfree[0]), htj12=tan(pfree[0]*0.5); j29=pfree[1]; cj29=cos(pfree[1]); sj29=sin(pfree[1]), htj29=tan(pfree[1]*0.5); r00 = eerot[0*3+0]; r01 = eerot[0*3+1]; r02 = eerot[0*3+2]; r10 = eerot[1*3+0]; r11 = eerot[1*3+1]; r12 = eerot[1*3+2]; r20 = eerot[2*3+0]; r21 = eerot[2*3+1]; r22 = eerot[2*3+2]; px = eetrans[0]; py = eetrans[1]; pz = eetrans[2]; new_r00=((-1.0)*r02); new_r01=r01; new_r02=r00; new_px=((0.05)+(((-0.18)*r00))+px); new_r10=((-1.0)*r12); new_r11=r11; new_r12=r10; new_py=((0.188)+(((-0.18)*r10))+py); new_r20=((-1.0)*r22); new_r21=r21; new_r22=r20; new_pz=((-0.739675)+(((-1.0)*j12))+pz+(((-0.18)*r20))); r00 = new_r00; r01 = new_r01; r02 = new_r02; r10 = new_r10; r11 = new_r11; r12 = new_r12; r20 = new_r20; r21 = new_r21; r22 = new_r22; px = new_px; py = new_py; pz = new_pz; IkReal x68=((1.0)*px); IkReal x69=((1.0)*pz); IkReal x70=((1.0)*py); pp=((px*px)+(py*py)+(pz*pz)); npx=(((px*r00))+((py*r10))+((pz*r20))); npy=(((px*r01))+((py*r11))+((pz*r21))); npz=(((px*r02))+((py*r12))+((pz*r22))); rxp0_0=((((-1.0)*r20*x70))+((pz*r10))); rxp0_1=(((px*r20))+(((-1.0)*r00*x69))); rxp0_2=((((-1.0)*r10*x68))+((py*r00))); rxp1_0=((((-1.0)*r21*x70))+((pz*r11))); rxp1_1=(((px*r21))+(((-1.0)*r01*x69))); rxp1_2=((((-1.0)*r11*x68))+((py*r01))); rxp2_0=((((-1.0)*r22*x70))+((pz*r12))); rxp2_1=(((px*r22))+(((-1.0)*r02*x69))); rxp2_2=((((-1.0)*r12*x68))+((py*r02))); IkReal op[8+1], zeror[8]; int numroots; IkReal x71=((0.2)*px); IkReal x72=((1.0)*pp); IkReal x73=((0.509841)+(((-1.0)*x72))+x71); IkReal x74=((-0.003759)+(((-1.0)*x72))+x71); IkReal x75=(x72+x71); IkReal x76=((0.509841)+(((-1.0)*x75))); IkReal x77=((-0.003759)+(((-1.0)*x75))); IkReal gconst0=x73; IkReal gconst1=x74; IkReal gconst2=x73; IkReal gconst3=x74; IkReal gconst4=x76; IkReal gconst5=x77; IkReal gconst6=x76; IkReal gconst7=x77; IkReal x78=py*py; IkReal x79=sj29*sj29; IkReal x80=px*px; IkReal x81=((1.0)*gconst4); IkReal x82=(gconst5*gconst7); IkReal x83=(gconst0*gconst3); IkReal x84=(gconst1*gconst2); IkReal x85=((2.0)*gconst5); IkReal x86=((1.0)*gconst0); IkReal x87=(gconst1*gconst7); IkReal x88=(gconst0*gconst6); IkReal x89=(gconst1*gconst3); IkReal x90=(gconst4*gconst7); IkReal x91=((2.0)*gconst0); IkReal x92=(gconst1*gconst6); IkReal x93=(gconst0*gconst7); IkReal x94=((2.0)*gconst4); IkReal x95=(gconst3*gconst5); IkReal x96=(gconst2*gconst5); IkReal x97=(gconst3*gconst4); IkReal x98=(gconst2*gconst4); IkReal x99=(gconst4*gconst6); IkReal x100=(gconst5*gconst6); IkReal x101=(gconst0*gconst2); IkReal x102=((1.05513984)*px*py); IkReal x103=(gconst6*x78); IkReal x104=((4.0)*px*py); IkReal x105=((4.0)*x80); IkReal x106=(gconst2*x78); IkReal x107=(py*x79); IkReal x108=((2.0)*x78); IkReal x109=((1.0)*x78); IkReal x110=((0.824328)*x79); IkReal x111=((0.412164)*x79); IkReal x112=(x78*x90); IkReal x113=(x100*x78); IkReal x114=(x78*x96); IkReal x115=(x78*x97); IkReal x116=(x78*x93); IkReal x117=(x78*x92); IkReal x118=((0.0834355125792)*x107); IkReal x119=(x78*x84); IkReal x120=(x78*x83); IkReal x122=(x78*x79); IkReal x123=(x109*x82); IkReal x124=(x103*x81); IkReal x125=(x100*x111); IkReal x126=(x104*x98); IkReal x127=(x104*x87); IkReal x128=(x104*x95); IkReal x129=(x104*x88); IkReal x130=(x104*x97); IkReal x131=(x104*x93); IkReal x132=(x104*x96); IkReal x133=(x104*x92); IkReal x134=(x111*x96); IkReal x135=((0.06594624)*x122); IkReal x136=(x109*x87); IkReal x137=(x106*x81); IkReal x138=(x103*x86); IkReal x139=(x111*x92); IkReal x140=(x109*x95); IkReal x141=((0.3297312)*pp*x107); IkReal x142=((0.06594624)*px*x107); IkReal x143=(x106*x86); IkReal x144=(x111*x84); IkReal x145=(x109*x89); IkReal x146=(x120+x119); IkReal x147=(x113+x112); IkReal x148=(x143+x144+x145); IkReal x149=(x124+x125+x123); IkReal x150=(x117+x116+x115+x114); IkReal x151=(x131+x130+x133+x132); IkReal x152=(x126+x127+x128+x129); IkReal x153=(x140+x135+x134+x137+x136+x139+x138); op[0]=((((-1.0)*x149))+x147); op[1]=((((-1.0)*x102))+(((-1.0)*x118))+x141+x142); op[2]=((((-1.0)*x153))+(((-1.0)*x100*x110))+(((-1.0)*x103*x85))+((x103*x94))+(((-1.0)*x105*x82))+x150+(((-1.0)*x105*x99))+((x108*x82))+(((-1.0)*x108*x90))+((x105*x90))+((x100*x105))); op[3]=((((-1.0)*x152))+(((-0.1648656)*gconst2*x107))+(((-1.0)*x100*x104))+(((-0.3297312)*gconst5*x107))+x151+(((-0.1648656)*gconst1*x107))+(((-0.3297312)*gconst6*x107))+((x104*x82))+((x104*x99))+(((-1.0)*x104*x90))); op[4]=((((-1.0)*x149))+(((-1.0)*x148))+(((-0.13189248)*x122))+(((-1.0)*gconst3*x78*x94))+(((-1.0)*x105*x88))+(((-1.0)*x105*x87))+x146+x147+((gconst3*x78*x85))+(((-1.0)*x105*x95))+(((-1.0)*x105*x98))+((x106*x94))+(((-1.0)*x110*x92))+(((-1.0)*x110*x96))+((x108*x88))+((x108*x87))+(((-1.0)*gconst7*x78*x91))+(((-1.0)*x108*x92))+((x105*x93))+((x105*x97))+((x105*x96))+((x105*x92))+(((-1.0)*x106*x85))); op[5]=((((-1.0)*x151))+(((-0.3297312)*gconst2*x107))+(((-1.0)*x101*x104))+x152+(((-0.1648656)*gconst5*x107))+(((-0.1648656)*gconst6*x107))+(((-0.3297312)*gconst1*x107))+((x104*x84))+((x104*x83))+(((-1.0)*x104*x89))); op[6]=((((-1.0)*x153))+(((-1.0)*x101*x105))+(((-1.0)*x105*x89))+x150+((x106*x91))+(((-1.0)*x110*x84))+((x108*x89))+(((-1.0)*x108*x83))+(((-1.0)*x108*x84))+((x105*x84))+((x105*x83))); op[7]=((((-1.0)*x142))+(((-1.0)*x118))+x141+x102); op[8]=((((-1.0)*x148))+x146); polyroots8(op,zeror,numroots); IkReal j27array[8], cj27array[8], sj27array[8], tempj27array[1]; int numsolutions = 0; for(int ij27 = 0; ij27 < numroots; ++ij27) { IkReal htj27 = zeror[ij27]; tempj27array[0]=((2.0)*(atan(htj27))); for(int kj27 = 0; kj27 < 1; ++kj27) { j27array[numsolutions] = tempj27array[kj27]; if( j27array[numsolutions] > IKPI ) { j27array[numsolutions]-=IK2PI; } else if( j27array[numsolutions] < -IKPI ) { j27array[numsolutions]+=IK2PI; } sj27array[numsolutions] = IKsin(j27array[numsolutions]); cj27array[numsolutions] = IKcos(j27array[numsolutions]); numsolutions++; } } bool j27valid[8]={true,true,true,true,true,true,true,true}; _nj27 = 8; for(int ij27 = 0; ij27 < numsolutions; ++ij27) { if( !j27valid[ij27] ) { continue; } j27 = j27array[ij27]; cj27 = cj27array[ij27]; sj27 = sj27array[ij27]; htj27 = IKtan(j27/2); _ij27[0] = ij27; _ij27[1] = -1; for(int iij27 = ij27+1; iij27 < numsolutions; ++iij27) { if( j27valid[iij27] && IKabs(cj27array[ij27]-cj27array[iij27]) < IKFAST_SOLUTION_THRESH && IKabs(sj27array[ij27]-sj27array[iij27]) < IKFAST_SOLUTION_THRESH ) { j27valid[iij27]=false; _ij27[1] = iij27; break; } } { IkReal j28eval[2]; IkReal x154=cj27*cj27; IkReal x155=py*py; IkReal x156=px*px; IkReal x157=pz*pz; IkReal x158=((100.0)*sj29); IkReal x159=(py*sj27); IkReal x160=((4.0)*sj29); IkReal x161=(cj27*px*sj29); IkReal x162=(x154*x156); IkReal x163=(x155*x160); j28eval[0]=((((-1.0)*x157*x158))+(((-1.0)*x158*x162))+((x154*x155*x158))+(((20.0)*x161))+(((-1.0)*sj29))+(((-1.0)*x155*x158))+(((-200.0)*x159*x161))+(((20.0)*sj29*x159))); j28eval[1]=IKsign(((((-1.0)*x157*x160))+(((-1.0)*x163))+(((-8.0)*x159*x161))+(((0.8)*sj29*x159))+(((-1.0)*x160*x162))+((x154*x163))+(((0.8)*x161))+(((-0.04)*sj29)))); if( IKabs(j28eval[0]) < 0.0000010000000000 || IKabs(j28eval[1]) < 0.0000010000000000 ) { { IkReal j30eval[1]; j30eval[0]=sj29; if( IKabs(j30eval[0]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j29))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j30array[2], cj30array[2], sj30array[2]; bool j30valid[2]={false}; _nj30 = 2; cj30array[0]=((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*py*sj27))+(((-0.778816199376947)*cj27*px))); if( cj30array[0] >= -1-IKFAST_SINCOS_THRESH && cj30array[0] <= 1+IKFAST_SINCOS_THRESH ) { j30valid[0] = j30valid[1] = true; j30array[0] = IKacos(cj30array[0]); sj30array[0] = IKsin(j30array[0]); cj30array[1] = cj30array[0]; j30array[1] = -j30array[0]; sj30array[1] = -sj30array[0]; } else if( isnan(cj30array[0]) ) { // probably any value will work j30valid[0] = true; cj30array[0] = 1; sj30array[0] = 0; j30array[0] = 0; } for(int ij30 = 0; ij30 < 2; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 2; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal j28eval[3]; sj29=0; cj29=1.0; j29=0; IkReal x164=((321000.0)*cj30); IkReal x165=(py*sj27); IkReal x166=((321000.0)*sj30); IkReal x167=(cj27*px); j28eval[0]=((1.02430295950156)+cj30); j28eval[1]=((IKabs(((((-1.0)*x166*x167))+(((32100.0)*sj30))+(((-1.0)*pz*x164))+(((-400000.0)*pz))+(((-1.0)*x165*x166)))))+(IKabs(((-40000.0)+(((400000.0)*x165))+(((400000.0)*x167))+(((-32100.0)*cj30))+(((-1.0)*pz*x166))+((x164*x167))+((x164*x165)))))); j28eval[2]=IKsign(((263041.0)+(((256800.0)*cj30)))); if( IKabs(j28eval[0]) < 0.0000010000000000 || IKabs(j28eval[1]) < 0.0000010000000000 || IKabs(j28eval[2]) < 0.0000010000000000 ) { { IkReal j28eval[3]; sj29=0; cj29=1.0; j29=0; IkReal x168=(pz*sj30); IkReal x169=(cj27*px); IkReal x170=(py*sj27); IkReal x171=((10.0)*cj30); IkReal x172=((321.0)*cj30); IkReal x173=((1000.0)*pz); j28eval[0]=((1.24610591900312)+(((-1.0)*x170*x171))+cj30+(((-12.4610591900312)*x170))+(((-1.0)*x169*x171))+(((-10.0)*x168))+(((-12.4610591900312)*x169))); j28eval[1]=((IKabs(((-160.0)+((pz*x173))+(((-103.041)*(cj30*cj30)))+(((-256.8)*cj30)))))+(IKabs(((((-100.0)*pz))+((x169*x173))+(((128.4)*sj30))+((x170*x173))+(((103.041)*cj30*sj30)))))); j28eval[2]=IKsign(((40.0)+(((-400.0)*x169))+(((-400.0)*x170))+(((-1.0)*x170*x172))+(((-321.0)*x168))+(((-1.0)*x169*x172))+(((32.1)*cj30)))); if( IKabs(j28eval[0]) < 0.0000010000000000 || IKabs(j28eval[1]) < 0.0000010000000000 || IKabs(j28eval[2]) < 0.0000010000000000 ) { { IkReal j28eval[3]; sj29=0; cj29=1.0; j29=0; IkReal x174=cj27*cj27; IkReal x175=py*py; IkReal x176=pz*pz; IkReal x177=px*px; IkReal x178=(cj27*px); IkReal x179=((321.0)*sj30); IkReal x180=(py*sj27); IkReal x181=((321.0)*cj30); IkReal x183=((200.0)*x180); IkReal x184=(x174*x175); IkReal x185=(x174*x177); j28eval[0]=((-1.0)+(((-1.0)*x178*x183))+(((-100.0)*x175))+(((-100.0)*x176))+(((20.0)*x180))+(((-100.0)*x185))+(((20.0)*x178))+(((100.0)*x184))); j28eval[1]=((IKabs(((40.0)+((pz*x179))+(((-1.0)*x178*x181))+(((-400.0)*x180))+(((-400.0)*x178))+(((-1.0)*x180*x181))+(((32.1)*cj30)))))+(IKabs((((pz*x181))+((x178*x179))+((x179*x180))+(((400.0)*pz))+(((-32.1)*sj30)))))); j28eval[2]=IKsign(((-10.0)+(((-2000.0)*x178*x180))+x183+(((-1000.0)*x185))+(((-1000.0)*x175))+(((-1000.0)*x176))+(((200.0)*x178))+(((1000.0)*x184)))); if( IKabs(j28eval[0]) < 0.0000010000000000 || IKabs(j28eval[1]) < 0.0000010000000000 || IKabs(j28eval[2]) < 0.0000010000000000 ) { continue; // no branches [j28] } else { { IkReal j28array[1], cj28array[1], sj28array[1]; bool j28valid[1]={false}; _nj28 = 1; IkReal x186=py*py; IkReal x187=cj27*cj27; IkReal x188=(cj27*px); IkReal x189=(py*sj27); IkReal x190=((321.0)*cj30); IkReal x191=((321.0)*sj30); IkReal x192=((1000.0)*x187); CheckValue<IkReal> x193 = IKatan2WithCheck(IkReal((((x188*x191))+(((400.0)*pz))+((x189*x191))+(((-32.1)*sj30))+((pz*x190)))),IkReal(((40.0)+(((-400.0)*x189))+(((-400.0)*x188))+(((-1.0)*x188*x190))+(((-1.0)*x189*x190))+(((32.1)*cj30))+((pz*x191)))),IKFAST_ATAN2_MAGTHRESH); if(!x193.valid){ continue; } CheckValue<IkReal> x194=IKPowWithIntegerCheck(IKsign(((-10.0)+((x186*x192))+(((-2000.0)*x188*x189))+(((-1000.0)*(pz*pz)))+(((-1000.0)*x186))+(((200.0)*x189))+(((200.0)*x188))+(((-1.0)*x192*(px*px))))),-1); if(!x194.valid){ continue; } j28array[0]=((-1.5707963267949)+(x193.value)+(((1.5707963267949)*(x194.value)))); sj28array[0]=IKsin(j28array[0]); cj28array[0]=IKcos(j28array[0]); if( j28array[0] > IKPI ) { j28array[0]-=IK2PI; } else if( j28array[0] < -IKPI ) { j28array[0]+=IK2PI; } j28valid[0] = true; for(int ij28 = 0; ij28 < 1; ++ij28) { if( !j28valid[ij28] ) { continue; } _ij28[0] = ij28; _ij28[1] = -1; for(int iij28 = ij28+1; iij28 < 1; ++iij28) { if( j28valid[iij28] && IKabs(cj28array[ij28]-cj28array[iij28]) < IKFAST_SOLUTION_THRESH && IKabs(sj28array[ij28]-sj28array[iij28]) < IKFAST_SOLUTION_THRESH ) { j28valid[iij28]=false; _ij28[1] = iij28; break; } } j28 = j28array[ij28]; cj28 = cj28array[ij28]; sj28 = sj28array[ij28]; { IkReal evalcond[5]; IkReal x195=IKsin(j28); IkReal x196=IKcos(j28); IkReal x197=((0.321)*cj30); IkReal x198=((0.321)*sj30); IkReal x199=(cj27*px); IkReal x200=(py*sj27); IkReal x201=((1.0)*x200); IkReal x202=(pz*x195); IkReal x203=((0.8)*x196); evalcond[0]=((((0.4)*x195))+((x196*x198))+((x195*x197))+pz); evalcond[1]=(((x195*x200))+x198+((x195*x199))+(((-0.1)*x195))+((pz*x196))); evalcond[2]=((0.1)+(((0.4)*x196))+(((-1.0)*x195*x198))+(((-1.0)*x199))+((x196*x197))+(((-1.0)*x201))); evalcond[3]=((0.4)+(((0.1)*x196))+(((-1.0)*x196*x199))+x197+x202+(((-1.0)*x196*x201))); evalcond[4]=((-0.066959)+(((0.2)*x200))+(((0.2)*x199))+((x200*x203))+(((-1.0)*pp))+(((-0.08)*x196))+((x199*x203))+(((-0.8)*x202))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j28array[1], cj28array[1], sj28array[1]; bool j28valid[1]={false}; _nj28 = 1; IkReal x669=((321.0)*cj30); IkReal x670=(py*sj27); IkReal x671=(cj27*px); IkReal x672=((1000.0)*pz); CheckValue<IkReal> x673 = IKatan2WithCheck(IkReal(((((-100.0)*pz))+((x671*x672))+((x670*x672))+(((128.4)*sj30))+(((103.041)*cj30*sj30)))),IkReal(((-160.0)+((pz*x672))+(((-103.041)*(cj30*cj30)))+(((-256.8)*cj30)))),IKFAST_ATAN2_MAGTHRESH); if(!x673.valid){ continue; } CheckValue<IkReal> x674=IKPowWithIntegerCheck(IKsign(((40.0)+(((-321.0)*pz*sj30))+(((-1.0)*x669*x671))+(((-1.0)*x669*x670))+(((32.1)*cj30))+(((-400.0)*x670))+(((-400.0)*x671)))),-1); if(!x674.valid){ continue; } j28array[0]=((-1.5707963267949)+(x673.value)+(((1.5707963267949)*(x674.value)))); sj28array[0]=IKsin(j28array[0]); cj28array[0]=IKcos(j28array[0]); if( j28array[0] > IKPI ) { j28array[0]-=IK2PI; } else if( j28array[0] < -IKPI ) { j28array[0]+=IK2PI; } j28valid[0] = true; for(int ij28 = 0; ij28 < 1; ++ij28) { if( !j28valid[ij28] ) { continue; } _ij28[0] = ij28; _ij28[1] = -1; for(int iij28 = ij28+1; iij28 < 1; ++iij28) { if( j28valid[iij28] && IKabs(cj28array[ij28]-cj28array[iij28]) < IKFAST_SOLUTION_THRESH && IKabs(sj28array[ij28]-sj28array[iij28]) < IKFAST_SOLUTION_THRESH ) { j28valid[iij28]=false; _ij28[1] = iij28; break; } } j28 = j28array[ij28]; cj28 = cj28array[ij28]; sj28 = sj28array[ij28]; { IkReal evalcond[5]; IkReal x675=IKsin(j28); IkReal x676=IKcos(j28); IkReal x677=((0.321)*cj30); IkReal x678=((0.321)*sj30); IkReal x679=(cj27*px); IkReal x680=(py*sj27); IkReal x681=((1.0)*x680); IkReal x682=(pz*x675); IkReal x683=((0.8)*x676); evalcond[0]=((((0.4)*x675))+((x676*x678))+pz+((x675*x677))); evalcond[1]=(((pz*x676))+(((-0.1)*x675))+x678+((x675*x680))+((x675*x679))); evalcond[2]=((0.1)+(((-1.0)*x675*x678))+(((0.4)*x676))+(((-1.0)*x681))+((x676*x677))+(((-1.0)*x679))); evalcond[3]=((0.4)+(((0.1)*x676))+(((-1.0)*x676*x679))+x677+x682+(((-1.0)*x676*x681))); evalcond[4]=((-0.066959)+(((-0.08)*x676))+(((0.2)*x680))+(((0.2)*x679))+(((-1.0)*pp))+((x679*x683))+((x680*x683))+(((-0.8)*x682))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j28array[1], cj28array[1], sj28array[1]; bool j28valid[1]={false}; _nj28 = 1; IkReal x684=((321000.0)*cj30); IkReal x685=(py*sj27); IkReal x686=(cj27*px); IkReal x687=((321000.0)*sj30); CheckValue<IkReal> x688 = IKatan2WithCheck(IkReal(((((-1.0)*x685*x687))+(((32100.0)*sj30))+(((-1.0)*x686*x687))+(((-400000.0)*pz))+(((-1.0)*pz*x684)))),IkReal(((-40000.0)+(((-32100.0)*cj30))+(((400000.0)*x685))+(((400000.0)*x686))+((x684*x685))+((x684*x686))+(((-1.0)*pz*x687)))),IKFAST_ATAN2_MAGTHRESH); if(!x688.valid){ continue; } CheckValue<IkReal> x689=IKPowWithIntegerCheck(IKsign(((263041.0)+(((256800.0)*cj30)))),-1); if(!x689.valid){ continue; } j28array[0]=((-1.5707963267949)+(x688.value)+(((1.5707963267949)*(x689.value)))); sj28array[0]=IKsin(j28array[0]); cj28array[0]=IKcos(j28array[0]); if( j28array[0] > IKPI ) { j28array[0]-=IK2PI; } else if( j28array[0] < -IKPI ) { j28array[0]+=IK2PI; } j28valid[0] = true; for(int ij28 = 0; ij28 < 1; ++ij28) { if( !j28valid[ij28] ) { continue; } _ij28[0] = ij28; _ij28[1] = -1; for(int iij28 = ij28+1; iij28 < 1; ++iij28) { if( j28valid[iij28] && IKabs(cj28array[ij28]-cj28array[iij28]) < IKFAST_SOLUTION_THRESH && IKabs(sj28array[ij28]-sj28array[iij28]) < IKFAST_SOLUTION_THRESH ) { j28valid[iij28]=false; _ij28[1] = iij28; break; } } j28 = j28array[ij28]; cj28 = cj28array[ij28]; sj28 = sj28array[ij28]; { IkReal evalcond[5]; IkReal x690=IKsin(j28); IkReal x691=IKcos(j28); IkReal x692=((0.321)*cj30); IkReal x693=((0.321)*sj30); IkReal x694=(cj27*px); IkReal x695=(py*sj27); IkReal x696=((1.0)*x695); IkReal x697=(pz*x690); IkReal x698=((0.8)*x691); evalcond[0]=(((x690*x692))+((x691*x693))+(((0.4)*x690))+pz); evalcond[1]=(((x690*x695))+((x690*x694))+((pz*x691))+x693+(((-0.1)*x690))); evalcond[2]=((0.1)+((x691*x692))+(((0.4)*x691))+(((-1.0)*x696))+(((-1.0)*x690*x693))+(((-1.0)*x694))); evalcond[3]=((0.4)+(((-1.0)*x691*x694))+(((0.1)*x691))+x697+x692+(((-1.0)*x691*x696))); evalcond[4]=((-0.066959)+((x695*x698))+((x694*x698))+(((-1.0)*pp))+(((-0.08)*x691))+(((-0.8)*x697))+(((0.2)*x695))+(((0.2)*x694))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j29)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j30array[2], cj30array[2], sj30array[2]; bool j30valid[2]={false}; _nj30 = 2; cj30array[0]=((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*py*sj27))+(((-0.778816199376947)*cj27*px))); if( cj30array[0] >= -1-IKFAST_SINCOS_THRESH && cj30array[0] <= 1+IKFAST_SINCOS_THRESH ) { j30valid[0] = j30valid[1] = true; j30array[0] = IKacos(cj30array[0]); sj30array[0] = IKsin(j30array[0]); cj30array[1] = cj30array[0]; j30array[1] = -j30array[0]; sj30array[1] = -sj30array[0]; } else if( isnan(cj30array[0]) ) { // probably any value will work j30valid[0] = true; cj30array[0] = 1; sj30array[0] = 0; j30array[0] = 0; } for(int ij30 = 0; ij30 < 2; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 2; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal j28eval[3]; sj29=0; cj29=-1.0; j29=3.14159265358979; IkReal x699=((321000.0)*cj30); IkReal x700=(py*sj27); IkReal x701=((321000.0)*sj30); IkReal x702=(cj27*px); j28eval[0]=((-1.02430295950156)+(((-1.0)*cj30))); j28eval[1]=IKsign(((-263041.0)+(((-256800.0)*cj30)))); j28eval[2]=((IKabs(((40000.0)+(((-1.0)*pz*x701))+(((-1.0)*x699*x702))+(((-1.0)*x699*x700))+(((32100.0)*cj30))+(((-400000.0)*x700))+(((-400000.0)*x702)))))+(IKabs(((((32100.0)*sj30))+((pz*x699))+(((400000.0)*pz))+(((-1.0)*x701*x702))+(((-1.0)*x700*x701)))))); if( IKabs(j28eval[0]) < 0.0000010000000000 || IKabs(j28eval[1]) < 0.0000010000000000 || IKabs(j28eval[2]) < 0.0000010000000000 ) { { IkReal j28eval[3]; sj29=0; cj29=-1.0; j29=3.14159265358979; IkReal x703=(pz*sj30); IkReal x704=(cj27*px); IkReal x705=(py*sj27); IkReal x706=((10.0)*cj30); IkReal x707=((1000.0)*pz); IkReal x708=((321.0)*cj30); j28eval[0]=((-1.24610591900312)+(((12.4610591900312)*x704))+(((12.4610591900312)*x705))+(((-10.0)*x703))+(((-1.0)*cj30))+((x704*x706))+((x705*x706))); j28eval[1]=((IKabs(((160.0)+(((-1.0)*pz*x707))+(((103.041)*(cj30*cj30)))+(((256.8)*cj30)))))+(IKabs(((((100.0)*pz))+(((128.4)*sj30))+(((-1.0)*x704*x707))+(((-1.0)*x705*x707))+(((103.041)*cj30*sj30)))))); j28eval[2]=IKsign(((-40.0)+(((-321.0)*x703))+(((400.0)*x705))+(((400.0)*x704))+((x704*x708))+((x705*x708))+(((-32.1)*cj30)))); if( IKabs(j28eval[0]) < 0.0000010000000000 || IKabs(j28eval[1]) < 0.0000010000000000 || IKabs(j28eval[2]) < 0.0000010000000000 ) { { IkReal j28eval[3]; sj29=0; cj29=-1.0; j29=3.14159265358979; IkReal x709=cj27*cj27; IkReal x710=py*py; IkReal x711=pz*pz; IkReal x712=px*px; IkReal x713=(cj27*px); IkReal x714=((321.0)*sj30); IkReal x715=(py*sj27); IkReal x716=((321.0)*cj30); IkReal x718=((200.0)*x715); IkReal x719=(x709*x710); IkReal x720=(x709*x712); j28eval[0]=((-1.0)+(((20.0)*x715))+(((20.0)*x713))+(((-100.0)*x720))+(((-100.0)*x711))+(((-100.0)*x710))+(((100.0)*x719))+(((-1.0)*x713*x718))); j28eval[1]=((IKabs(((40.0)+(((-1.0)*pz*x714))+(((-400.0)*x715))+(((-400.0)*x713))+(((-1.0)*x713*x716))+(((32.1)*cj30))+(((-1.0)*x715*x716)))))+(IKabs(((((-1.0)*x714*x715))+(((400.0)*pz))+(((32.1)*sj30))+(((-1.0)*x713*x714))+((pz*x716)))))); j28eval[2]=IKsign(((-10.0)+(((1000.0)*x719))+(((-2000.0)*x713*x715))+(((-1000.0)*x711))+(((-1000.0)*x710))+x718+(((-1000.0)*x720))+(((200.0)*x713)))); if( IKabs(j28eval[0]) < 0.0000010000000000 || IKabs(j28eval[1]) < 0.0000010000000000 || IKabs(j28eval[2]) < 0.0000010000000000 ) { continue; // no branches [j28] } else { { IkReal j28array[1], cj28array[1], sj28array[1]; bool j28valid[1]={false}; _nj28 = 1; IkReal x721=py*py; IkReal x722=cj27*cj27; IkReal x723=(cj27*px); IkReal x724=(py*sj27); IkReal x725=((321.0)*cj30); IkReal x726=((321.0)*sj30); IkReal x727=((1000.0)*x722); CheckValue<IkReal> x728=IKPowWithIntegerCheck(IKsign(((-10.0)+((x721*x727))+(((-1.0)*x727*(px*px)))+(((200.0)*x723))+(((200.0)*x724))+(((-1000.0)*(pz*pz)))+(((-2000.0)*x723*x724))+(((-1000.0)*x721)))),-1); if(!x728.valid){ continue; } CheckValue<IkReal> x729 = IKatan2WithCheck(IkReal(((((-1.0)*x724*x726))+(((-1.0)*x723*x726))+(((400.0)*pz))+(((32.1)*sj30))+((pz*x725)))),IkReal(((40.0)+(((-1.0)*x724*x725))+(((-1.0)*x723*x725))+(((-400.0)*x724))+(((-400.0)*x723))+(((32.1)*cj30))+(((-1.0)*pz*x726)))),IKFAST_ATAN2_MAGTHRESH); if(!x729.valid){ continue; } j28array[0]=((-1.5707963267949)+(((1.5707963267949)*(x728.value)))+(x729.value)); sj28array[0]=IKsin(j28array[0]); cj28array[0]=IKcos(j28array[0]); if( j28array[0] > IKPI ) { j28array[0]-=IK2PI; } else if( j28array[0] < -IKPI ) { j28array[0]+=IK2PI; } j28valid[0] = true; for(int ij28 = 0; ij28 < 1; ++ij28) { if( !j28valid[ij28] ) { continue; } _ij28[0] = ij28; _ij28[1] = -1; for(int iij28 = ij28+1; iij28 < 1; ++iij28) { if( j28valid[iij28] && IKabs(cj28array[ij28]-cj28array[iij28]) < IKFAST_SOLUTION_THRESH && IKabs(sj28array[ij28]-sj28array[iij28]) < IKFAST_SOLUTION_THRESH ) { j28valid[iij28]=false; _ij28[1] = iij28; break; } } j28 = j28array[ij28]; cj28 = cj28array[ij28]; sj28 = sj28array[ij28]; { IkReal evalcond[5]; IkReal x730=IKsin(j28); IkReal x731=IKcos(j28); IkReal x732=((0.321)*cj30); IkReal x733=((0.321)*sj30); IkReal x734=(py*sj27); IkReal x735=(cj27*px); IkReal x736=((1.0)*x734); IkReal x737=(pz*x730); IkReal x738=((1.0)*x731); IkReal x739=((0.8)*x731); evalcond[0]=((((0.4)*x730))+(((-1.0)*x731*x733))+pz+((x730*x732))); evalcond[1]=((0.1)+(((0.4)*x731))+((x731*x732))+(((-1.0)*x735))+(((-1.0)*x736))+((x730*x733))); evalcond[2]=((0.4)+(((-1.0)*x731*x736))+(((-1.0)*x735*x738))+(((0.1)*x731))+x737+x732); evalcond[3]=((((-1.0)*x730*x735))+(((-1.0)*x730*x736))+(((0.1)*x730))+x733+(((-1.0)*pz*x738))); evalcond[4]=((-0.066959)+(((-0.08)*x731))+((x735*x739))+((x734*x739))+(((-1.0)*pp))+(((-0.8)*x737))+(((0.2)*x735))+(((0.2)*x734))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j28array[1], cj28array[1], sj28array[1]; bool j28valid[1]={false}; _nj28 = 1; IkReal x740=((321.0)*cj30); IkReal x741=(py*sj27); IkReal x742=(cj27*px); IkReal x743=((1000.0)*pz); CheckValue<IkReal> x744=IKPowWithIntegerCheck(IKsign(((-40.0)+(((-321.0)*pz*sj30))+(((400.0)*x742))+(((400.0)*x741))+((x740*x741))+((x740*x742))+(((-32.1)*cj30)))),-1); if(!x744.valid){ continue; } CheckValue<IkReal> x745 = IKatan2WithCheck(IkReal(((((100.0)*pz))+(((-1.0)*x742*x743))+(((128.4)*sj30))+(((-1.0)*x741*x743))+(((103.041)*cj30*sj30)))),IkReal(((160.0)+(((-1.0)*pz*x743))+(((103.041)*(cj30*cj30)))+(((256.8)*cj30)))),IKFAST_ATAN2_MAGTHRESH); if(!x745.valid){ continue; } j28array[0]=((-1.5707963267949)+(((1.5707963267949)*(x744.value)))+(x745.value)); sj28array[0]=IKsin(j28array[0]); cj28array[0]=IKcos(j28array[0]); if( j28array[0] > IKPI ) { j28array[0]-=IK2PI; } else if( j28array[0] < -IKPI ) { j28array[0]+=IK2PI; } j28valid[0] = true; for(int ij28 = 0; ij28 < 1; ++ij28) { if( !j28valid[ij28] ) { continue; } _ij28[0] = ij28; _ij28[1] = -1; for(int iij28 = ij28+1; iij28 < 1; ++iij28) { if( j28valid[iij28] && IKabs(cj28array[ij28]-cj28array[iij28]) < IKFAST_SOLUTION_THRESH && IKabs(sj28array[ij28]-sj28array[iij28]) < IKFAST_SOLUTION_THRESH ) { j28valid[iij28]=false; _ij28[1] = iij28; break; } } j28 = j28array[ij28]; cj28 = cj28array[ij28]; sj28 = sj28array[ij28]; { IkReal evalcond[5]; IkReal x746=IKsin(j28); IkReal x747=IKcos(j28); IkReal x748=((0.321)*cj30); IkReal x749=((0.321)*sj30); IkReal x750=(py*sj27); IkReal x751=(cj27*px); IkReal x752=((1.0)*x750); IkReal x753=(pz*x746); IkReal x754=((1.0)*x747); IkReal x755=((0.8)*x747); evalcond[0]=((((-1.0)*x747*x749))+((x746*x748))+pz+(((0.4)*x746))); evalcond[1]=((0.1)+((x747*x748))+((x746*x749))+(((-1.0)*x751))+(((0.4)*x747))+(((-1.0)*x752))); evalcond[2]=((0.4)+(((0.1)*x747))+(((-1.0)*x751*x754))+(((-1.0)*x747*x752))+x753+x748); evalcond[3]=((((0.1)*x746))+(((-1.0)*x746*x752))+(((-1.0)*x746*x751))+x749+(((-1.0)*pz*x754))); evalcond[4]=((-0.066959)+((x751*x755))+(((-0.08)*x747))+(((0.2)*x751))+(((0.2)*x750))+(((-1.0)*pp))+(((-0.8)*x753))+((x750*x755))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j28array[1], cj28array[1], sj28array[1]; bool j28valid[1]={false}; _nj28 = 1; IkReal x756=(cj27*px); IkReal x757=((321000.0)*cj30); IkReal x758=((321000.0)*sj30); CheckValue<IkReal> x760 = IKatan2WithCheck(IkReal((((pz*x757))+(((-1.0)*py*sj27*x758))+(((32100.0)*sj30))+(((400000.0)*pz))+(((-1.0)*x756*x758)))),IkReal(((40000.0)+(((-400000.0)*py*sj27))+(((-1.0)*py*sj27*x757))+(((-400000.0)*x756))+(((-1.0)*x756*x757))+(((32100.0)*cj30))+(((-1.0)*pz*x758)))),IKFAST_ATAN2_MAGTHRESH); if(!x760.valid){ continue; } CheckValue<IkReal> x761=IKPowWithIntegerCheck(IKsign(((-263041.0)+(((-256800.0)*cj30)))),-1); if(!x761.valid){ continue; } j28array[0]=((-1.5707963267949)+(x760.value)+(((1.5707963267949)*(x761.value)))); sj28array[0]=IKsin(j28array[0]); cj28array[0]=IKcos(j28array[0]); if( j28array[0] > IKPI ) { j28array[0]-=IK2PI; } else if( j28array[0] < -IKPI ) { j28array[0]+=IK2PI; } j28valid[0] = true; for(int ij28 = 0; ij28 < 1; ++ij28) { if( !j28valid[ij28] ) { continue; } _ij28[0] = ij28; _ij28[1] = -1; for(int iij28 = ij28+1; iij28 < 1; ++iij28) { if( j28valid[iij28] && IKabs(cj28array[ij28]-cj28array[iij28]) < IKFAST_SOLUTION_THRESH && IKabs(sj28array[ij28]-sj28array[iij28]) < IKFAST_SOLUTION_THRESH ) { j28valid[iij28]=false; _ij28[1] = iij28; break; } } j28 = j28array[ij28]; cj28 = cj28array[ij28]; sj28 = sj28array[ij28]; { IkReal evalcond[5]; IkReal x762=IKsin(j28); IkReal x763=IKcos(j28); IkReal x764=((0.321)*cj30); IkReal x765=((0.321)*sj30); IkReal x766=(py*sj27); IkReal x767=(cj27*px); IkReal x768=((1.0)*x766); IkReal x769=(pz*x762); IkReal x770=((1.0)*x763); IkReal x771=((0.8)*x763); evalcond[0]=((((-1.0)*x763*x765))+((x762*x764))+pz+(((0.4)*x762))); evalcond[1]=((0.1)+(((-1.0)*x768))+((x763*x764))+((x762*x765))+(((-1.0)*x767))+(((0.4)*x763))); evalcond[2]=((0.4)+(((-1.0)*x763*x768))+(((0.1)*x763))+(((-1.0)*x767*x770))+x769+x764); evalcond[3]=((((-1.0)*x762*x768))+(((0.1)*x762))+(((-1.0)*pz*x770))+(((-1.0)*x762*x767))+x765); evalcond[4]=((-0.066959)+(((-0.08)*x763))+(((0.2)*x766))+(((0.2)*x767))+((x767*x771))+(((-1.0)*pp))+((x766*x771))+(((-0.8)*x769))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j28, j30] } } while(0); if( bgotonextstatement ) { } } } } } else { { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; CheckValue<IkReal> x772=IKPowWithIntegerCheck(sj29,-1); if(!x772.valid){ continue; } if( IKabs(((0.00311526479750779)*(x772.value)*(((((1000.0)*cj27*py))+(((-1000.0)*px*sj27)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*py*sj27))+(((-0.778816199376947)*cj27*px)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((0.00311526479750779)*(x772.value)*(((((1000.0)*cj27*py))+(((-1000.0)*px*sj27))))))+IKsqr(((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*py*sj27))+(((-0.778816199376947)*cj27*px))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2(((0.00311526479750779)*(x772.value)*(((((1000.0)*cj27*py))+(((-1000.0)*px*sj27))))), ((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*py*sj27))+(((-0.778816199376947)*cj27*px)))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[2]; evalcond[0]=((((-1.0)*cj27*py))+((px*sj27))+(((0.321)*sj29*(IKsin(j30))))); evalcond[1]=((0.253041)+(((0.2568)*(IKcos(j30))))+(((-1.0)*pp))+(((0.2)*py*sj27))+(((0.2)*cj27*px))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH ) { continue; } } { IkReal j28eval[3]; IkReal x773=(py*sj27); IkReal x774=(cj29*sj30); IkReal x775=(cj27*px); IkReal x776=((10.0)*cj30); IkReal x777=((1000.0)*pz); IkReal x778=((321.0)*cj30); j28eval[0]=((-1.24610591900312)+((x773*x776))+(((10.0)*pz*x774))+(((-1.0)*cj30))+(((12.4610591900312)*x773))+(((12.4610591900312)*x775))+((x775*x776))); j28eval[1]=IKsign(((-40.0)+((x773*x778))+(((400.0)*x773))+(((400.0)*x775))+(((321.0)*pz*x774))+(((-32.1)*cj30))+((x775*x778)))); j28eval[2]=((IKabs(((160.0)+(((-1.0)*pz*x777))+(((103.041)*(cj30*cj30)))+(((256.8)*cj30)))))+(IKabs(((((-103.041)*cj30*x774))+(((100.0)*pz))+(((-128.4)*x774))+(((-1.0)*x775*x777))+(((-1.0)*x773*x777)))))); if( IKabs(j28eval[0]) < 0.0000010000000000 || IKabs(j28eval[1]) < 0.0000010000000000 || IKabs(j28eval[2]) < 0.0000010000000000 ) { { IkReal j28eval[3]; IkReal x779=cj29*cj29; IkReal x780=cj30*cj30; IkReal x781=(cj27*px); IkReal x782=((321000.0)*cj30); IkReal x783=(py*sj27); IkReal x784=((321000.0)*cj29*sj30); IkReal x785=((103041.0)*x780); j28eval[0]=((1.5527799613746)+x779+x780+(((2.49221183800623)*cj30))+(((-1.0)*x779*x780))); j28eval[1]=IKsign(((160000.0)+(((256800.0)*cj30))+(((103041.0)*x779))+x785+(((-1.0)*x779*x785)))); j28eval[2]=((IKabs(((((32100.0)*cj29*sj30))+(((-1.0)*x781*x784))+(((-400000.0)*pz))+(((-1.0)*pz*x782))+(((-1.0)*x783*x784)))))+(IKabs(((-40000.0)+((x781*x782))+(((-32100.0)*cj30))+((x782*x783))+(((400000.0)*x783))+(((400000.0)*x781))+(((-1.0)*pz*x784)))))); if( IKabs(j28eval[0]) < 0.0000010000000000 || IKabs(j28eval[1]) < 0.0000010000000000 || IKabs(j28eval[2]) < 0.0000010000000000 ) { { IkReal j28eval[2]; IkReal x786=(cj29*sj30); IkReal x787=(py*sj27); IkReal x788=(cj30*pz); IkReal x789=(cj27*px); j28eval[0]=((((-10.0)*x786*x787))+(((-10.0)*x786*x789))+x786+(((10.0)*x788))+(((12.4610591900312)*pz))); j28eval[1]=IKsign(((((400.0)*pz))+(((321.0)*x788))+(((-321.0)*x786*x787))+(((-321.0)*x786*x789))+(((32.1)*x786)))); if( IKabs(j28eval[0]) < 0.0000010000000000 || IKabs(j28eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { evalcond[0]=((IKabs(pz))+(IKabs(((-3.14159265358979)+(IKfmod(((1.5707963267949)+j29), 6.28318530717959)))))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j28eval[1]; IkReal x790=((-1.0)*py); pz=0; j29=1.5707963267949; sj29=1.0; cj29=0; pp=((px*px)+(py*py)); npx=(((px*r00))+((py*r10))); npy=(((px*r01))+((py*r11))); npz=(((px*r02))+((py*r12))); rxp0_0=(r20*x790); rxp0_1=(px*r20); rxp1_0=(r21*x790); rxp1_1=(px*r21); rxp2_0=(r22*x790); rxp2_1=(px*r22); j28eval[0]=((1.0)+(((-10.0)*cj27*px))+(((-10.0)*py*sj27))); if( IKabs(j28eval[0]) < 0.0000010000000000 ) { { IkReal j28eval[1]; IkReal x791=((-1.0)*py); pz=0; j29=1.5707963267949; sj29=1.0; cj29=0; pp=((px*px)+(py*py)); npx=(((px*r00))+((py*r10))); npy=(((px*r01))+((py*r11))); npz=(((px*r02))+((py*r12))); rxp0_0=(r20*x791); rxp0_1=(px*r20); rxp1_0=(r21*x791); rxp1_1=(px*r21); rxp2_0=(r22*x791); rxp2_1=(px*r22); j28eval[0]=((1.24610591900312)+cj30); if( IKabs(j28eval[0]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { IkReal x792=((((100.0)*(px*px)))+(((100.0)*(py*py)))); if((x792) < -0.00001) continue; IkReal x793=IKabs(IKsqrt(x792)); IkReal x799 = x792; if(IKabs(x799)==0){ continue; } IkReal x794=pow(x799,-0.5); CheckValue<IkReal> x800=IKPowWithIntegerCheck(x793,-1); if(!x800.valid){ continue; } IkReal x795=x800.value; IkReal x796=((10.0)*px*x794); IkReal x797=((10.0)*py*x794); if((((1.0)+(((-1.0)*(x795*x795))))) < -0.00001) continue; IkReal x798=IKsqrt(((1.0)+(((-1.0)*(x795*x795))))); if( (x795) < -1-IKFAST_SINCOS_THRESH || (x795) > 1+IKFAST_SINCOS_THRESH ) continue; CheckValue<IkReal> x801 = IKatan2WithCheck(IkReal(((-10.0)*px)),IkReal(((-10.0)*py)),IKFAST_ATAN2_MAGTHRESH); if(!x801.valid){ continue; } IkReal gconst25=(((x796*x798))+((x795*x797))); IkReal gconst26=((((-1.0)*x797*x798))+((x795*x796))); if((((((100.0)*(px*px)))+(((100.0)*(py*py))))) < -0.00001) continue; CheckValue<IkReal> x802=IKPowWithIntegerCheck(IKabs(IKsqrt(((((100.0)*(px*px)))+(((100.0)*(py*py)))))),-1); if(!x802.valid){ continue; } if( (x802.value) < -1-IKFAST_SINCOS_THRESH || (x802.value) > 1+IKFAST_SINCOS_THRESH ) continue; CheckValue<IkReal> x803 = IKatan2WithCheck(IkReal(((-10.0)*px)),IkReal(((-10.0)*py)),IKFAST_ATAN2_MAGTHRESH); if(!x803.valid){ continue; } evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((IKasin(x802.value))+j27+(x803.value))))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j28array[2], cj28array[2], sj28array[2]; bool j28valid[2]={false}; _nj28 = 2; CheckValue<IkReal> x805=IKPowWithIntegerCheck(((0.1)+(((-1.0)*gconst25*py))+(((-1.0)*gconst26*px))),-1); if(!x805.valid){ continue; } IkReal x804=x805.value; cj28array[0]=((((-0.4)*x804))+(((-0.321)*cj30*x804))); if( cj28array[0] >= -1-IKFAST_SINCOS_THRESH && cj28array[0] <= 1+IKFAST_SINCOS_THRESH ) { j28valid[0] = j28valid[1] = true; j28array[0] = IKacos(cj28array[0]); sj28array[0] = IKsin(j28array[0]); cj28array[1] = cj28array[0]; j28array[1] = -j28array[0]; sj28array[1] = -sj28array[0]; } else if( isnan(cj28array[0]) ) { // probably any value will work j28valid[0] = true; cj28array[0] = 1; sj28array[0] = 0; j28array[0] = 0; } for(int ij28 = 0; ij28 < 2; ++ij28) { if( !j28valid[ij28] ) { continue; } _ij28[0] = ij28; _ij28[1] = -1; for(int iij28 = ij28+1; iij28 < 2; ++iij28) { if( j28valid[iij28] && IKabs(cj28array[ij28]-cj28array[iij28]) < IKFAST_SOLUTION_THRESH && IKabs(sj28array[ij28]-sj28array[iij28]) < IKFAST_SOLUTION_THRESH ) { j28valid[iij28]=false; _ij28[1] = iij28; break; } } j28 = j28array[ij28]; cj28 = cj28array[ij28]; sj28 = sj28array[ij28]; { IkReal evalcond[4]; IkReal x806=IKsin(j28); IkReal x807=IKcos(j28); IkReal x808=(gconst25*py); IkReal x809=(gconst26*px); IkReal x810=((0.321)*cj30); IkReal x811=((1.0)*x806); IkReal x812=((0.8)*x807); evalcond[0]=(((x806*x810))+(((0.4)*x806))); evalcond[1]=((((-1.0)*x808*x811))+(((0.1)*x806))+(((-1.0)*x809*x811))); evalcond[2]=((0.1)+(((-1.0)*x808))+(((-1.0)*x809))+((x807*x810))+(((0.4)*x807))); evalcond[3]=((-0.32)+((x809*x812))+((x808*x812))+(((-0.08)*x807))+(((-0.2568)*cj30))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { IkReal x813=((((100.0)*(px*px)))+(((100.0)*(py*py)))); IkReal x820 = x813; if(IKabs(x820)==0){ continue; } IkReal x814=pow(x820,-0.5); if((x813) < -0.00001) continue; IkReal x815=IKabs(IKsqrt(x813)); CheckValue<IkReal> x821=IKPowWithIntegerCheck(x815,-1); if(!x821.valid){ continue; } IkReal x816=x821.value; IkReal x817=((10.0)*px*x814); IkReal x818=((10.0)*py*x814); if((((1.0)+(((-1.0)*(x816*x816))))) < -0.00001) continue; IkReal x819=IKsqrt(((1.0)+(((-1.0)*(x816*x816))))); if( (x816) < -1-IKFAST_SINCOS_THRESH || (x816) > 1+IKFAST_SINCOS_THRESH ) continue; CheckValue<IkReal> x822 = IKatan2WithCheck(IkReal(((-10.0)*px)),IkReal(((-10.0)*py)),IKFAST_ATAN2_MAGTHRESH); if(!x822.valid){ continue; } IkReal gconst28=(((x816*x818))+(((-1.0)*x817*x819))); IkReal gconst29=(((x816*x817))+((x818*x819))); if((((((100.0)*(px*px)))+(((100.0)*(py*py))))) < -0.00001) continue; CheckValue<IkReal> x823=IKPowWithIntegerCheck(IKabs(IKsqrt(((((100.0)*(px*px)))+(((100.0)*(py*py)))))),-1); if(!x823.valid){ continue; } if( (x823.value) < -1-IKFAST_SINCOS_THRESH || (x823.value) > 1+IKFAST_SINCOS_THRESH ) continue; CheckValue<IkReal> x824 = IKatan2WithCheck(IkReal(((-10.0)*px)),IkReal(((-10.0)*py)),IKFAST_ATAN2_MAGTHRESH); if(!x824.valid){ continue; } evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+(((-1.0)*(IKasin(x823.value))))+j27+(x824.value))))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j28array[2], cj28array[2], sj28array[2]; bool j28valid[2]={false}; _nj28 = 2; CheckValue<IkReal> x826=IKPowWithIntegerCheck(((0.1)+(((-1.0)*gconst29*px))+(((-1.0)*gconst28*py))),-1); if(!x826.valid){ continue; } IkReal x825=x826.value; cj28array[0]=((((-0.4)*x825))+(((-0.321)*cj30*x825))); if( cj28array[0] >= -1-IKFAST_SINCOS_THRESH && cj28array[0] <= 1+IKFAST_SINCOS_THRESH ) { j28valid[0] = j28valid[1] = true; j28array[0] = IKacos(cj28array[0]); sj28array[0] = IKsin(j28array[0]); cj28array[1] = cj28array[0]; j28array[1] = -j28array[0]; sj28array[1] = -sj28array[0]; } else if( isnan(cj28array[0]) ) { // probably any value will work j28valid[0] = true; cj28array[0] = 1; sj28array[0] = 0; j28array[0] = 0; } for(int ij28 = 0; ij28 < 2; ++ij28) { if( !j28valid[ij28] ) { continue; } _ij28[0] = ij28; _ij28[1] = -1; for(int iij28 = ij28+1; iij28 < 2; ++iij28) { if( j28valid[iij28] && IKabs(cj28array[ij28]-cj28array[iij28]) < IKFAST_SOLUTION_THRESH && IKabs(sj28array[ij28]-sj28array[iij28]) < IKFAST_SOLUTION_THRESH ) { j28valid[iij28]=false; _ij28[1] = iij28; break; } } j28 = j28array[ij28]; cj28 = cj28array[ij28]; sj28 = sj28array[ij28]; { IkReal evalcond[4]; IkReal x827=IKsin(j28); IkReal x828=IKcos(j28); IkReal x829=(gconst28*py); IkReal x830=((0.321)*cj30); IkReal x831=((0.8)*x828); IkReal x832=((1.0)*gconst29*px); evalcond[0]=(((x827*x830))+(((0.4)*x827))); evalcond[1]=((((0.1)*x827))+(((-1.0)*x827*x832))+(((-1.0)*x827*x829))); evalcond[2]=((0.1)+(((0.4)*x828))+(((-1.0)*x829))+(((-1.0)*x832))+((x828*x830))); evalcond[3]=((-0.32)+(((-0.08)*x828))+((x829*x831))+((gconst29*px*x831))+(((-0.2568)*cj30))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j28] } } while(0); if( bgotonextstatement ) { } } } } } else { { IkReal j28array[2], cj28array[2], sj28array[2]; bool j28valid[2]={false}; _nj28 = 2; CheckValue<IkReal> x834=IKPowWithIntegerCheck(((0.4)+(((0.321)*cj30))),-1); if(!x834.valid){ continue; } IkReal x833=x834.value; cj28array[0]=(((cj27*px*x833))+(((-0.1)*x833))+((py*sj27*x833))); if( cj28array[0] >= -1-IKFAST_SINCOS_THRESH && cj28array[0] <= 1+IKFAST_SINCOS_THRESH ) { j28valid[0] = j28valid[1] = true; j28array[0] = IKacos(cj28array[0]); sj28array[0] = IKsin(j28array[0]); cj28array[1] = cj28array[0]; j28array[1] = -j28array[0]; sj28array[1] = -sj28array[0]; } else if( isnan(cj28array[0]) ) { // probably any value will work j28valid[0] = true; cj28array[0] = 1; sj28array[0] = 0; j28array[0] = 0; } for(int ij28 = 0; ij28 < 2; ++ij28) { if( !j28valid[ij28] ) { continue; } _ij28[0] = ij28; _ij28[1] = -1; for(int iij28 = ij28+1; iij28 < 2; ++iij28) { if( j28valid[iij28] && IKabs(cj28array[ij28]-cj28array[iij28]) < IKFAST_SOLUTION_THRESH && IKabs(sj28array[ij28]-sj28array[iij28]) < IKFAST_SOLUTION_THRESH ) { j28valid[iij28]=false; _ij28[1] = iij28; break; } } j28 = j28array[ij28]; cj28 = cj28array[ij28]; sj28 = sj28array[ij28]; { IkReal evalcond[4]; IkReal x835=IKsin(j28); IkReal x836=IKcos(j28); IkReal x837=((0.321)*cj30); IkReal x838=(cj27*px); IkReal x839=((1.0)*x835); IkReal x840=(py*sj27*x836); evalcond[0]=((((0.4)*x835))+((x835*x837))); evalcond[1]=((((-1.0)*py*sj27*x839))+(((-1.0)*x838*x839))+(((0.1)*x835))); evalcond[2]=((0.4)+(((-1.0)*x836*x838))+(((0.1)*x836))+(((-1.0)*x840))+x837); evalcond[3]=((-0.32)+(((0.8)*x836*x838))+(((-0.08)*x836))+(((0.8)*x840))+(((-0.2568)*cj30))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j28array[2], cj28array[2], sj28array[2]; bool j28valid[2]={false}; _nj28 = 2; CheckValue<IkReal> x842=IKPowWithIntegerCheck(((0.1)+(((-1.0)*py*sj27))+(((-1.0)*cj27*px))),-1); if(!x842.valid){ continue; } IkReal x841=x842.value; cj28array[0]=((((-0.4)*x841))+(((-0.321)*cj30*x841))); if( cj28array[0] >= -1-IKFAST_SINCOS_THRESH && cj28array[0] <= 1+IKFAST_SINCOS_THRESH ) { j28valid[0] = j28valid[1] = true; j28array[0] = IKacos(cj28array[0]); sj28array[0] = IKsin(j28array[0]); cj28array[1] = cj28array[0]; j28array[1] = -j28array[0]; sj28array[1] = -sj28array[0]; } else if( isnan(cj28array[0]) ) { // probably any value will work j28valid[0] = true; cj28array[0] = 1; sj28array[0] = 0; j28array[0] = 0; } for(int ij28 = 0; ij28 < 2; ++ij28) { if( !j28valid[ij28] ) { continue; } _ij28[0] = ij28; _ij28[1] = -1; for(int iij28 = ij28+1; iij28 < 2; ++iij28) { if( j28valid[iij28] && IKabs(cj28array[ij28]-cj28array[iij28]) < IKFAST_SOLUTION_THRESH && IKabs(sj28array[ij28]-sj28array[iij28]) < IKFAST_SOLUTION_THRESH ) { j28valid[iij28]=false; _ij28[1] = iij28; break; } } j28 = j28array[ij28]; cj28 = cj28array[ij28]; sj28 = sj28array[ij28]; { IkReal evalcond[4]; IkReal x843=IKsin(j28); IkReal x844=IKcos(j28); IkReal x845=(py*sj27); IkReal x846=(cj27*px); IkReal x847=((0.321)*cj30); IkReal x848=((0.8)*x844); IkReal x849=((1.0)*x843); evalcond[0]=((((0.4)*x843))+((x843*x847))); evalcond[1]=((((-1.0)*x846*x849))+(((0.1)*x843))+(((-1.0)*x845*x849))); evalcond[2]=((0.1)+(((0.4)*x844))+(((-1.0)*x846))+(((-1.0)*x845))+((x844*x847))); evalcond[3]=((-0.32)+(((-0.08)*x844))+((x846*x848))+(((-0.2568)*cj30))+((x845*x848))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(pz))+(IKabs(((-3.14159265358979)+(IKfmod(((4.71238898038469)+j29), 6.28318530717959)))))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j28eval[1]; IkReal x850=((-1.0)*py); pz=0; j29=-1.5707963267949; sj29=-1.0; cj29=0; pp=((px*px)+(py*py)); npx=(((px*r00))+((py*r10))); npy=(((px*r01))+((py*r11))); npz=(((px*r02))+((py*r12))); rxp0_0=(r20*x850); rxp0_1=(px*r20); rxp1_0=(r21*x850); rxp1_1=(px*r21); rxp2_0=(r22*x850); rxp2_1=(px*r22); j28eval[0]=((1.0)+(((-10.0)*cj27*px))+(((-10.0)*py*sj27))); if( IKabs(j28eval[0]) < 0.0000010000000000 ) { { IkReal j28eval[1]; IkReal x851=((-1.0)*py); pz=0; j29=-1.5707963267949; sj29=-1.0; cj29=0; pp=((px*px)+(py*py)); npx=(((px*r00))+((py*r10))); npy=(((px*r01))+((py*r11))); npz=(((px*r02))+((py*r12))); rxp0_0=(r20*x851); rxp0_1=(px*r20); rxp1_0=(r21*x851); rxp1_1=(px*r21); rxp2_0=(r22*x851); rxp2_1=(px*r22); j28eval[0]=((1.24610591900312)+cj30); if( IKabs(j28eval[0]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { IkReal x852=((((100.0)*(px*px)))+(((100.0)*(py*py)))); if((x852) < -0.00001) continue; IkReal x853=IKabs(IKsqrt(x852)); IkReal x859 = x852; if(IKabs(x859)==0){ continue; } IkReal x854=pow(x859,-0.5); CheckValue<IkReal> x860=IKPowWithIntegerCheck(x853,-1); if(!x860.valid){ continue; } IkReal x855=x860.value; IkReal x856=((10.0)*px*x854); IkReal x857=((10.0)*py*x854); if((((1.0)+(((-1.0)*(x855*x855))))) < -0.00001) continue; IkReal x858=IKsqrt(((1.0)+(((-1.0)*(x855*x855))))); if( (x855) < -1-IKFAST_SINCOS_THRESH || (x855) > 1+IKFAST_SINCOS_THRESH ) continue; CheckValue<IkReal> x861 = IKatan2WithCheck(IkReal(((-10.0)*px)),IkReal(((-10.0)*py)),IKFAST_ATAN2_MAGTHRESH); if(!x861.valid){ continue; } IkReal gconst31=(((x855*x857))+((x856*x858))); IkReal gconst32=(((x855*x856))+(((-1.0)*x857*x858))); if((((((100.0)*(px*px)))+(((100.0)*(py*py))))) < -0.00001) continue; CheckValue<IkReal> x862=IKPowWithIntegerCheck(IKabs(IKsqrt(((((100.0)*(px*px)))+(((100.0)*(py*py)))))),-1); if(!x862.valid){ continue; } if( (x862.value) < -1-IKFAST_SINCOS_THRESH || (x862.value) > 1+IKFAST_SINCOS_THRESH ) continue; CheckValue<IkReal> x863 = IKatan2WithCheck(IkReal(((-10.0)*px)),IkReal(((-10.0)*py)),IKFAST_ATAN2_MAGTHRESH); if(!x863.valid){ continue; } evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((IKasin(x862.value))+j27+(x863.value))))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j28array[2], cj28array[2], sj28array[2]; bool j28valid[2]={false}; _nj28 = 2; CheckValue<IkReal> x865=IKPowWithIntegerCheck(((0.1)+(((-1.0)*gconst32*px))+(((-1.0)*gconst31*py))),-1); if(!x865.valid){ continue; } IkReal x864=x865.value; cj28array[0]=((((-0.4)*x864))+(((-0.321)*cj30*x864))); if( cj28array[0] >= -1-IKFAST_SINCOS_THRESH && cj28array[0] <= 1+IKFAST_SINCOS_THRESH ) { j28valid[0] = j28valid[1] = true; j28array[0] = IKacos(cj28array[0]); sj28array[0] = IKsin(j28array[0]); cj28array[1] = cj28array[0]; j28array[1] = -j28array[0]; sj28array[1] = -sj28array[0]; } else if( isnan(cj28array[0]) ) { // probably any value will work j28valid[0] = true; cj28array[0] = 1; sj28array[0] = 0; j28array[0] = 0; } for(int ij28 = 0; ij28 < 2; ++ij28) { if( !j28valid[ij28] ) { continue; } _ij28[0] = ij28; _ij28[1] = -1; for(int iij28 = ij28+1; iij28 < 2; ++iij28) { if( j28valid[iij28] && IKabs(cj28array[ij28]-cj28array[iij28]) < IKFAST_SOLUTION_THRESH && IKabs(sj28array[ij28]-sj28array[iij28]) < IKFAST_SOLUTION_THRESH ) { j28valid[iij28]=false; _ij28[1] = iij28; break; } } j28 = j28array[ij28]; cj28 = cj28array[ij28]; sj28 = sj28array[ij28]; { IkReal evalcond[4]; IkReal x866=IKsin(j28); IkReal x867=IKcos(j28); IkReal x868=(gconst31*py); IkReal x869=(gconst32*px); IkReal x870=((0.321)*cj30); IkReal x871=((0.8)*x867); evalcond[0]=(((x866*x870))+(((0.4)*x866))); evalcond[1]=((((-0.1)*x866))+((x866*x869))+((x866*x868))); evalcond[2]=((0.1)+((x867*x870))+(((-1.0)*x869))+(((-1.0)*x868))+(((0.4)*x867))); evalcond[3]=((-0.32)+((x868*x871))+(((-0.2568)*cj30))+((x869*x871))+(((-0.08)*x867))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { IkReal x872=((((100.0)*(px*px)))+(((100.0)*(py*py)))); IkReal x879 = x872; if(IKabs(x879)==0){ continue; } IkReal x873=pow(x879,-0.5); if((x872) < -0.00001) continue; IkReal x874=IKabs(IKsqrt(x872)); CheckValue<IkReal> x880=IKPowWithIntegerCheck(x874,-1); if(!x880.valid){ continue; } IkReal x875=x880.value; IkReal x876=((10.0)*px*x873); IkReal x877=((10.0)*py*x873); if((((1.0)+(((-1.0)*(x875*x875))))) < -0.00001) continue; IkReal x878=IKsqrt(((1.0)+(((-1.0)*(x875*x875))))); if( (x875) < -1-IKFAST_SINCOS_THRESH || (x875) > 1+IKFAST_SINCOS_THRESH ) continue; CheckValue<IkReal> x881 = IKatan2WithCheck(IkReal(((-10.0)*px)),IkReal(((-10.0)*py)),IKFAST_ATAN2_MAGTHRESH); if(!x881.valid){ continue; } IkReal gconst34=((((-1.0)*x876*x878))+((x875*x877))); IkReal gconst35=(((x875*x876))+((x877*x878))); if((((((100.0)*(px*px)))+(((100.0)*(py*py))))) < -0.00001) continue; CheckValue<IkReal> x882=IKPowWithIntegerCheck(IKabs(IKsqrt(((((100.0)*(px*px)))+(((100.0)*(py*py)))))),-1); if(!x882.valid){ continue; } if( (x882.value) < -1-IKFAST_SINCOS_THRESH || (x882.value) > 1+IKFAST_SINCOS_THRESH ) continue; CheckValue<IkReal> x883 = IKatan2WithCheck(IkReal(((-10.0)*px)),IkReal(((-10.0)*py)),IKFAST_ATAN2_MAGTHRESH); if(!x883.valid){ continue; } evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+(((-1.0)*(IKasin(x882.value))))+j27+(x883.value))))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j28array[2], cj28array[2], sj28array[2]; bool j28valid[2]={false}; _nj28 = 2; CheckValue<IkReal> x885=IKPowWithIntegerCheck(((0.1)+(((-1.0)*gconst34*py))+(((-1.0)*gconst35*px))),-1); if(!x885.valid){ continue; } IkReal x884=x885.value; cj28array[0]=((((-0.4)*x884))+(((-0.321)*cj30*x884))); if( cj28array[0] >= -1-IKFAST_SINCOS_THRESH && cj28array[0] <= 1+IKFAST_SINCOS_THRESH ) { j28valid[0] = j28valid[1] = true; j28array[0] = IKacos(cj28array[0]); sj28array[0] = IKsin(j28array[0]); cj28array[1] = cj28array[0]; j28array[1] = -j28array[0]; sj28array[1] = -sj28array[0]; } else if( isnan(cj28array[0]) ) { // probably any value will work j28valid[0] = true; cj28array[0] = 1; sj28array[0] = 0; j28array[0] = 0; } for(int ij28 = 0; ij28 < 2; ++ij28) { if( !j28valid[ij28] ) { continue; } _ij28[0] = ij28; _ij28[1] = -1; for(int iij28 = ij28+1; iij28 < 2; ++iij28) { if( j28valid[iij28] && IKabs(cj28array[ij28]-cj28array[iij28]) < IKFAST_SOLUTION_THRESH && IKabs(sj28array[ij28]-sj28array[iij28]) < IKFAST_SOLUTION_THRESH ) { j28valid[iij28]=false; _ij28[1] = iij28; break; } } j28 = j28array[ij28]; cj28 = cj28array[ij28]; sj28 = sj28array[ij28]; { IkReal evalcond[4]; IkReal x886=IKsin(j28); IkReal x887=IKcos(j28); IkReal x888=(gconst34*py); IkReal x889=(gconst35*px); IkReal x890=((0.321)*cj30); IkReal x891=((0.8)*x887); evalcond[0]=(((x886*x890))+(((0.4)*x886))); evalcond[1]=(((x886*x888))+((x886*x889))+(((-0.1)*x886))); evalcond[2]=((0.1)+(((-1.0)*x889))+(((-1.0)*x888))+(((0.4)*x887))+((x887*x890))); evalcond[3]=((-0.32)+(((-0.2568)*cj30))+((x889*x891))+((x888*x891))+(((-0.08)*x887))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j28] } } while(0); if( bgotonextstatement ) { } } } } } else { { IkReal j28array[2], cj28array[2], sj28array[2]; bool j28valid[2]={false}; _nj28 = 2; CheckValue<IkReal> x893=IKPowWithIntegerCheck(((0.4)+(((0.321)*cj30))),-1); if(!x893.valid){ continue; } IkReal x892=x893.value; cj28array[0]=((((-0.1)*x892))+((cj27*px*x892))+((py*sj27*x892))); if( cj28array[0] >= -1-IKFAST_SINCOS_THRESH && cj28array[0] <= 1+IKFAST_SINCOS_THRESH ) { j28valid[0] = j28valid[1] = true; j28array[0] = IKacos(cj28array[0]); sj28array[0] = IKsin(j28array[0]); cj28array[1] = cj28array[0]; j28array[1] = -j28array[0]; sj28array[1] = -sj28array[0]; } else if( isnan(cj28array[0]) ) { // probably any value will work j28valid[0] = true; cj28array[0] = 1; sj28array[0] = 0; j28array[0] = 0; } for(int ij28 = 0; ij28 < 2; ++ij28) { if( !j28valid[ij28] ) { continue; } _ij28[0] = ij28; _ij28[1] = -1; for(int iij28 = ij28+1; iij28 < 2; ++iij28) { if( j28valid[iij28] && IKabs(cj28array[ij28]-cj28array[iij28]) < IKFAST_SOLUTION_THRESH && IKabs(sj28array[ij28]-sj28array[iij28]) < IKFAST_SOLUTION_THRESH ) { j28valid[iij28]=false; _ij28[1] = iij28; break; } } j28 = j28array[ij28]; cj28 = cj28array[ij28]; sj28 = sj28array[ij28]; { IkReal evalcond[4]; IkReal x894=IKsin(j28); IkReal x895=IKcos(j28); IkReal x896=((0.321)*cj30); IkReal x897=(py*sj27*x895); IkReal x898=(cj27*px*x895); evalcond[0]=(((x894*x896))+(((0.4)*x894))); evalcond[1]=((((-0.1)*x894))+((cj27*px*x894))+((py*sj27*x894))); evalcond[2]=((0.4)+(((-1.0)*x898))+(((-1.0)*x897))+x896+(((0.1)*x895))); evalcond[3]=((-0.32)+(((0.8)*x897))+(((0.8)*x898))+(((-0.2568)*cj30))+(((-0.08)*x895))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j28array[2], cj28array[2], sj28array[2]; bool j28valid[2]={false}; _nj28 = 2; CheckValue<IkReal> x900=IKPowWithIntegerCheck(((0.1)+(((-1.0)*py*sj27))+(((-1.0)*cj27*px))),-1); if(!x900.valid){ continue; } IkReal x899=x900.value; cj28array[0]=((((-0.4)*x899))+(((-0.321)*cj30*x899))); if( cj28array[0] >= -1-IKFAST_SINCOS_THRESH && cj28array[0] <= 1+IKFAST_SINCOS_THRESH ) { j28valid[0] = j28valid[1] = true; j28array[0] = IKacos(cj28array[0]); sj28array[0] = IKsin(j28array[0]); cj28array[1] = cj28array[0]; j28array[1] = -j28array[0]; sj28array[1] = -sj28array[0]; } else if( isnan(cj28array[0]) ) { // probably any value will work j28valid[0] = true; cj28array[0] = 1; sj28array[0] = 0; j28array[0] = 0; } for(int ij28 = 0; ij28 < 2; ++ij28) { if( !j28valid[ij28] ) { continue; } _ij28[0] = ij28; _ij28[1] = -1; for(int iij28 = ij28+1; iij28 < 2; ++iij28) { if( j28valid[iij28] && IKabs(cj28array[ij28]-cj28array[iij28]) < IKFAST_SOLUTION_THRESH && IKabs(sj28array[ij28]-sj28array[iij28]) < IKFAST_SOLUTION_THRESH ) { j28valid[iij28]=false; _ij28[1] = iij28; break; } } j28 = j28array[ij28]; cj28 = cj28array[ij28]; sj28 = sj28array[ij28]; { IkReal evalcond[4]; IkReal x901=IKsin(j28); IkReal x902=IKcos(j28); IkReal x903=(py*sj27); IkReal x904=(cj27*px); IkReal x905=((0.321)*cj30); IkReal x906=((0.8)*x902); evalcond[0]=(((x901*x905))+(((0.4)*x901))); evalcond[1]=(((x901*x904))+((x901*x903))+(((-0.1)*x901))); evalcond[2]=((0.1)+((x902*x905))+(((0.4)*x902))+(((-1.0)*x903))+(((-1.0)*x904))); evalcond[3]=((-0.32)+((x903*x906))+(((-0.08)*x902))+(((-0.2568)*cj30))+((x904*x906))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(pz))+(IKabs(((-3.14159265358979)+(IKfmod(((3.14159265358979)+j30), 6.28318530717959)))))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j28array[2], cj28array[2], sj28array[2]; bool j28valid[2]={false}; _nj28 = 2; cj28array[0]=((-0.13869625520111)+(((1.3869625520111)*py*sj27))+(((1.3869625520111)*cj27*px))); if( cj28array[0] >= -1-IKFAST_SINCOS_THRESH && cj28array[0] <= 1+IKFAST_SINCOS_THRESH ) { j28valid[0] = j28valid[1] = true; j28array[0] = IKacos(cj28array[0]); sj28array[0] = IKsin(j28array[0]); cj28array[1] = cj28array[0]; j28array[1] = -j28array[0]; sj28array[1] = -sj28array[0]; } else if( isnan(cj28array[0]) ) { // probably any value will work j28valid[0] = true; cj28array[0] = 1; sj28array[0] = 0; j28array[0] = 0; } for(int ij28 = 0; ij28 < 2; ++ij28) { if( !j28valid[ij28] ) { continue; } _ij28[0] = ij28; _ij28[1] = -1; for(int iij28 = ij28+1; iij28 < 2; ++iij28) { if( j28valid[iij28] && IKabs(cj28array[ij28]-cj28array[iij28]) < IKFAST_SOLUTION_THRESH && IKabs(sj28array[ij28]-sj28array[iij28]) < IKFAST_SOLUTION_THRESH ) { j28valid[iij28]=false; _ij28[1] = iij28; break; } } j28 = j28array[ij28]; cj28 = cj28array[ij28]; sj28 = sj28array[ij28]; { IkReal evalcond[5]; IkReal x907=IKcos(j28); IkReal x908=px*px; CheckValue<IkReal> x917=IKPowWithIntegerCheck(py,-1); if(!x917.valid){ continue; } IkReal x909=x917.value; IkReal x910=IKsin(j28); IkReal x911=(py*sj27); IkReal x912=(x908*x909); IkReal x913=((1.0)*x907); IkReal x914=(sj29*x910); IkReal x915=(cj29*x910); IkReal x916=((0.8)*sj27*x907); evalcond[0]=((0.721)*x910); evalcond[1]=((0.721)+(((-1.0)*cj27*px*x913))+(((-1.0)*x911*x913))+(((0.1)*x907))); evalcond[2]=((-0.5768)+(((-0.08)*x907))+((x912*x916))+(((0.8)*x907*x911))); evalcond[3]=(((x911*x915))+((sj27*x912*x915))+(((-0.1)*x915))); evalcond[4]=((((-1.0)*sj27*x912*x914))+(((-1.0)*x911*x914))+(((0.1)*x914))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(pz))+(IKabs(((-3.14159265358979)+(IKfmod(j30, 6.28318530717959)))))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j28array[2], cj28array[2], sj28array[2]; bool j28valid[2]={false}; _nj28 = 2; cj28array[0]=((-1.26582278481013)+(((12.6582278481013)*py*sj27))+(((12.6582278481013)*cj27*px))); if( cj28array[0] >= -1-IKFAST_SINCOS_THRESH && cj28array[0] <= 1+IKFAST_SINCOS_THRESH ) { j28valid[0] = j28valid[1] = true; j28array[0] = IKacos(cj28array[0]); sj28array[0] = IKsin(j28array[0]); cj28array[1] = cj28array[0]; j28array[1] = -j28array[0]; sj28array[1] = -sj28array[0]; } else if( isnan(cj28array[0]) ) { // probably any value will work j28valid[0] = true; cj28array[0] = 1; sj28array[0] = 0; j28array[0] = 0; } for(int ij28 = 0; ij28 < 2; ++ij28) { if( !j28valid[ij28] ) { continue; } _ij28[0] = ij28; _ij28[1] = -1; for(int iij28 = ij28+1; iij28 < 2; ++iij28) { if( j28valid[iij28] && IKabs(cj28array[ij28]-cj28array[iij28]) < IKFAST_SOLUTION_THRESH && IKabs(sj28array[ij28]-sj28array[iij28]) < IKFAST_SOLUTION_THRESH ) { j28valid[iij28]=false; _ij28[1] = iij28; break; } } j28 = j28array[ij28]; cj28 = cj28array[ij28]; sj28 = sj28array[ij28]; { IkReal evalcond[5]; IkReal x918=IKcos(j28); IkReal x919=px*px; CheckValue<IkReal> x928=IKPowWithIntegerCheck(py,-1); if(!x928.valid){ continue; } IkReal x920=x928.value; IkReal x921=IKsin(j28); IkReal x922=(py*sj27); IkReal x923=(x919*x920); IkReal x924=((1.0)*x918); IkReal x925=(sj29*x921); IkReal x926=(cj29*x921); IkReal x927=((0.8)*sj27*x918); evalcond[0]=((0.079)*x921); evalcond[1]=((0.079)+(((0.1)*x918))+(((-1.0)*cj27*px*x924))+(((-1.0)*x922*x924))); evalcond[2]=((-0.0632)+(((-0.08)*x918))+(((0.8)*x918*x922))+((x923*x927))); evalcond[3]=((((-0.1)*x926))+((sj27*x923*x926))+((x922*x926))); evalcond[4]=((((0.1)*x925))+(((-1.0)*sj27*x923*x925))+(((-1.0)*x922*x925))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j28] } } while(0); if( bgotonextstatement ) { } } } } } } } else { { IkReal j28array[1], cj28array[1], sj28array[1]; bool j28valid[1]={false}; _nj28 = 1; IkReal x929=cj27*cj27; IkReal x930=py*py; IkReal x931=(cj27*px); IkReal x932=(cj29*sj30); IkReal x933=(py*sj27); IkReal x934=((1000.0)*pz); IkReal x935=((1000.0)*x929); CheckValue<IkReal> x936=IKPowWithIntegerCheck(IKsign(((((32.1)*x932))+(((321.0)*cj30*pz))+(((-321.0)*x932*x933))+(((400.0)*pz))+(((-321.0)*x931*x932)))),-1); if(!x936.valid){ continue; } CheckValue<IkReal> x937 = IKatan2WithCheck(IkReal(((-150.0)+((x935*(px*px)))+(((-1.0)*x930*x935))+(((-200.0)*x931))+(((-200.0)*x933))+(((2000.0)*x931*x933))+(((1000.0)*x930))+(((-103.041)*(cj30*cj30)))+(((-256.8)*cj30)))),IkReal(((((-100.0)*pz))+(((-103.041)*cj30*x932))+(((-128.4)*x932))+((x931*x934))+((x933*x934)))),IKFAST_ATAN2_MAGTHRESH); if(!x937.valid){ continue; } j28array[0]=((-1.5707963267949)+(((1.5707963267949)*(x936.value)))+(x937.value)); sj28array[0]=IKsin(j28array[0]); cj28array[0]=IKcos(j28array[0]); if( j28array[0] > IKPI ) { j28array[0]-=IK2PI; } else if( j28array[0] < -IKPI ) { j28array[0]+=IK2PI; } j28valid[0] = true; for(int ij28 = 0; ij28 < 1; ++ij28) { if( !j28valid[ij28] ) { continue; } _ij28[0] = ij28; _ij28[1] = -1; for(int iij28 = ij28+1; iij28 < 1; ++iij28) { if( j28valid[iij28] && IKabs(cj28array[ij28]-cj28array[iij28]) < IKFAST_SOLUTION_THRESH && IKabs(sj28array[ij28]-sj28array[iij28]) < IKFAST_SOLUTION_THRESH ) { j28valid[iij28]=false; _ij28[1] = iij28; break; } } j28 = j28array[ij28]; cj28 = cj28array[ij28]; sj28 = sj28array[ij28]; { IkReal evalcond[6]; IkReal x938=IKsin(j28); IkReal x939=IKcos(j28); IkReal x940=((0.321)*cj30); IkReal x941=(py*sj27); IkReal x942=((0.321)*sj30); IkReal x943=((1.0)*sj29); IkReal x944=(px*sj27); IkReal x945=(cj27*px); IkReal x946=(cj27*py); IkReal x947=((1.0)*x941); IkReal x948=(pz*x938); IkReal x949=(cj29*x938); IkReal x950=(pz*x939); IkReal x951=((0.8)*x939); IkReal x952=(sj29*x938); evalcond[0]=(((x938*x940))+((cj29*x939*x942))+pz+(((0.4)*x938))); evalcond[1]=((0.1)+(((-1.0)*x947))+(((-1.0)*x942*x949))+((x939*x940))+(((-1.0)*x945))+(((0.4)*x939))); evalcond[2]=((0.4)+(((0.1)*x939))+(((-1.0)*x939*x947))+(((-1.0)*x939*x945))+x948+x940); evalcond[3]=((-0.066959)+(((-0.08)*x939))+(((-0.8)*x948))+(((0.2)*x945))+(((0.2)*x941))+((x941*x951))+(((-1.0)*pp))+((x945*x951))); evalcond[4]=((((0.1)*x952))+(((-1.0)*cj29*x946))+(((-1.0)*x943*x950))+(((-1.0)*x938*x941*x943))+((cj29*x944))+(((-1.0)*x938*x943*x945))); evalcond[5]=(((sj29*x944))+((x945*x949))+((x941*x949))+((cj29*x950))+(((-1.0)*x943*x946))+(((-0.1)*x949))+x942); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j28array[1], cj28array[1], sj28array[1]; bool j28valid[1]={false}; _nj28 = 1; IkReal x953=cj29*cj29; IkReal x954=cj30*cj30; IkReal x955=(cj27*px); IkReal x956=((321000.0)*cj30); IkReal x957=(py*sj27); IkReal x958=((321000.0)*cj29*sj30); IkReal x959=((103041.0)*x953); CheckValue<IkReal> x960=IKPowWithIntegerCheck(IKsign(((160000.0)+(((256800.0)*cj30))+(((-1.0)*x954*x959))+(((103041.0)*x954))+x959)),-1); if(!x960.valid){ continue; } CheckValue<IkReal> x961 = IKatan2WithCheck(IkReal(((((-1.0)*pz*x956))+(((32100.0)*cj29*sj30))+(((-1.0)*x957*x958))+(((-400000.0)*pz))+(((-1.0)*x955*x958)))),IkReal(((-40000.0)+((x955*x956))+(((-1.0)*pz*x958))+(((-32100.0)*cj30))+((x956*x957))+(((400000.0)*x957))+(((400000.0)*x955)))),IKFAST_ATAN2_MAGTHRESH); if(!x961.valid){ continue; } j28array[0]=((-1.5707963267949)+(((1.5707963267949)*(x960.value)))+(x961.value)); sj28array[0]=IKsin(j28array[0]); cj28array[0]=IKcos(j28array[0]); if( j28array[0] > IKPI ) { j28array[0]-=IK2PI; } else if( j28array[0] < -IKPI ) { j28array[0]+=IK2PI; } j28valid[0] = true; for(int ij28 = 0; ij28 < 1; ++ij28) { if( !j28valid[ij28] ) { continue; } _ij28[0] = ij28; _ij28[1] = -1; for(int iij28 = ij28+1; iij28 < 1; ++iij28) { if( j28valid[iij28] && IKabs(cj28array[ij28]-cj28array[iij28]) < IKFAST_SOLUTION_THRESH && IKabs(sj28array[ij28]-sj28array[iij28]) < IKFAST_SOLUTION_THRESH ) { j28valid[iij28]=false; _ij28[1] = iij28; break; } } j28 = j28array[ij28]; cj28 = cj28array[ij28]; sj28 = sj28array[ij28]; { IkReal evalcond[6]; IkReal x962=IKsin(j28); IkReal x963=IKcos(j28); IkReal x964=((0.321)*cj30); IkReal x965=(py*sj27); IkReal x966=((0.321)*sj30); IkReal x967=((1.0)*sj29); IkReal x968=(px*sj27); IkReal x969=(cj27*px); IkReal x970=(cj27*py); IkReal x971=((1.0)*x965); IkReal x972=(pz*x962); IkReal x973=(cj29*x962); IkReal x974=(pz*x963); IkReal x975=((0.8)*x963); IkReal x976=(sj29*x962); evalcond[0]=(((x962*x964))+((cj29*x963*x966))+pz+(((0.4)*x962))); evalcond[1]=((0.1)+(((-1.0)*x969))+(((-1.0)*x966*x973))+((x963*x964))+(((0.4)*x963))+(((-1.0)*x971))); evalcond[2]=((0.4)+(((-1.0)*x963*x971))+(((-1.0)*x963*x969))+(((0.1)*x963))+x972+x964); evalcond[3]=((-0.066959)+((x969*x975))+(((-0.8)*x972))+((x965*x975))+(((-1.0)*pp))+(((0.2)*x965))+(((0.2)*x969))+(((-0.08)*x963))); evalcond[4]=((((-1.0)*x962*x965*x967))+(((0.1)*x976))+(((-1.0)*cj29*x970))+(((-1.0)*x962*x967*x969))+((cj29*x968))+(((-1.0)*x967*x974))); evalcond[5]=(((x969*x973))+((sj29*x968))+(((-0.1)*x973))+((x965*x973))+(((-1.0)*x967*x970))+((cj29*x974))+x966); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j28array[1], cj28array[1], sj28array[1]; bool j28valid[1]={false}; _nj28 = 1; IkReal x977=(py*sj27); IkReal x978=(cj29*sj30); IkReal x979=((321.0)*cj30); IkReal x980=(cj27*px); IkReal x981=((1000.0)*pz); CheckValue<IkReal> x982=IKPowWithIntegerCheck(IKsign(((-40.0)+(((321.0)*pz*x978))+((x977*x979))+((x979*x980))+(((400.0)*x977))+(((400.0)*x980))+(((-32.1)*cj30)))),-1); if(!x982.valid){ continue; } CheckValue<IkReal> x983 = IKatan2WithCheck(IkReal(((((100.0)*pz))+(((-128.4)*x978))+(((-1.0)*x977*x981))+(((-1.0)*x980*x981))+(((-103.041)*cj30*x978)))),IkReal(((160.0)+(((-1.0)*pz*x981))+(((103.041)*(cj30*cj30)))+(((256.8)*cj30)))),IKFAST_ATAN2_MAGTHRESH); if(!x983.valid){ continue; } j28array[0]=((-1.5707963267949)+(((1.5707963267949)*(x982.value)))+(x983.value)); sj28array[0]=IKsin(j28array[0]); cj28array[0]=IKcos(j28array[0]); if( j28array[0] > IKPI ) { j28array[0]-=IK2PI; } else if( j28array[0] < -IKPI ) { j28array[0]+=IK2PI; } j28valid[0] = true; for(int ij28 = 0; ij28 < 1; ++ij28) { if( !j28valid[ij28] ) { continue; } _ij28[0] = ij28; _ij28[1] = -1; for(int iij28 = ij28+1; iij28 < 1; ++iij28) { if( j28valid[iij28] && IKabs(cj28array[ij28]-cj28array[iij28]) < IKFAST_SOLUTION_THRESH && IKabs(sj28array[ij28]-sj28array[iij28]) < IKFAST_SOLUTION_THRESH ) { j28valid[iij28]=false; _ij28[1] = iij28; break; } } j28 = j28array[ij28]; cj28 = cj28array[ij28]; sj28 = sj28array[ij28]; { IkReal evalcond[6]; IkReal x984=IKsin(j28); IkReal x985=IKcos(j28); IkReal x986=((0.321)*cj30); IkReal x987=(py*sj27); IkReal x988=((0.321)*sj30); IkReal x989=((1.0)*sj29); IkReal x990=(px*sj27); IkReal x991=(cj27*px); IkReal x992=(cj27*py); IkReal x993=((1.0)*x987); IkReal x994=(pz*x984); IkReal x995=(cj29*x984); IkReal x996=(pz*x985); IkReal x997=((0.8)*x985); IkReal x998=(sj29*x984); evalcond[0]=((((0.4)*x984))+pz+((cj29*x985*x988))+((x984*x986))); evalcond[1]=((0.1)+(((-1.0)*x991))+(((0.4)*x985))+(((-1.0)*x993))+((x985*x986))+(((-1.0)*x988*x995))); evalcond[2]=((0.4)+(((-1.0)*x985*x991))+(((0.1)*x985))+(((-1.0)*x985*x993))+x994+x986); evalcond[3]=((-0.066959)+(((-0.8)*x994))+((x991*x997))+(((-1.0)*pp))+(((0.2)*x987))+((x987*x997))+(((-0.08)*x985))+(((0.2)*x991))); evalcond[4]=(((cj29*x990))+(((-1.0)*x984*x989*x991))+(((0.1)*x998))+(((-1.0)*x989*x996))+(((-1.0)*x984*x987*x989))+(((-1.0)*cj29*x992))); evalcond[5]=(((x991*x995))+((cj29*x996))+((sj29*x990))+(((-0.1)*x995))+((x987*x995))+(((-1.0)*x989*x992))+x988); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } } } } else { { IkReal j28array[1], cj28array[1], sj28array[1]; bool j28valid[1]={false}; _nj28 = 1; IkReal x999=cj27*cj27; IkReal x1000=px*px; IkReal x1001=py*py; IkReal x1002=((1.0)*pz); IkReal x1003=(cj27*px); IkReal x1004=((5.0)*pp); IkReal x1005=(cj29*py); IkReal x1006=((4.0)*cj27); IkReal x1007=(pz*sj29); IkReal x1008=(cj29*sj27); IkReal x1009=(py*sj27*sj29); IkReal x1011=(sj29*x999); IkReal x1012=((4.0)*x1001); CheckValue<IkReal> x1013=IKPowWithIntegerCheck(IKsign(((((0.8)*sj29*x1003))+(((-0.04)*sj29))+(((-4.0)*x1000*x1011))+(((-1.0)*sj29*x1012))+(((0.8)*x1009))+((x1011*x1012))+(((-8.0)*x1003*x1009))+(((-4.0)*pz*x1007)))),-1); if(!x1013.valid){ continue; } CheckValue<IkReal> x1014 = IKatan2WithCheck(IkReal(((((-0.4)*cj27*x1005))+((x1001*x1006*x1008))+((x1004*x1007))+(((-1.0)*x1002*x1009))+(((-1.0)*x1000*x1006*x1008))+(((-1.0)*sj29*x1002*x1003))+(((8.0)*px*x1005*x999))+(((-4.0)*px*x1005))+(((0.334795)*x1007))+(((0.4)*px*x1008)))),IkReal(((((0.5)*pp*sj29))+((pz*x1005*x1006))+(((-4.0)*px*pz*x1008))+((x1000*x1011))+(((0.0334795)*sj29))+(((-1.0)*x1001*x1011))+(((2.0)*x1003*x1009))+(((-1.0)*sj29*x1003*x1004))+(((-1.0)*x1004*x1009))+((sj29*x1001))+(((-0.434795)*x1009))+(((-0.434795)*sj29*x1003)))),IKFAST_ATAN2_MAGTHRESH); if(!x1014.valid){ continue; } j28array[0]=((-1.5707963267949)+(((1.5707963267949)*(x1013.value)))+(x1014.value)); sj28array[0]=IKsin(j28array[0]); cj28array[0]=IKcos(j28array[0]); if( j28array[0] > IKPI ) { j28array[0]-=IK2PI; } else if( j28array[0] < -IKPI ) { j28array[0]+=IK2PI; } j28valid[0] = true; for(int ij28 = 0; ij28 < 1; ++ij28) { if( !j28valid[ij28] ) { continue; } _ij28[0] = ij28; _ij28[1] = -1; for(int iij28 = ij28+1; iij28 < 1; ++iij28) { if( j28valid[iij28] && IKabs(cj28array[ij28]-cj28array[iij28]) < IKFAST_SOLUTION_THRESH && IKabs(sj28array[ij28]-sj28array[iij28]) < IKFAST_SOLUTION_THRESH ) { j28valid[iij28]=false; _ij28[1] = iij28; break; } } j28 = j28array[ij28]; cj28 = cj28array[ij28]; sj28 = sj28array[ij28]; { IkReal evalcond[2]; IkReal x1015=IKcos(j28); IkReal x1016=IKsin(j28); IkReal x1017=(py*sj27); IkReal x1018=((1.0)*cj27); IkReal x1019=(cj27*px); IkReal x1020=((0.8)*x1015); IkReal x1021=(sj29*x1016); evalcond[0]=((-0.066959)+(((-0.8)*pz*x1016))+((x1017*x1020))+(((-0.08)*x1015))+(((-1.0)*pp))+((x1019*x1020))+(((0.2)*x1019))+(((0.2)*x1017))); evalcond[1]=(((cj29*px*sj27))+(((-1.0)*pz*sj29*x1015))+(((-1.0)*cj29*py*x1018))+(((-1.0)*px*x1018*x1021))+(((0.1)*x1021))+(((-1.0)*x1017*x1021))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH ) { continue; } } { IkReal j30eval[1]; j30eval[0]=sj29; if( IKabs(j30eval[0]) < 0.0000010000000000 ) { { IkReal j30eval[2]; j30eval[0]=cj28; j30eval[1]=cj29; if( IKabs(j30eval[0]) < 0.0000010000000000 || IKabs(j30eval[1]) < 0.0000010000000000 ) { { IkReal j30eval[2]; j30eval[0]=sj29; j30eval[1]=sj28; if( IKabs(j30eval[0]) < 0.0000010000000000 || IKabs(j30eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j29))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; IkReal x1022=((3.11526479750779)*cj28); IkReal x1023=(py*sj27); IkReal x1024=((3.11526479750779)*sj28); IkReal x1025=(cj27*px); if( IKabs(((((-1.0)*pz*x1022))+(((-1.0)*x1023*x1024))+(((0.311526479750779)*sj28))+(((-1.0)*x1024*x1025)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.24610591900312)+(((-0.311526479750779)*cj28))+(((-1.0)*pz*x1024))+((x1022*x1025))+((x1022*x1023)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*pz*x1022))+(((-1.0)*x1023*x1024))+(((0.311526479750779)*sj28))+(((-1.0)*x1024*x1025))))+IKsqr(((-1.24610591900312)+(((-0.311526479750779)*cj28))+(((-1.0)*pz*x1024))+((x1022*x1025))+((x1022*x1023))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2(((((-1.0)*pz*x1022))+(((-1.0)*x1023*x1024))+(((0.311526479750779)*sj28))+(((-1.0)*x1024*x1025))), ((-1.24610591900312)+(((-0.311526479750779)*cj28))+(((-1.0)*pz*x1024))+((x1022*x1025))+((x1022*x1023)))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[5]; IkReal x1026=IKcos(j30); IkReal x1027=IKsin(j30); IkReal x1028=(py*sj27); IkReal x1029=(cj27*px); IkReal x1030=((0.321)*x1026); IkReal x1031=((0.321)*x1027); evalcond[0]=((((0.4)*sj28))+((cj28*x1031))+pz+((sj28*x1030))); evalcond[1]=((0.253041)+(((0.2568)*x1026))+(((-1.0)*pp))+(((0.2)*x1028))+(((0.2)*x1029))); evalcond[2]=(x1031+((cj28*pz))+((sj28*x1028))+((sj28*x1029))+(((-0.1)*sj28))); CheckValue<IkReal> x1032=IKPowWithIntegerCheck(py,-1); if(!x1032.valid){ continue; } evalcond[3]=((0.31630125)+x1030+(((-1.25)*pp))+(((0.25)*x1028))+(((0.25)*sj27*(px*px)*(x1032.value)))); evalcond[4]=((0.1)+((cj28*x1030))+(((-1.0)*x1029))+(((-1.0)*x1028))+(((0.4)*cj28))+(((-1.0)*sj28*x1031))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j29)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; IkReal x1033=((3.11526479750779)*cj28); IkReal x1034=(py*sj27); IkReal x1035=((3.11526479750779)*sj28); IkReal x1036=(cj27*px); if( IKabs((((pz*x1033))+(((-0.311526479750779)*sj28))+((x1034*x1035))+((x1035*x1036)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.24610591900312)+(((-0.311526479750779)*cj28))+(((-1.0)*pz*x1035))+((x1033*x1036))+((x1033*x1034)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((((pz*x1033))+(((-0.311526479750779)*sj28))+((x1034*x1035))+((x1035*x1036))))+IKsqr(((-1.24610591900312)+(((-0.311526479750779)*cj28))+(((-1.0)*pz*x1035))+((x1033*x1036))+((x1033*x1034))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2((((pz*x1033))+(((-0.311526479750779)*sj28))+((x1034*x1035))+((x1035*x1036))), ((-1.24610591900312)+(((-0.311526479750779)*cj28))+(((-1.0)*pz*x1035))+((x1033*x1036))+((x1033*x1034)))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[5]; IkReal x1037=IKcos(j30); IkReal x1038=IKsin(j30); IkReal x1039=(cj27*px); IkReal x1040=((1.0)*sj28); IkReal x1041=((0.25)*sj27); IkReal x1042=(py*sj27); IkReal x1043=((0.321)*x1037); IkReal x1044=((0.321)*x1038); evalcond[0]=((((0.4)*sj28))+((sj28*x1043))+pz+(((-1.0)*cj28*x1044))); evalcond[1]=((0.253041)+(((0.2)*x1042))+(((0.2568)*x1037))+(((-1.0)*pp))+(((0.2)*x1039))); CheckValue<IkReal> x1045=IKPowWithIntegerCheck(py,-1); if(!x1045.valid){ continue; } evalcond[2]=((0.31630125)+x1043+(((-1.25)*pp))+((x1041*(px*px)*(x1045.value)))+((py*x1041))); evalcond[3]=(x1044+(((-1.0)*x1039*x1040))+(((0.1)*sj28))+(((-1.0)*x1040*x1042))+(((-1.0)*cj28*pz))); evalcond[4]=((0.1)+((sj28*x1044))+(((-1.0)*x1039))+(((0.4)*cj28))+(((-1.0)*x1042))+((cj28*x1043))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j28))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j30eval[1]; sj28=0; cj28=1.0; j28=0; j30eval[0]=cj29; if( IKabs(j30eval[0]) < 0.0000010000000000 ) { { IkReal j30eval[1]; sj28=0; cj28=1.0; j28=0; j30eval[0]=sj29; if( IKabs(j30eval[0]) < 0.0000010000000000 ) { { IkReal evalcond[2]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j29))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; if( IKabs(((-3.11526479750779)*pz)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.09981619937695)+(((3.11526479750779)*pp)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-3.11526479750779)*pz))+IKsqr(((-1.09981619937695)+(((3.11526479750779)*pp))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2(((-3.11526479750779)*pz), ((-1.09981619937695)+(((3.11526479750779)*pp)))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[3]; IkReal x1046=IKcos(j30); evalcond[0]=(pz+(((0.321)*(IKsin(j30))))); evalcond[1]=((0.2824328)+(((-0.8)*pp))+(((0.2568)*x1046))); evalcond[2]=((0.353041)+(((0.321)*x1046))+(((-1.0)*pp))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j29)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; if( IKabs(((3.11526479750779)*pz)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.09981619937695)+(((3.11526479750779)*pp)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((3.11526479750779)*pz))+IKsqr(((-1.09981619937695)+(((3.11526479750779)*pp))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2(((3.11526479750779)*pz), ((-1.09981619937695)+(((3.11526479750779)*pp)))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[3]; IkReal x1047=IKcos(j30); evalcond[0]=((((-0.321)*(IKsin(j30))))+pz); evalcond[1]=((0.2824328)+(((-0.8)*pp))+(((0.2568)*x1047))); evalcond[2]=((0.353041)+(((0.321)*x1047))+(((-1.0)*pp))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j29)))), 6.28318530717959))); evalcond[1]=pz; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; if( IKabs(((((3.11526479750779)*cj27*py))+(((-3.11526479750779)*px*sj27)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.09981619937695)+(((3.11526479750779)*pp)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((3.11526479750779)*cj27*py))+(((-3.11526479750779)*px*sj27))))+IKsqr(((-1.09981619937695)+(((3.11526479750779)*pp))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2(((((3.11526479750779)*cj27*py))+(((-3.11526479750779)*px*sj27))), ((-1.09981619937695)+(((3.11526479750779)*pp)))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[3]; IkReal x1048=IKcos(j30); evalcond[0]=((0.2824328)+(((-0.8)*pp))+(((0.2568)*x1048))); evalcond[1]=((0.353041)+(((0.321)*x1048))+(((-1.0)*pp))); evalcond[2]=((((-1.0)*cj27*py))+((px*sj27))+(((0.321)*(IKsin(j30))))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j29)))), 6.28318530717959))); evalcond[1]=pz; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; if( IKabs(((((-3.11526479750779)*cj27*py))+(((3.11526479750779)*px*sj27)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.09981619937695)+(((3.11526479750779)*pp)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-3.11526479750779)*cj27*py))+(((3.11526479750779)*px*sj27))))+IKsqr(((-1.09981619937695)+(((3.11526479750779)*pp))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2(((((-3.11526479750779)*cj27*py))+(((3.11526479750779)*px*sj27))), ((-1.09981619937695)+(((3.11526479750779)*pp)))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[3]; IkReal x1049=IKcos(j30); evalcond[0]=((0.2824328)+(((-0.8)*pp))+(((0.2568)*x1049))); evalcond[1]=((0.353041)+(((0.321)*x1049))+(((-1.0)*pp))); evalcond[2]=((((-1.0)*cj27*py))+(((-0.321)*(IKsin(j30))))+((px*sj27))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j30] } } while(0); if( bgotonextstatement ) { } } } } } } } else { { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; CheckValue<IkReal> x1050=IKPowWithIntegerCheck(sj29,-1); if(!x1050.valid){ continue; } if( IKabs(((0.00311526479750779)*(x1050.value)*(((((1000.0)*cj27*py))+(((-1000.0)*px*sj27)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.09981619937695)+(((3.11526479750779)*pp)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((0.00311526479750779)*(x1050.value)*(((((1000.0)*cj27*py))+(((-1000.0)*px*sj27))))))+IKsqr(((-1.09981619937695)+(((3.11526479750779)*pp))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2(((0.00311526479750779)*(x1050.value)*(((((1000.0)*cj27*py))+(((-1000.0)*px*sj27))))), ((-1.09981619937695)+(((3.11526479750779)*pp)))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[5]; IkReal x1051=IKcos(j30); IkReal x1052=IKsin(j30); IkReal x1053=(px*sj27); IkReal x1054=((1.0)*cj27*py); IkReal x1055=((0.321)*x1052); evalcond[0]=(pz+((cj29*x1055))); evalcond[1]=((0.2824328)+(((-0.8)*pp))+(((0.2568)*x1051))); evalcond[2]=((0.353041)+(((0.321)*x1051))+(((-1.0)*pp))); evalcond[3]=((((-1.0)*x1054))+x1053+((sj29*x1055))); evalcond[4]=(x1055+((cj29*pz))+(((-1.0)*sj29*x1054))+((sj29*x1053))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; CheckValue<IkReal> x1056=IKPowWithIntegerCheck(cj29,-1); if(!x1056.valid){ continue; } if( IKabs(((-3.11526479750779)*pz*(x1056.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.09981619937695)+(((3.11526479750779)*pp)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-3.11526479750779)*pz*(x1056.value)))+IKsqr(((-1.09981619937695)+(((3.11526479750779)*pp))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2(((-3.11526479750779)*pz*(x1056.value)), ((-1.09981619937695)+(((3.11526479750779)*pp)))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[5]; IkReal x1057=IKcos(j30); IkReal x1058=IKsin(j30); IkReal x1059=(px*sj27); IkReal x1060=((1.0)*cj27*py); IkReal x1061=((0.321)*x1058); evalcond[0]=(pz+((cj29*x1061))); evalcond[1]=((0.2824328)+(((-0.8)*pp))+(((0.2568)*x1057))); evalcond[2]=((0.353041)+(((0.321)*x1057))+(((-1.0)*pp))); evalcond[3]=(x1059+(((-1.0)*x1060))+((sj29*x1061))); evalcond[4]=(x1061+(((-1.0)*sj29*x1060))+((cj29*pz))+((sj29*x1059))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j28)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j30eval[1]; sj28=0; cj28=-1.0; j28=3.14159265358979; j30eval[0]=cj29; if( IKabs(j30eval[0]) < 0.0000010000000000 ) { { IkReal j30eval[1]; sj28=0; cj28=-1.0; j28=3.14159265358979; j30eval[0]=sj29; if( IKabs(j30eval[0]) < 0.0000010000000000 ) { { IkReal evalcond[2]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j29))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; if( IKabs(((3.11526479750779)*pz)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.00228971962617)+(((5.19210799584631)*pp)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((3.11526479750779)*pz))+IKsqr(((-1.00228971962617)+(((5.19210799584631)*pp))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2(((3.11526479750779)*pz), ((-1.00228971962617)+(((5.19210799584631)*pp)))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[3]; IkReal x1062=IKcos(j30); evalcond[0]=((((-0.321)*(IKsin(j30))))+pz); evalcond[1]=((0.257388)+(((0.2568)*x1062))+(((-1.33333333333333)*pp))); evalcond[2]=((0.321735)+(((0.321)*x1062))+(((-1.66666666666667)*pp))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j29)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; if( IKabs(((-3.11526479750779)*pz)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.00228971962617)+(((5.19210799584631)*pp)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-3.11526479750779)*pz))+IKsqr(((-1.00228971962617)+(((5.19210799584631)*pp))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2(((-3.11526479750779)*pz), ((-1.00228971962617)+(((5.19210799584631)*pp)))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[3]; IkReal x1063=IKcos(j30); evalcond[0]=(pz+(((0.321)*(IKsin(j30))))); evalcond[1]=((0.257388)+(((0.2568)*x1063))+(((-1.33333333333333)*pp))); evalcond[2]=((0.321735)+(((0.321)*x1063))+(((-1.66666666666667)*pp))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j29)))), 6.28318530717959))); evalcond[1]=pz; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; if( IKabs(((((3.11526479750779)*cj27*py))+(((-3.11526479750779)*px*sj27)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.00228971962617)+(((5.19210799584631)*pp)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((3.11526479750779)*cj27*py))+(((-3.11526479750779)*px*sj27))))+IKsqr(((-1.00228971962617)+(((5.19210799584631)*pp))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2(((((3.11526479750779)*cj27*py))+(((-3.11526479750779)*px*sj27))), ((-1.00228971962617)+(((5.19210799584631)*pp)))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[3]; IkReal x1064=IKcos(j30); evalcond[0]=((0.257388)+(((0.2568)*x1064))+(((-1.33333333333333)*pp))); evalcond[1]=((0.321735)+(((0.321)*x1064))+(((-1.66666666666667)*pp))); evalcond[2]=((((-1.0)*cj27*py))+((px*sj27))+(((0.321)*(IKsin(j30))))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j29)))), 6.28318530717959))); evalcond[1]=pz; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; if( IKabs(((((-3.11526479750779)*cj27*py))+(((3.11526479750779)*px*sj27)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.00228971962617)+(((5.19210799584631)*pp)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-3.11526479750779)*cj27*py))+(((3.11526479750779)*px*sj27))))+IKsqr(((-1.00228971962617)+(((5.19210799584631)*pp))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2(((((-3.11526479750779)*cj27*py))+(((3.11526479750779)*px*sj27))), ((-1.00228971962617)+(((5.19210799584631)*pp)))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[3]; IkReal x1065=IKcos(j30); evalcond[0]=((0.257388)+(((0.2568)*x1065))+(((-1.33333333333333)*pp))); evalcond[1]=((0.321735)+(((0.321)*x1065))+(((-1.66666666666667)*pp))); evalcond[2]=((((-1.0)*cj27*py))+(((-0.321)*(IKsin(j30))))+((px*sj27))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j30] } } while(0); if( bgotonextstatement ) { } } } } } } } else { { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; CheckValue<IkReal> x1066=IKPowWithIntegerCheck(sj29,-1); if(!x1066.valid){ continue; } if( IKabs(((0.00311526479750779)*(x1066.value)*(((((1000.0)*cj27*py))+(((-1000.0)*px*sj27)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.00228971962617)+(((5.19210799584631)*pp)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((0.00311526479750779)*(x1066.value)*(((((1000.0)*cj27*py))+(((-1000.0)*px*sj27))))))+IKsqr(((-1.00228971962617)+(((5.19210799584631)*pp))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2(((0.00311526479750779)*(x1066.value)*(((((1000.0)*cj27*py))+(((-1000.0)*px*sj27))))), ((-1.00228971962617)+(((5.19210799584631)*pp)))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[5]; IkReal x1067=IKcos(j30); IkReal x1068=IKsin(j30); IkReal x1069=(px*sj27); IkReal x1070=((1.0)*cj27*py); IkReal x1071=((0.321)*x1068); evalcond[0]=(pz+(((-1.0)*cj29*x1071))); evalcond[1]=((0.257388)+(((0.2568)*x1067))+(((-1.33333333333333)*pp))); evalcond[2]=((0.321735)+(((0.321)*x1067))+(((-1.66666666666667)*pp))); evalcond[3]=(x1069+((sj29*x1071))+(((-1.0)*x1070))); evalcond[4]=((((-1.0)*sj29*x1070))+x1071+(((-1.0)*cj29*pz))+((sj29*x1069))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; CheckValue<IkReal> x1072=IKPowWithIntegerCheck(cj29,-1); if(!x1072.valid){ continue; } if( IKabs(((3.11526479750779)*pz*(x1072.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.00228971962617)+(((5.19210799584631)*pp)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((3.11526479750779)*pz*(x1072.value)))+IKsqr(((-1.00228971962617)+(((5.19210799584631)*pp))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2(((3.11526479750779)*pz*(x1072.value)), ((-1.00228971962617)+(((5.19210799584631)*pp)))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[5]; IkReal x1073=IKcos(j30); IkReal x1074=IKsin(j30); IkReal x1075=(px*sj27); IkReal x1076=((1.0)*cj27*py); IkReal x1077=((0.321)*x1074); evalcond[0]=(pz+(((-1.0)*cj29*x1077))); evalcond[1]=((0.257388)+(((0.2568)*x1073))+(((-1.33333333333333)*pp))); evalcond[2]=((0.321735)+(((0.321)*x1073))+(((-1.66666666666667)*pp))); evalcond[3]=(x1075+((sj29*x1077))+(((-1.0)*x1076))); evalcond[4]=((((-1.0)*sj29*x1076))+x1077+(((-1.0)*cj29*pz))+((sj29*x1075))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j28)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j30eval[1]; sj28=1.0; cj28=0; j28=1.5707963267949; j30eval[0]=sj29; if( IKabs(j30eval[0]) < 0.0000010000000000 ) { { IkReal j30eval[1]; sj28=1.0; cj28=0; j28=1.5707963267949; j30eval[0]=cj29; if( IKabs(j30eval[0]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j29)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; if( IKabs(((((3.11526479750779)*cj27*py))+(((-3.11526479750779)*px*sj27)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.24610591900312)+(((-3.11526479750779)*pz)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((3.11526479750779)*cj27*py))+(((-3.11526479750779)*px*sj27))))+IKsqr(((-1.24610591900312)+(((-3.11526479750779)*pz))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2(((((3.11526479750779)*cj27*py))+(((-3.11526479750779)*px*sj27))), ((-1.24610591900312)+(((-3.11526479750779)*pz)))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[3]; IkReal x1078=IKcos(j30); evalcond[0]=((0.4)+(((0.321)*x1078))+pz); evalcond[1]=((0.32)+(((0.8)*pz))+(((0.2568)*x1078))); evalcond[2]=((((-1.0)*cj27*py))+((px*sj27))+(((0.321)*(IKsin(j30))))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j29)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; if( IKabs(((((-3.11526479750779)*cj27*py))+(((3.11526479750779)*px*sj27)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.24610591900312)+(((-3.11526479750779)*pz)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-3.11526479750779)*cj27*py))+(((3.11526479750779)*px*sj27))))+IKsqr(((-1.24610591900312)+(((-3.11526479750779)*pz))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2(((((-3.11526479750779)*cj27*py))+(((3.11526479750779)*px*sj27))), ((-1.24610591900312)+(((-3.11526479750779)*pz)))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[3]; IkReal x1079=IKcos(j30); evalcond[0]=((0.4)+(((0.321)*x1079))+pz); evalcond[1]=((0.32)+(((0.8)*pz))+(((0.2568)*x1079))); evalcond[2]=((((-1.0)*cj27*py))+(((-0.321)*(IKsin(j30))))+((px*sj27))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j29))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; if( IKabs(((0.311526479750779)+(((-3.11526479750779)*cj27*px))+(((-3.11526479750779)*py*sj27)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.24610591900312)+(((-3.11526479750779)*pz)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((0.311526479750779)+(((-3.11526479750779)*cj27*px))+(((-3.11526479750779)*py*sj27))))+IKsqr(((-1.24610591900312)+(((-3.11526479750779)*pz))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2(((0.311526479750779)+(((-3.11526479750779)*cj27*px))+(((-3.11526479750779)*py*sj27))), ((-1.24610591900312)+(((-3.11526479750779)*pz)))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[3]; IkReal x1080=IKcos(j30); evalcond[0]=((0.4)+(((0.321)*x1080))+pz); evalcond[1]=((0.32)+(((0.8)*pz))+(((0.2568)*x1080))); evalcond[2]=((0.1)+(((-1.0)*py*sj27))+(((-1.0)*cj27*px))+(((-0.321)*(IKsin(j30))))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j29)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; if( IKabs(((-0.311526479750779)+(((3.11526479750779)*cj27*px))+(((3.11526479750779)*py*sj27)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.24610591900312)+(((-3.11526479750779)*pz)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-0.311526479750779)+(((3.11526479750779)*cj27*px))+(((3.11526479750779)*py*sj27))))+IKsqr(((-1.24610591900312)+(((-3.11526479750779)*pz))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2(((-0.311526479750779)+(((3.11526479750779)*cj27*px))+(((3.11526479750779)*py*sj27))), ((-1.24610591900312)+(((-3.11526479750779)*pz)))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[3]; IkReal x1081=IKcos(j30); evalcond[0]=((0.4)+(((0.321)*x1081))+pz); evalcond[1]=((0.32)+(((0.8)*pz))+(((0.2568)*x1081))); evalcond[2]=((0.1)+(((-1.0)*py*sj27))+(((-1.0)*cj27*px))+(((0.321)*(IKsin(j30))))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j30] } } while(0); if( bgotonextstatement ) { } } } } } } } else { { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; CheckValue<IkReal> x1082=IKPowWithIntegerCheck(cj29,-1); if(!x1082.valid){ continue; } if( IKabs(((0.00311526479750779)*(x1082.value)*(((100.0)+(((-1000.0)*cj27*px))+(((-1000.0)*py*sj27)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.24610591900312)+(((-3.11526479750779)*pz)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((0.00311526479750779)*(x1082.value)*(((100.0)+(((-1000.0)*cj27*px))+(((-1000.0)*py*sj27))))))+IKsqr(((-1.24610591900312)+(((-3.11526479750779)*pz))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2(((0.00311526479750779)*(x1082.value)*(((100.0)+(((-1000.0)*cj27*px))+(((-1000.0)*py*sj27))))), ((-1.24610591900312)+(((-3.11526479750779)*pz)))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[5]; IkReal x1083=IKcos(j30); IkReal x1084=IKsin(j30); IkReal x1085=((1.0)*py); IkReal x1086=(cj27*px); IkReal x1087=(px*sj27); IkReal x1088=((0.321)*x1084); evalcond[0]=((0.4)+(((0.321)*x1083))+pz); evalcond[1]=((0.32)+(((0.8)*pz))+(((0.2568)*x1083))); evalcond[2]=(x1087+((sj29*x1088))+(((-1.0)*cj27*x1085))); evalcond[3]=((0.1)+(((-1.0)*x1086))+(((-1.0)*sj27*x1085))+(((-1.0)*cj29*x1088))); evalcond[4]=(((cj29*py*sj27))+x1088+((sj29*x1087))+(((-1.0)*cj27*sj29*x1085))+((cj29*x1086))+(((-0.1)*cj29))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; CheckValue<IkReal> x1089=IKPowWithIntegerCheck(sj29,-1); if(!x1089.valid){ continue; } if( IKabs(((0.00311526479750779)*(x1089.value)*(((((1000.0)*cj27*py))+(((-1000.0)*px*sj27)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.24610591900312)+(((-3.11526479750779)*pz)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((0.00311526479750779)*(x1089.value)*(((((1000.0)*cj27*py))+(((-1000.0)*px*sj27))))))+IKsqr(((-1.24610591900312)+(((-3.11526479750779)*pz))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2(((0.00311526479750779)*(x1089.value)*(((((1000.0)*cj27*py))+(((-1000.0)*px*sj27))))), ((-1.24610591900312)+(((-3.11526479750779)*pz)))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[5]; IkReal x1090=IKcos(j30); IkReal x1091=IKsin(j30); IkReal x1092=((1.0)*py); IkReal x1093=(cj27*px); IkReal x1094=(px*sj27); IkReal x1095=((0.321)*x1091); evalcond[0]=((0.4)+pz+(((0.321)*x1090))); evalcond[1]=((0.32)+(((0.2568)*x1090))+(((0.8)*pz))); evalcond[2]=(x1094+((sj29*x1095))+(((-1.0)*cj27*x1092))); evalcond[3]=((0.1)+(((-1.0)*x1093))+(((-1.0)*cj29*x1095))+(((-1.0)*sj27*x1092))); evalcond[4]=(((cj29*py*sj27))+x1095+((cj29*x1093))+((sj29*x1094))+(((-1.0)*cj27*sj29*x1092))+(((-0.1)*cj29))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j28)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j30eval[1]; sj28=-1.0; cj28=0; j28=-1.5707963267949; j30eval[0]=sj29; if( IKabs(j30eval[0]) < 0.0000010000000000 ) { { IkReal j30eval[1]; sj28=-1.0; cj28=0; j28=-1.5707963267949; j30eval[0]=cj29; if( IKabs(j30eval[0]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j29)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; if( IKabs(((((3.11526479750779)*cj27*py))+(((-3.11526479750779)*px*sj27)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.24610591900312)+(((3.11526479750779)*pz)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((3.11526479750779)*cj27*py))+(((-3.11526479750779)*px*sj27))))+IKsqr(((-1.24610591900312)+(((3.11526479750779)*pz))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2(((((3.11526479750779)*cj27*py))+(((-3.11526479750779)*px*sj27))), ((-1.24610591900312)+(((3.11526479750779)*pz)))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[3]; IkReal x1096=IKcos(j30); evalcond[0]=((-0.4)+(((-0.321)*x1096))+pz); evalcond[1]=((0.32)+(((0.2568)*x1096))+(((-0.8)*pz))); evalcond[2]=((((-1.0)*cj27*py))+((px*sj27))+(((0.321)*(IKsin(j30))))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j29)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; if( IKabs(((((-3.11526479750779)*cj27*py))+(((3.11526479750779)*px*sj27)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.24610591900312)+(((3.11526479750779)*pz)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-3.11526479750779)*cj27*py))+(((3.11526479750779)*px*sj27))))+IKsqr(((-1.24610591900312)+(((3.11526479750779)*pz))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2(((((-3.11526479750779)*cj27*py))+(((3.11526479750779)*px*sj27))), ((-1.24610591900312)+(((3.11526479750779)*pz)))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[3]; IkReal x1097=IKcos(j30); evalcond[0]=((-0.4)+(((-0.321)*x1097))+pz); evalcond[1]=((0.32)+(((0.2568)*x1097))+(((-0.8)*pz))); evalcond[2]=((((-1.0)*cj27*py))+(((-0.321)*(IKsin(j30))))+((px*sj27))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j29))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; if( IKabs(((-0.311526479750779)+(((3.11526479750779)*cj27*px))+(((3.11526479750779)*py*sj27)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.24610591900312)+(((3.11526479750779)*pz)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-0.311526479750779)+(((3.11526479750779)*cj27*px))+(((3.11526479750779)*py*sj27))))+IKsqr(((-1.24610591900312)+(((3.11526479750779)*pz))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2(((-0.311526479750779)+(((3.11526479750779)*cj27*px))+(((3.11526479750779)*py*sj27))), ((-1.24610591900312)+(((3.11526479750779)*pz)))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[3]; IkReal x1098=IKcos(j30); evalcond[0]=((-0.4)+(((-0.321)*x1098))+pz); evalcond[1]=((0.32)+(((0.2568)*x1098))+(((-0.8)*pz))); evalcond[2]=((0.1)+(((-1.0)*py*sj27))+(((-1.0)*cj27*px))+(((0.321)*(IKsin(j30))))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j29)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; if( IKabs(((0.311526479750779)+(((-3.11526479750779)*cj27*px))+(((-3.11526479750779)*py*sj27)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.24610591900312)+(((3.11526479750779)*pz)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((0.311526479750779)+(((-3.11526479750779)*cj27*px))+(((-3.11526479750779)*py*sj27))))+IKsqr(((-1.24610591900312)+(((3.11526479750779)*pz))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2(((0.311526479750779)+(((-3.11526479750779)*cj27*px))+(((-3.11526479750779)*py*sj27))), ((-1.24610591900312)+(((3.11526479750779)*pz)))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[3]; IkReal x1099=IKcos(j30); evalcond[0]=((-0.4)+(((-0.321)*x1099))+pz); evalcond[1]=((0.32)+(((0.2568)*x1099))+(((-0.8)*pz))); evalcond[2]=((0.1)+(((-1.0)*py*sj27))+(((-1.0)*cj27*px))+(((-0.321)*(IKsin(j30))))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j30] } } while(0); if( bgotonextstatement ) { } } } } } } } else { { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; CheckValue<IkReal> x1100=IKPowWithIntegerCheck(cj29,-1); if(!x1100.valid){ continue; } if( IKabs(((0.00311526479750779)*(x1100.value)*(((-100.0)+(((1000.0)*cj27*px))+(((1000.0)*py*sj27)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.24610591900312)+(((3.11526479750779)*pz)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((0.00311526479750779)*(x1100.value)*(((-100.0)+(((1000.0)*cj27*px))+(((1000.0)*py*sj27))))))+IKsqr(((-1.24610591900312)+(((3.11526479750779)*pz))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2(((0.00311526479750779)*(x1100.value)*(((-100.0)+(((1000.0)*cj27*px))+(((1000.0)*py*sj27))))), ((-1.24610591900312)+(((3.11526479750779)*pz)))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[5]; IkReal x1101=IKcos(j30); IkReal x1102=IKsin(j30); IkReal x1103=((1.0)*py); IkReal x1104=(px*sj27); IkReal x1105=((1.0)*cj27*px); IkReal x1106=((0.321)*x1102); evalcond[0]=((-0.4)+(((-0.321)*x1101))+pz); evalcond[1]=((0.32)+(((-0.8)*pz))+(((0.2568)*x1101))); evalcond[2]=(x1104+(((-1.0)*cj27*x1103))+((sj29*x1106))); evalcond[3]=((0.1)+((cj29*x1106))+(((-1.0)*sj27*x1103))+(((-1.0)*x1105))); evalcond[4]=(x1106+(((-1.0)*cj27*sj29*x1103))+((sj29*x1104))+(((0.1)*cj29))+(((-1.0)*cj29*x1105))+(((-1.0)*cj29*sj27*x1103))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; CheckValue<IkReal> x1107=IKPowWithIntegerCheck(sj29,-1); if(!x1107.valid){ continue; } if( IKabs(((0.00311526479750779)*(x1107.value)*(((((1000.0)*cj27*py))+(((-1000.0)*px*sj27)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.24610591900312)+(((3.11526479750779)*pz)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((0.00311526479750779)*(x1107.value)*(((((1000.0)*cj27*py))+(((-1000.0)*px*sj27))))))+IKsqr(((-1.24610591900312)+(((3.11526479750779)*pz))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2(((0.00311526479750779)*(x1107.value)*(((((1000.0)*cj27*py))+(((-1000.0)*px*sj27))))), ((-1.24610591900312)+(((3.11526479750779)*pz)))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[5]; IkReal x1108=IKcos(j30); IkReal x1109=IKsin(j30); IkReal x1110=((1.0)*py); IkReal x1111=(px*sj27); IkReal x1112=((1.0)*cj27*px); IkReal x1113=((0.321)*x1109); evalcond[0]=((-0.4)+(((-0.321)*x1108))+pz); evalcond[1]=((0.32)+(((-0.8)*pz))+(((0.2568)*x1108))); evalcond[2]=(x1111+(((-1.0)*cj27*x1110))+((sj29*x1113))); evalcond[3]=((0.1)+(((-1.0)*sj27*x1110))+(((-1.0)*x1112))+((cj29*x1113))); evalcond[4]=(x1113+(((-1.0)*cj27*sj29*x1110))+((sj29*x1111))+(((-1.0)*cj29*x1112))+(((0.1)*cj29))+(((-1.0)*cj29*sj27*x1110))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j29)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; if( IKabs(((((3.11526479750779)*cj27*py))+(((-3.11526479750779)*px*sj27)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*py*sj27))+(((-0.778816199376947)*cj27*px)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((3.11526479750779)*cj27*py))+(((-3.11526479750779)*px*sj27))))+IKsqr(((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*py*sj27))+(((-0.778816199376947)*cj27*px))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2(((((3.11526479750779)*cj27*py))+(((-3.11526479750779)*px*sj27))), ((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*py*sj27))+(((-0.778816199376947)*cj27*px)))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[5]; IkReal x1114=IKcos(j30); IkReal x1115=((1.0)*py); IkReal x1116=(cj27*px); IkReal x1117=((0.321)*x1114); evalcond[0]=((((0.4)*sj28))+((sj28*x1117))+pz); evalcond[1]=((((-1.0)*cj27*x1115))+((px*sj27))+(((0.321)*(IKsin(j30))))); evalcond[2]=((0.253041)+(((-1.0)*pp))+(((0.2)*py*sj27))+(((0.2)*x1116))+(((0.2568)*x1114))); evalcond[3]=((0.1)+((cj28*x1117))+(((-1.0)*sj27*x1115))+(((0.4)*cj28))+(((-1.0)*x1116))); evalcond[4]=((0.4)+(((-1.0)*cj28*x1116))+(((-1.0)*cj28*sj27*x1115))+x1117+(((0.1)*cj28))+((pz*sj28))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j29)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; if( IKabs(((((-3.11526479750779)*cj27*py))+(((3.11526479750779)*px*sj27)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*py*sj27))+(((-0.778816199376947)*cj27*px)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-3.11526479750779)*cj27*py))+(((3.11526479750779)*px*sj27))))+IKsqr(((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*py*sj27))+(((-0.778816199376947)*cj27*px))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2(((((-3.11526479750779)*cj27*py))+(((3.11526479750779)*px*sj27))), ((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*py*sj27))+(((-0.778816199376947)*cj27*px)))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[5]; IkReal x1118=IKcos(j30); IkReal x1119=((1.0)*py); IkReal x1120=(cj27*px); IkReal x1121=((0.321)*x1118); evalcond[0]=((((0.4)*sj28))+((sj28*x1121))+pz); evalcond[1]=((((-1.0)*cj27*x1119))+(((-0.321)*(IKsin(j30))))+((px*sj27))); evalcond[2]=((0.253041)+(((-1.0)*pp))+(((0.2)*x1120))+(((0.2)*py*sj27))+(((0.2568)*x1118))); evalcond[3]=((0.1)+(((-1.0)*sj27*x1119))+(((0.4)*cj28))+(((-1.0)*x1120))+((cj28*x1121))); evalcond[4]=((0.4)+(((-1.0)*cj28*sj27*x1119))+x1121+(((-1.0)*cj28*x1120))+(((0.1)*cj28))+((pz*sj28))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j30] } } while(0); if( bgotonextstatement ) { } } } } } } } } } } } else { { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; CheckValue<IkReal> x1127=IKPowWithIntegerCheck(sj29,-1); if(!x1127.valid){ continue; } IkReal x1122=x1127.value; IkReal x1123=((0.00311526479750779)*x1122); IkReal x1124=(cj28*cj29); IkReal x1125=((1000.0)*cj27*py); IkReal x1126=((1000.0)*px*sj27); CheckValue<IkReal> x1128=IKPowWithIntegerCheck(sj28,-1); if(!x1128.valid){ continue; } if( IKabs((x1123*((x1125+(((-1.0)*x1126)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs((x1123*(x1128.value)*(((((-400.0)*sj28*sj29))+((x1124*x1126))+(((-1000.0)*pz*sj29))+(((-1.0)*x1124*x1125)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((x1123*((x1125+(((-1.0)*x1126))))))+IKsqr((x1123*(x1128.value)*(((((-400.0)*sj28*sj29))+((x1124*x1126))+(((-1000.0)*pz*sj29))+(((-1.0)*x1124*x1125))))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2((x1123*((x1125+(((-1.0)*x1126))))), (x1123*(x1128.value)*(((((-400.0)*sj28*sj29))+((x1124*x1126))+(((-1000.0)*pz*sj29))+(((-1.0)*x1124*x1125)))))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[6]; IkReal x1129=IKsin(j30); IkReal x1130=IKcos(j30); IkReal x1131=((1.0)*py); IkReal x1132=(cj29*sj28); IkReal x1133=(cj27*px); IkReal x1134=(cj28*cj29); IkReal x1135=(py*sj27); IkReal x1136=(px*sj27); IkReal x1137=((0.321)*x1129); IkReal x1138=((0.321)*x1130); evalcond[0]=(x1136+((sj29*x1137))+(((-1.0)*cj27*x1131))); evalcond[1]=((0.253041)+(((-1.0)*pp))+(((0.2)*x1133))+(((0.2)*x1135))+(((0.2568)*x1130))); evalcond[2]=((((0.4)*sj28))+((sj28*x1138))+((x1134*x1137))+pz); evalcond[3]=((0.4)+x1138+(((-1.0)*cj28*x1133))+(((0.1)*cj28))+((pz*sj28))+(((-1.0)*cj28*sj27*x1131))); evalcond[4]=((0.1)+(((0.4)*cj28))+(((-1.0)*x1132*x1137))+(((-1.0)*sj27*x1131))+(((-1.0)*x1133))+((cj28*x1138))); evalcond[5]=(x1137+((sj29*x1136))+(((-0.1)*x1132))+((pz*x1134))+(((-1.0)*cj27*sj29*x1131))+((x1132*x1135))+((x1132*x1133))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; IkReal x1139=((250.0)*sj28); IkReal x1140=(py*sj27); IkReal x1141=(cj27*px); CheckValue<IkReal> x1142=IKPowWithIntegerCheck(cj28,-1); if(!x1142.valid){ continue; } CheckValue<IkReal> x1143=IKPowWithIntegerCheck(cj29,-1); if(!x1143.valid){ continue; } if( IKabs(((0.00311526479750779)*(x1142.value)*(x1143.value)*(((((-1000.0)*pz))+(((-83.69875)*sj28))+(((-1250.0)*pp*sj28))+((x1139*x1141))+((x1139*x1140)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*x1140))+(((-0.778816199376947)*x1141)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((0.00311526479750779)*(x1142.value)*(x1143.value)*(((((-1000.0)*pz))+(((-83.69875)*sj28))+(((-1250.0)*pp*sj28))+((x1139*x1141))+((x1139*x1140))))))+IKsqr(((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*x1140))+(((-0.778816199376947)*x1141))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2(((0.00311526479750779)*(x1142.value)*(x1143.value)*(((((-1000.0)*pz))+(((-83.69875)*sj28))+(((-1250.0)*pp*sj28))+((x1139*x1141))+((x1139*x1140))))), ((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*x1140))+(((-0.778816199376947)*x1141)))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[6]; IkReal x1144=IKsin(j30); IkReal x1145=IKcos(j30); IkReal x1146=((1.0)*py); IkReal x1147=(cj29*sj28); IkReal x1148=(cj27*px); IkReal x1149=(cj28*cj29); IkReal x1150=(py*sj27); IkReal x1151=(px*sj27); IkReal x1152=((0.321)*x1144); IkReal x1153=((0.321)*x1145); evalcond[0]=(x1151+((sj29*x1152))+(((-1.0)*cj27*x1146))); evalcond[1]=((0.253041)+(((0.2)*x1150))+(((-1.0)*pp))+(((0.2)*x1148))+(((0.2568)*x1145))); evalcond[2]=((((0.4)*sj28))+((x1149*x1152))+((sj28*x1153))+pz); evalcond[3]=((0.4)+x1153+(((-1.0)*cj28*sj27*x1146))+(((-1.0)*cj28*x1148))+(((0.1)*cj28))+((pz*sj28))); evalcond[4]=((0.1)+(((0.4)*cj28))+((cj28*x1153))+(((-1.0)*x1148))+(((-1.0)*x1147*x1152))+(((-1.0)*sj27*x1146))); evalcond[5]=(x1152+((pz*x1149))+((sj29*x1151))+(((-1.0)*cj27*sj29*x1146))+(((-0.1)*x1147))+((x1147*x1150))+((x1147*x1148))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j30array[1], cj30array[1], sj30array[1]; bool j30valid[1]={false}; _nj30 = 1; CheckValue<IkReal> x1154=IKPowWithIntegerCheck(sj29,-1); if(!x1154.valid){ continue; } if( IKabs(((0.00311526479750779)*(x1154.value)*(((((1000.0)*cj27*py))+(((-1000.0)*px*sj27)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*py*sj27))+(((-0.778816199376947)*cj27*px)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((0.00311526479750779)*(x1154.value)*(((((1000.0)*cj27*py))+(((-1000.0)*px*sj27))))))+IKsqr(((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*py*sj27))+(((-0.778816199376947)*cj27*px))))-1) <= IKFAST_SINCOS_THRESH ) continue; j30array[0]=IKatan2(((0.00311526479750779)*(x1154.value)*(((((1000.0)*cj27*py))+(((-1000.0)*px*sj27))))), ((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*py*sj27))+(((-0.778816199376947)*cj27*px)))); sj30array[0]=IKsin(j30array[0]); cj30array[0]=IKcos(j30array[0]); if( j30array[0] > IKPI ) { j30array[0]-=IK2PI; } else if( j30array[0] < -IKPI ) { j30array[0]+=IK2PI; } j30valid[0] = true; for(int ij30 = 0; ij30 < 1; ++ij30) { if( !j30valid[ij30] ) { continue; } _ij30[0] = ij30; _ij30[1] = -1; for(int iij30 = ij30+1; iij30 < 1; ++iij30) { if( j30valid[iij30] && IKabs(cj30array[ij30]-cj30array[iij30]) < IKFAST_SOLUTION_THRESH && IKabs(sj30array[ij30]-sj30array[iij30]) < IKFAST_SOLUTION_THRESH ) { j30valid[iij30]=false; _ij30[1] = iij30; break; } } j30 = j30array[ij30]; cj30 = cj30array[ij30]; sj30 = sj30array[ij30]; { IkReal evalcond[6]; IkReal x1155=IKsin(j30); IkReal x1156=IKcos(j30); IkReal x1157=((1.0)*py); IkReal x1158=(cj29*sj28); IkReal x1159=(cj27*px); IkReal x1160=(cj28*cj29); IkReal x1161=(py*sj27); IkReal x1162=(px*sj27); IkReal x1163=((0.321)*x1155); IkReal x1164=((0.321)*x1156); evalcond[0]=(x1162+(((-1.0)*cj27*x1157))+((sj29*x1163))); evalcond[1]=((0.253041)+(((0.2)*x1159))+(((0.2568)*x1156))+(((-1.0)*pp))+(((0.2)*x1161))); evalcond[2]=((((0.4)*sj28))+pz+((x1160*x1163))+((sj28*x1164))); evalcond[3]=((0.4)+x1164+(((-1.0)*cj28*sj27*x1157))+(((-1.0)*cj28*x1159))+(((0.1)*cj28))+((pz*sj28))); evalcond[4]=((0.1)+(((-1.0)*sj27*x1157))+(((-1.0)*x1158*x1163))+(((0.4)*cj28))+(((-1.0)*x1159))+((cj28*x1164))); evalcond[5]=(x1163+((x1158*x1159))+(((-1.0)*cj27*sj29*x1157))+(((-0.1)*x1158))+((pz*x1160))+((x1158*x1161))+((sj29*x1162))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } } } } } return solutions.GetNumSolutions()>0; } inline void rotationfunction0(IkSolutionListBase<IkReal>& solutions) { for(int rotationiter = 0; rotationiter < 1; ++rotationiter) { IkReal x204=(sj27*sj29); IkReal x205=(cj27*sj29); IkReal x206=(cj28*sj29); IkReal x207=(cj28*cj30); IkReal x208=((1.0)*sj30); IkReal x209=((1.0)*cj29); IkReal x210=(cj29*x208); IkReal x211=((1.0)*cj30*sj28); IkReal x212=((((-1.0)*x207*x209))+((sj28*sj30))); IkReal x213=((((-1.0)*sj27*x209))+((sj28*x205))); IkReal x214=(((sj28*x204))+((cj27*cj29))); IkReal x215=(x207+(((-1.0)*sj28*x210))); IkReal x216=(cj27*x215); IkReal x217=((((-1.0)*cj30*sj28*x209))+(((-1.0)*cj28*x208))); IkReal x218=((((-1.0)*cj28*x210))+(((-1.0)*x211))); IkReal x219=(cj27*x217); IkReal x220=(((sj27*x215))+((sj30*x205))); IkReal x221=(x216+(((-1.0)*sj30*x204))); IkReal x222=(((sj27*x217))+((cj30*x205))); IkReal x223=(x219+(((-1.0)*cj30*x204))); new_r00=(((r10*x222))+((r00*((x219+(((-1.0)*cj30*x204))))))+((r20*x212))); new_r01=(((r21*x212))+((r01*x223))+((r11*x222))); new_r02=(((r12*x222))+((r22*x212))+((r02*x223))); new_r10=(((r20*x206))+((r00*x213))+((r10*x214))); new_r11=(((r11*x214))+((r21*x206))+((r01*x213))); new_r12=(((r22*x206))+((r12*x214))+((r02*x213))); new_r20=(((r00*x221))+((r10*x220))+((r20*x218))); new_r21=(((r21*x218))+((r01*x221))+((r11*x220))); new_r22=(((r12*x220))+((r02*(((((-1.0)*x204*x208))+x216))))+((r22*x218))); { IkReal j32array[2], cj32array[2], sj32array[2]; bool j32valid[2]={false}; _nj32 = 2; cj32array[0]=new_r22; if( cj32array[0] >= -1-IKFAST_SINCOS_THRESH && cj32array[0] <= 1+IKFAST_SINCOS_THRESH ) { j32valid[0] = j32valid[1] = true; j32array[0] = IKacos(cj32array[0]); sj32array[0] = IKsin(j32array[0]); cj32array[1] = cj32array[0]; j32array[1] = -j32array[0]; sj32array[1] = -sj32array[0]; } else if( isnan(cj32array[0]) ) { // probably any value will work j32valid[0] = true; cj32array[0] = 1; sj32array[0] = 0; j32array[0] = 0; } for(int ij32 = 0; ij32 < 2; ++ij32) { if( !j32valid[ij32] ) { continue; } _ij32[0] = ij32; _ij32[1] = -1; for(int iij32 = ij32+1; iij32 < 2; ++iij32) { if( j32valid[iij32] && IKabs(cj32array[ij32]-cj32array[iij32]) < IKFAST_SOLUTION_THRESH && IKabs(sj32array[ij32]-sj32array[iij32]) < IKFAST_SOLUTION_THRESH ) { j32valid[iij32]=false; _ij32[1] = iij32; break; } } j32 = j32array[ij32]; cj32 = cj32array[ij32]; sj32 = sj32array[ij32]; { IkReal j31eval[3]; j31eval[0]=sj32; j31eval[1]=IKsign(sj32); j31eval[2]=((IKabs(new_r12))+(IKabs(new_r02))); if( IKabs(j31eval[0]) < 0.0000010000000000 || IKabs(j31eval[1]) < 0.0000010000000000 || IKabs(j31eval[2]) < 0.0000010000000000 ) { { IkReal j33eval[3]; j33eval[0]=sj32; j33eval[1]=IKsign(sj32); j33eval[2]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(j33eval[0]) < 0.0000010000000000 || IKabs(j33eval[1]) < 0.0000010000000000 || IKabs(j33eval[2]) < 0.0000010000000000 ) { { IkReal j31eval[2]; j31eval[0]=new_r12; j31eval[1]=sj32; if( IKabs(j31eval[0]) < 0.0000010000000000 || IKabs(j31eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[5]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j32))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r12; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; IkReal j33mul = 1; j33=0; j31mul=-1.0; if( IKabs(((-1.0)*new_r01)) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r00) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r01))+IKsqr(new_r00)-1) <= IKFAST_SINCOS_THRESH ) continue; j31=IKatan2(((-1.0)*new_r01), new_r00); { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].fmul = j31mul; vinfos[5].freeind = 0; vinfos[5].maxsolutions = 0; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].fmul = j33mul; vinfos[7].freeind = 0; vinfos[7].maxsolutions = 0; std::vector<int> vfree(1); vfree[0] = 7; solutions.AddSolution(vinfos,vfree); } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j32)))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r12; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; IkReal j33mul = 1; j33=0; j31mul=1.0; if( IKabs(((-1.0)*new_r01)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r00)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r01))+IKsqr(((-1.0)*new_r00))-1) <= IKFAST_SINCOS_THRESH ) continue; j31=IKatan2(((-1.0)*new_r01), ((-1.0)*new_r00)); { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].fmul = j31mul; vinfos[5].freeind = 0; vinfos[5].maxsolutions = 0; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].fmul = j33mul; vinfos[7].freeind = 0; vinfos[7].maxsolutions = 0; std::vector<int> vfree(1); vfree[0] = 7; solutions.AddSolution(vinfos,vfree); } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r12))+(IKabs(new_r02))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j31eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; IkReal x224=new_r22*new_r22; IkReal x225=((16.0)*new_r10); IkReal x226=((16.0)*new_r01); IkReal x227=((16.0)*new_r22); IkReal x228=((8.0)*new_r11); IkReal x229=((8.0)*new_r00); IkReal x230=(x224*x225); IkReal x231=(x224*x226); j31eval[0]=((IKabs((((new_r11*x227))+(((16.0)*new_r00))+(((-32.0)*new_r00*x224)))))+(IKabs(((((32.0)*new_r11))+(((-16.0)*new_r11*x224))+(((-1.0)*new_r00*x227)))))+(IKabs(((((-1.0)*x231))+x226)))+(IKabs(((((-1.0)*x230))+x225)))+(IKabs((((x224*x228))+(((-1.0)*new_r22*x229)))))+(IKabs((x231+(((-1.0)*x226)))))+(IKabs((x230+(((-1.0)*x225)))))+(IKabs((((new_r22*x228))+(((-1.0)*x229)))))); if( IKabs(j31eval[0]) < 0.0000000100000000 ) { continue; // no branches [j31, j33] } else { IkReal op[4+1], zeror[4]; int numroots; IkReal j31evalpoly[1]; IkReal x232=new_r22*new_r22; IkReal x233=((16.0)*new_r10); IkReal x234=(new_r11*new_r22); IkReal x235=(x232*x233); IkReal x236=((((8.0)*x234))+(((-8.0)*new_r00))); op[0]=x236; op[1]=((((-1.0)*x235))+x233); op[2]=((((16.0)*new_r00))+(((16.0)*x234))+(((-32.0)*new_r00*x232))); op[3]=((((-1.0)*x233))+x235); op[4]=x236; polyroots4(op,zeror,numroots); IkReal j31array[4], cj31array[4], sj31array[4], tempj31array[1]; int numsolutions = 0; for(int ij31 = 0; ij31 < numroots; ++ij31) { IkReal htj31 = zeror[ij31]; tempj31array[0]=((2.0)*(atan(htj31))); for(int kj31 = 0; kj31 < 1; ++kj31) { j31array[numsolutions] = tempj31array[kj31]; if( j31array[numsolutions] > IKPI ) { j31array[numsolutions]-=IK2PI; } else if( j31array[numsolutions] < -IKPI ) { j31array[numsolutions]+=IK2PI; } sj31array[numsolutions] = IKsin(j31array[numsolutions]); cj31array[numsolutions] = IKcos(j31array[numsolutions]); numsolutions++; } } bool j31valid[4]={true,true,true,true}; _nj31 = 4; for(int ij31 = 0; ij31 < numsolutions; ++ij31) { if( !j31valid[ij31] ) { continue; } j31 = j31array[ij31]; cj31 = cj31array[ij31]; sj31 = sj31array[ij31]; htj31 = IKtan(j31/2); IkReal x237=((16.0)*new_r01); IkReal x238=new_r22*new_r22; IkReal x239=(new_r00*new_r22); IkReal x240=((8.0)*x239); IkReal x241=(new_r11*x238); IkReal x242=(x237*x238); IkReal x243=((8.0)*x241); j31evalpoly[0]=((((htj31*htj31)*(((((32.0)*new_r11))+(((-16.0)*x241))+(((-16.0)*x239))))))+(((htj31*htj31*htj31*htj31)*((x243+(((-1.0)*x240))))))+x243+(((-1.0)*x240))+(((htj31*htj31*htj31)*(((((-1.0)*x237))+x242))))+((htj31*((x237+(((-1.0)*x242))))))); if( IKabs(j31evalpoly[0]) > 0.0000001000000000 ) { continue; } _ij31[0] = ij31; _ij31[1] = -1; for(int iij31 = ij31+1; iij31 < numsolutions; ++iij31) { if( j31valid[iij31] && IKabs(cj31array[ij31]-cj31array[iij31]) < IKFAST_SOLUTION_THRESH && IKabs(sj31array[ij31]-sj31array[iij31]) < IKFAST_SOLUTION_THRESH ) { j31valid[iij31]=false; _ij31[1] = iij31; break; } } { IkReal j33eval[3]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; IkReal x244=cj31*cj31; IkReal x245=(cj31*new_r22); IkReal x246=((-1.0)+(((-1.0)*x244*(new_r22*new_r22)))+x244); j33eval[0]=x246; j33eval[1]=IKsign(x246); j33eval[2]=((IKabs(((((-1.0)*new_r00*x245))+((new_r01*sj31)))))+(IKabs((((new_r00*sj31))+((new_r01*x245)))))); if( IKabs(j33eval[0]) < 0.0000010000000000 || IKabs(j33eval[1]) < 0.0000010000000000 || IKabs(j33eval[2]) < 0.0000010000000000 ) { { IkReal j33eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; j33eval[0]=new_r22; if( IKabs(j33eval[0]) < 0.0000010000000000 ) { { IkReal j33eval[2]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; IkReal x247=new_r22*new_r22; j33eval[0]=((((-1.0)*cj31))+((cj31*x247))); j33eval[1]=(((sj31*x247))+(((-1.0)*sj31))); if( IKabs(j33eval[0]) < 0.0000010000000000 || IKabs(j33eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j31)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; if( IKabs(((-1.0)*new_r00)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r01)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r00))+IKsqr(((-1.0)*new_r01))-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2(((-1.0)*new_r00), ((-1.0)*new_r01)); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[4]; IkReal x248=IKsin(j33); IkReal x249=IKcos(j33); evalcond[0]=x248; evalcond[1]=((-1.0)*x249); evalcond[2]=((((-1.0)*x248))+(((-1.0)*new_r00))); evalcond[3]=((((-1.0)*x249))+(((-1.0)*new_r01))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j31)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; if( IKabs(new_r00) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r01) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r00)+IKsqr(new_r01)-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2(new_r00, new_r01); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[4]; IkReal x250=IKsin(j33); IkReal x251=IKcos(j33); evalcond[0]=x250; evalcond[1]=((-1.0)*x251); evalcond[2]=(new_r00+(((-1.0)*x250))); evalcond[3]=(new_r01+(((-1.0)*x251))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j31))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; if( IKabs(new_r10) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r11) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r10)+IKsqr(new_r11)-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2(new_r10, new_r11); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[4]; IkReal x252=IKsin(j33); IkReal x253=IKcos(j33); evalcond[0]=x252; evalcond[1]=((-1.0)*x253); evalcond[2]=(new_r10+(((-1.0)*x252))); evalcond[3]=(new_r11+(((-1.0)*x253))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j31)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; if( IKabs(((-1.0)*new_r10)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r11)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r10))+IKsqr(((-1.0)*new_r11))-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2(((-1.0)*new_r10), ((-1.0)*new_r11)); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[4]; IkReal x254=IKsin(j33); IkReal x255=IKcos(j33); evalcond[0]=x254; evalcond[1]=((-1.0)*x255); evalcond[2]=((((-1.0)*new_r10))+(((-1.0)*x254))); evalcond[3]=((((-1.0)*new_r11))+(((-1.0)*x255))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { CheckValue<IkReal> x256=IKPowWithIntegerCheck(((1.0)+(((-1.0)*(new_r22*new_r22)))),-1); if(!x256.valid){ continue; } if((x256.value) < -0.00001) continue; IkReal gconst36=((-1.0)*(IKsqrt(x256.value))); evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.0)+(IKsign(sj31)))))+(IKabs((cj31+(((-1.0)*gconst36)))))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; if((((1.0)+(((-1.0)*(gconst36*gconst36))))) < -0.00001) continue; sj31=IKsqrt(((1.0)+(((-1.0)*(gconst36*gconst36))))); cj31=gconst36; if( (gconst36) < -1-IKFAST_SINCOS_THRESH || (gconst36) > 1+IKFAST_SINCOS_THRESH ) continue; j31=IKacos(gconst36); CheckValue<IkReal> x257=IKPowWithIntegerCheck(((1.0)+(((-1.0)*(new_r22*new_r22)))),-1); if(!x257.valid){ continue; } if((x257.value) < -0.00001) continue; IkReal gconst36=((-1.0)*(IKsqrt(x257.value))); j33eval[0]=((IKabs(new_r11))+(IKabs(new_r10))); if( IKabs(j33eval[0]) < 0.0000010000000000 ) { { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; if((((1.0)+(((-1.0)*(gconst36*gconst36))))) < -0.00001) continue; CheckValue<IkReal> x258=IKPowWithIntegerCheck(gconst36,-1); if(!x258.valid){ continue; } if( IKabs((((gconst36*new_r10))+(((-1.0)*new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst36*gconst36)))))))))) < IKFAST_ATAN2_MAGTHRESH && IKabs((new_r11*(x258.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((((gconst36*new_r10))+(((-1.0)*new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst36*gconst36))))))))))+IKsqr((new_r11*(x258.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2((((gconst36*new_r10))+(((-1.0)*new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst36*gconst36))))))))), (new_r11*(x258.value))); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[8]; IkReal x259=IKcos(j33); IkReal x260=IKsin(j33); IkReal x261=((1.0)*x259); IkReal x262=((1.0)*x260); if((((1.0)+(((-1.0)*(gconst36*gconst36))))) < -0.00001) continue; IkReal x263=IKsqrt(((1.0)+(((-1.0)*(gconst36*gconst36))))); IkReal x264=((1.0)*x263); evalcond[0]=x260; evalcond[1]=((-1.0)*x259); evalcond[2]=((((-1.0)*gconst36*x261))+new_r11); evalcond[3]=((((-1.0)*gconst36*x262))+new_r10); evalcond[4]=(((x259*x263))+new_r01); evalcond[5]=(((x260*x263))+new_r00); evalcond[6]=((((-1.0)*new_r00*x264))+((gconst36*new_r10))+(((-1.0)*x262))); evalcond[7]=((((-1.0)*new_r01*x264))+((gconst36*new_r11))+(((-1.0)*x261))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } else { { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; CheckValue<IkReal> x265 = IKatan2WithCheck(IkReal(new_r10),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x265.valid){ continue; } CheckValue<IkReal> x266=IKPowWithIntegerCheck(IKsign(gconst36),-1); if(!x266.valid){ continue; } j33array[0]=((-1.5707963267949)+(x265.value)+(((1.5707963267949)*(x266.value)))); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[8]; IkReal x267=IKcos(j33); IkReal x268=IKsin(j33); IkReal x269=((1.0)*x267); IkReal x270=((1.0)*x268); if((((1.0)+(((-1.0)*(gconst36*gconst36))))) < -0.00001) continue; IkReal x271=IKsqrt(((1.0)+(((-1.0)*(gconst36*gconst36))))); IkReal x272=((1.0)*x271); evalcond[0]=x268; evalcond[1]=((-1.0)*x267); evalcond[2]=((((-1.0)*gconst36*x269))+new_r11); evalcond[3]=((((-1.0)*gconst36*x270))+new_r10); evalcond[4]=(new_r01+((x267*x271))); evalcond[5]=(new_r00+((x268*x271))); evalcond[6]=((((-1.0)*new_r00*x272))+((gconst36*new_r10))+(((-1.0)*x270))); evalcond[7]=((((-1.0)*new_r01*x272))+((gconst36*new_r11))+(((-1.0)*x269))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { CheckValue<IkReal> x273=IKPowWithIntegerCheck(((1.0)+(((-1.0)*(new_r22*new_r22)))),-1); if(!x273.valid){ continue; } if((x273.value) < -0.00001) continue; IkReal gconst36=((-1.0)*(IKsqrt(x273.value))); evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.0)+(IKsign(sj31)))))+(IKabs((cj31+(((-1.0)*gconst36)))))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; if((((1.0)+(((-1.0)*(gconst36*gconst36))))) < -0.00001) continue; sj31=((-1.0)*(IKsqrt(((1.0)+(((-1.0)*(gconst36*gconst36))))))); cj31=gconst36; if( (gconst36) < -1-IKFAST_SINCOS_THRESH || (gconst36) > 1+IKFAST_SINCOS_THRESH ) continue; j31=((-1.0)*(IKacos(gconst36))); CheckValue<IkReal> x274=IKPowWithIntegerCheck(((1.0)+(((-1.0)*(new_r22*new_r22)))),-1); if(!x274.valid){ continue; } if((x274.value) < -0.00001) continue; IkReal gconst36=((-1.0)*(IKsqrt(x274.value))); j33eval[0]=((IKabs(new_r11))+(IKabs(new_r10))); if( IKabs(j33eval[0]) < 0.0000010000000000 ) { { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; if((((1.0)+(((-1.0)*(gconst36*gconst36))))) < -0.00001) continue; CheckValue<IkReal> x275=IKPowWithIntegerCheck(gconst36,-1); if(!x275.valid){ continue; } if( IKabs((((new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst36*gconst36))))))))+((gconst36*new_r10)))) < IKFAST_ATAN2_MAGTHRESH && IKabs((new_r11*(x275.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((((new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst36*gconst36))))))))+((gconst36*new_r10))))+IKsqr((new_r11*(x275.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2((((new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst36*gconst36))))))))+((gconst36*new_r10))), (new_r11*(x275.value))); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[8]; IkReal x276=IKcos(j33); IkReal x277=IKsin(j33); IkReal x278=((1.0)*x277); IkReal x279=((1.0)*x276); if((((1.0)+(((-1.0)*(gconst36*gconst36))))) < -0.00001) continue; IkReal x280=IKsqrt(((1.0)+(((-1.0)*(gconst36*gconst36))))); evalcond[0]=x277; evalcond[1]=((-1.0)*x276); evalcond[2]=((((-1.0)*gconst36*x279))+new_r11); evalcond[3]=((((-1.0)*gconst36*x278))+new_r10); evalcond[4]=(new_r01+(((-1.0)*x279*x280))); evalcond[5]=(new_r00+(((-1.0)*x278*x280))); evalcond[6]=(((gconst36*new_r10))+(((-1.0)*x278))+((new_r00*x280))); evalcond[7]=(((gconst36*new_r11))+(((-1.0)*x279))+((new_r01*x280))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } else { { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; CheckValue<IkReal> x281 = IKatan2WithCheck(IkReal(new_r10),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x281.valid){ continue; } CheckValue<IkReal> x282=IKPowWithIntegerCheck(IKsign(gconst36),-1); if(!x282.valid){ continue; } j33array[0]=((-1.5707963267949)+(x281.value)+(((1.5707963267949)*(x282.value)))); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[8]; IkReal x283=IKcos(j33); IkReal x284=IKsin(j33); IkReal x285=((1.0)*x284); IkReal x286=((1.0)*x283); if((((1.0)+(((-1.0)*(gconst36*gconst36))))) < -0.00001) continue; IkReal x287=IKsqrt(((1.0)+(((-1.0)*(gconst36*gconst36))))); evalcond[0]=x284; evalcond[1]=((-1.0)*x283); evalcond[2]=((((-1.0)*gconst36*x286))+new_r11); evalcond[3]=((((-1.0)*gconst36*x285))+new_r10); evalcond[4]=(new_r01+(((-1.0)*x286*x287))); evalcond[5]=((((-1.0)*x285*x287))+new_r00); evalcond[6]=(((gconst36*new_r10))+(((-1.0)*x285))+((new_r00*x287))); evalcond[7]=(((gconst36*new_r11))+(((-1.0)*x286))+((new_r01*x287))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { CheckValue<IkReal> x288=IKPowWithIntegerCheck(((1.0)+(((-1.0)*(new_r22*new_r22)))),-1); if(!x288.valid){ continue; } if((x288.value) < -0.00001) continue; IkReal gconst37=IKsqrt(x288.value); evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.0)+(IKsign(sj31)))))+(IKabs((cj31+(((-1.0)*gconst37)))))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; if((((1.0)+(((-1.0)*(gconst37*gconst37))))) < -0.00001) continue; sj31=IKsqrt(((1.0)+(((-1.0)*(gconst37*gconst37))))); cj31=gconst37; if( (gconst37) < -1-IKFAST_SINCOS_THRESH || (gconst37) > 1+IKFAST_SINCOS_THRESH ) continue; j31=IKacos(gconst37); CheckValue<IkReal> x289=IKPowWithIntegerCheck(((1.0)+(((-1.0)*(new_r22*new_r22)))),-1); if(!x289.valid){ continue; } if((x289.value) < -0.00001) continue; IkReal gconst37=IKsqrt(x289.value); j33eval[0]=((IKabs(new_r11))+(IKabs(new_r10))); if( IKabs(j33eval[0]) < 0.0000010000000000 ) { { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; if((((1.0)+(((-1.0)*(gconst37*gconst37))))) < -0.00001) continue; CheckValue<IkReal> x290=IKPowWithIntegerCheck(gconst37,-1); if(!x290.valid){ continue; } if( IKabs(((((-1.0)*new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst37*gconst37))))))))+((gconst37*new_r10)))) < IKFAST_ATAN2_MAGTHRESH && IKabs((new_r11*(x290.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst37*gconst37))))))))+((gconst37*new_r10))))+IKsqr((new_r11*(x290.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2(((((-1.0)*new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst37*gconst37))))))))+((gconst37*new_r10))), (new_r11*(x290.value))); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[8]; IkReal x291=IKcos(j33); IkReal x292=IKsin(j33); IkReal x293=((1.0)*x292); IkReal x294=((1.0)*x291); if((((1.0)+(((-1.0)*(gconst37*gconst37))))) < -0.00001) continue; IkReal x295=IKsqrt(((1.0)+(((-1.0)*(gconst37*gconst37))))); IkReal x296=((1.0)*x295); evalcond[0]=x292; evalcond[1]=((-1.0)*x291); evalcond[2]=((((-1.0)*gconst37*x294))+new_r11); evalcond[3]=((((-1.0)*gconst37*x293))+new_r10); evalcond[4]=(((x291*x295))+new_r01); evalcond[5]=(new_r00+((x292*x295))); evalcond[6]=((((-1.0)*x293))+((gconst37*new_r10))+(((-1.0)*new_r00*x296))); evalcond[7]=((((-1.0)*new_r01*x296))+(((-1.0)*x294))+((gconst37*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } else { { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; CheckValue<IkReal> x297=IKPowWithIntegerCheck(IKsign(gconst37),-1); if(!x297.valid){ continue; } CheckValue<IkReal> x298 = IKatan2WithCheck(IkReal(new_r10),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x298.valid){ continue; } j33array[0]=((-1.5707963267949)+(((1.5707963267949)*(x297.value)))+(x298.value)); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[8]; IkReal x299=IKcos(j33); IkReal x300=IKsin(j33); IkReal x301=((1.0)*x300); IkReal x302=((1.0)*x299); if((((1.0)+(((-1.0)*(gconst37*gconst37))))) < -0.00001) continue; IkReal x303=IKsqrt(((1.0)+(((-1.0)*(gconst37*gconst37))))); IkReal x304=((1.0)*x303); evalcond[0]=x300; evalcond[1]=((-1.0)*x299); evalcond[2]=(new_r11+(((-1.0)*gconst37*x302))); evalcond[3]=(new_r10+(((-1.0)*gconst37*x301))); evalcond[4]=(((x299*x303))+new_r01); evalcond[5]=(new_r00+((x300*x303))); evalcond[6]=(((gconst37*new_r10))+(((-1.0)*new_r00*x304))+(((-1.0)*x301))); evalcond[7]=((((-1.0)*new_r01*x304))+((gconst37*new_r11))+(((-1.0)*x302))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { CheckValue<IkReal> x305=IKPowWithIntegerCheck(((1.0)+(((-1.0)*(new_r22*new_r22)))),-1); if(!x305.valid){ continue; } if((x305.value) < -0.00001) continue; IkReal gconst37=IKsqrt(x305.value); evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.0)+(IKsign(sj31)))))+(IKabs((cj31+(((-1.0)*gconst37)))))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; if((((1.0)+(((-1.0)*(gconst37*gconst37))))) < -0.00001) continue; sj31=((-1.0)*(IKsqrt(((1.0)+(((-1.0)*(gconst37*gconst37))))))); cj31=gconst37; if( (gconst37) < -1-IKFAST_SINCOS_THRESH || (gconst37) > 1+IKFAST_SINCOS_THRESH ) continue; j31=((-1.0)*(IKacos(gconst37))); CheckValue<IkReal> x306=IKPowWithIntegerCheck(((1.0)+(((-1.0)*(new_r22*new_r22)))),-1); if(!x306.valid){ continue; } if((x306.value) < -0.00001) continue; IkReal gconst37=IKsqrt(x306.value); j33eval[0]=((IKabs(new_r11))+(IKabs(new_r10))); if( IKabs(j33eval[0]) < 0.0000010000000000 ) { { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; if((((1.0)+(((-1.0)*(gconst37*gconst37))))) < -0.00001) continue; CheckValue<IkReal> x307=IKPowWithIntegerCheck(gconst37,-1); if(!x307.valid){ continue; } if( IKabs((((gconst37*new_r10))+((new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst37*gconst37)))))))))) < IKFAST_ATAN2_MAGTHRESH && IKabs((new_r11*(x307.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((((gconst37*new_r10))+((new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst37*gconst37))))))))))+IKsqr((new_r11*(x307.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2((((gconst37*new_r10))+((new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst37*gconst37))))))))), (new_r11*(x307.value))); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[8]; IkReal x308=IKcos(j33); IkReal x309=IKsin(j33); IkReal x310=((1.0)*x309); IkReal x311=((1.0)*x308); if((((1.0)+(((-1.0)*(gconst37*gconst37))))) < -0.00001) continue; IkReal x312=IKsqrt(((1.0)+(((-1.0)*(gconst37*gconst37))))); evalcond[0]=x309; evalcond[1]=((-1.0)*x308); evalcond[2]=((((-1.0)*gconst37*x311))+new_r11); evalcond[3]=((((-1.0)*gconst37*x310))+new_r10); evalcond[4]=(new_r01+(((-1.0)*x311*x312))); evalcond[5]=((((-1.0)*x310*x312))+new_r00); evalcond[6]=(((new_r00*x312))+(((-1.0)*x310))+((gconst37*new_r10))); evalcond[7]=(((new_r01*x312))+(((-1.0)*x311))+((gconst37*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } else { { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; CheckValue<IkReal> x313=IKPowWithIntegerCheck(IKsign(gconst37),-1); if(!x313.valid){ continue; } CheckValue<IkReal> x314 = IKatan2WithCheck(IkReal(new_r10),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x314.valid){ continue; } j33array[0]=((-1.5707963267949)+(((1.5707963267949)*(x313.value)))+(x314.value)); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[8]; IkReal x315=IKcos(j33); IkReal x316=IKsin(j33); IkReal x317=((1.0)*x316); IkReal x318=((1.0)*x315); if((((1.0)+(((-1.0)*(gconst37*gconst37))))) < -0.00001) continue; IkReal x319=IKsqrt(((1.0)+(((-1.0)*(gconst37*gconst37))))); evalcond[0]=x316; evalcond[1]=((-1.0)*x315); evalcond[2]=((((-1.0)*gconst37*x318))+new_r11); evalcond[3]=((((-1.0)*gconst37*x317))+new_r10); evalcond[4]=((((-1.0)*x318*x319))+new_r01); evalcond[5]=(new_r00+(((-1.0)*x317*x319))); evalcond[6]=(((new_r00*x319))+(((-1.0)*x317))+((gconst37*new_r10))); evalcond[7]=(((new_r01*x319))+(((-1.0)*x318))+((gconst37*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j33] } } while(0); if( bgotonextstatement ) { } } } } } } } } } } } else { { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; IkReal x320=new_r22*new_r22; CheckValue<IkReal> x321=IKPowWithIntegerCheck(((((-1.0)*cj31))+((cj31*x320))),-1); if(!x321.valid){ continue; } CheckValue<IkReal> x322=IKPowWithIntegerCheck((((sj31*x320))+(((-1.0)*sj31))),-1); if(!x322.valid){ continue; } if( IKabs(((x321.value)*(((((-1.0)*new_r01*new_r22))+(((-1.0)*new_r10)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((x322.value)*((((new_r10*new_r22))+new_r01)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((x321.value)*(((((-1.0)*new_r01*new_r22))+(((-1.0)*new_r10))))))+IKsqr(((x322.value)*((((new_r10*new_r22))+new_r01))))-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2(((x321.value)*(((((-1.0)*new_r01*new_r22))+(((-1.0)*new_r10))))), ((x322.value)*((((new_r10*new_r22))+new_r01)))); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[10]; IkReal x323=IKsin(j33); IkReal x324=IKcos(j33); IkReal x325=((1.0)*cj31); IkReal x326=(new_r22*sj31); IkReal x327=((1.0)*sj31); IkReal x328=(cj31*new_r00); IkReal x329=(cj31*new_r01); IkReal x330=((1.0)*x324); IkReal x331=(new_r22*x324); IkReal x332=(new_r22*x323); evalcond[0]=(((new_r11*sj31))+x332+x329); evalcond[1]=(((new_r22*x329))+x323+((new_r11*x326))); evalcond[2]=(((cj31*new_r10))+(((-1.0)*x323))+(((-1.0)*new_r00*x327))); evalcond[3]=(((cj31*new_r11))+(((-1.0)*new_r01*x327))+(((-1.0)*x330))); evalcond[4]=(((sj31*x324))+((cj31*x332))+new_r01); evalcond[5]=((((-1.0)*new_r22*x330))+x328+((new_r10*sj31))); evalcond[6]=(((sj31*x323))+new_r00+(((-1.0)*x325*x331))); evalcond[7]=(((x323*x326))+new_r11+(((-1.0)*x324*x325))); evalcond[8]=(((new_r22*x328))+(((-1.0)*x330))+((new_r10*x326))); evalcond[9]=((((-1.0)*x323*x325))+new_r10+(((-1.0)*x326*x330))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; IkReal x333=((1.0)*new_r01); CheckValue<IkReal> x334=IKPowWithIntegerCheck(new_r22,-1); if(!x334.valid){ continue; } if( IKabs(((x334.value)*(((((-1.0)*new_r11*sj31))+(((-1.0)*cj31*x333)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs((((cj31*new_r11))+(((-1.0)*sj31*x333)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((x334.value)*(((((-1.0)*new_r11*sj31))+(((-1.0)*cj31*x333))))))+IKsqr((((cj31*new_r11))+(((-1.0)*sj31*x333))))-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2(((x334.value)*(((((-1.0)*new_r11*sj31))+(((-1.0)*cj31*x333))))), (((cj31*new_r11))+(((-1.0)*sj31*x333)))); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[10]; IkReal x335=IKsin(j33); IkReal x336=IKcos(j33); IkReal x337=((1.0)*cj31); IkReal x338=(new_r22*sj31); IkReal x339=((1.0)*sj31); IkReal x340=(cj31*new_r00); IkReal x341=(cj31*new_r01); IkReal x342=((1.0)*x336); IkReal x343=(new_r22*x336); IkReal x344=(new_r22*x335); evalcond[0]=(((new_r11*sj31))+x341+x344); evalcond[1]=(((new_r22*x341))+((new_r11*x338))+x335); evalcond[2]=(((cj31*new_r10))+(((-1.0)*x335))+(((-1.0)*new_r00*x339))); evalcond[3]=(((cj31*new_r11))+(((-1.0)*x342))+(((-1.0)*new_r01*x339))); evalcond[4]=(((sj31*x336))+new_r01+((cj31*x344))); evalcond[5]=(x340+((new_r10*sj31))+(((-1.0)*new_r22*x342))); evalcond[6]=(((sj31*x335))+(((-1.0)*x337*x343))+new_r00); evalcond[7]=(((x335*x338))+new_r11+(((-1.0)*x336*x337))); evalcond[8]=(((new_r22*x340))+((new_r10*x338))+(((-1.0)*x342))); evalcond[9]=(new_r10+(((-1.0)*x338*x342))+(((-1.0)*x335*x337))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; IkReal x345=cj31*cj31; IkReal x346=(cj31*new_r22); CheckValue<IkReal> x347 = IKatan2WithCheck(IkReal((((new_r00*sj31))+((new_r01*x346)))),IkReal((((new_r01*sj31))+(((-1.0)*new_r00*x346)))),IKFAST_ATAN2_MAGTHRESH); if(!x347.valid){ continue; } CheckValue<IkReal> x348=IKPowWithIntegerCheck(IKsign(((-1.0)+(((-1.0)*x345*(new_r22*new_r22)))+x345)),-1); if(!x348.valid){ continue; } j33array[0]=((-1.5707963267949)+(x347.value)+(((1.5707963267949)*(x348.value)))); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[10]; IkReal x349=IKsin(j33); IkReal x350=IKcos(j33); IkReal x351=((1.0)*cj31); IkReal x352=(new_r22*sj31); IkReal x353=((1.0)*sj31); IkReal x354=(cj31*new_r00); IkReal x355=(cj31*new_r01); IkReal x356=((1.0)*x350); IkReal x357=(new_r22*x350); IkReal x358=(new_r22*x349); evalcond[0]=(((new_r11*sj31))+x355+x358); evalcond[1]=(((new_r22*x355))+x349+((new_r11*x352))); evalcond[2]=(((cj31*new_r10))+(((-1.0)*new_r00*x353))+(((-1.0)*x349))); evalcond[3]=(((cj31*new_r11))+(((-1.0)*x356))+(((-1.0)*new_r01*x353))); evalcond[4]=(((sj31*x350))+((cj31*x358))+new_r01); evalcond[5]=((((-1.0)*new_r22*x356))+x354+((new_r10*sj31))); evalcond[6]=(((sj31*x349))+(((-1.0)*x351*x357))+new_r00); evalcond[7]=(((x349*x352))+new_r11+(((-1.0)*x350*x351))); evalcond[8]=(((new_r22*x354))+(((-1.0)*x356))+((new_r10*x352))); evalcond[9]=((((-1.0)*x349*x351))+new_r10+(((-1.0)*x352*x356))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j31, j33] } } while(0); if( bgotonextstatement ) { } } } } } } else { { IkReal j31array[1], cj31array[1], sj31array[1]; bool j31valid[1]={false}; _nj31 = 1; CheckValue<IkReal> x360=IKPowWithIntegerCheck(sj32,-1); if(!x360.valid){ continue; } IkReal x359=x360.value; CheckValue<IkReal> x361=IKPowWithIntegerCheck(new_r12,-1); if(!x361.valid){ continue; } if( IKabs((x359*(x361.value)*(((1.0)+(((-1.0)*(new_r02*new_r02)))+(((-1.0)*(cj32*cj32))))))) < IKFAST_ATAN2_MAGTHRESH && IKabs((new_r02*x359)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((x359*(x361.value)*(((1.0)+(((-1.0)*(new_r02*new_r02)))+(((-1.0)*(cj32*cj32)))))))+IKsqr((new_r02*x359))-1) <= IKFAST_SINCOS_THRESH ) continue; j31array[0]=IKatan2((x359*(x361.value)*(((1.0)+(((-1.0)*(new_r02*new_r02)))+(((-1.0)*(cj32*cj32)))))), (new_r02*x359)); sj31array[0]=IKsin(j31array[0]); cj31array[0]=IKcos(j31array[0]); if( j31array[0] > IKPI ) { j31array[0]-=IK2PI; } else if( j31array[0] < -IKPI ) { j31array[0]+=IK2PI; } j31valid[0] = true; for(int ij31 = 0; ij31 < 1; ++ij31) { if( !j31valid[ij31] ) { continue; } _ij31[0] = ij31; _ij31[1] = -1; for(int iij31 = ij31+1; iij31 < 1; ++iij31) { if( j31valid[iij31] && IKabs(cj31array[ij31]-cj31array[iij31]) < IKFAST_SOLUTION_THRESH && IKabs(sj31array[ij31]-sj31array[iij31]) < IKFAST_SOLUTION_THRESH ) { j31valid[iij31]=false; _ij31[1] = iij31; break; } } j31 = j31array[ij31]; cj31 = cj31array[ij31]; sj31 = sj31array[ij31]; { IkReal evalcond[8]; IkReal x362=IKcos(j31); IkReal x363=IKsin(j31); IkReal x364=((1.0)*sj32); IkReal x365=(new_r02*x362); IkReal x366=(new_r12*x363); IkReal x367=(sj32*x362); IkReal x368=(sj32*x363); evalcond[0]=((((-1.0)*x362*x364))+new_r02); evalcond[1]=((((-1.0)*x363*x364))+new_r12); evalcond[2]=((((-1.0)*new_r02*x363))+((new_r12*x362))); evalcond[3]=((((-1.0)*x364))+x365+x366); evalcond[4]=(((new_r00*x367))+((cj32*new_r20))+((new_r10*x368))); evalcond[5]=(((new_r01*x367))+((cj32*new_r21))+((new_r11*x368))); evalcond[6]=((-1.0)+((sj32*x365))+((sj32*x366))+((cj32*new_r22))); evalcond[7]=((((-1.0)*new_r22*x364))+((cj32*x365))+((cj32*x366))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { IkReal j33eval[3]; j33eval[0]=sj32; j33eval[1]=IKsign(sj32); j33eval[2]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(j33eval[0]) < 0.0000010000000000 || IKabs(j33eval[1]) < 0.0000010000000000 || IKabs(j33eval[2]) < 0.0000010000000000 ) { { IkReal j33eval[2]; j33eval[0]=sj32; j33eval[1]=sj31; if( IKabs(j33eval[0]) < 0.0000010000000000 || IKabs(j33eval[1]) < 0.0000010000000000 ) { { IkReal j33eval[3]; j33eval[0]=cj32; j33eval[1]=sj31; j33eval[2]=sj32; if( IKabs(j33eval[0]) < 0.0000010000000000 || IKabs(j33eval[1]) < 0.0000010000000000 || IKabs(j33eval[2]) < 0.0000010000000000 ) { { IkReal evalcond[5]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j32)))), 6.28318530717959))); evalcond[1]=new_r22; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; if( IKabs(new_r21) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r21)+IKsqr(((-1.0)*new_r20))-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2(new_r21, ((-1.0)*new_r20)); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[8]; IkReal x369=IKcos(j33); IkReal x370=IKsin(j33); IkReal x371=((1.0)*sj31); IkReal x372=((1.0)*x370); IkReal x373=((1.0)*x369); evalcond[0]=(x369+new_r20); evalcond[1]=((((-1.0)*x372))+new_r21); evalcond[2]=(new_r01+((sj31*x369))); evalcond[3]=(((sj31*x370))+new_r00); evalcond[4]=((((-1.0)*cj31*x373))+new_r11); evalcond[5]=((((-1.0)*cj31*x372))+new_r10); evalcond[6]=((((-1.0)*new_r00*x371))+((cj31*new_r10))+(((-1.0)*x372))); evalcond[7]=(((cj31*new_r11))+(((-1.0)*x373))+(((-1.0)*new_r01*x371))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j32)))), 6.28318530717959))); evalcond[1]=new_r22; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; if( IKabs(((-1.0)*new_r21)) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r20) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r21))+IKsqr(new_r20)-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2(((-1.0)*new_r21), new_r20); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[8]; IkReal x374=IKcos(j33); IkReal x375=IKsin(j33); IkReal x376=((1.0)*sj31); IkReal x377=((1.0)*x374); IkReal x378=((1.0)*x375); evalcond[0]=(x375+new_r21); evalcond[1]=((((-1.0)*x377))+new_r20); evalcond[2]=(((sj31*x374))+new_r01); evalcond[3]=(((sj31*x375))+new_r00); evalcond[4]=((((-1.0)*cj31*x377))+new_r11); evalcond[5]=((((-1.0)*cj31*x378))+new_r10); evalcond[6]=((((-1.0)*new_r00*x376))+((cj31*new_r10))+(((-1.0)*x378))); evalcond[7]=(((cj31*new_r11))+(((-1.0)*x377))+(((-1.0)*new_r01*x376))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j31))), 6.28318530717959))); evalcond[1]=new_r12; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; if( IKabs(new_r10) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r11) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r10)+IKsqr(new_r11)-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2(new_r10, new_r11); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[8]; IkReal x379=IKcos(j33); IkReal x380=IKsin(j33); IkReal x381=((1.0)*sj32); IkReal x382=((1.0)*x379); evalcond[0]=(new_r20+((sj32*x379))); evalcond[1]=((((-1.0)*x380))+new_r10); evalcond[2]=((((-1.0)*x382))+new_r11); evalcond[3]=(new_r01+((cj32*x380))); evalcond[4]=((((-1.0)*x380*x381))+new_r21); evalcond[5]=((((-1.0)*cj32*x382))+new_r00); evalcond[6]=(((cj32*new_r01))+x380+(((-1.0)*new_r21*x381))); evalcond[7]=(((cj32*new_r00))+(((-1.0)*new_r20*x381))+(((-1.0)*x382))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j31)))), 6.28318530717959))); evalcond[1]=new_r12; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33eval[3]; sj31=0; cj31=-1.0; j31=3.14159265358979; j33eval[0]=sj32; j33eval[1]=IKsign(sj32); j33eval[2]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(j33eval[0]) < 0.0000010000000000 || IKabs(j33eval[1]) < 0.0000010000000000 || IKabs(j33eval[2]) < 0.0000010000000000 ) { { IkReal j33eval[1]; sj31=0; cj31=-1.0; j31=3.14159265358979; j33eval[0]=sj32; if( IKabs(j33eval[0]) < 0.0000010000000000 ) { { IkReal j33eval[2]; sj31=0; cj31=-1.0; j31=3.14159265358979; j33eval[0]=cj32; j33eval[1]=sj32; if( IKabs(j33eval[0]) < 0.0000010000000000 || IKabs(j33eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[4]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j32)))), 6.28318530717959))); evalcond[1]=new_r22; evalcond[2]=new_r01; evalcond[3]=new_r00; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; if( IKabs(new_r21) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r21)+IKsqr(((-1.0)*new_r20))-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2(new_r21, ((-1.0)*new_r20)); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[4]; IkReal x383=IKcos(j33); IkReal x384=((1.0)*(IKsin(j33))); evalcond[0]=(x383+new_r20); evalcond[1]=((((-1.0)*x384))+new_r21); evalcond[2]=((((-1.0)*x384))+(((-1.0)*new_r10))); evalcond[3]=((((-1.0)*x383))+(((-1.0)*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j32)))), 6.28318530717959))); evalcond[1]=new_r22; evalcond[2]=new_r01; evalcond[3]=new_r00; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; if( IKabs(((-1.0)*new_r21)) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r20) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r21))+IKsqr(new_r20)-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2(((-1.0)*new_r21), new_r20); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[4]; IkReal x385=IKsin(j33); IkReal x386=((1.0)*(IKcos(j33))); evalcond[0]=(x385+new_r21); evalcond[1]=((((-1.0)*x386))+new_r20); evalcond[2]=((((-1.0)*x385))+(((-1.0)*new_r10))); evalcond[3]=((((-1.0)*x386))+(((-1.0)*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j32))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; if( IKabs(new_r01) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r11)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r01)+IKsqr(((-1.0)*new_r11))-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2(new_r01, ((-1.0)*new_r11)); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[4]; IkReal x387=IKsin(j33); IkReal x388=((1.0)*(IKcos(j33))); evalcond[0]=(x387+(((-1.0)*new_r01))); evalcond[1]=((((-1.0)*x387))+(((-1.0)*new_r10))); evalcond[2]=((((-1.0)*x388))+(((-1.0)*new_r11))); evalcond[3]=((((-1.0)*x388))+(((-1.0)*new_r00))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j32)))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; if( IKabs(((-1.0)*new_r10)) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r00) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r10))+IKsqr(new_r00)-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2(((-1.0)*new_r10), new_r00); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[4]; IkReal x389=IKcos(j33); IkReal x390=((1.0)*(IKsin(j33))); evalcond[0]=(x389+(((-1.0)*new_r00))); evalcond[1]=((((-1.0)*x390))+(((-1.0)*new_r10))); evalcond[2]=((((-1.0)*x389))+(((-1.0)*new_r11))); evalcond[3]=((((-1.0)*x390))+(((-1.0)*new_r01))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; if( IKabs(((-1.0)*new_r10)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r11)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r10))+IKsqr(((-1.0)*new_r11))-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2(((-1.0)*new_r10), ((-1.0)*new_r11)); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[6]; IkReal x391=IKsin(j33); IkReal x392=IKcos(j33); IkReal x393=((-1.0)*x392); evalcond[0]=x391; evalcond[1]=(new_r22*x391); evalcond[2]=x393; evalcond[3]=(new_r22*x393); evalcond[4]=((((-1.0)*x391))+(((-1.0)*new_r10))); evalcond[5]=((((-1.0)*x392))+(((-1.0)*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j33] } } while(0); if( bgotonextstatement ) { } } } } } } } } else { { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; CheckValue<IkReal> x394=IKPowWithIntegerCheck(cj32,-1); if(!x394.valid){ continue; } CheckValue<IkReal> x395=IKPowWithIntegerCheck(sj32,-1); if(!x395.valid){ continue; } if( IKabs((new_r01*(x394.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20*(x395.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((new_r01*(x394.value)))+IKsqr(((-1.0)*new_r20*(x395.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2((new_r01*(x394.value)), ((-1.0)*new_r20*(x395.value))); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[8]; IkReal x396=IKsin(j33); IkReal x397=IKcos(j33); IkReal x398=((1.0)*new_r00); IkReal x399=((1.0)*sj32); IkReal x400=((1.0)*new_r01); IkReal x401=((1.0)*x397); evalcond[0]=(((sj32*x397))+new_r20); evalcond[1]=((((-1.0)*x396*x399))+new_r21); evalcond[2]=((((-1.0)*x396))+(((-1.0)*new_r10))); evalcond[3]=((((-1.0)*new_r11))+(((-1.0)*x401))); evalcond[4]=(((cj32*x396))+(((-1.0)*x400))); evalcond[5]=((((-1.0)*x398))+(((-1.0)*cj32*x401))); evalcond[6]=((((-1.0)*new_r21*x399))+x396+(((-1.0)*cj32*x400))); evalcond[7]=((((-1.0)*cj32*x398))+(((-1.0)*x401))+(((-1.0)*new_r20*x399))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; CheckValue<IkReal> x402=IKPowWithIntegerCheck(sj32,-1); if(!x402.valid){ continue; } if( IKabs((new_r21*(x402.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r11)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((new_r21*(x402.value)))+IKsqr(((-1.0)*new_r11))-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2((new_r21*(x402.value)), ((-1.0)*new_r11)); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[8]; IkReal x403=IKsin(j33); IkReal x404=IKcos(j33); IkReal x405=((1.0)*new_r00); IkReal x406=((1.0)*sj32); IkReal x407=((1.0)*new_r01); IkReal x408=((1.0)*x404); evalcond[0]=(new_r20+((sj32*x404))); evalcond[1]=((((-1.0)*x403*x406))+new_r21); evalcond[2]=((((-1.0)*new_r10))+(((-1.0)*x403))); evalcond[3]=((((-1.0)*new_r11))+(((-1.0)*x408))); evalcond[4]=(((cj32*x403))+(((-1.0)*x407))); evalcond[5]=((((-1.0)*cj32*x408))+(((-1.0)*x405))); evalcond[6]=(x403+(((-1.0)*new_r21*x406))+(((-1.0)*cj32*x407))); evalcond[7]=((((-1.0)*new_r20*x406))+(((-1.0)*cj32*x405))+(((-1.0)*x408))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; CheckValue<IkReal> x409=IKPowWithIntegerCheck(IKsign(sj32),-1); if(!x409.valid){ continue; } CheckValue<IkReal> x410 = IKatan2WithCheck(IkReal(new_r21),IkReal(((-1.0)*new_r20)),IKFAST_ATAN2_MAGTHRESH); if(!x410.valid){ continue; } j33array[0]=((-1.5707963267949)+(((1.5707963267949)*(x409.value)))+(x410.value)); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[8]; IkReal x411=IKsin(j33); IkReal x412=IKcos(j33); IkReal x413=((1.0)*new_r00); IkReal x414=((1.0)*sj32); IkReal x415=((1.0)*new_r01); IkReal x416=((1.0)*x412); evalcond[0]=(((sj32*x412))+new_r20); evalcond[1]=((((-1.0)*x411*x414))+new_r21); evalcond[2]=((((-1.0)*new_r10))+(((-1.0)*x411))); evalcond[3]=((((-1.0)*new_r11))+(((-1.0)*x416))); evalcond[4]=(((cj32*x411))+(((-1.0)*x415))); evalcond[5]=((((-1.0)*cj32*x416))+(((-1.0)*x413))); evalcond[6]=(x411+(((-1.0)*new_r21*x414))+(((-1.0)*cj32*x415))); evalcond[7]=((((-1.0)*new_r20*x414))+(((-1.0)*cj32*x413))+(((-1.0)*x416))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j32))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r12; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; IkReal x417=((1.0)*sj31); if( IKabs(((((-1.0)*cj31*new_r01))+(((-1.0)*new_r00*x417)))) < IKFAST_ATAN2_MAGTHRESH && IKabs((((cj31*new_r00))+(((-1.0)*new_r01*x417)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*cj31*new_r01))+(((-1.0)*new_r00*x417))))+IKsqr((((cj31*new_r00))+(((-1.0)*new_r01*x417))))-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2(((((-1.0)*cj31*new_r01))+(((-1.0)*new_r00*x417))), (((cj31*new_r00))+(((-1.0)*new_r01*x417)))); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[8]; IkReal x418=IKsin(j33); IkReal x419=IKcos(j33); IkReal x420=((1.0)*sj31); IkReal x421=((1.0)*x419); IkReal x422=(sj31*x418); IkReal x423=((1.0)*x418); IkReal x424=(cj31*x421); evalcond[0]=(((cj31*new_r01))+((new_r11*sj31))+x418); evalcond[1]=(((sj31*x419))+((cj31*x418))+new_r01); evalcond[2]=(((cj31*new_r00))+(((-1.0)*x421))+((new_r10*sj31))); evalcond[3]=(((cj31*new_r10))+(((-1.0)*new_r00*x420))+(((-1.0)*x423))); evalcond[4]=(((cj31*new_r11))+(((-1.0)*x421))+(((-1.0)*new_r01*x420))); evalcond[5]=((((-1.0)*x424))+x422+new_r00); evalcond[6]=((((-1.0)*x424))+x422+new_r11); evalcond[7]=((((-1.0)*cj31*x423))+(((-1.0)*x419*x420))+new_r10); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j32)))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r12; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; IkReal x425=((1.0)*sj31); if( IKabs(((((-1.0)*new_r00*x425))+((cj31*new_r01)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((((-1.0)*cj31*new_r00))+(((-1.0)*new_r01*x425)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*new_r00*x425))+((cj31*new_r01))))+IKsqr(((((-1.0)*cj31*new_r00))+(((-1.0)*new_r01*x425))))-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2(((((-1.0)*new_r00*x425))+((cj31*new_r01))), ((((-1.0)*cj31*new_r00))+(((-1.0)*new_r01*x425)))); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[8]; IkReal x426=IKsin(j33); IkReal x427=IKcos(j33); IkReal x428=((1.0)*sj31); IkReal x429=((1.0)*x426); IkReal x430=(sj31*x427); IkReal x431=((1.0)*x427); IkReal x432=(cj31*x429); evalcond[0]=(((cj31*new_r00))+((new_r10*sj31))+x427); evalcond[1]=(((cj31*new_r01))+(((-1.0)*x429))+((new_r11*sj31))); evalcond[2]=(((cj31*x427))+((sj31*x426))+new_r00); evalcond[3]=(((cj31*new_r10))+(((-1.0)*new_r00*x428))+(((-1.0)*x429))); evalcond[4]=((((-1.0)*x431))+((cj31*new_r11))+(((-1.0)*new_r01*x428))); evalcond[5]=((((-1.0)*x432))+x430+new_r01); evalcond[6]=((((-1.0)*x432))+x430+new_r10); evalcond[7]=((((-1.0)*cj31*x431))+(((-1.0)*x426*x428))+new_r11); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33eval[1]; new_r21=0; new_r20=0; new_r02=0; new_r12=0; j33eval[0]=1.0; if( IKabs(j33eval[0]) < 0.0000000100000000 ) { continue; // no branches [j33] } else { IkReal op[2+1], zeror[2]; int numroots; op[0]=1.0; op[1]=0; op[2]=-1.0; polyroots2(op,zeror,numroots); IkReal j33array[2], cj33array[2], sj33array[2], tempj33array[1]; int numsolutions = 0; for(int ij33 = 0; ij33 < numroots; ++ij33) { IkReal htj33 = zeror[ij33]; tempj33array[0]=((2.0)*(atan(htj33))); for(int kj33 = 0; kj33 < 1; ++kj33) { j33array[numsolutions] = tempj33array[kj33]; if( j33array[numsolutions] > IKPI ) { j33array[numsolutions]-=IK2PI; } else if( j33array[numsolutions] < -IKPI ) { j33array[numsolutions]+=IK2PI; } sj33array[numsolutions] = IKsin(j33array[numsolutions]); cj33array[numsolutions] = IKcos(j33array[numsolutions]); numsolutions++; } } bool j33valid[2]={true,true}; _nj33 = 2; for(int ij33 = 0; ij33 < numsolutions; ++ij33) { if( !j33valid[ij33] ) { continue; } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; htj33 = IKtan(j33/2); _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < numsolutions; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j33] } } while(0); if( bgotonextstatement ) { } } } } } } } } } } else { { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; CheckValue<IkReal> x434=IKPowWithIntegerCheck(sj32,-1); if(!x434.valid){ continue; } IkReal x433=x434.value; CheckValue<IkReal> x435=IKPowWithIntegerCheck(cj32,-1); if(!x435.valid){ continue; } CheckValue<IkReal> x436=IKPowWithIntegerCheck(sj31,-1); if(!x436.valid){ continue; } if( IKabs((x433*(x435.value)*(x436.value)*(((((-1.0)*new_r11*sj32))+(((-1.0)*cj31*new_r20)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20*x433)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((x433*(x435.value)*(x436.value)*(((((-1.0)*new_r11*sj32))+(((-1.0)*cj31*new_r20))))))+IKsqr(((-1.0)*new_r20*x433))-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2((x433*(x435.value)*(x436.value)*(((((-1.0)*new_r11*sj32))+(((-1.0)*cj31*new_r20))))), ((-1.0)*new_r20*x433)); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[12]; IkReal x437=IKsin(j33); IkReal x438=IKcos(j33); IkReal x439=(cj31*cj32); IkReal x440=((1.0)*sj31); IkReal x441=(new_r11*sj31); IkReal x442=(new_r10*sj31); IkReal x443=((1.0)*sj32); IkReal x444=((1.0)*x438); IkReal x445=((1.0)*x437); IkReal x446=(sj31*x437); evalcond[0]=(((sj32*x438))+new_r20); evalcond[1]=((((-1.0)*x437*x443))+new_r21); evalcond[2]=(((cj31*new_r01))+((cj32*x437))+x441); evalcond[3]=((((-1.0)*x445))+(((-1.0)*new_r00*x440))+((cj31*new_r10))); evalcond[4]=((((-1.0)*x444))+((cj31*new_r11))+(((-1.0)*new_r01*x440))); evalcond[5]=(((sj31*x438))+new_r01+((x437*x439))); evalcond[6]=(((cj31*new_r00))+x442+(((-1.0)*cj32*x444))); evalcond[7]=((((-1.0)*x439*x444))+x446+new_r00); evalcond[8]=(((cj32*x446))+(((-1.0)*cj31*x444))+new_r11); evalcond[9]=((((-1.0)*cj32*x438*x440))+(((-1.0)*cj31*x445))+new_r10); evalcond[10]=(((new_r01*x439))+((cj32*x441))+x437+(((-1.0)*new_r21*x443))); evalcond[11]=((((-1.0)*x444))+((new_r00*x439))+((cj32*x442))+(((-1.0)*new_r20*x443))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; CheckValue<IkReal> x448=IKPowWithIntegerCheck(sj32,-1); if(!x448.valid){ continue; } IkReal x447=x448.value; CheckValue<IkReal> x449=IKPowWithIntegerCheck(sj31,-1); if(!x449.valid){ continue; } if( IKabs((new_r21*x447)) < IKFAST_ATAN2_MAGTHRESH && IKabs((x447*(x449.value)*(((((-1.0)*cj31*cj32*new_r21))+(((-1.0)*new_r01*sj32)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((new_r21*x447))+IKsqr((x447*(x449.value)*(((((-1.0)*cj31*cj32*new_r21))+(((-1.0)*new_r01*sj32))))))-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2((new_r21*x447), (x447*(x449.value)*(((((-1.0)*cj31*cj32*new_r21))+(((-1.0)*new_r01*sj32)))))); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[12]; IkReal x450=IKsin(j33); IkReal x451=IKcos(j33); IkReal x452=(cj31*cj32); IkReal x453=((1.0)*sj31); IkReal x454=(new_r11*sj31); IkReal x455=(new_r10*sj31); IkReal x456=((1.0)*sj32); IkReal x457=((1.0)*x451); IkReal x458=((1.0)*x450); IkReal x459=(sj31*x450); evalcond[0]=(((sj32*x451))+new_r20); evalcond[1]=((((-1.0)*x450*x456))+new_r21); evalcond[2]=(((cj31*new_r01))+x454+((cj32*x450))); evalcond[3]=(((cj31*new_r10))+(((-1.0)*new_r00*x453))+(((-1.0)*x458))); evalcond[4]=(((cj31*new_r11))+(((-1.0)*new_r01*x453))+(((-1.0)*x457))); evalcond[5]=(((x450*x452))+new_r01+((sj31*x451))); evalcond[6]=((((-1.0)*cj32*x457))+((cj31*new_r00))+x455); evalcond[7]=(x459+(((-1.0)*x452*x457))+new_r00); evalcond[8]=(new_r11+((cj32*x459))+(((-1.0)*cj31*x457))); evalcond[9]=((((-1.0)*cj32*x451*x453))+new_r10+(((-1.0)*cj31*x458))); evalcond[10]=((((-1.0)*new_r21*x456))+((new_r01*x452))+x450+((cj32*x454))); evalcond[11]=((((-1.0)*new_r20*x456))+((new_r00*x452))+(((-1.0)*x457))+((cj32*x455))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; CheckValue<IkReal> x460=IKPowWithIntegerCheck(IKsign(sj32),-1); if(!x460.valid){ continue; } CheckValue<IkReal> x461 = IKatan2WithCheck(IkReal(new_r21),IkReal(((-1.0)*new_r20)),IKFAST_ATAN2_MAGTHRESH); if(!x461.valid){ continue; } j33array[0]=((-1.5707963267949)+(((1.5707963267949)*(x460.value)))+(x461.value)); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[12]; IkReal x462=IKsin(j33); IkReal x463=IKcos(j33); IkReal x464=(cj31*cj32); IkReal x465=((1.0)*sj31); IkReal x466=(new_r11*sj31); IkReal x467=(new_r10*sj31); IkReal x468=((1.0)*sj32); IkReal x469=((1.0)*x463); IkReal x470=((1.0)*x462); IkReal x471=(sj31*x462); evalcond[0]=(((sj32*x463))+new_r20); evalcond[1]=((((-1.0)*x462*x468))+new_r21); evalcond[2]=(((cj31*new_r01))+x466+((cj32*x462))); evalcond[3]=(((cj31*new_r10))+(((-1.0)*x470))+(((-1.0)*new_r00*x465))); evalcond[4]=(((cj31*new_r11))+(((-1.0)*new_r01*x465))+(((-1.0)*x469))); evalcond[5]=(((sj31*x463))+new_r01+((x462*x464))); evalcond[6]=(((cj31*new_r00))+(((-1.0)*cj32*x469))+x467); evalcond[7]=((((-1.0)*x464*x469))+x471+new_r00); evalcond[8]=(((cj32*x471))+new_r11+(((-1.0)*cj31*x469))); evalcond[9]=((((-1.0)*cj32*x463*x465))+(((-1.0)*cj31*x470))+new_r10); evalcond[10]=((((-1.0)*new_r21*x468))+((new_r01*x464))+x462+((cj32*x466))); evalcond[11]=(((new_r00*x464))+(((-1.0)*new_r20*x468))+(((-1.0)*x469))+((cj32*x467))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } } } } else { { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; CheckValue<IkReal> x472=IKPowWithIntegerCheck(IKsign(sj32),-1); if(!x472.valid){ continue; } CheckValue<IkReal> x473 = IKatan2WithCheck(IkReal(new_r21),IkReal(((-1.0)*new_r20)),IKFAST_ATAN2_MAGTHRESH); if(!x473.valid){ continue; } j33array[0]=((-1.5707963267949)+(((1.5707963267949)*(x472.value)))+(x473.value)); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[2]; evalcond[0]=(((sj32*(IKcos(j33))))+new_r20); evalcond[1]=((((-1.0)*sj32*(IKsin(j33))))+new_r21); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH ) { continue; } } { IkReal j31eval[3]; j31eval[0]=sj32; j31eval[1]=IKsign(sj32); j31eval[2]=((IKabs(new_r12))+(IKabs(new_r02))); if( IKabs(j31eval[0]) < 0.0000010000000000 || IKabs(j31eval[1]) < 0.0000010000000000 || IKabs(j31eval[2]) < 0.0000010000000000 ) { { IkReal j31eval[2]; j31eval[0]=cj33; j31eval[1]=sj32; if( IKabs(j31eval[0]) < 0.0000010000000000 || IKabs(j31eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[5]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j33)))), 6.28318530717959))); evalcond[1]=new_r20; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j31array[1], cj31array[1], sj31array[1]; bool j31valid[1]={false}; _nj31 = 1; if( IKabs(((-1.0)*new_r00)) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r10) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r00))+IKsqr(new_r10)-1) <= IKFAST_SINCOS_THRESH ) continue; j31array[0]=IKatan2(((-1.0)*new_r00), new_r10); sj31array[0]=IKsin(j31array[0]); cj31array[0]=IKcos(j31array[0]); if( j31array[0] > IKPI ) { j31array[0]-=IK2PI; } else if( j31array[0] < -IKPI ) { j31array[0]+=IK2PI; } j31valid[0] = true; for(int ij31 = 0; ij31 < 1; ++ij31) { if( !j31valid[ij31] ) { continue; } _ij31[0] = ij31; _ij31[1] = -1; for(int iij31 = ij31+1; iij31 < 1; ++iij31) { if( j31valid[iij31] && IKabs(cj31array[ij31]-cj31array[iij31]) < IKFAST_SOLUTION_THRESH && IKabs(sj31array[ij31]-sj31array[iij31]) < IKFAST_SOLUTION_THRESH ) { j31valid[iij31]=false; _ij31[1] = iij31; break; } } j31 = j31array[ij31]; cj31 = cj31array[ij31]; sj31 = sj31array[ij31]; { IkReal evalcond[18]; IkReal x474=IKsin(j31); IkReal x475=IKcos(j31); IkReal x476=((1.0)*new_r21); IkReal x477=(new_r21*x474); IkReal x478=(new_r22*x474); IkReal x479=(new_r00*x475); IkReal x480=(new_r02*x475); IkReal x481=((1.0)*x474); IkReal x482=(new_r01*x475); IkReal x483=((1.0)*x475); evalcond[0]=(x474+new_r00); evalcond[1]=(((new_r22*x475))+new_r01); evalcond[2]=(x478+new_r11); evalcond[3]=((((-1.0)*x483))+new_r10); evalcond[4]=((((-1.0)*x475*x476))+new_r02); evalcond[5]=(new_r12+(((-1.0)*x474*x476))); evalcond[6]=(((new_r10*x474))+x479); evalcond[7]=(((new_r12*x475))+(((-1.0)*new_r02*x481))); evalcond[8]=((((-1.0)*new_r01*x481))+((new_r11*x475))); evalcond[9]=(((new_r11*x474))+x482+new_r22); evalcond[10]=((-1.0)+(((-1.0)*new_r00*x481))+((new_r10*x475))); evalcond[11]=(((new_r10*x477))+((new_r21*x479))); evalcond[12]=(((new_r10*x478))+((new_r22*x479))); evalcond[13]=(((new_r12*x474))+(((-1.0)*x476))+x480); evalcond[14]=(((new_r11*x477))+((new_r21*x482))+((new_r21*new_r22))); evalcond[15]=((-1.0)+(new_r22*new_r22)+((new_r12*x477))+((new_r21*x480))); evalcond[16]=(((new_r12*x478))+(((-1.0)*new_r22*x476))+((new_r22*x480))); evalcond[17]=((1.0)+(((-1.0)*new_r21*x476))+((new_r11*x478))+((new_r22*x482))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[12]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[13]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[14]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[15]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[16]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[17]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j33)))), 6.28318530717959))); evalcond[1]=new_r20; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j31array[1], cj31array[1], sj31array[1]; bool j31valid[1]={false}; _nj31 = 1; if( IKabs(new_r00) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r10)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r00)+IKsqr(((-1.0)*new_r10))-1) <= IKFAST_SINCOS_THRESH ) continue; j31array[0]=IKatan2(new_r00, ((-1.0)*new_r10)); sj31array[0]=IKsin(j31array[0]); cj31array[0]=IKcos(j31array[0]); if( j31array[0] > IKPI ) { j31array[0]-=IK2PI; } else if( j31array[0] < -IKPI ) { j31array[0]+=IK2PI; } j31valid[0] = true; for(int ij31 = 0; ij31 < 1; ++ij31) { if( !j31valid[ij31] ) { continue; } _ij31[0] = ij31; _ij31[1] = -1; for(int iij31 = ij31+1; iij31 < 1; ++iij31) { if( j31valid[iij31] && IKabs(cj31array[ij31]-cj31array[iij31]) < IKFAST_SOLUTION_THRESH && IKabs(sj31array[ij31]-sj31array[iij31]) < IKFAST_SOLUTION_THRESH ) { j31valid[iij31]=false; _ij31[1] = iij31; break; } } j31 = j31array[ij31]; cj31 = cj31array[ij31]; sj31 = sj31array[ij31]; { IkReal evalcond[18]; IkReal x484=IKcos(j31); IkReal x485=IKsin(j31); IkReal x486=(new_r21*new_r22); IkReal x487=((1.0)*x484); IkReal x488=((1.0)*x485); IkReal x489=(new_r22*x485); IkReal x490=(new_r22*x484); evalcond[0]=(x484+new_r10); evalcond[1]=(((new_r21*x484))+new_r02); evalcond[2]=(((new_r21*x485))+new_r12); evalcond[3]=((((-1.0)*x488))+new_r00); evalcond[4]=(new_r01+(((-1.0)*new_r22*x487))); evalcond[5]=(new_r11+(((-1.0)*new_r22*x488))); evalcond[6]=(((new_r10*x485))+((new_r00*x484))); evalcond[7]=(((new_r12*x484))+(((-1.0)*new_r02*x488))); evalcond[8]=(((new_r02*x484))+((new_r12*x485))+new_r21); evalcond[9]=((((-1.0)*new_r01*x488))+((new_r11*x484))); evalcond[10]=((1.0)+(((-1.0)*new_r00*x488))+((new_r10*x484))); evalcond[11]=(((new_r10*x489))+((new_r00*x490))); evalcond[12]=(((new_r11*x485))+(((-1.0)*new_r22))+((new_r01*x484))); evalcond[13]=((((-1.0)*new_r10*new_r21*x488))+(((-1.0)*new_r00*new_r21*x487))); evalcond[14]=(((new_r02*x490))+((new_r12*x489))+x486); evalcond[15]=((-1.0)+((new_r11*x489))+(new_r21*new_r21)+((new_r01*x490))); evalcond[16]=((((-1.0)*new_r01*new_r21*x487))+x486+(((-1.0)*new_r11*new_r21*x488))); evalcond[17]=((-1.0)+(new_r22*new_r22)+(((-1.0)*new_r12*new_r21*x488))+(((-1.0)*new_r02*new_r21*x487))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[12]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[13]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[14]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[15]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[16]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[17]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j32))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r12; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j31array[1], cj31array[1], sj31array[1]; bool j31valid[1]={false}; _nj31 = 1; IkReal x491=((1.0)*new_r01); if( IKabs(((((-1.0)*new_r00*sj33))+(((-1.0)*cj33*x491)))) < IKFAST_ATAN2_MAGTHRESH && IKabs((((cj33*new_r00))+(((-1.0)*sj33*x491)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*new_r00*sj33))+(((-1.0)*cj33*x491))))+IKsqr((((cj33*new_r00))+(((-1.0)*sj33*x491))))-1) <= IKFAST_SINCOS_THRESH ) continue; j31array[0]=IKatan2(((((-1.0)*new_r00*sj33))+(((-1.0)*cj33*x491))), (((cj33*new_r00))+(((-1.0)*sj33*x491)))); sj31array[0]=IKsin(j31array[0]); cj31array[0]=IKcos(j31array[0]); if( j31array[0] > IKPI ) { j31array[0]-=IK2PI; } else if( j31array[0] < -IKPI ) { j31array[0]+=IK2PI; } j31valid[0] = true; for(int ij31 = 0; ij31 < 1; ++ij31) { if( !j31valid[ij31] ) { continue; } _ij31[0] = ij31; _ij31[1] = -1; for(int iij31 = ij31+1; iij31 < 1; ++iij31) { if( j31valid[iij31] && IKabs(cj31array[ij31]-cj31array[iij31]) < IKFAST_SOLUTION_THRESH && IKabs(sj31array[ij31]-sj31array[iij31]) < IKFAST_SOLUTION_THRESH ) { j31valid[iij31]=false; _ij31[1] = iij31; break; } } j31 = j31array[ij31]; cj31 = cj31array[ij31]; sj31 = sj31array[ij31]; { IkReal evalcond[8]; IkReal x492=IKsin(j31); IkReal x493=IKcos(j31); IkReal x494=((1.0)*cj33); IkReal x495=((1.0)*sj33); IkReal x496=(sj33*x492); IkReal x497=((1.0)*x492); IkReal x498=(x493*x494); evalcond[0]=(((new_r11*x492))+sj33+((new_r01*x493))); evalcond[1]=(((sj33*x493))+((cj33*x492))+new_r01); evalcond[2]=((((-1.0)*x498))+x496+new_r00); evalcond[3]=((((-1.0)*x498))+x496+new_r11); evalcond[4]=((((-1.0)*x494))+((new_r10*x492))+((new_r00*x493))); evalcond[5]=((((-1.0)*x493*x495))+new_r10+(((-1.0)*x492*x494))); evalcond[6]=((((-1.0)*new_r00*x497))+(((-1.0)*x495))+((new_r10*x493))); evalcond[7]=((((-1.0)*x494))+(((-1.0)*new_r01*x497))+((new_r11*x493))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j32)))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r12; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j31array[1], cj31array[1], sj31array[1]; bool j31valid[1]={false}; _nj31 = 1; IkReal x499=((1.0)*cj33); if( IKabs(((((-1.0)*new_r01*x499))+(((-1.0)*new_r00*sj33)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((((-1.0)*new_r00*x499))+((new_r01*sj33)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*new_r01*x499))+(((-1.0)*new_r00*sj33))))+IKsqr(((((-1.0)*new_r00*x499))+((new_r01*sj33))))-1) <= IKFAST_SINCOS_THRESH ) continue; j31array[0]=IKatan2(((((-1.0)*new_r01*x499))+(((-1.0)*new_r00*sj33))), ((((-1.0)*new_r00*x499))+((new_r01*sj33)))); sj31array[0]=IKsin(j31array[0]); cj31array[0]=IKcos(j31array[0]); if( j31array[0] > IKPI ) { j31array[0]-=IK2PI; } else if( j31array[0] < -IKPI ) { j31array[0]+=IK2PI; } j31valid[0] = true; for(int ij31 = 0; ij31 < 1; ++ij31) { if( !j31valid[ij31] ) { continue; } _ij31[0] = ij31; _ij31[1] = -1; for(int iij31 = ij31+1; iij31 < 1; ++iij31) { if( j31valid[iij31] && IKabs(cj31array[ij31]-cj31array[iij31]) < IKFAST_SOLUTION_THRESH && IKabs(sj31array[ij31]-sj31array[iij31]) < IKFAST_SOLUTION_THRESH ) { j31valid[iij31]=false; _ij31[1] = iij31; break; } } j31 = j31array[ij31]; cj31 = cj31array[ij31]; sj31 = sj31array[ij31]; { IkReal evalcond[8]; IkReal x500=IKcos(j31); IkReal x501=IKsin(j31); IkReal x502=((1.0)*sj33); IkReal x503=(cj33*x501); IkReal x504=(cj33*x500); IkReal x505=((1.0)*x501); IkReal x506=(x500*x502); evalcond[0]=(cj33+((new_r10*x501))+((new_r00*x500))); evalcond[1]=(((sj33*x501))+x504+new_r00); evalcond[2]=((((-1.0)*x506))+x503+new_r01); evalcond[3]=((((-1.0)*x506))+x503+new_r10); evalcond[4]=((((-1.0)*x502))+((new_r11*x501))+((new_r01*x500))); evalcond[5]=((((-1.0)*x501*x502))+new_r11+(((-1.0)*x504))); evalcond[6]=((((-1.0)*new_r00*x505))+(((-1.0)*x502))+((new_r10*x500))); evalcond[7]=((((-1.0)*new_r01*x505))+(((-1.0)*cj33))+((new_r11*x500))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r12))+(IKabs(new_r02))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j31eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; j31eval[0]=((IKabs(new_r11))+(IKabs(new_r01))); if( IKabs(j31eval[0]) < 0.0000010000000000 ) { { IkReal j31eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; j31eval[0]=((IKabs(new_r10))+(IKabs(new_r00))); if( IKabs(j31eval[0]) < 0.0000010000000000 ) { { IkReal j31eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; j31eval[0]=((IKabs((new_r11*new_r22)))+(IKabs((new_r01*new_r22)))); if( IKabs(j31eval[0]) < 0.0000010000000000 ) { continue; // no branches [j31] } else { { IkReal j31array[2], cj31array[2], sj31array[2]; bool j31valid[2]={false}; _nj31 = 2; CheckValue<IkReal> x508 = IKatan2WithCheck(IkReal((new_r01*new_r22)),IkReal((new_r11*new_r22)),IKFAST_ATAN2_MAGTHRESH); if(!x508.valid){ continue; } IkReal x507=x508.value; j31array[0]=((-1.0)*x507); sj31array[0]=IKsin(j31array[0]); cj31array[0]=IKcos(j31array[0]); j31array[1]=((3.14159265358979)+(((-1.0)*x507))); sj31array[1]=IKsin(j31array[1]); cj31array[1]=IKcos(j31array[1]); if( j31array[0] > IKPI ) { j31array[0]-=IK2PI; } else if( j31array[0] < -IKPI ) { j31array[0]+=IK2PI; } j31valid[0] = true; if( j31array[1] > IKPI ) { j31array[1]-=IK2PI; } else if( j31array[1] < -IKPI ) { j31array[1]+=IK2PI; } j31valid[1] = true; for(int ij31 = 0; ij31 < 2; ++ij31) { if( !j31valid[ij31] ) { continue; } _ij31[0] = ij31; _ij31[1] = -1; for(int iij31 = ij31+1; iij31 < 2; ++iij31) { if( j31valid[iij31] && IKabs(cj31array[ij31]-cj31array[iij31]) < IKFAST_SOLUTION_THRESH && IKabs(sj31array[ij31]-sj31array[iij31]) < IKFAST_SOLUTION_THRESH ) { j31valid[iij31]=false; _ij31[1] = iij31; break; } } j31 = j31array[ij31]; cj31 = cj31array[ij31]; sj31 = sj31array[ij31]; { IkReal evalcond[5]; IkReal x509=IKsin(j31); IkReal x510=IKcos(j31); IkReal x511=(new_r00*x510); IkReal x512=(new_r10*x509); IkReal x513=((1.0)*x509); evalcond[0]=(((new_r01*x510))+((new_r11*x509))); evalcond[1]=(x512+x511); evalcond[2]=(((new_r10*x510))+(((-1.0)*new_r00*x513))); evalcond[3]=(((new_r11*x510))+(((-1.0)*new_r01*x513))); evalcond[4]=(((new_r22*x511))+((new_r22*x512))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j31array[2], cj31array[2], sj31array[2]; bool j31valid[2]={false}; _nj31 = 2; CheckValue<IkReal> x515 = IKatan2WithCheck(IkReal(new_r00),IkReal(new_r10),IKFAST_ATAN2_MAGTHRESH); if(!x515.valid){ continue; } IkReal x514=x515.value; j31array[0]=((-1.0)*x514); sj31array[0]=IKsin(j31array[0]); cj31array[0]=IKcos(j31array[0]); j31array[1]=((3.14159265358979)+(((-1.0)*x514))); sj31array[1]=IKsin(j31array[1]); cj31array[1]=IKcos(j31array[1]); if( j31array[0] > IKPI ) { j31array[0]-=IK2PI; } else if( j31array[0] < -IKPI ) { j31array[0]+=IK2PI; } j31valid[0] = true; if( j31array[1] > IKPI ) { j31array[1]-=IK2PI; } else if( j31array[1] < -IKPI ) { j31array[1]+=IK2PI; } j31valid[1] = true; for(int ij31 = 0; ij31 < 2; ++ij31) { if( !j31valid[ij31] ) { continue; } _ij31[0] = ij31; _ij31[1] = -1; for(int iij31 = ij31+1; iij31 < 2; ++iij31) { if( j31valid[iij31] && IKabs(cj31array[ij31]-cj31array[iij31]) < IKFAST_SOLUTION_THRESH && IKabs(sj31array[ij31]-sj31array[iij31]) < IKFAST_SOLUTION_THRESH ) { j31valid[iij31]=false; _ij31[1] = iij31; break; } } j31 = j31array[ij31]; cj31 = cj31array[ij31]; sj31 = sj31array[ij31]; { IkReal evalcond[5]; IkReal x516=IKcos(j31); IkReal x517=IKsin(j31); IkReal x518=(new_r22*x517); IkReal x519=(new_r01*x516); IkReal x520=((1.0)*x517); evalcond[0]=(((new_r11*x517))+x519); evalcond[1]=(((new_r10*x516))+(((-1.0)*new_r00*x520))); evalcond[2]=(((new_r11*x516))+(((-1.0)*new_r01*x520))); evalcond[3]=(((new_r11*x518))+((new_r22*x519))); evalcond[4]=(((new_r10*x518))+((new_r00*new_r22*x516))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j31array[2], cj31array[2], sj31array[2]; bool j31valid[2]={false}; _nj31 = 2; CheckValue<IkReal> x522 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x522.valid){ continue; } IkReal x521=x522.value; j31array[0]=((-1.0)*x521); sj31array[0]=IKsin(j31array[0]); cj31array[0]=IKcos(j31array[0]); j31array[1]=((3.14159265358979)+(((-1.0)*x521))); sj31array[1]=IKsin(j31array[1]); cj31array[1]=IKcos(j31array[1]); if( j31array[0] > IKPI ) { j31array[0]-=IK2PI; } else if( j31array[0] < -IKPI ) { j31array[0]+=IK2PI; } j31valid[0] = true; if( j31array[1] > IKPI ) { j31array[1]-=IK2PI; } else if( j31array[1] < -IKPI ) { j31array[1]+=IK2PI; } j31valid[1] = true; for(int ij31 = 0; ij31 < 2; ++ij31) { if( !j31valid[ij31] ) { continue; } _ij31[0] = ij31; _ij31[1] = -1; for(int iij31 = ij31+1; iij31 < 2; ++iij31) { if( j31valid[iij31] && IKabs(cj31array[ij31]-cj31array[iij31]) < IKFAST_SOLUTION_THRESH && IKabs(sj31array[ij31]-sj31array[iij31]) < IKFAST_SOLUTION_THRESH ) { j31valid[iij31]=false; _ij31[1] = iij31; break; } } j31 = j31array[ij31]; cj31 = cj31array[ij31]; sj31 = sj31array[ij31]; { IkReal evalcond[5]; IkReal x523=IKcos(j31); IkReal x524=IKsin(j31); IkReal x525=(new_r22*x524); IkReal x526=(new_r22*x523); IkReal x527=((1.0)*x524); evalcond[0]=(((new_r10*x524))+((new_r00*x523))); evalcond[1]=((((-1.0)*new_r00*x527))+((new_r10*x523))); evalcond[2]=(((new_r11*x523))+(((-1.0)*new_r01*x527))); evalcond[3]=(((new_r01*x526))+((new_r11*x525))); evalcond[4]=(((new_r10*x525))+((new_r00*x526))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j31] } } while(0); if( bgotonextstatement ) { } } } } } } } } else { { IkReal j31array[1], cj31array[1], sj31array[1]; bool j31valid[1]={false}; _nj31 = 1; CheckValue<IkReal> x529=IKPowWithIntegerCheck(sj32,-1); if(!x529.valid){ continue; } IkReal x528=x529.value; CheckValue<IkReal> x530=IKPowWithIntegerCheck(cj33,-1); if(!x530.valid){ continue; } if( IKabs((x528*(x530.value)*(((((-1.0)*cj32*new_r02*sj33))+(((-1.0)*new_r01*sj32)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs((new_r02*x528)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((x528*(x530.value)*(((((-1.0)*cj32*new_r02*sj33))+(((-1.0)*new_r01*sj32))))))+IKsqr((new_r02*x528))-1) <= IKFAST_SINCOS_THRESH ) continue; j31array[0]=IKatan2((x528*(x530.value)*(((((-1.0)*cj32*new_r02*sj33))+(((-1.0)*new_r01*sj32))))), (new_r02*x528)); sj31array[0]=IKsin(j31array[0]); cj31array[0]=IKcos(j31array[0]); if( j31array[0] > IKPI ) { j31array[0]-=IK2PI; } else if( j31array[0] < -IKPI ) { j31array[0]+=IK2PI; } j31valid[0] = true; for(int ij31 = 0; ij31 < 1; ++ij31) { if( !j31valid[ij31] ) { continue; } _ij31[0] = ij31; _ij31[1] = -1; for(int iij31 = ij31+1; iij31 < 1; ++iij31) { if( j31valid[iij31] && IKabs(cj31array[ij31]-cj31array[iij31]) < IKFAST_SOLUTION_THRESH && IKabs(sj31array[ij31]-sj31array[iij31]) < IKFAST_SOLUTION_THRESH ) { j31valid[iij31]=false; _ij31[1] = iij31; break; } } j31 = j31array[ij31]; cj31 = cj31array[ij31]; sj31 = sj31array[ij31]; { IkReal evalcond[18]; IkReal x531=IKcos(j31); IkReal x532=IKsin(j31); IkReal x533=((1.0)*cj33); IkReal x534=((1.0)*sj33); IkReal x535=(cj32*sj33); IkReal x536=((1.0)*sj32); IkReal x537=(new_r10*x532); IkReal x538=(cj32*x531); IkReal x539=(sj32*x531); IkReal x540=(new_r11*x532); IkReal x541=(new_r12*x532); IkReal x542=((1.0)*x532); evalcond[0]=((((-1.0)*x531*x536))+new_r02); evalcond[1]=((((-1.0)*x532*x536))+new_r12); evalcond[2]=(((new_r12*x531))+(((-1.0)*new_r02*x542))); evalcond[3]=(((cj33*x532))+((x531*x535))+new_r01); evalcond[4]=(((new_r02*x531))+(((-1.0)*x536))+x541); evalcond[5]=(((new_r01*x531))+x540+x535); evalcond[6]=(((sj33*x532))+(((-1.0)*x533*x538))+new_r00); evalcond[7]=((((-1.0)*x531*x533))+new_r11+((x532*x535))); evalcond[8]=((((-1.0)*new_r00*x542))+(((-1.0)*x534))+((new_r10*x531))); evalcond[9]=(((new_r11*x531))+(((-1.0)*x533))+(((-1.0)*new_r01*x542))); evalcond[10]=((((-1.0)*cj32*x533))+x537+((new_r00*x531))); evalcond[11]=((((-1.0)*x531*x534))+(((-1.0)*cj32*x532*x533))+new_r10); evalcond[12]=(((sj32*x537))+((cj32*new_r20))+((new_r00*x539))); evalcond[13]=(((new_r01*x539))+((sj32*x540))+((cj32*new_r21))); evalcond[14]=((-1.0)+((new_r02*x539))+((sj32*x541))+((cj32*new_r22))); evalcond[15]=(((new_r02*x538))+(((-1.0)*new_r22*x536))+((cj32*x541))); evalcond[16]=(((new_r01*x538))+((cj32*x540))+(((-1.0)*new_r21*x536))+sj33); evalcond[17]=(((cj32*x537))+(((-1.0)*x533))+(((-1.0)*new_r20*x536))+((new_r00*x538))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[12]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[13]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[14]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[15]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[16]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[17]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j31array[1], cj31array[1], sj31array[1]; bool j31valid[1]={false}; _nj31 = 1; CheckValue<IkReal> x543=IKPowWithIntegerCheck(IKsign(sj32),-1); if(!x543.valid){ continue; } CheckValue<IkReal> x544 = IKatan2WithCheck(IkReal(new_r12),IkReal(new_r02),IKFAST_ATAN2_MAGTHRESH); if(!x544.valid){ continue; } j31array[0]=((-1.5707963267949)+(((1.5707963267949)*(x543.value)))+(x544.value)); sj31array[0]=IKsin(j31array[0]); cj31array[0]=IKcos(j31array[0]); if( j31array[0] > IKPI ) { j31array[0]-=IK2PI; } else if( j31array[0] < -IKPI ) { j31array[0]+=IK2PI; } j31valid[0] = true; for(int ij31 = 0; ij31 < 1; ++ij31) { if( !j31valid[ij31] ) { continue; } _ij31[0] = ij31; _ij31[1] = -1; for(int iij31 = ij31+1; iij31 < 1; ++iij31) { if( j31valid[iij31] && IKabs(cj31array[ij31]-cj31array[iij31]) < IKFAST_SOLUTION_THRESH && IKabs(sj31array[ij31]-sj31array[iij31]) < IKFAST_SOLUTION_THRESH ) { j31valid[iij31]=false; _ij31[1] = iij31; break; } } j31 = j31array[ij31]; cj31 = cj31array[ij31]; sj31 = sj31array[ij31]; { IkReal evalcond[18]; IkReal x545=IKcos(j31); IkReal x546=IKsin(j31); IkReal x547=((1.0)*cj33); IkReal x548=((1.0)*sj33); IkReal x549=(cj32*sj33); IkReal x550=((1.0)*sj32); IkReal x551=(new_r10*x546); IkReal x552=(cj32*x545); IkReal x553=(sj32*x545); IkReal x554=(new_r11*x546); IkReal x555=(new_r12*x546); IkReal x556=((1.0)*x546); evalcond[0]=((((-1.0)*x545*x550))+new_r02); evalcond[1]=(new_r12+(((-1.0)*x546*x550))); evalcond[2]=(((new_r12*x545))+(((-1.0)*new_r02*x556))); evalcond[3]=(((cj33*x546))+new_r01+((x545*x549))); evalcond[4]=(((new_r02*x545))+(((-1.0)*x550))+x555); evalcond[5]=(x554+x549+((new_r01*x545))); evalcond[6]=(((sj33*x546))+(((-1.0)*x547*x552))+new_r00); evalcond[7]=((((-1.0)*x545*x547))+new_r11+((x546*x549))); evalcond[8]=(((new_r10*x545))+(((-1.0)*x548))+(((-1.0)*new_r00*x556))); evalcond[9]=((((-1.0)*new_r01*x556))+((new_r11*x545))+(((-1.0)*x547))); evalcond[10]=(((new_r00*x545))+(((-1.0)*cj32*x547))+x551); evalcond[11]=((((-1.0)*x545*x548))+(((-1.0)*cj32*x546*x547))+new_r10); evalcond[12]=(((sj32*x551))+((cj32*new_r20))+((new_r00*x553))); evalcond[13]=(((sj32*x554))+((cj32*new_r21))+((new_r01*x553))); evalcond[14]=((-1.0)+((sj32*x555))+((new_r02*x553))+((cj32*new_r22))); evalcond[15]=(((new_r02*x552))+(((-1.0)*new_r22*x550))+((cj32*x555))); evalcond[16]=(((cj32*x554))+(((-1.0)*new_r21*x550))+sj33+((new_r01*x552))); evalcond[17]=(((cj32*x551))+(((-1.0)*x547))+(((-1.0)*new_r20*x550))+((new_r00*x552))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[12]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[13]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[14]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[15]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[16]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[17]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } } } } else { { IkReal j31array[1], cj31array[1], sj31array[1]; bool j31valid[1]={false}; _nj31 = 1; CheckValue<IkReal> x557=IKPowWithIntegerCheck(IKsign(sj32),-1); if(!x557.valid){ continue; } CheckValue<IkReal> x558 = IKatan2WithCheck(IkReal(new_r12),IkReal(new_r02),IKFAST_ATAN2_MAGTHRESH); if(!x558.valid){ continue; } j31array[0]=((-1.5707963267949)+(((1.5707963267949)*(x557.value)))+(x558.value)); sj31array[0]=IKsin(j31array[0]); cj31array[0]=IKcos(j31array[0]); if( j31array[0] > IKPI ) { j31array[0]-=IK2PI; } else if( j31array[0] < -IKPI ) { j31array[0]+=IK2PI; } j31valid[0] = true; for(int ij31 = 0; ij31 < 1; ++ij31) { if( !j31valid[ij31] ) { continue; } _ij31[0] = ij31; _ij31[1] = -1; for(int iij31 = ij31+1; iij31 < 1; ++iij31) { if( j31valid[iij31] && IKabs(cj31array[ij31]-cj31array[iij31]) < IKFAST_SOLUTION_THRESH && IKabs(sj31array[ij31]-sj31array[iij31]) < IKFAST_SOLUTION_THRESH ) { j31valid[iij31]=false; _ij31[1] = iij31; break; } } j31 = j31array[ij31]; cj31 = cj31array[ij31]; sj31 = sj31array[ij31]; { IkReal evalcond[8]; IkReal x559=IKcos(j31); IkReal x560=IKsin(j31); IkReal x561=((1.0)*sj32); IkReal x562=(new_r02*x559); IkReal x563=(new_r12*x560); IkReal x564=(sj32*x559); IkReal x565=(sj32*x560); evalcond[0]=((((-1.0)*x559*x561))+new_r02); evalcond[1]=((((-1.0)*x560*x561))+new_r12); evalcond[2]=((((-1.0)*new_r02*x560))+((new_r12*x559))); evalcond[3]=(x562+x563+(((-1.0)*x561))); evalcond[4]=(((new_r00*x564))+((cj32*new_r20))+((new_r10*x565))); evalcond[5]=(((new_r01*x564))+((cj32*new_r21))+((new_r11*x565))); evalcond[6]=((-1.0)+((sj32*x562))+((sj32*x563))+((cj32*new_r22))); evalcond[7]=((((-1.0)*new_r22*x561))+((cj32*x563))+((cj32*x562))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { IkReal j33eval[3]; j33eval[0]=sj32; j33eval[1]=IKsign(sj32); j33eval[2]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(j33eval[0]) < 0.0000010000000000 || IKabs(j33eval[1]) < 0.0000010000000000 || IKabs(j33eval[2]) < 0.0000010000000000 ) { { IkReal j33eval[2]; j33eval[0]=sj32; j33eval[1]=sj31; if( IKabs(j33eval[0]) < 0.0000010000000000 || IKabs(j33eval[1]) < 0.0000010000000000 ) { { IkReal j33eval[3]; j33eval[0]=cj32; j33eval[1]=sj31; j33eval[2]=sj32; if( IKabs(j33eval[0]) < 0.0000010000000000 || IKabs(j33eval[1]) < 0.0000010000000000 || IKabs(j33eval[2]) < 0.0000010000000000 ) { { IkReal evalcond[5]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j32)))), 6.28318530717959))); evalcond[1]=new_r22; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; if( IKabs(new_r21) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r21)+IKsqr(((-1.0)*new_r20))-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2(new_r21, ((-1.0)*new_r20)); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[8]; IkReal x566=IKcos(j33); IkReal x567=IKsin(j33); IkReal x568=((1.0)*sj31); IkReal x569=((1.0)*x567); IkReal x570=((1.0)*x566); evalcond[0]=(x566+new_r20); evalcond[1]=(new_r21+(((-1.0)*x569))); evalcond[2]=(((sj31*x566))+new_r01); evalcond[3]=(((sj31*x567))+new_r00); evalcond[4]=(new_r11+(((-1.0)*cj31*x570))); evalcond[5]=((((-1.0)*cj31*x569))+new_r10); evalcond[6]=((((-1.0)*new_r00*x568))+((cj31*new_r10))+(((-1.0)*x569))); evalcond[7]=(((cj31*new_r11))+(((-1.0)*x570))+(((-1.0)*new_r01*x568))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j32)))), 6.28318530717959))); evalcond[1]=new_r22; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; if( IKabs(((-1.0)*new_r21)) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r20) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r21))+IKsqr(new_r20)-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2(((-1.0)*new_r21), new_r20); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[8]; IkReal x571=IKcos(j33); IkReal x572=IKsin(j33); IkReal x573=((1.0)*sj31); IkReal x574=((1.0)*x571); IkReal x575=((1.0)*x572); evalcond[0]=(x572+new_r21); evalcond[1]=((((-1.0)*x574))+new_r20); evalcond[2]=(new_r01+((sj31*x571))); evalcond[3]=(new_r00+((sj31*x572))); evalcond[4]=(new_r11+(((-1.0)*cj31*x574))); evalcond[5]=(new_r10+(((-1.0)*cj31*x575))); evalcond[6]=(((cj31*new_r10))+(((-1.0)*x575))+(((-1.0)*new_r00*x573))); evalcond[7]=(((cj31*new_r11))+(((-1.0)*x574))+(((-1.0)*new_r01*x573))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j31))), 6.28318530717959))); evalcond[1]=new_r12; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; if( IKabs(new_r10) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r11) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r10)+IKsqr(new_r11)-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2(new_r10, new_r11); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[8]; IkReal x576=IKcos(j33); IkReal x577=IKsin(j33); IkReal x578=((1.0)*sj32); IkReal x579=((1.0)*x576); evalcond[0]=(((sj32*x576))+new_r20); evalcond[1]=((((-1.0)*x577))+new_r10); evalcond[2]=((((-1.0)*x579))+new_r11); evalcond[3]=(((cj32*x577))+new_r01); evalcond[4]=((((-1.0)*x577*x578))+new_r21); evalcond[5]=((((-1.0)*cj32*x579))+new_r00); evalcond[6]=(((cj32*new_r01))+x577+(((-1.0)*new_r21*x578))); evalcond[7]=(((cj32*new_r00))+(((-1.0)*x579))+(((-1.0)*new_r20*x578))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j31)))), 6.28318530717959))); evalcond[1]=new_r12; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33eval[3]; sj31=0; cj31=-1.0; j31=3.14159265358979; j33eval[0]=sj32; j33eval[1]=IKsign(sj32); j33eval[2]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(j33eval[0]) < 0.0000010000000000 || IKabs(j33eval[1]) < 0.0000010000000000 || IKabs(j33eval[2]) < 0.0000010000000000 ) { { IkReal j33eval[1]; sj31=0; cj31=-1.0; j31=3.14159265358979; j33eval[0]=sj32; if( IKabs(j33eval[0]) < 0.0000010000000000 ) { { IkReal j33eval[2]; sj31=0; cj31=-1.0; j31=3.14159265358979; j33eval[0]=cj32; j33eval[1]=sj32; if( IKabs(j33eval[0]) < 0.0000010000000000 || IKabs(j33eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[4]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j32)))), 6.28318530717959))); evalcond[1]=new_r22; evalcond[2]=new_r01; evalcond[3]=new_r00; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; if( IKabs(new_r21) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r21)+IKsqr(((-1.0)*new_r20))-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2(new_r21, ((-1.0)*new_r20)); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[4]; IkReal x580=IKcos(j33); IkReal x581=((1.0)*(IKsin(j33))); evalcond[0]=(x580+new_r20); evalcond[1]=(new_r21+(((-1.0)*x581))); evalcond[2]=((((-1.0)*new_r10))+(((-1.0)*x581))); evalcond[3]=((((-1.0)*x580))+(((-1.0)*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j32)))), 6.28318530717959))); evalcond[1]=new_r22; evalcond[2]=new_r01; evalcond[3]=new_r00; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; if( IKabs(((-1.0)*new_r21)) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r20) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r21))+IKsqr(new_r20)-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2(((-1.0)*new_r21), new_r20); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[4]; IkReal x582=IKsin(j33); IkReal x583=((1.0)*(IKcos(j33))); evalcond[0]=(x582+new_r21); evalcond[1]=(new_r20+(((-1.0)*x583))); evalcond[2]=((((-1.0)*x582))+(((-1.0)*new_r10))); evalcond[3]=((((-1.0)*new_r11))+(((-1.0)*x583))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j32))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; if( IKabs(new_r01) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r11)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r01)+IKsqr(((-1.0)*new_r11))-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2(new_r01, ((-1.0)*new_r11)); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[4]; IkReal x584=IKsin(j33); IkReal x585=((1.0)*(IKcos(j33))); evalcond[0]=(x584+(((-1.0)*new_r01))); evalcond[1]=((((-1.0)*x584))+(((-1.0)*new_r10))); evalcond[2]=((((-1.0)*new_r11))+(((-1.0)*x585))); evalcond[3]=((((-1.0)*new_r00))+(((-1.0)*x585))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j32)))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; if( IKabs(((-1.0)*new_r10)) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r00) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r10))+IKsqr(new_r00)-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2(((-1.0)*new_r10), new_r00); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[4]; IkReal x586=IKcos(j33); IkReal x587=((1.0)*(IKsin(j33))); evalcond[0]=(x586+(((-1.0)*new_r00))); evalcond[1]=((((-1.0)*new_r10))+(((-1.0)*x587))); evalcond[2]=((((-1.0)*x586))+(((-1.0)*new_r11))); evalcond[3]=((((-1.0)*new_r01))+(((-1.0)*x587))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; if( IKabs(((-1.0)*new_r10)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r11)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r10))+IKsqr(((-1.0)*new_r11))-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2(((-1.0)*new_r10), ((-1.0)*new_r11)); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[6]; IkReal x588=IKsin(j33); IkReal x589=IKcos(j33); IkReal x590=((-1.0)*x589); evalcond[0]=x588; evalcond[1]=(new_r22*x588); evalcond[2]=x590; evalcond[3]=(new_r22*x590); evalcond[4]=((((-1.0)*x588))+(((-1.0)*new_r10))); evalcond[5]=((((-1.0)*x589))+(((-1.0)*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j33] } } while(0); if( bgotonextstatement ) { } } } } } } } } else { { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; CheckValue<IkReal> x591=IKPowWithIntegerCheck(cj32,-1); if(!x591.valid){ continue; } CheckValue<IkReal> x592=IKPowWithIntegerCheck(sj32,-1); if(!x592.valid){ continue; } if( IKabs((new_r01*(x591.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20*(x592.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((new_r01*(x591.value)))+IKsqr(((-1.0)*new_r20*(x592.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2((new_r01*(x591.value)), ((-1.0)*new_r20*(x592.value))); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[8]; IkReal x593=IKsin(j33); IkReal x594=IKcos(j33); IkReal x595=((1.0)*new_r00); IkReal x596=((1.0)*sj32); IkReal x597=((1.0)*new_r01); IkReal x598=((1.0)*x594); evalcond[0]=(((sj32*x594))+new_r20); evalcond[1]=((((-1.0)*x593*x596))+new_r21); evalcond[2]=((((-1.0)*x593))+(((-1.0)*new_r10))); evalcond[3]=((((-1.0)*x598))+(((-1.0)*new_r11))); evalcond[4]=(((cj32*x593))+(((-1.0)*x597))); evalcond[5]=((((-1.0)*cj32*x598))+(((-1.0)*x595))); evalcond[6]=((((-1.0)*new_r21*x596))+(((-1.0)*cj32*x597))+x593); evalcond[7]=((((-1.0)*new_r20*x596))+(((-1.0)*cj32*x595))+(((-1.0)*x598))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; CheckValue<IkReal> x599=IKPowWithIntegerCheck(sj32,-1); if(!x599.valid){ continue; } if( IKabs((new_r21*(x599.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r11)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((new_r21*(x599.value)))+IKsqr(((-1.0)*new_r11))-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2((new_r21*(x599.value)), ((-1.0)*new_r11)); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[8]; IkReal x600=IKsin(j33); IkReal x601=IKcos(j33); IkReal x602=((1.0)*new_r00); IkReal x603=((1.0)*sj32); IkReal x604=((1.0)*new_r01); IkReal x605=((1.0)*x601); evalcond[0]=(((sj32*x601))+new_r20); evalcond[1]=((((-1.0)*x600*x603))+new_r21); evalcond[2]=((((-1.0)*x600))+(((-1.0)*new_r10))); evalcond[3]=((((-1.0)*new_r11))+(((-1.0)*x605))); evalcond[4]=(((cj32*x600))+(((-1.0)*x604))); evalcond[5]=((((-1.0)*cj32*x605))+(((-1.0)*x602))); evalcond[6]=((((-1.0)*cj32*x604))+x600+(((-1.0)*new_r21*x603))); evalcond[7]=((((-1.0)*new_r20*x603))+(((-1.0)*cj32*x602))+(((-1.0)*x605))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; CheckValue<IkReal> x606=IKPowWithIntegerCheck(IKsign(sj32),-1); if(!x606.valid){ continue; } CheckValue<IkReal> x607 = IKatan2WithCheck(IkReal(new_r21),IkReal(((-1.0)*new_r20)),IKFAST_ATAN2_MAGTHRESH); if(!x607.valid){ continue; } j33array[0]=((-1.5707963267949)+(((1.5707963267949)*(x606.value)))+(x607.value)); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[8]; IkReal x608=IKsin(j33); IkReal x609=IKcos(j33); IkReal x610=((1.0)*new_r00); IkReal x611=((1.0)*sj32); IkReal x612=((1.0)*new_r01); IkReal x613=((1.0)*x609); evalcond[0]=(((sj32*x609))+new_r20); evalcond[1]=(new_r21+(((-1.0)*x608*x611))); evalcond[2]=((((-1.0)*x608))+(((-1.0)*new_r10))); evalcond[3]=((((-1.0)*x613))+(((-1.0)*new_r11))); evalcond[4]=(((cj32*x608))+(((-1.0)*x612))); evalcond[5]=((((-1.0)*cj32*x613))+(((-1.0)*x610))); evalcond[6]=((((-1.0)*new_r21*x611))+(((-1.0)*cj32*x612))+x608); evalcond[7]=((((-1.0)*cj32*x610))+(((-1.0)*x613))+(((-1.0)*new_r20*x611))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j32))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r12; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; IkReal x614=((1.0)*sj31); if( IKabs(((((-1.0)*cj31*new_r01))+(((-1.0)*new_r00*x614)))) < IKFAST_ATAN2_MAGTHRESH && IKabs((((cj31*new_r00))+(((-1.0)*new_r01*x614)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*cj31*new_r01))+(((-1.0)*new_r00*x614))))+IKsqr((((cj31*new_r00))+(((-1.0)*new_r01*x614))))-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2(((((-1.0)*cj31*new_r01))+(((-1.0)*new_r00*x614))), (((cj31*new_r00))+(((-1.0)*new_r01*x614)))); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[8]; IkReal x615=IKsin(j33); IkReal x616=IKcos(j33); IkReal x617=((1.0)*sj31); IkReal x618=((1.0)*x616); IkReal x619=(sj31*x615); IkReal x620=((1.0)*x615); IkReal x621=(cj31*x618); evalcond[0]=(((cj31*new_r01))+((new_r11*sj31))+x615); evalcond[1]=(((cj31*x615))+((sj31*x616))+new_r01); evalcond[2]=(((cj31*new_r00))+((new_r10*sj31))+(((-1.0)*x618))); evalcond[3]=(((cj31*new_r10))+(((-1.0)*x620))+(((-1.0)*new_r00*x617))); evalcond[4]=(((cj31*new_r11))+(((-1.0)*x618))+(((-1.0)*new_r01*x617))); evalcond[5]=((((-1.0)*x621))+x619+new_r00); evalcond[6]=((((-1.0)*x621))+x619+new_r11); evalcond[7]=(new_r10+(((-1.0)*cj31*x620))+(((-1.0)*x616*x617))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j32)))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r12; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; IkReal x622=((1.0)*sj31); if( IKabs(((((-1.0)*new_r00*x622))+((cj31*new_r01)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((((-1.0)*new_r01*x622))+(((-1.0)*cj31*new_r00)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*new_r00*x622))+((cj31*new_r01))))+IKsqr(((((-1.0)*new_r01*x622))+(((-1.0)*cj31*new_r00))))-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2(((((-1.0)*new_r00*x622))+((cj31*new_r01))), ((((-1.0)*new_r01*x622))+(((-1.0)*cj31*new_r00)))); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[8]; IkReal x623=IKsin(j33); IkReal x624=IKcos(j33); IkReal x625=((1.0)*sj31); IkReal x626=((1.0)*x623); IkReal x627=(sj31*x624); IkReal x628=((1.0)*x624); IkReal x629=(cj31*x626); evalcond[0]=(((cj31*new_r00))+((new_r10*sj31))+x624); evalcond[1]=(((cj31*new_r01))+(((-1.0)*x626))+((new_r11*sj31))); evalcond[2]=(((sj31*x623))+((cj31*x624))+new_r00); evalcond[3]=((((-1.0)*new_r00*x625))+((cj31*new_r10))+(((-1.0)*x626))); evalcond[4]=((((-1.0)*new_r01*x625))+((cj31*new_r11))+(((-1.0)*x628))); evalcond[5]=((((-1.0)*x629))+x627+new_r01); evalcond[6]=((((-1.0)*x629))+x627+new_r10); evalcond[7]=((((-1.0)*x623*x625))+new_r11+(((-1.0)*cj31*x628))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j33eval[1]; new_r21=0; new_r20=0; new_r02=0; new_r12=0; j33eval[0]=1.0; if( IKabs(j33eval[0]) < 0.0000000100000000 ) { continue; // no branches [j33] } else { IkReal op[2+1], zeror[2]; int numroots; op[0]=1.0; op[1]=0; op[2]=-1.0; polyroots2(op,zeror,numroots); IkReal j33array[2], cj33array[2], sj33array[2], tempj33array[1]; int numsolutions = 0; for(int ij33 = 0; ij33 < numroots; ++ij33) { IkReal htj33 = zeror[ij33]; tempj33array[0]=((2.0)*(atan(htj33))); for(int kj33 = 0; kj33 < 1; ++kj33) { j33array[numsolutions] = tempj33array[kj33]; if( j33array[numsolutions] > IKPI ) { j33array[numsolutions]-=IK2PI; } else if( j33array[numsolutions] < -IKPI ) { j33array[numsolutions]+=IK2PI; } sj33array[numsolutions] = IKsin(j33array[numsolutions]); cj33array[numsolutions] = IKcos(j33array[numsolutions]); numsolutions++; } } bool j33valid[2]={true,true}; _nj33 = 2; for(int ij33 = 0; ij33 < numsolutions; ++ij33) { if( !j33valid[ij33] ) { continue; } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; htj33 = IKtan(j33/2); _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < numsolutions; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j33] } } while(0); if( bgotonextstatement ) { } } } } } } } } } } else { { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; CheckValue<IkReal> x631=IKPowWithIntegerCheck(sj32,-1); if(!x631.valid){ continue; } IkReal x630=x631.value; CheckValue<IkReal> x632=IKPowWithIntegerCheck(cj32,-1); if(!x632.valid){ continue; } CheckValue<IkReal> x633=IKPowWithIntegerCheck(sj31,-1); if(!x633.valid){ continue; } if( IKabs((x630*(x632.value)*(x633.value)*(((((-1.0)*new_r11*sj32))+(((-1.0)*cj31*new_r20)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20*x630)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((x630*(x632.value)*(x633.value)*(((((-1.0)*new_r11*sj32))+(((-1.0)*cj31*new_r20))))))+IKsqr(((-1.0)*new_r20*x630))-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2((x630*(x632.value)*(x633.value)*(((((-1.0)*new_r11*sj32))+(((-1.0)*cj31*new_r20))))), ((-1.0)*new_r20*x630)); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[12]; IkReal x634=IKsin(j33); IkReal x635=IKcos(j33); IkReal x636=(cj31*cj32); IkReal x637=((1.0)*sj31); IkReal x638=(new_r11*sj31); IkReal x639=(new_r10*sj31); IkReal x640=((1.0)*sj32); IkReal x641=((1.0)*x635); IkReal x642=((1.0)*x634); IkReal x643=(sj31*x634); evalcond[0]=(((sj32*x635))+new_r20); evalcond[1]=(new_r21+(((-1.0)*x634*x640))); evalcond[2]=(((cj31*new_r01))+x638+((cj32*x634))); evalcond[3]=(((cj31*new_r10))+(((-1.0)*new_r00*x637))+(((-1.0)*x642))); evalcond[4]=((((-1.0)*new_r01*x637))+((cj31*new_r11))+(((-1.0)*x641))); evalcond[5]=(((x634*x636))+((sj31*x635))+new_r01); evalcond[6]=(((cj31*new_r00))+(((-1.0)*cj32*x641))+x639); evalcond[7]=(x643+(((-1.0)*x636*x641))+new_r00); evalcond[8]=(((cj32*x643))+new_r11+(((-1.0)*cj31*x641))); evalcond[9]=((((-1.0)*cj32*x635*x637))+new_r10+(((-1.0)*cj31*x642))); evalcond[10]=(((new_r01*x636))+(((-1.0)*new_r21*x640))+x634+((cj32*x638))); evalcond[11]=(((new_r00*x636))+(((-1.0)*x641))+((cj32*x639))+(((-1.0)*new_r20*x640))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; CheckValue<IkReal> x645=IKPowWithIntegerCheck(sj32,-1); if(!x645.valid){ continue; } IkReal x644=x645.value; CheckValue<IkReal> x646=IKPowWithIntegerCheck(sj31,-1); if(!x646.valid){ continue; } if( IKabs((new_r21*x644)) < IKFAST_ATAN2_MAGTHRESH && IKabs((x644*(x646.value)*(((((-1.0)*cj31*cj32*new_r21))+(((-1.0)*new_r01*sj32)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((new_r21*x644))+IKsqr((x644*(x646.value)*(((((-1.0)*cj31*cj32*new_r21))+(((-1.0)*new_r01*sj32))))))-1) <= IKFAST_SINCOS_THRESH ) continue; j33array[0]=IKatan2((new_r21*x644), (x644*(x646.value)*(((((-1.0)*cj31*cj32*new_r21))+(((-1.0)*new_r01*sj32)))))); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[12]; IkReal x647=IKsin(j33); IkReal x648=IKcos(j33); IkReal x649=(cj31*cj32); IkReal x650=((1.0)*sj31); IkReal x651=(new_r11*sj31); IkReal x652=(new_r10*sj31); IkReal x653=((1.0)*sj32); IkReal x654=((1.0)*x648); IkReal x655=((1.0)*x647); IkReal x656=(sj31*x647); evalcond[0]=(new_r20+((sj32*x648))); evalcond[1]=((((-1.0)*x647*x653))+new_r21); evalcond[2]=(((cj32*x647))+((cj31*new_r01))+x651); evalcond[3]=(((cj31*new_r10))+(((-1.0)*new_r00*x650))+(((-1.0)*x655))); evalcond[4]=(((cj31*new_r11))+(((-1.0)*x654))+(((-1.0)*new_r01*x650))); evalcond[5]=(((sj31*x648))+new_r01+((x647*x649))); evalcond[6]=(((cj31*new_r00))+(((-1.0)*cj32*x654))+x652); evalcond[7]=(x656+(((-1.0)*x649*x654))+new_r00); evalcond[8]=(((cj32*x656))+(((-1.0)*cj31*x654))+new_r11); evalcond[9]=((((-1.0)*cj31*x655))+(((-1.0)*cj32*x648*x650))+new_r10); evalcond[10]=(((cj32*x651))+((new_r01*x649))+x647+(((-1.0)*new_r21*x653))); evalcond[11]=(((cj32*x652))+(((-1.0)*x654))+(((-1.0)*new_r20*x653))+((new_r00*x649))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j33array[1], cj33array[1], sj33array[1]; bool j33valid[1]={false}; _nj33 = 1; CheckValue<IkReal> x657=IKPowWithIntegerCheck(IKsign(sj32),-1); if(!x657.valid){ continue; } CheckValue<IkReal> x658 = IKatan2WithCheck(IkReal(new_r21),IkReal(((-1.0)*new_r20)),IKFAST_ATAN2_MAGTHRESH); if(!x658.valid){ continue; } j33array[0]=((-1.5707963267949)+(((1.5707963267949)*(x657.value)))+(x658.value)); sj33array[0]=IKsin(j33array[0]); cj33array[0]=IKcos(j33array[0]); if( j33array[0] > IKPI ) { j33array[0]-=IK2PI; } else if( j33array[0] < -IKPI ) { j33array[0]+=IK2PI; } j33valid[0] = true; for(int ij33 = 0; ij33 < 1; ++ij33) { if( !j33valid[ij33] ) { continue; } _ij33[0] = ij33; _ij33[1] = -1; for(int iij33 = ij33+1; iij33 < 1; ++iij33) { if( j33valid[iij33] && IKabs(cj33array[ij33]-cj33array[iij33]) < IKFAST_SOLUTION_THRESH && IKabs(sj33array[ij33]-sj33array[iij33]) < IKFAST_SOLUTION_THRESH ) { j33valid[iij33]=false; _ij33[1] = iij33; break; } } j33 = j33array[ij33]; cj33 = cj33array[ij33]; sj33 = sj33array[ij33]; { IkReal evalcond[12]; IkReal x659=IKsin(j33); IkReal x660=IKcos(j33); IkReal x661=(cj31*cj32); IkReal x662=((1.0)*sj31); IkReal x663=(new_r11*sj31); IkReal x664=(new_r10*sj31); IkReal x665=((1.0)*sj32); IkReal x666=((1.0)*x660); IkReal x667=((1.0)*x659); IkReal x668=(sj31*x659); evalcond[0]=(((sj32*x660))+new_r20); evalcond[1]=((((-1.0)*x659*x665))+new_r21); evalcond[2]=(((cj32*x659))+((cj31*new_r01))+x663); evalcond[3]=(((cj31*new_r10))+(((-1.0)*x667))+(((-1.0)*new_r00*x662))); evalcond[4]=(((cj31*new_r11))+(((-1.0)*x666))+(((-1.0)*new_r01*x662))); evalcond[5]=(((sj31*x660))+((x659*x661))+new_r01); evalcond[6]=(((cj31*new_r00))+(((-1.0)*cj32*x666))+x664); evalcond[7]=((((-1.0)*x661*x666))+x668+new_r00); evalcond[8]=((((-1.0)*cj31*x666))+((cj32*x668))+new_r11); evalcond[9]=((((-1.0)*cj31*x667))+(((-1.0)*cj32*x660*x662))+new_r10); evalcond[10]=((((-1.0)*new_r21*x665))+((cj32*x663))+x659+((new_r01*x661))); evalcond[11]=(((cj32*x664))+(((-1.0)*x666))+((new_r00*x661))+(((-1.0)*new_r20*x665))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j27; vinfos[1].indices[0] = _ij27[0]; vinfos[1].indices[1] = _ij27[1]; vinfos[1].maxsolutions = _nj27; vinfos[2].jointtype = 1; vinfos[2].foffset = j28; vinfos[2].indices[0] = _ij28[0]; vinfos[2].indices[1] = _ij28[1]; vinfos[2].maxsolutions = _nj28; vinfos[3].jointtype = 1; vinfos[3].foffset = j29; vinfos[3].indices[0] = _ij29[0]; vinfos[3].indices[1] = _ij29[1]; vinfos[3].maxsolutions = _nj29; vinfos[4].jointtype = 1; vinfos[4].foffset = j30; vinfos[4].indices[0] = _ij30[0]; vinfos[4].indices[1] = _ij30[1]; vinfos[4].maxsolutions = _nj30; vinfos[5].jointtype = 1; vinfos[5].foffset = j31; vinfos[5].indices[0] = _ij31[0]; vinfos[5].indices[1] = _ij31[1]; vinfos[5].maxsolutions = _nj31; vinfos[6].jointtype = 1; vinfos[6].foffset = j32; vinfos[6].indices[0] = _ij32[0]; vinfos[6].indices[1] = _ij32[1]; vinfos[6].maxsolutions = _nj32; vinfos[7].jointtype = 1; vinfos[7].foffset = j33; vinfos[7].indices[0] = _ij33[0]; vinfos[7].indices[1] = _ij33[1]; vinfos[7].maxsolutions = _nj33; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } } } } } } }static inline void polyroots3(IkReal rawcoeffs[3+1], IkReal rawroots[3], int& numroots) { using std::complex; if( rawcoeffs[0] == 0 ) { // solve with one reduced degree polyroots2(&rawcoeffs[1], &rawroots[0], numroots); return; } IKFAST_ASSERT(rawcoeffs[0] != 0); const IkReal tol = 128.0*std::numeric_limits<IkReal>::epsilon(); const IkReal tolsqrt = sqrt(std::numeric_limits<IkReal>::epsilon()); complex<IkReal> coeffs[3]; const int maxsteps = 110; for(int i = 0; i < 3; ++i) { coeffs[i] = complex<IkReal>(rawcoeffs[i+1]/rawcoeffs[0]); } complex<IkReal> roots[3]; IkReal err[3]; roots[0] = complex<IkReal>(1,0); roots[1] = complex<IkReal>(0.4,0.9); // any complex number not a root of unity works err[0] = 1.0; err[1] = 1.0; for(int i = 2; i < 3; ++i) { roots[i] = roots[i-1]*roots[1]; err[i] = 1.0; } for(int step = 0; step < maxsteps; ++step) { bool changed = false; for(int i = 0; i < 3; ++i) { if ( err[i] >= tol ) { changed = true; // evaluate complex<IkReal> x = roots[i] + coeffs[0]; for(int j = 1; j < 3; ++j) { x = roots[i] * x + coeffs[j]; } for(int j = 0; j < 3; ++j) { if( i != j ) { if( roots[i] != roots[j] ) { x /= (roots[i] - roots[j]); } } } roots[i] -= x; err[i] = abs(x); } } if( !changed ) { break; } } numroots = 0; bool visited[3] = {false}; for(int i = 0; i < 3; ++i) { if( !visited[i] ) { // might be a multiple root, in which case it will have more error than the other roots // find any neighboring roots, and take the average complex<IkReal> newroot=roots[i]; int n = 1; for(int j = i+1; j < 3; ++j) { // care about error in real much more than imaginary if( abs(real(roots[i])-real(roots[j])) < tolsqrt && abs(imag(roots[i])-imag(roots[j])) < 0.002 ) { newroot += roots[j]; n += 1; visited[j] = true; } } if( n > 1 ) { newroot /= n; } // there are still cases where even the mean is not accurate enough, until a better multi-root algorithm is used, need to use the sqrt if( IKabs(imag(newroot)) < tolsqrt ) { rawroots[numroots++] = real(newroot); } } } } static inline void polyroots2(IkReal rawcoeffs[2+1], IkReal rawroots[2], int& numroots) { IkReal det = rawcoeffs[1]*rawcoeffs[1]-4*rawcoeffs[0]*rawcoeffs[2]; if( det < 0 ) { numroots=0; } else if( det == 0 ) { rawroots[0] = -0.5*rawcoeffs[1]/rawcoeffs[0]; numroots = 1; } else { det = IKsqrt(det); rawroots[0] = (-rawcoeffs[1]+det)/(2*rawcoeffs[0]); rawroots[1] = (-rawcoeffs[1]-det)/(2*rawcoeffs[0]);//rawcoeffs[2]/(rawcoeffs[0]*rawroots[0]); numroots = 2; } } static inline void polyroots5(IkReal rawcoeffs[5+1], IkReal rawroots[5], int& numroots) { using std::complex; if( rawcoeffs[0] == 0 ) { // solve with one reduced degree polyroots4(&rawcoeffs[1], &rawroots[0], numroots); return; } IKFAST_ASSERT(rawcoeffs[0] != 0); const IkReal tol = 128.0*std::numeric_limits<IkReal>::epsilon(); const IkReal tolsqrt = sqrt(std::numeric_limits<IkReal>::epsilon()); complex<IkReal> coeffs[5]; const int maxsteps = 110; for(int i = 0; i < 5; ++i) { coeffs[i] = complex<IkReal>(rawcoeffs[i+1]/rawcoeffs[0]); } complex<IkReal> roots[5]; IkReal err[5]; roots[0] = complex<IkReal>(1,0); roots[1] = complex<IkReal>(0.4,0.9); // any complex number not a root of unity works err[0] = 1.0; err[1] = 1.0; for(int i = 2; i < 5; ++i) { roots[i] = roots[i-1]*roots[1]; err[i] = 1.0; } for(int step = 0; step < maxsteps; ++step) { bool changed = false; for(int i = 0; i < 5; ++i) { if ( err[i] >= tol ) { changed = true; // evaluate complex<IkReal> x = roots[i] + coeffs[0]; for(int j = 1; j < 5; ++j) { x = roots[i] * x + coeffs[j]; } for(int j = 0; j < 5; ++j) { if( i != j ) { if( roots[i] != roots[j] ) { x /= (roots[i] - roots[j]); } } } roots[i] -= x; err[i] = abs(x); } } if( !changed ) { break; } } numroots = 0; bool visited[5] = {false}; for(int i = 0; i < 5; ++i) { if( !visited[i] ) { // might be a multiple root, in which case it will have more error than the other roots // find any neighboring roots, and take the average complex<IkReal> newroot=roots[i]; int n = 1; for(int j = i+1; j < 5; ++j) { // care about error in real much more than imaginary if( abs(real(roots[i])-real(roots[j])) < tolsqrt && abs(imag(roots[i])-imag(roots[j])) < 0.002 ) { newroot += roots[j]; n += 1; visited[j] = true; } } if( n > 1 ) { newroot /= n; } // there are still cases where even the mean is not accurate enough, until a better multi-root algorithm is used, need to use the sqrt if( IKabs(imag(newroot)) < tolsqrt ) { rawroots[numroots++] = real(newroot); } } } } static inline void polyroots4(IkReal rawcoeffs[4+1], IkReal rawroots[4], int& numroots) { using std::complex; if( rawcoeffs[0] == 0 ) { // solve with one reduced degree polyroots3(&rawcoeffs[1], &rawroots[0], numroots); return; } IKFAST_ASSERT(rawcoeffs[0] != 0); const IkReal tol = 128.0*std::numeric_limits<IkReal>::epsilon(); const IkReal tolsqrt = sqrt(std::numeric_limits<IkReal>::epsilon()); complex<IkReal> coeffs[4]; const int maxsteps = 110; for(int i = 0; i < 4; ++i) { coeffs[i] = complex<IkReal>(rawcoeffs[i+1]/rawcoeffs[0]); } complex<IkReal> roots[4]; IkReal err[4]; roots[0] = complex<IkReal>(1,0); roots[1] = complex<IkReal>(0.4,0.9); // any complex number not a root of unity works err[0] = 1.0; err[1] = 1.0; for(int i = 2; i < 4; ++i) { roots[i] = roots[i-1]*roots[1]; err[i] = 1.0; } for(int step = 0; step < maxsteps; ++step) { bool changed = false; for(int i = 0; i < 4; ++i) { if ( err[i] >= tol ) { changed = true; // evaluate complex<IkReal> x = roots[i] + coeffs[0]; for(int j = 1; j < 4; ++j) { x = roots[i] * x + coeffs[j]; } for(int j = 0; j < 4; ++j) { if( i != j ) { if( roots[i] != roots[j] ) { x /= (roots[i] - roots[j]); } } } roots[i] -= x; err[i] = abs(x); } } if( !changed ) { break; } } numroots = 0; bool visited[4] = {false}; for(int i = 0; i < 4; ++i) { if( !visited[i] ) { // might be a multiple root, in which case it will have more error than the other roots // find any neighboring roots, and take the average complex<IkReal> newroot=roots[i]; int n = 1; for(int j = i+1; j < 4; ++j) { // care about error in real much more than imaginary if( abs(real(roots[i])-real(roots[j])) < tolsqrt && abs(imag(roots[i])-imag(roots[j])) < 0.002 ) { newroot += roots[j]; n += 1; visited[j] = true; } } if( n > 1 ) { newroot /= n; } // there are still cases where even the mean is not accurate enough, until a better multi-root algorithm is used, need to use the sqrt if( IKabs(imag(newroot)) < tolsqrt ) { rawroots[numroots++] = real(newroot); } } } } static inline void polyroots7(IkReal rawcoeffs[7+1], IkReal rawroots[7], int& numroots) { using std::complex; if( rawcoeffs[0] == 0 ) { // solve with one reduced degree polyroots6(&rawcoeffs[1], &rawroots[0], numroots); return; } IKFAST_ASSERT(rawcoeffs[0] != 0); const IkReal tol = 128.0*std::numeric_limits<IkReal>::epsilon(); const IkReal tolsqrt = sqrt(std::numeric_limits<IkReal>::epsilon()); complex<IkReal> coeffs[7]; const int maxsteps = 110; for(int i = 0; i < 7; ++i) { coeffs[i] = complex<IkReal>(rawcoeffs[i+1]/rawcoeffs[0]); } complex<IkReal> roots[7]; IkReal err[7]; roots[0] = complex<IkReal>(1,0); roots[1] = complex<IkReal>(0.4,0.9); // any complex number not a root of unity works err[0] = 1.0; err[1] = 1.0; for(int i = 2; i < 7; ++i) { roots[i] = roots[i-1]*roots[1]; err[i] = 1.0; } for(int step = 0; step < maxsteps; ++step) { bool changed = false; for(int i = 0; i < 7; ++i) { if ( err[i] >= tol ) { changed = true; // evaluate complex<IkReal> x = roots[i] + coeffs[0]; for(int j = 1; j < 7; ++j) { x = roots[i] * x + coeffs[j]; } for(int j = 0; j < 7; ++j) { if( i != j ) { if( roots[i] != roots[j] ) { x /= (roots[i] - roots[j]); } } } roots[i] -= x; err[i] = abs(x); } } if( !changed ) { break; } } numroots = 0; bool visited[7] = {false}; for(int i = 0; i < 7; ++i) { if( !visited[i] ) { // might be a multiple root, in which case it will have more error than the other roots // find any neighboring roots, and take the average complex<IkReal> newroot=roots[i]; int n = 1; for(int j = i+1; j < 7; ++j) { // care about error in real much more than imaginary if( abs(real(roots[i])-real(roots[j])) < tolsqrt && abs(imag(roots[i])-imag(roots[j])) < 0.002 ) { newroot += roots[j]; n += 1; visited[j] = true; } } if( n > 1 ) { newroot /= n; } // there are still cases where even the mean is not accurate enough, until a better multi-root algorithm is used, need to use the sqrt if( IKabs(imag(newroot)) < tolsqrt ) { rawroots[numroots++] = real(newroot); } } } } static inline void polyroots6(IkReal rawcoeffs[6+1], IkReal rawroots[6], int& numroots) { using std::complex; if( rawcoeffs[0] == 0 ) { // solve with one reduced degree polyroots5(&rawcoeffs[1], &rawroots[0], numroots); return; } IKFAST_ASSERT(rawcoeffs[0] != 0); const IkReal tol = 128.0*std::numeric_limits<IkReal>::epsilon(); const IkReal tolsqrt = sqrt(std::numeric_limits<IkReal>::epsilon()); complex<IkReal> coeffs[6]; const int maxsteps = 110; for(int i = 0; i < 6; ++i) { coeffs[i] = complex<IkReal>(rawcoeffs[i+1]/rawcoeffs[0]); } complex<IkReal> roots[6]; IkReal err[6]; roots[0] = complex<IkReal>(1,0); roots[1] = complex<IkReal>(0.4,0.9); // any complex number not a root of unity works err[0] = 1.0; err[1] = 1.0; for(int i = 2; i < 6; ++i) { roots[i] = roots[i-1]*roots[1]; err[i] = 1.0; } for(int step = 0; step < maxsteps; ++step) { bool changed = false; for(int i = 0; i < 6; ++i) { if ( err[i] >= tol ) { changed = true; // evaluate complex<IkReal> x = roots[i] + coeffs[0]; for(int j = 1; j < 6; ++j) { x = roots[i] * x + coeffs[j]; } for(int j = 0; j < 6; ++j) { if( i != j ) { if( roots[i] != roots[j] ) { x /= (roots[i] - roots[j]); } } } roots[i] -= x; err[i] = abs(x); } } if( !changed ) { break; } } numroots = 0; bool visited[6] = {false}; for(int i = 0; i < 6; ++i) { if( !visited[i] ) { // might be a multiple root, in which case it will have more error than the other roots // find any neighboring roots, and take the average complex<IkReal> newroot=roots[i]; int n = 1; for(int j = i+1; j < 6; ++j) { // care about error in real much more than imaginary if( abs(real(roots[i])-real(roots[j])) < tolsqrt && abs(imag(roots[i])-imag(roots[j])) < 0.002 ) { newroot += roots[j]; n += 1; visited[j] = true; } } if( n > 1 ) { newroot /= n; } // there are still cases where even the mean is not accurate enough, until a better multi-root algorithm is used, need to use the sqrt if( IKabs(imag(newroot)) < tolsqrt ) { rawroots[numroots++] = real(newroot); } } } } static inline void polyroots8(IkReal rawcoeffs[8+1], IkReal rawroots[8], int& numroots) { using std::complex; if( rawcoeffs[0] == 0 ) { // solve with one reduced degree polyroots7(&rawcoeffs[1], &rawroots[0], numroots); return; } IKFAST_ASSERT(rawcoeffs[0] != 0); const IkReal tol = 128.0*std::numeric_limits<IkReal>::epsilon(); const IkReal tolsqrt = sqrt(std::numeric_limits<IkReal>::epsilon()); complex<IkReal> coeffs[8]; const int maxsteps = 110; for(int i = 0; i < 8; ++i) { coeffs[i] = complex<IkReal>(rawcoeffs[i+1]/rawcoeffs[0]); } complex<IkReal> roots[8]; IkReal err[8]; roots[0] = complex<IkReal>(1,0); roots[1] = complex<IkReal>(0.4,0.9); // any complex number not a root of unity works err[0] = 1.0; err[1] = 1.0; for(int i = 2; i < 8; ++i) { roots[i] = roots[i-1]*roots[1]; err[i] = 1.0; } for(int step = 0; step < maxsteps; ++step) { bool changed = false; for(int i = 0; i < 8; ++i) { if ( err[i] >= tol ) { changed = true; // evaluate complex<IkReal> x = roots[i] + coeffs[0]; for(int j = 1; j < 8; ++j) { x = roots[i] * x + coeffs[j]; } for(int j = 0; j < 8; ++j) { if( i != j ) { if( roots[i] != roots[j] ) { x /= (roots[i] - roots[j]); } } } roots[i] -= x; err[i] = abs(x); } } if( !changed ) { break; } } numroots = 0; bool visited[8] = {false}; for(int i = 0; i < 8; ++i) { if( !visited[i] ) { // might be a multiple root, in which case it will have more error than the other roots // find any neighboring roots, and take the average complex<IkReal> newroot=roots[i]; int n = 1; for(int j = i+1; j < 8; ++j) { // care about error in real much more than imaginary if( abs(real(roots[i])-real(roots[j])) < tolsqrt && abs(imag(roots[i])-imag(roots[j])) < 0.002 ) { newroot += roots[j]; n += 1; visited[j] = true; } } if( n > 1 ) { newroot /= n; } // there are still cases where even the mean is not accurate enough, until a better multi-root algorithm is used, need to use the sqrt if( IKabs(imag(newroot)) < tolsqrt ) { rawroots[numroots++] = real(newroot); } } } } }; /// solves the inverse kinematics equations. /// \param pfree is an array specifying the free joints of the chain. IKFAST_API bool ComputeIk(const IkReal* eetrans, const IkReal* eerot, const IkReal* pfree, IkSolutionListBase<IkReal>& solutions) { IKSolver solver; return solver.ComputeIk(eetrans,eerot,pfree,solutions); } IKFAST_API bool ComputeIk2(const IkReal* eetrans, const IkReal* eerot, const IkReal* pfree, IkSolutionListBase<IkReal>& solutions, void* pOpenRAVEManip) { IKSolver solver; return solver.ComputeIk(eetrans,eerot,pfree,solutions); } IKFAST_API const char* GetKinematicsHash() { return ""; } IKFAST_API const char* GetIkFastVersion() { return "0x1000004a"; } #ifdef IKFAST_NAMESPACE } // end namespace #endif #ifndef IKFAST_NO_MAIN #include <stdio.h> #include <stdlib.h> #ifdef IKFAST_NAMESPACE using namespace IKFAST_NAMESPACE; #endif int main(int argc, char** argv) { if( argc != 12+GetNumFreeParameters()+1 ) { printf("\nUsage: ./ik r00 r01 r02 t0 r10 r11 r12 t1 r20 r21 r22 t2 free0 ...\n\n" "Returns the ik solutions given the transformation of the end effector specified by\n" "a 3x3 rotation R (rXX), and a 3x1 translation (tX).\n" "There are %d free parameters that have to be specified.\n\n",GetNumFreeParameters()); return 1; } IkSolutionList<IkReal> solutions; std::vector<IkReal> vfree(GetNumFreeParameters()); IkReal eerot[9],eetrans[3]; eerot[0] = atof(argv[1]); eerot[1] = atof(argv[2]); eerot[2] = atof(argv[3]); eetrans[0] = atof(argv[4]); eerot[3] = atof(argv[5]); eerot[4] = atof(argv[6]); eerot[5] = atof(argv[7]); eetrans[1] = atof(argv[8]); eerot[6] = atof(argv[9]); eerot[7] = atof(argv[10]); eerot[8] = atof(argv[11]); eetrans[2] = atof(argv[12]); for(std::size_t i = 0; i < vfree.size(); ++i) vfree[i] = atof(argv[13+i]); bool bSuccess = ComputeIk(eetrans, eerot, vfree.size() > 0 ? &vfree[0] : NULL, solutions); if( !bSuccess ) { fprintf(stderr,"Failed to get ik solution\n"); return -1; } printf("Found %d ik solutions:\n", (int)solutions.GetNumSolutions()); std::vector<IkReal> solvalues(GetNumJoints()); for(std::size_t i = 0; i < solutions.GetNumSolutions(); ++i) { const IkSolutionBase<IkReal>& sol = solutions.GetSolution(i); printf("sol%d (free=%d): ", (int)i, (int)sol.GetFree().size()); std::vector<IkReal> vsolfree(sol.GetFree().size()); sol.GetSolution(&solvalues[0],vsolfree.size()>0?&vsolfree[0]:NULL); for( std::size_t j = 0; j < solvalues.size(); ++j) printf("%.15f, ", solvalues[j]); printf("\n"); } return 0; } #endif //// START static PyObject *right_arm_ik(PyObject *self, PyObject *args) { IkSolutionList<IkReal> solutions; // Should only have two free parameters (torso and upper arm) std::vector<IkReal> vfree(GetNumFreeParameters()); IkReal eerot[9], eetrans[3]; // First list if 3x3 rotation matrix, easier to compute in Python. // Next list is [x, y, z] translation matrix. // Last list is free joints (torso and upper arm roll (in that order)). PyObject *rotList; // 3x3 rotation matrix PyObject *transList; // [x,y,z] PyObject *freeList; // [torso, upper arm] if(!PyArg_ParseTuple(args, "O!O!O!", &PyList_Type, &rotList, &PyList_Type, &transList, &PyList_Type, &freeList)) { return NULL; } for(std::size_t i = 0; i < 3; ++i) { eetrans[i] = PyFloat_AsDouble(PyList_GetItem(transList, i)); PyObject* rowList = PyList_GetItem(rotList, i); for( std::size_t j = 0; j < 3; ++j){ eerot[3*i + j] = PyFloat_AsDouble(PyList_GetItem(rowList, j)); } } for(int i = 0; i < GetNumFreeParameters(); ++i) { vfree[i] = PyFloat_AsDouble(PyList_GetItem(freeList, i)); } // I don't understand why we pass &vfree[0] instead of just vfree. // Clearly ComputeIk takes an IkReal* parameter there, but it treats that parameter like an array. // It probably does work because the computeIk call in main specifically makes this change. // So it's hopefully right, and I don't understand because I don't know C++. bool bSuccess = ComputeIk(eetrans, eerot, &vfree[0], solutions); if (!bSuccess) { return Py_BuildValue(""); // Equivalent to returning None } // There are 8 joints in each solution (torso + 7 arm joints). std::vector<IkReal> solvalues(GetNumJoints()); PyObject *solutionList = PyList_New(solutions.GetNumSolutions()); for(std::size_t i = 0; i < solutions.GetNumSolutions(); ++i) { const IkSolutionBase<IkReal>& sol = solutions.GetSolution(i); std::vector<IkReal> vsolfree(sol.GetFree().size()); sol.GetSolution(&solvalues[0],vsolfree.size()>0?&vsolfree[0]:NULL); PyObject *individualSolution = PyList_New(GetNumJoints()); for( std::size_t j = 0; j < solvalues.size(); ++j){ // I think IkReal is just a wrapper for double. So this should work. PyList_SetItem(individualSolution, j, PyFloat_FromDouble(solvalues[j])); } PyList_SetItem(solutionList, i, individualSolution); } return solutionList; } static PyObject *right_arm_fk(PyObject *self, PyObject *args) { std::vector<IkReal> joints(8); IkReal eerot[9], eetrans[3]; // First double is torso height. Next 7 doubles are arm joints PyObject *jointList; if(!PyArg_ParseTuple(args, "O!", &PyList_Type, &jointList)) { return NULL; } for(std::size_t i = 0; i < 8; ++i){ joints[i] = PyFloat_AsDouble(PyList_GetItem(jointList, i)); } ComputeFk(&joints[0], eetrans, eerot); PyObject *pose = PyList_New(2); PyObject *pos = PyList_New(3); PyObject *rot = PyList_New(3); for(std::size_t i = 0; i < 3; ++i) { PyList_SetItem(pos, i, PyFloat_FromDouble(eetrans[i])); PyObject *row = PyList_New(3); for( std::size_t j = 0; j < 3; ++j){ PyList_SetItem(row, j, PyFloat_FromDouble(eerot[3*i + j])); } PyList_SetItem(rot, i, row); } PyList_SetItem(pose, 0, pos); PyList_SetItem(pose, 1, rot); return pose; } static PyMethodDef ikRightMethods[] = { {"get_ik", right_arm_ik, METH_VARARGS, "Compute ik solutions using ikfast."}, {"get_fk", right_arm_fk, METH_VARARGS, "Compute fk solutions using ikfast."}, // TODO: deprecate {"rightIK", right_arm_ik, METH_VARARGS, "Compute IK for the PR2's right arm."}, {"rightFK", right_arm_fk, METH_VARARGS, "Compute FK for the PR2's right arm."}, {NULL, NULL, 0, NULL} // Not sure why/if this is needed. It shows up in the examples though(something about Sentinel). }; // OLD WAY /*#if PY_MAJOR_VERSION >= 3 //// This is the python3.4 version. static struct PyModuleDef ikRightModule = { PyModuleDef_HEAD_INIT, "ikRight", NULL, -1, ikRightMethods }; PyMODINIT_FUNC PyInit_ikRight(void) { return PyModule_Create(&ikRightModule); } #else //// This is the python2.7 version. PyMODINIT_FUNC initikRight(void) { (void) Py_InitModule("ikRight", ikRightMethods); } #endif*/ // NEW WAY #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef ikRightModule = { PyModuleDef_HEAD_INIT, "ikRight", /* name of module */ NULL, /* module documentation, may be NULL */ -1, /* size of per-interpreter state of the module, or -1 if the module keeps state in global variables. */ ikRightMethods }; #define INITERROR return NULL PyMODINIT_FUNC PyInit_ikRight(void) #else // PY_MAJOR_VERSION < 3 #define INITERROR return PyMODINIT_FUNC initikRight(void) #endif { #if PY_MAJOR_VERSION >= 3 PyObject *module = PyModule_Create(&ikRightModule); #else PyObject *module = Py_InitModule("ikRight", ikRightMethods); #endif if (module == NULL) INITERROR; #if PY_MAJOR_VERSION >= 3 return module; #endif } //// END
420,723
C++
30.329511
874
0.635349
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/pybullet_tools/ikfast/pr2/left_arm_ik.cpp
/// autogenerated analytical inverse kinematics code from ikfast program part of OpenRAVE /// \author Rosen Diankov /// /// Licensed under the Apache License, Version 2.0 (the "License"); /// you may not use this file except in compliance with the License. /// You may obtain a copy of the License at /// http://www.apache.org/licenses/LICENSE-2.0 /// /// Unless required by applicable law or agreed to in writing, software /// distributed under the License is distributed on an "AS IS" BASIS, /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. /// See the License for the specific language governing permissions and /// limitations under the License. /// /// ikfast version 0x1000004a generated on 2018-07-20 15:25:52.167515 /// Generated using solver transform6d /// To compile with gcc: /// gcc -lstdc++ ik.cpp /// To compile without any main function as a shared object (might need -llapack): /// gcc -fPIC -lstdc++ -DIKFAST_NO_MAIN -DIKFAST_CLIBRARY -shared -Wl,-soname,libik.so -o libik.so ik.cpp //// START //// Make sure the version number matches. //// You might need to install the dev version to get the header files. //// sudo apt-get install python3.4-dev #include "Python.h" //// END #define IKFAST_HAS_LIBRARY #include "ikfast.h" // found inside share/openrave-X.Y/python/ikfast.h using namespace ikfast; // check if the included ikfast version matches what this file was compiled with #define IKFAST_COMPILE_ASSERT(x) extern int __dummy[(int)x] IKFAST_COMPILE_ASSERT(IKFAST_VERSION==0x1000004a); #include <cmath> #include <vector> #include <limits> #include <algorithm> #include <complex> #ifndef IKFAST_ASSERT #include <stdexcept> #include <sstream> #include <iostream> #ifdef _MSC_VER #ifndef __PRETTY_FUNCTION__ #define __PRETTY_FUNCTION__ __FUNCDNAME__ #endif #endif #ifndef __PRETTY_FUNCTION__ #define __PRETTY_FUNCTION__ __func__ #endif #define IKFAST_ASSERT(b) { if( !(b) ) { std::stringstream ss; ss << "ikfast exception: " << __FILE__ << ":" << __LINE__ << ": " <<__PRETTY_FUNCTION__ << ": Assertion '" << #b << "' failed"; throw std::runtime_error(ss.str()); } } #endif #if defined(_MSC_VER) #define IKFAST_ALIGNED16(x) __declspec(align(16)) x #else #define IKFAST_ALIGNED16(x) x __attribute((aligned(16))) #endif #define IK2PI ((IkReal)6.28318530717959) #define IKPI ((IkReal)3.14159265358979) #define IKPI_2 ((IkReal)1.57079632679490) #ifdef _MSC_VER #ifndef isnan #define isnan _isnan #endif #ifndef isinf #define isinf _isinf #endif //#ifndef isfinite //#define isfinite _isfinite //#endif #endif // _MSC_VER // lapack routines extern "C" { void dgetrf_ (const int* m, const int* n, double* a, const int* lda, int* ipiv, int* info); void zgetrf_ (const int* m, const int* n, std::complex<double>* a, const int* lda, int* ipiv, int* info); void dgetri_(const int* n, const double* a, const int* lda, int* ipiv, double* work, const int* lwork, int* info); void dgesv_ (const int* n, const int* nrhs, double* a, const int* lda, int* ipiv, double* b, const int* ldb, int* info); void dgetrs_(const char *trans, const int *n, const int *nrhs, double *a, const int *lda, int *ipiv, double *b, const int *ldb, int *info); void dgeev_(const char *jobvl, const char *jobvr, const int *n, double *a, const int *lda, double *wr, double *wi,double *vl, const int *ldvl, double *vr, const int *ldvr, double *work, const int *lwork, int *info); } using namespace std; // necessary to get std math routines #ifdef IKFAST_NAMESPACE namespace IKFAST_NAMESPACE { #endif inline float IKabs(float f) { return fabsf(f); } inline double IKabs(double f) { return fabs(f); } inline float IKsqr(float f) { return f*f; } inline double IKsqr(double f) { return f*f; } inline float IKlog(float f) { return logf(f); } inline double IKlog(double f) { return log(f); } // allows asin and acos to exceed 1. has to be smaller than thresholds used for branch conds and evaluation #ifndef IKFAST_SINCOS_THRESH #define IKFAST_SINCOS_THRESH ((IkReal)1e-7) #endif // used to check input to atan2 for degenerate cases. has to be smaller than thresholds used for branch conds and evaluation #ifndef IKFAST_ATAN2_MAGTHRESH #define IKFAST_ATAN2_MAGTHRESH ((IkReal)1e-7) #endif // minimum distance of separate solutions #ifndef IKFAST_SOLUTION_THRESH #define IKFAST_SOLUTION_THRESH ((IkReal)1e-6) #endif // there are checkpoints in ikfast that are evaluated to make sure they are 0. This threshold speicfies by how much they can deviate #ifndef IKFAST_EVALCOND_THRESH #define IKFAST_EVALCOND_THRESH ((IkReal)0.00001) #endif inline float IKasin(float f) { IKFAST_ASSERT( f > -1-IKFAST_SINCOS_THRESH && f < 1+IKFAST_SINCOS_THRESH ); // any more error implies something is wrong with the solver if( f <= -1 ) return float(-IKPI_2); else if( f >= 1 ) return float(IKPI_2); return asinf(f); } inline double IKasin(double f) { IKFAST_ASSERT( f > -1-IKFAST_SINCOS_THRESH && f < 1+IKFAST_SINCOS_THRESH ); // any more error implies something is wrong with the solver if( f <= -1 ) return -IKPI_2; else if( f >= 1 ) return IKPI_2; return asin(f); } // return positive value in [0,y) inline float IKfmod(float x, float y) { while(x < 0) { x += y; } return fmodf(x,y); } // return positive value in [0,y) inline double IKfmod(double x, double y) { while(x < 0) { x += y; } return fmod(x,y); } inline float IKacos(float f) { IKFAST_ASSERT( f > -1-IKFAST_SINCOS_THRESH && f < 1+IKFAST_SINCOS_THRESH ); // any more error implies something is wrong with the solver if( f <= -1 ) return float(IKPI); else if( f >= 1 ) return float(0); return acosf(f); } inline double IKacos(double f) { IKFAST_ASSERT( f > -1-IKFAST_SINCOS_THRESH && f < 1+IKFAST_SINCOS_THRESH ); // any more error implies something is wrong with the solver if( f <= -1 ) return IKPI; else if( f >= 1 ) return 0; return acos(f); } inline float IKsin(float f) { return sinf(f); } inline double IKsin(double f) { return sin(f); } inline float IKcos(float f) { return cosf(f); } inline double IKcos(double f) { return cos(f); } inline float IKtan(float f) { return tanf(f); } inline double IKtan(double f) { return tan(f); } inline float IKsqrt(float f) { if( f <= 0.0f ) return 0.0f; return sqrtf(f); } inline double IKsqrt(double f) { if( f <= 0.0 ) return 0.0; return sqrt(f); } inline float IKatan2Simple(float fy, float fx) { return atan2f(fy,fx); } inline float IKatan2(float fy, float fx) { if( isnan(fy) ) { IKFAST_ASSERT(!isnan(fx)); // if both are nan, probably wrong value will be returned return float(IKPI_2); } else if( isnan(fx) ) { return 0; } return atan2f(fy,fx); } inline double IKatan2Simple(double fy, double fx) { return atan2(fy,fx); } inline double IKatan2(double fy, double fx) { if( isnan(fy) ) { IKFAST_ASSERT(!isnan(fx)); // if both are nan, probably wrong value will be returned return IKPI_2; } else if( isnan(fx) ) { return 0; } return atan2(fy,fx); } template <typename T> struct CheckValue { T value; bool valid; }; template <typename T> inline CheckValue<T> IKatan2WithCheck(T fy, T fx, T epsilon) { CheckValue<T> ret; ret.valid = false; ret.value = 0; if( !isnan(fy) && !isnan(fx) ) { if( IKabs(fy) >= IKFAST_ATAN2_MAGTHRESH || IKabs(fx) > IKFAST_ATAN2_MAGTHRESH ) { ret.value = IKatan2Simple(fy,fx); ret.valid = true; } } return ret; } inline float IKsign(float f) { if( f > 0 ) { return float(1); } else if( f < 0 ) { return float(-1); } return 0; } inline double IKsign(double f) { if( f > 0 ) { return 1.0; } else if( f < 0 ) { return -1.0; } return 0; } template <typename T> inline CheckValue<T> IKPowWithIntegerCheck(T f, int n) { CheckValue<T> ret; ret.valid = true; if( n == 0 ) { ret.value = 1.0; return ret; } else if( n == 1 ) { ret.value = f; return ret; } else if( n < 0 ) { if( f == 0 ) { ret.valid = false; ret.value = (T)1.0e30; return ret; } if( n == -1 ) { ret.value = T(1.0)/f; return ret; } } int num = n > 0 ? n : -n; if( num == 2 ) { ret.value = f*f; } else if( num == 3 ) { ret.value = f*f*f; } else { ret.value = 1.0; while(num>0) { if( num & 1 ) { ret.value *= f; } num >>= 1; f *= f; } } if( n < 0 ) { ret.value = T(1.0)/ret.value; } return ret; } /// solves the forward kinematics equations. /// \param pfree is an array specifying the free joints of the chain. IKFAST_API void ComputeFk(const IkReal* j, IkReal* eetrans, IkReal* eerot) { IkReal x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,x17,x18,x19,x20,x21,x22,x23,x24,x25,x26,x27,x28,x29,x30,x31,x32,x33,x34,x36,x37,x38,x39,x41,x42,x43,x44,x45,x46,x47,x48,x49,x50,x51,x52,x54,x55,x56,x57,x58,x59,x60,x61,x62,x63,x64,x65,x66; x0=IKcos(j[1]); x1=IKcos(j[4]); x2=IKcos(j[2]); x3=IKsin(j[4]); x4=IKsin(j[2]); x5=IKsin(j[3]); x6=IKcos(j[3]); x7=IKsin(j[1]); x8=IKcos(j[5]); x9=IKsin(j[5]); x10=IKsin(j[6]); x11=IKcos(j[6]); x12=IKsin(j[7]); x13=IKcos(j[7]); x14=((1.0)*x1); x15=((1.0)*x3); x16=((0.18)*x8); x17=((1.0)*x6); x18=((0.321)*x5); x19=((1.0)*x8); x20=((0.18)*x9); x21=((0.18)*x3); x22=((0.18)*x1); x23=((0.321)*x1); x24=((1.0)*x9); x25=((1.0)*x10); x26=((0.321)*x6); x27=((1.0)*x11); x28=(x2*x7); x29=((-1.0)*x3); x30=(x0*x4); x31=(x2*x5); x32=((-1.0)*x10); x33=(x0*x2); x34=((-1.0)*x1); x36=((-1.0)*x11); x37=(x5*x7); x38=(x2*x6); x39=(x4*x7); x41=(x15*x33); x42=(x14*x38); x43=(((x30*x5))+(((-1.0)*x17*x7))); x44=(((x0*x5))+(((-1.0)*x17*x39))); x45=(((x0*x6))+((x37*x4))); x46=((((-1.0)*x42))+((x3*x4))); x47=(x42+(((-1.0)*x15*x4))); x48=((((-1.0)*x37))+(((-1.0)*x17*x30))); x49=(x43*x9); x50=(((x14*x4))+((x15*x38))); x51=(x45*x9); x52=(x45*x8); x54=(x47*x9); x55=(x1*x48); x56=(((x31*x9))+((x46*x8))); x57=((((-1.0)*x14*x44))+((x15*x28))); x58=(((x28*x29))+((x1*x44))); x59=(((x29*x33))+x55); x60=(x58*x8); x61=(x57*x9); x62=(x59*x8); x63=(x51+x60); x64=(x49+x62); x65=((((-1.0)*x27*x56))+(((-1.0)*x25*x50))); x66=(((x36*x63))+((x32*((((x29*x44))+((x28*x34))))))); eerot[0]=(((x11*((((x3*x48))+((x1*x33))))))+((x10*((x49+((x8*(((((-1.0)*x41))+x55))))))))); eerot[1]=(((x13*((((x9*((((x34*x48))+x41))))+((x43*x8))))))+(((-1.0)*x12*((((x27*x64))+((x25*(((((-1.0)*x15*x48))+(((-1.0)*x14*x33))))))))))); eerot[2]=(((x13*((((x36*x64))+((x32*((((x29*x48))+((x33*x34))))))))))+(((-1.0)*x12*((((x24*(((((-1.0)*x14*x48))+x41))))+((x19*x43))))))); eetrans[0]=((-0.05)+((x10*((((x20*x43))+((x16*x59))))))+((x23*x33))+(((0.1)*x0))+((x3*(((((-1.0)*x18*x7))+(((-1.0)*x26*x30))))))+(((0.4)*x33))+((x11*((((x22*x33))+((x21*x48))))))); eerot[3]=(((x11*((((x1*x28))+((x3*x44))))))+((x10*x63))); eerot[4]=(((x12*x66))+((x13*((x52+x61))))); eerot[5]=(((x12*(((((-1.0)*x19*x45))+(((-1.0)*x24*x57))))))+((x13*x66))); eetrans[1]=((0.188)+(((0.1)*x7))+((x10*((((x20*x45))+((x16*x58))))))+((x23*x28))+(((0.4)*x28))+((x11*((((x22*x28))+((x21*x44))))))+((x3*((((x0*x18))+(((-1.0)*x26*x39))))))); eerot[6]=((((-1.0)*x11*x50))+((x10*x56))); eerot[7]=(((x13*((((x31*x8))+x54))))+((x12*x65))); eerot[8]=(((x13*x65))+((x12*(((((-1.0)*x24*x47))+(((-1.0)*x19*x31))))))); IkReal x67=((1.0)*x4); eetrans[2]=((0.739675)+((x11*(((((-1.0)*x21*x38))+(((-1.0)*x22*x67))))))+((x10*((((x20*x31))+((x16*x46))))))+(((-1.0)*x2*x26*x3))+(((-1.0)*x23*x67))+(((-0.4)*x4))+j[0]); } IKFAST_API int GetNumFreeParameters() { return 2; } IKFAST_API int* GetFreeParameters() { static int freeparams[] = {0, 3}; return freeparams; } IKFAST_API int GetNumJoints() { return 8; } IKFAST_API int GetIkRealSize() { return sizeof(IkReal); } IKFAST_API int GetIkType() { return 0x67000001; } class IKSolver { public: IkReal j15,cj15,sj15,htj15,j15mul,j16,cj16,sj16,htj16,j16mul,j18,cj18,sj18,htj18,j18mul,j19,cj19,sj19,htj19,j19mul,j20,cj20,sj20,htj20,j20mul,j21,cj21,sj21,htj21,j21mul,j12,cj12,sj12,htj12,j17,cj17,sj17,htj17,new_r00,r00,rxp0_0,new_r01,r01,rxp0_1,new_r02,r02,rxp0_2,new_r10,r10,rxp1_0,new_r11,r11,rxp1_1,new_r12,r12,rxp1_2,new_r20,r20,rxp2_0,new_r21,r21,rxp2_1,new_r22,r22,rxp2_2,new_px,px,npx,new_py,py,npy,new_pz,pz,npz,pp; unsigned char _ij15[2], _nj15,_ij16[2], _nj16,_ij18[2], _nj18,_ij19[2], _nj19,_ij20[2], _nj20,_ij21[2], _nj21,_ij12[2], _nj12,_ij17[2], _nj17; IkReal j100, cj100, sj100; unsigned char _ij100[2], _nj100; bool ComputeIk(const IkReal* eetrans, const IkReal* eerot, const IkReal* pfree, IkSolutionListBase<IkReal>& solutions) { j15=numeric_limits<IkReal>::quiet_NaN(); _ij15[0] = -1; _ij15[1] = -1; _nj15 = -1; j16=numeric_limits<IkReal>::quiet_NaN(); _ij16[0] = -1; _ij16[1] = -1; _nj16 = -1; j18=numeric_limits<IkReal>::quiet_NaN(); _ij18[0] = -1; _ij18[1] = -1; _nj18 = -1; j19=numeric_limits<IkReal>::quiet_NaN(); _ij19[0] = -1; _ij19[1] = -1; _nj19 = -1; j20=numeric_limits<IkReal>::quiet_NaN(); _ij20[0] = -1; _ij20[1] = -1; _nj20 = -1; j21=numeric_limits<IkReal>::quiet_NaN(); _ij21[0] = -1; _ij21[1] = -1; _nj21 = -1; _ij12[0] = -1; _ij12[1] = -1; _nj12 = 0; _ij17[0] = -1; _ij17[1] = -1; _nj17 = 0; for(int dummyiter = 0; dummyiter < 1; ++dummyiter) { solutions.Clear(); j12=pfree[0]; cj12=cos(pfree[0]); sj12=sin(pfree[0]), htj12=tan(pfree[0]*0.5); j17=pfree[1]; cj17=cos(pfree[1]); sj17=sin(pfree[1]), htj17=tan(pfree[1]*0.5); r00 = eerot[0*3+0]; r01 = eerot[0*3+1]; r02 = eerot[0*3+2]; r10 = eerot[1*3+0]; r11 = eerot[1*3+1]; r12 = eerot[1*3+2]; r20 = eerot[2*3+0]; r21 = eerot[2*3+1]; r22 = eerot[2*3+2]; px = eetrans[0]; py = eetrans[1]; pz = eetrans[2]; new_r00=((-1.0)*r02); new_r01=r01; new_r02=r00; new_px=((0.05)+(((-0.18)*r00))+px); new_r10=((-1.0)*r12); new_r11=r11; new_r12=r10; new_py=((-0.188)+(((-0.18)*r10))+py); new_r20=((-1.0)*r22); new_r21=r21; new_r22=r20; new_pz=((-0.739675)+(((-1.0)*j12))+pz+(((-0.18)*r20))); r00 = new_r00; r01 = new_r01; r02 = new_r02; r10 = new_r10; r11 = new_r11; r12 = new_r12; r20 = new_r20; r21 = new_r21; r22 = new_r22; px = new_px; py = new_py; pz = new_pz; IkReal x68=((1.0)*px); IkReal x69=((1.0)*pz); IkReal x70=((1.0)*py); pp=((px*px)+(py*py)+(pz*pz)); npx=(((px*r00))+((py*r10))+((pz*r20))); npy=(((px*r01))+((py*r11))+((pz*r21))); npz=(((px*r02))+((py*r12))+((pz*r22))); rxp0_0=((((-1.0)*r20*x70))+((pz*r10))); rxp0_1=(((px*r20))+(((-1.0)*r00*x69))); rxp0_2=((((-1.0)*r10*x68))+((py*r00))); rxp1_0=((((-1.0)*r21*x70))+((pz*r11))); rxp1_1=(((px*r21))+(((-1.0)*r01*x69))); rxp1_2=((((-1.0)*r11*x68))+((py*r01))); rxp2_0=((((-1.0)*r22*x70))+((pz*r12))); rxp2_1=(((px*r22))+(((-1.0)*r02*x69))); rxp2_2=((((-1.0)*r12*x68))+((py*r02))); IkReal op[8+1], zeror[8]; int numroots; IkReal x71=((0.2)*px); IkReal x72=((1.0)*pp); IkReal x73=((0.509841)+(((-1.0)*x72))+x71); IkReal x74=((-0.003759)+(((-1.0)*x72))+x71); IkReal x75=(x72+x71); IkReal x76=((0.509841)+(((-1.0)*x75))); IkReal x77=((-0.003759)+(((-1.0)*x75))); IkReal gconst0=x73; IkReal gconst1=x74; IkReal gconst2=x73; IkReal gconst3=x74; IkReal gconst4=x76; IkReal gconst5=x77; IkReal gconst6=x76; IkReal gconst7=x77; IkReal x78=py*py; IkReal x79=sj17*sj17; IkReal x80=px*px; IkReal x81=((1.0)*gconst4); IkReal x82=(gconst5*py); IkReal x83=((4.0)*px); IkReal x84=(gconst0*gconst3); IkReal x85=(gconst1*gconst2); IkReal x86=((2.0)*gconst5); IkReal x87=((1.0)*gconst0); IkReal x88=(gconst1*gconst7); IkReal x89=(gconst0*gconst6); IkReal x90=(gconst1*gconst3); IkReal x91=(gconst4*gconst7); IkReal x92=(gconst6*py); IkReal x93=((2.0)*gconst0); IkReal x94=(gconst0*gconst7); IkReal x95=((2.0)*gconst4); IkReal x96=(gconst3*gconst5); IkReal x97=(gconst2*gconst5); IkReal x98=(gconst3*gconst4); IkReal x99=(gconst5*gconst6); IkReal x100=(gconst2*gconst4); IkReal x101=(gconst1*gconst6); IkReal x102=(px*py); IkReal x103=(gconst1*py); IkReal x104=(gconst2*py); IkReal x105=(gconst5*gconst7); IkReal x106=((1.05513984)*x102); IkReal x107=(gconst6*x78); IkReal x108=((0.3297312)*x79); IkReal x109=((4.0)*x80); IkReal x110=(gconst2*x78); IkReal x111=((2.0)*x78); IkReal x112=((1.0)*x78); IkReal x113=((0.824328)*x79); IkReal x114=((0.412164)*x79); IkReal x115=((0.1648656)*x79); IkReal x116=(x78*x91); IkReal x117=(x78*x99); IkReal x118=(x78*x97); IkReal x119=(x78*x98); IkReal x120=(x78*x94); IkReal x121=(x101*x78); IkReal x122=((0.0834355125792)*py*x79); IkReal x123=(x78*x85); IkReal x124=(x78*x84); IkReal x125=(x78*x79); IkReal x126=(x114*x99); IkReal x127=(x105*x112); IkReal x128=(x107*x81); IkReal x129=(py*x100*x83); IkReal x130=(py*x83*x88); IkReal x131=(gconst3*x82*x83); IkReal x132=(py*x83*x89); IkReal x133=(py*x83*x98); IkReal x134=(py*x83*x94); IkReal x135=(gconst2*x82*x83); IkReal x136=(gconst1*x83*x92); IkReal x137=(x112*x88); IkReal x138=(x110*x81); IkReal x139=(x101*x114); IkReal x140=((0.06594624)*x125); IkReal x141=(x107*x87); IkReal x142=(x114*x97); IkReal x143=(x112*x96); IkReal x144=(pp*py*x108); IkReal x145=((0.06594624)*x102*x79); IkReal x146=(x110*x87); IkReal x147=(x112*x90); IkReal x148=(x114*x85); IkReal x149=(x124+x123); IkReal x150=(x117+x116); IkReal x151=(x126+x127+x128); IkReal x152=(x146+x147+x148); IkReal x153=(x120+x121+x119+x118); IkReal x154=(x135+x134+x136+x133); IkReal x155=(x131+x130+x132+x129); IkReal x156=(x140+x141+x142+x143+x137+x139+x138); op[0]=((((-1.0)*x151))+x150); op[1]=((((-1.0)*x106))+(((-1.0)*x122))+x144+x145); op[2]=((((-1.0)*x156))+((gconst7*x78*x86))+((x107*x95))+(((-1.0)*x113*x99))+(((-1.0)*gconst4*gconst6*x109))+x153+(((-1.0)*x111*x91))+((x109*x99))+((x109*x91))+(((-1.0)*x105*x109))+(((-1.0)*x107*x86))); op[3]=((((-1.0)*x155))+(((-1.0)*gconst6*x82*x83))+(((-1.0)*py*x83*x91))+((gconst4*x83*x92))+x154+(((-1.0)*x108*x82))+(((-1.0)*x108*x92))+((gconst7*x82*x83))+(((-1.0)*x103*x115))+(((-1.0)*x104*x115))); op[4]=((((-0.13189248)*x125))+(((-1.0)*x151))+(((-1.0)*x152))+(((-1.0)*x101*x113))+(((-1.0)*x101*x111))+(((-1.0)*x100*x109))+(((-1.0)*x113*x97))+(((-1.0)*gconst3*x78*x95))+x150+x149+((gconst3*x78*x86))+(((-1.0)*x110*x86))+((x111*x88))+((x111*x89))+((x109*x98))+((x109*x94))+((x109*x97))+(((-1.0)*gconst7*x78*x93))+(((-1.0)*x109*x96))+(((-1.0)*x109*x88))+(((-1.0)*x109*x89))+((x101*x109))+((x110*x95))); op[5]=((((-1.0)*x104*x108))+(((-1.0)*x115*x82))+(((-1.0)*x154))+(((-1.0)*x115*x92))+(((-1.0)*py*x83*x90))+x155+((py*x83*x85))+((py*x83*x84))+(((-1.0)*x103*x108))+(((-1.0)*gconst0*x104*x83))); op[6]=((((-1.0)*x156))+(((-1.0)*x113*x85))+(((-1.0)*x111*x84))+(((-1.0)*x111*x85))+x153+(((-1.0)*gconst0*gconst2*x109))+((x111*x90))+((x109*x84))+((x109*x85))+(((-1.0)*x109*x90))+((x110*x93))); op[7]=((((-1.0)*x145))+(((-1.0)*x122))+x144+x106); op[8]=((((-1.0)*x152))+x149); polyroots8(op,zeror,numroots); IkReal j15array[8], cj15array[8], sj15array[8], tempj15array[1]; int numsolutions = 0; for(int ij15 = 0; ij15 < numroots; ++ij15) { IkReal htj15 = zeror[ij15]; tempj15array[0]=((2.0)*(atan(htj15))); for(int kj15 = 0; kj15 < 1; ++kj15) { j15array[numsolutions] = tempj15array[kj15]; if( j15array[numsolutions] > IKPI ) { j15array[numsolutions]-=IK2PI; } else if( j15array[numsolutions] < -IKPI ) { j15array[numsolutions]+=IK2PI; } sj15array[numsolutions] = IKsin(j15array[numsolutions]); cj15array[numsolutions] = IKcos(j15array[numsolutions]); numsolutions++; } } bool j15valid[8]={true,true,true,true,true,true,true,true}; _nj15 = 8; for(int ij15 = 0; ij15 < numsolutions; ++ij15) { if( !j15valid[ij15] ) { continue; } j15 = j15array[ij15]; cj15 = cj15array[ij15]; sj15 = sj15array[ij15]; htj15 = IKtan(j15/2); _ij15[0] = ij15; _ij15[1] = -1; for(int iij15 = ij15+1; iij15 < numsolutions; ++iij15) { if( j15valid[iij15] && IKabs(cj15array[ij15]-cj15array[iij15]) < IKFAST_SOLUTION_THRESH && IKabs(sj15array[ij15]-sj15array[iij15]) < IKFAST_SOLUTION_THRESH ) { j15valid[iij15]=false; _ij15[1] = iij15; break; } } { IkReal j16eval[2]; IkReal x157=py*py; IkReal x158=cj15*cj15; IkReal x159=px*px; IkReal x160=pz*pz; IkReal x161=((4.0)*sj17); IkReal x162=((20.0)*sj17); IkReal x163=(py*sj15); IkReal x164=(cj15*px); IkReal x165=((100.0)*sj17); IkReal x166=((0.8)*sj17); IkReal x167=(x157*x158); IkReal x168=(x158*x159); j16eval[0]=((((-1.0)*x157*x165))+(((-200.0)*sj17*x163*x164))+(((-1.0)*x160*x165))+((x162*x163))+((x162*x164))+(((-1.0)*sj17))+((x165*x167))+(((-1.0)*x165*x168))); j16eval[1]=IKsign(((((-1.0)*x157*x161))+((x161*x167))+(((-1.0)*x160*x161))+(((-1.0)*x161*x168))+((x164*x166))+(((-8.0)*sj17*x163*x164))+((x163*x166))+(((-0.04)*sj17)))); if( IKabs(j16eval[0]) < 0.0000010000000000 || IKabs(j16eval[1]) < 0.0000010000000000 ) { { IkReal j18eval[1]; j18eval[0]=sj17; if( IKabs(j18eval[0]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j17))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j18array[2], cj18array[2], sj18array[2]; bool j18valid[2]={false}; _nj18 = 2; cj18array[0]=((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*cj15*px))+(((-0.778816199376947)*py*sj15))); if( cj18array[0] >= -1-IKFAST_SINCOS_THRESH && cj18array[0] <= 1+IKFAST_SINCOS_THRESH ) { j18valid[0] = j18valid[1] = true; j18array[0] = IKacos(cj18array[0]); sj18array[0] = IKsin(j18array[0]); cj18array[1] = cj18array[0]; j18array[1] = -j18array[0]; sj18array[1] = -sj18array[0]; } else if( isnan(cj18array[0]) ) { // probably any value will work j18valid[0] = true; cj18array[0] = 1; sj18array[0] = 0; j18array[0] = 0; } for(int ij18 = 0; ij18 < 2; ++ij18) { if( !j18valid[ij18] ) { continue; } _ij18[0] = ij18; _ij18[1] = -1; for(int iij18 = ij18+1; iij18 < 2; ++iij18) { if( j18valid[iij18] && IKabs(cj18array[ij18]-cj18array[iij18]) < IKFAST_SOLUTION_THRESH && IKabs(sj18array[ij18]-sj18array[iij18]) < IKFAST_SOLUTION_THRESH ) { j18valid[iij18]=false; _ij18[1] = iij18; break; } } j18 = j18array[ij18]; cj18 = cj18array[ij18]; sj18 = sj18array[ij18]; { IkReal j16eval[3]; sj17=0; cj17=1.0; j17=0; IkReal x169=((321000.0)*sj18); IkReal x170=(py*sj15); IkReal x171=((321000.0)*cj18); IkReal x172=(cj15*px); j16eval[0]=((1.02430295950156)+cj18); j16eval[1]=IKsign(((263041.0)+(((256800.0)*cj18)))); j16eval[2]=((IKabs(((((-1.0)*pz*x171))+(((-400000.0)*pz))+(((32100.0)*sj18))+(((-1.0)*x169*x170))+(((-1.0)*x169*x172)))))+(IKabs(((-40000.0)+(((400000.0)*x170))+(((400000.0)*x172))+(((-1.0)*pz*x169))+(((-32100.0)*cj18))+((x171*x172))+((x170*x171)))))); if( IKabs(j16eval[0]) < 0.0000010000000000 || IKabs(j16eval[1]) < 0.0000010000000000 || IKabs(j16eval[2]) < 0.0000010000000000 ) { { IkReal j16eval[3]; sj17=0; cj17=1.0; j17=0; IkReal x173=(cj15*px); IkReal x174=((1000.0)*pz); IkReal x175=(py*sj15); IkReal x176=((10.0)*cj18); IkReal x177=((321.0)*cj18); IkReal x178=(pz*sj18); j16eval[0]=((1.24610591900312)+(((-10.0)*x178))+(((-1.0)*x175*x176))+cj18+(((-12.4610591900312)*x175))+(((-12.4610591900312)*x173))+(((-1.0)*x173*x176))); j16eval[1]=IKsign(((40.0)+(((-1.0)*x175*x177))+(((-400.0)*x175))+(((-400.0)*x173))+(((32.1)*cj18))+(((-321.0)*x178))+(((-1.0)*x173*x177)))); j16eval[2]=((IKabs(((((-100.0)*pz))+(((103.041)*cj18*sj18))+((x173*x174))+((x174*x175))+(((128.4)*sj18)))))+(IKabs(((-160.0)+((pz*x174))+(((-256.8)*cj18))+(((-103.041)*(cj18*cj18))))))); if( IKabs(j16eval[0]) < 0.0000010000000000 || IKabs(j16eval[1]) < 0.0000010000000000 || IKabs(j16eval[2]) < 0.0000010000000000 ) { { IkReal j16eval[3]; sj17=0; cj17=1.0; j17=0; IkReal x179=cj15*cj15; IkReal x180=py*py; IkReal x181=px*px; IkReal x182=pz*pz; IkReal x183=(py*sj15); IkReal x184=((321.0)*sj18); IkReal x185=(cj15*px); IkReal x186=((321.0)*cj18); IkReal x187=((100.0)*x179); IkReal x188=((1000.0)*x179); j16eval[0]=((-1.0)+((x180*x187))+(((20.0)*x183))+(((20.0)*x185))+(((-100.0)*x180))+(((-100.0)*x182))+(((-200.0)*x183*x185))+(((-1.0)*x181*x187))); j16eval[1]=IKsign(((-10.0)+((x180*x188))+(((-1000.0)*x180))+(((-1000.0)*x182))+(((200.0)*x183))+(((200.0)*x185))+(((-2000.0)*x183*x185))+(((-1.0)*x181*x188)))); j16eval[2]=((IKabs((((pz*x186))+(((400.0)*pz))+((x184*x185))+(((-32.1)*sj18))+((x183*x184)))))+(IKabs(((40.0)+((pz*x184))+(((-400.0)*x185))+(((-400.0)*x183))+(((32.1)*cj18))+(((-1.0)*x185*x186))+(((-1.0)*x183*x186)))))); if( IKabs(j16eval[0]) < 0.0000010000000000 || IKabs(j16eval[1]) < 0.0000010000000000 || IKabs(j16eval[2]) < 0.0000010000000000 ) { continue; // no branches [j16] } else { { IkReal j16array[1], cj16array[1], sj16array[1]; bool j16valid[1]={false}; _nj16 = 1; IkReal x189=py*py; IkReal x190=cj15*cj15; IkReal x191=(py*sj15); IkReal x192=((321.0)*sj18); IkReal x193=(cj15*px); IkReal x194=((321.0)*cj18); IkReal x195=((1000.0)*x190); CheckValue<IkReal> x196=IKPowWithIntegerCheck(IKsign(((-10.0)+(((-1000.0)*(pz*pz)))+(((-2000.0)*x191*x193))+((x189*x195))+(((-1000.0)*x189))+(((-1.0)*x195*(px*px)))+(((200.0)*x191))+(((200.0)*x193)))),-1); if(!x196.valid){ continue; } CheckValue<IkReal> x197 = IKatan2WithCheck(IkReal(((((400.0)*pz))+((x192*x193))+(((-32.1)*sj18))+((x191*x192))+((pz*x194)))),IkReal(((40.0)+(((-400.0)*x191))+(((-400.0)*x193))+(((-1.0)*x191*x194))+(((32.1)*cj18))+(((-1.0)*x193*x194))+((pz*x192)))),IKFAST_ATAN2_MAGTHRESH); if(!x197.valid){ continue; } j16array[0]=((-1.5707963267949)+(((1.5707963267949)*(x196.value)))+(x197.value)); sj16array[0]=IKsin(j16array[0]); cj16array[0]=IKcos(j16array[0]); if( j16array[0] > IKPI ) { j16array[0]-=IK2PI; } else if( j16array[0] < -IKPI ) { j16array[0]+=IK2PI; } j16valid[0] = true; for(int ij16 = 0; ij16 < 1; ++ij16) { if( !j16valid[ij16] ) { continue; } _ij16[0] = ij16; _ij16[1] = -1; for(int iij16 = ij16+1; iij16 < 1; ++iij16) { if( j16valid[iij16] && IKabs(cj16array[ij16]-cj16array[iij16]) < IKFAST_SOLUTION_THRESH && IKabs(sj16array[ij16]-sj16array[iij16]) < IKFAST_SOLUTION_THRESH ) { j16valid[iij16]=false; _ij16[1] = iij16; break; } } j16 = j16array[ij16]; cj16 = cj16array[ij16]; sj16 = sj16array[ij16]; { IkReal evalcond[5]; IkReal x198=IKsin(j16); IkReal x199=IKcos(j16); IkReal x200=((0.321)*sj18); IkReal x201=((0.321)*cj18); IkReal x202=(py*sj15); IkReal x203=(cj15*px); IkReal x204=(pz*x198); IkReal x205=(x199*x203); evalcond[0]=(((x198*x201))+(((0.4)*x198))+pz+((x199*x200))); evalcond[1]=(((x198*x202))+((x198*x203))+x200+(((-0.1)*x198))+((pz*x199))); evalcond[2]=((0.1)+(((0.4)*x199))+(((-1.0)*x198*x200))+(((-1.0)*x203))+(((-1.0)*x202))+((x199*x201))); evalcond[3]=((0.4)+(((0.1)*x199))+x204+x201+(((-1.0)*x199*x202))+(((-1.0)*x205))); evalcond[4]=((-0.066959)+(((0.2)*x202))+(((0.2)*x203))+(((0.8)*x199*x202))+(((-1.0)*pp))+(((0.8)*x205))+(((-0.08)*x199))+(((-0.8)*x204))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j16array[1], cj16array[1], sj16array[1]; bool j16valid[1]={false}; _nj16 = 1; IkReal x689=(cj15*px); IkReal x690=((1000.0)*pz); IkReal x691=((321.0)*cj18); IkReal x692=(py*sj15); CheckValue<IkReal> x693 = IKatan2WithCheck(IkReal(((((-100.0)*pz))+(((103.041)*cj18*sj18))+((x690*x692))+((x689*x690))+(((128.4)*sj18)))),IkReal(((-160.0)+((pz*x690))+(((-256.8)*cj18))+(((-103.041)*(cj18*cj18))))),IKFAST_ATAN2_MAGTHRESH); if(!x693.valid){ continue; } CheckValue<IkReal> x694=IKPowWithIntegerCheck(IKsign(((40.0)+(((-321.0)*pz*sj18))+(((-400.0)*x689))+(((32.1)*cj18))+(((-400.0)*x692))+(((-1.0)*x689*x691))+(((-1.0)*x691*x692)))),-1); if(!x694.valid){ continue; } j16array[0]=((-1.5707963267949)+(x693.value)+(((1.5707963267949)*(x694.value)))); sj16array[0]=IKsin(j16array[0]); cj16array[0]=IKcos(j16array[0]); if( j16array[0] > IKPI ) { j16array[0]-=IK2PI; } else if( j16array[0] < -IKPI ) { j16array[0]+=IK2PI; } j16valid[0] = true; for(int ij16 = 0; ij16 < 1; ++ij16) { if( !j16valid[ij16] ) { continue; } _ij16[0] = ij16; _ij16[1] = -1; for(int iij16 = ij16+1; iij16 < 1; ++iij16) { if( j16valid[iij16] && IKabs(cj16array[ij16]-cj16array[iij16]) < IKFAST_SOLUTION_THRESH && IKabs(sj16array[ij16]-sj16array[iij16]) < IKFAST_SOLUTION_THRESH ) { j16valid[iij16]=false; _ij16[1] = iij16; break; } } j16 = j16array[ij16]; cj16 = cj16array[ij16]; sj16 = sj16array[ij16]; { IkReal evalcond[5]; IkReal x695=IKsin(j16); IkReal x696=IKcos(j16); IkReal x697=((0.321)*sj18); IkReal x698=((0.321)*cj18); IkReal x699=(py*sj15); IkReal x700=(cj15*px); IkReal x701=(pz*x695); IkReal x702=(x696*x700); evalcond[0]=(((x695*x698))+((x696*x697))+(((0.4)*x695))+pz); evalcond[1]=(((x695*x699))+((pz*x696))+((x695*x700))+x697+(((-0.1)*x695))); evalcond[2]=((0.1)+((x696*x698))+(((-1.0)*x700))+(((0.4)*x696))+(((-1.0)*x695*x697))+(((-1.0)*x699))); evalcond[3]=((0.4)+(((-1.0)*x696*x699))+(((-1.0)*x702))+(((0.1)*x696))+x698+x701); evalcond[4]=((-0.066959)+(((-0.8)*x701))+(((-1.0)*pp))+(((0.8)*x696*x699))+(((-0.08)*x696))+(((0.2)*x700))+(((0.8)*x702))+(((0.2)*x699))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j16array[1], cj16array[1], sj16array[1]; bool j16valid[1]={false}; _nj16 = 1; IkReal x703=((321000.0)*sj18); IkReal x704=(py*sj15); IkReal x705=((321000.0)*cj18); IkReal x706=(cj15*px); CheckValue<IkReal> x707=IKPowWithIntegerCheck(IKsign(((263041.0)+(((256800.0)*cj18)))),-1); if(!x707.valid){ continue; } CheckValue<IkReal> x708 = IKatan2WithCheck(IkReal(((((-1.0)*pz*x705))+(((-1.0)*x703*x706))+(((-1.0)*x703*x704))+(((-400000.0)*pz))+(((32100.0)*sj18)))),IkReal(((-40000.0)+(((-1.0)*pz*x703))+(((400000.0)*x706))+(((400000.0)*x704))+(((-32100.0)*cj18))+((x704*x705))+((x705*x706)))),IKFAST_ATAN2_MAGTHRESH); if(!x708.valid){ continue; } j16array[0]=((-1.5707963267949)+(((1.5707963267949)*(x707.value)))+(x708.value)); sj16array[0]=IKsin(j16array[0]); cj16array[0]=IKcos(j16array[0]); if( j16array[0] > IKPI ) { j16array[0]-=IK2PI; } else if( j16array[0] < -IKPI ) { j16array[0]+=IK2PI; } j16valid[0] = true; for(int ij16 = 0; ij16 < 1; ++ij16) { if( !j16valid[ij16] ) { continue; } _ij16[0] = ij16; _ij16[1] = -1; for(int iij16 = ij16+1; iij16 < 1; ++iij16) { if( j16valid[iij16] && IKabs(cj16array[ij16]-cj16array[iij16]) < IKFAST_SOLUTION_THRESH && IKabs(sj16array[ij16]-sj16array[iij16]) < IKFAST_SOLUTION_THRESH ) { j16valid[iij16]=false; _ij16[1] = iij16; break; } } j16 = j16array[ij16]; cj16 = cj16array[ij16]; sj16 = sj16array[ij16]; { IkReal evalcond[5]; IkReal x709=IKsin(j16); IkReal x710=IKcos(j16); IkReal x711=((0.321)*sj18); IkReal x712=((0.321)*cj18); IkReal x713=(py*sj15); IkReal x714=(cj15*px); IkReal x715=(pz*x709); IkReal x716=(x710*x714); evalcond[0]=((((0.4)*x709))+((x709*x712))+((x710*x711))+pz); evalcond[1]=((((-0.1)*x709))+((x709*x714))+((x709*x713))+x711+((pz*x710))); evalcond[2]=((0.1)+(((0.4)*x710))+(((-1.0)*x709*x711))+(((-1.0)*x713))+(((-1.0)*x714))+((x710*x712))); evalcond[3]=((0.4)+(((-1.0)*x710*x713))+(((-1.0)*x716))+(((0.1)*x710))+x712+x715); evalcond[4]=((-0.066959)+(((-1.0)*pp))+(((-0.8)*x715))+(((0.2)*x713))+(((0.2)*x714))+(((0.8)*x710*x713))+(((-0.08)*x710))+(((0.8)*x716))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j17)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j18array[2], cj18array[2], sj18array[2]; bool j18valid[2]={false}; _nj18 = 2; cj18array[0]=((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*cj15*px))+(((-0.778816199376947)*py*sj15))); if( cj18array[0] >= -1-IKFAST_SINCOS_THRESH && cj18array[0] <= 1+IKFAST_SINCOS_THRESH ) { j18valid[0] = j18valid[1] = true; j18array[0] = IKacos(cj18array[0]); sj18array[0] = IKsin(j18array[0]); cj18array[1] = cj18array[0]; j18array[1] = -j18array[0]; sj18array[1] = -sj18array[0]; } else if( isnan(cj18array[0]) ) { // probably any value will work j18valid[0] = true; cj18array[0] = 1; sj18array[0] = 0; j18array[0] = 0; } for(int ij18 = 0; ij18 < 2; ++ij18) { if( !j18valid[ij18] ) { continue; } _ij18[0] = ij18; _ij18[1] = -1; for(int iij18 = ij18+1; iij18 < 2; ++iij18) { if( j18valid[iij18] && IKabs(cj18array[ij18]-cj18array[iij18]) < IKFAST_SOLUTION_THRESH && IKabs(sj18array[ij18]-sj18array[iij18]) < IKFAST_SOLUTION_THRESH ) { j18valid[iij18]=false; _ij18[1] = iij18; break; } } j18 = j18array[ij18]; cj18 = cj18array[ij18]; sj18 = sj18array[ij18]; { IkReal j16eval[3]; sj17=0; cj17=-1.0; j17=3.14159265358979; IkReal x717=((321000.0)*pz); IkReal x718=((321000.0)*py*sj15); IkReal x719=((321000.0)*cj15*px); j16eval[0]=((-1.02430295950156)+(((-1.0)*cj18))); j16eval[1]=IKsign(((-263041.0)+(((-256800.0)*cj18)))); j16eval[2]=((IKabs(((40000.0)+(((32100.0)*cj18))+(((-1.0)*sj18*x717))+(((-400000.0)*cj15*px))+(((-400000.0)*py*sj15))+(((-1.0)*cj18*x719))+(((-1.0)*cj18*x718)))))+(IKabs(((((-1.0)*sj18*x718))+(((-1.0)*sj18*x719))+((cj18*x717))+(((400000.0)*pz))+(((32100.0)*sj18)))))); if( IKabs(j16eval[0]) < 0.0000010000000000 || IKabs(j16eval[1]) < 0.0000010000000000 || IKabs(j16eval[2]) < 0.0000010000000000 ) { { IkReal j16eval[3]; sj17=0; cj17=-1.0; j17=3.14159265358979; IkReal x720=(cj15*px); IkReal x721=((1000.0)*pz); IkReal x722=(py*sj15); IkReal x723=((10.0)*cj18); IkReal x724=((321.0)*cj18); IkReal x725=(pz*sj18); j16eval[0]=((-1.24610591900312)+((x720*x723))+(((-10.0)*x725))+(((12.4610591900312)*x722))+(((12.4610591900312)*x720))+((x722*x723))+(((-1.0)*cj18))); j16eval[1]=((IKabs(((160.0)+(((256.8)*cj18))+(((-1.0)*pz*x721))+(((103.041)*(cj18*cj18))))))+(IKabs(((((100.0)*pz))+(((103.041)*cj18*sj18))+(((-1.0)*x721*x722))+(((-1.0)*x720*x721))+(((128.4)*sj18)))))); j16eval[2]=IKsign(((-40.0)+((x720*x724))+(((400.0)*x720))+(((400.0)*x722))+(((-321.0)*x725))+((x722*x724))+(((-32.1)*cj18)))); if( IKabs(j16eval[0]) < 0.0000010000000000 || IKabs(j16eval[1]) < 0.0000010000000000 || IKabs(j16eval[2]) < 0.0000010000000000 ) { { IkReal j16eval[3]; sj17=0; cj17=-1.0; j17=3.14159265358979; IkReal x726=cj15*cj15; IkReal x727=py*py; IkReal x728=px*px; IkReal x729=pz*pz; IkReal x730=(py*sj15); IkReal x731=((321.0)*cj18); IkReal x732=(cj15*px); IkReal x733=((321.0)*sj18); IkReal x734=(x726*x728); IkReal x735=(x726*x727); j16eval[0]=((-1.0)+(((100.0)*x735))+(((-200.0)*x730*x732))+(((-100.0)*x727))+(((-100.0)*x729))+(((-100.0)*x734))+(((20.0)*x730))+(((20.0)*x732))); j16eval[1]=IKsign(((-10.0)+(((200.0)*x732))+(((200.0)*x730))+(((1000.0)*x735))+(((-2000.0)*x730*x732))+(((-1000.0)*x727))+(((-1000.0)*x729))+(((-1000.0)*x734)))); j16eval[2]=((IKabs(((((32.1)*sj18))+(((-1.0)*x732*x733))+(((400.0)*pz))+(((-1.0)*x730*x733))+((pz*x731)))))+(IKabs(((40.0)+(((-1.0)*x731*x732))+(((32.1)*cj18))+(((-400.0)*x730))+(((-400.0)*x732))+(((-1.0)*x730*x731))+(((-1.0)*pz*x733)))))); if( IKabs(j16eval[0]) < 0.0000010000000000 || IKabs(j16eval[1]) < 0.0000010000000000 || IKabs(j16eval[2]) < 0.0000010000000000 ) { continue; // no branches [j16] } else { { IkReal j16array[1], cj16array[1], sj16array[1]; bool j16valid[1]={false}; _nj16 = 1; IkReal x736=py*py; IkReal x737=cj15*cj15; IkReal x738=(py*sj15); IkReal x739=((321.0)*sj18); IkReal x740=(cj15*px); IkReal x741=((321.0)*cj18); IkReal x742=((1000.0)*x737); CheckValue<IkReal> x743 = IKatan2WithCheck(IkReal(((((32.1)*sj18))+(((400.0)*pz))+(((-1.0)*x739*x740))+(((-1.0)*x738*x739))+((pz*x741)))),IkReal(((40.0)+(((32.1)*cj18))+(((-1.0)*x738*x741))+(((-400.0)*x738))+(((-1.0)*x740*x741))+(((-400.0)*x740))+(((-1.0)*pz*x739)))),IKFAST_ATAN2_MAGTHRESH); if(!x743.valid){ continue; } CheckValue<IkReal> x744=IKPowWithIntegerCheck(IKsign(((-10.0)+(((200.0)*x738))+(((-1.0)*x742*(px*px)))+(((-1000.0)*(pz*pz)))+(((200.0)*x740))+(((-1000.0)*x736))+(((-2000.0)*x738*x740))+((x736*x742)))),-1); if(!x744.valid){ continue; } j16array[0]=((-1.5707963267949)+(x743.value)+(((1.5707963267949)*(x744.value)))); sj16array[0]=IKsin(j16array[0]); cj16array[0]=IKcos(j16array[0]); if( j16array[0] > IKPI ) { j16array[0]-=IK2PI; } else if( j16array[0] < -IKPI ) { j16array[0]+=IK2PI; } j16valid[0] = true; for(int ij16 = 0; ij16 < 1; ++ij16) { if( !j16valid[ij16] ) { continue; } _ij16[0] = ij16; _ij16[1] = -1; for(int iij16 = ij16+1; iij16 < 1; ++iij16) { if( j16valid[iij16] && IKabs(cj16array[ij16]-cj16array[iij16]) < IKFAST_SOLUTION_THRESH && IKabs(sj16array[ij16]-sj16array[iij16]) < IKFAST_SOLUTION_THRESH ) { j16valid[iij16]=false; _ij16[1] = iij16; break; } } j16 = j16array[ij16]; cj16 = cj16array[ij16]; sj16 = sj16array[ij16]; { IkReal evalcond[5]; IkReal x745=IKsin(j16); IkReal x746=IKcos(j16); IkReal x747=((0.321)*sj18); IkReal x748=((0.321)*cj18); IkReal x749=(cj15*px); IkReal x750=(py*sj15); IkReal x751=(pz*x745); IkReal x752=((1.0)*x745); IkReal x753=((1.0)*x746); IkReal x754=(x746*x749); evalcond[0]=(((x745*x748))+(((-1.0)*x746*x747))+pz+(((0.4)*x745))); evalcond[1]=((0.1)+((x745*x747))+((x746*x748))+(((-1.0)*x750))+(((-1.0)*x749))+(((0.4)*x746))); evalcond[2]=((0.4)+(((-1.0)*x750*x753))+(((0.1)*x746))+x751+x748+(((-1.0)*x749*x753))); evalcond[3]=((((-1.0)*x750*x752))+(((0.1)*x745))+x747+(((-1.0)*pz*x753))+(((-1.0)*x749*x752))); evalcond[4]=((-0.066959)+(((0.8)*x746*x750))+(((0.8)*x754))+(((-0.08)*x746))+(((0.2)*x750))+(((-1.0)*pp))+(((0.2)*x749))+(((-0.8)*x751))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j16array[1], cj16array[1], sj16array[1]; bool j16valid[1]={false}; _nj16 = 1; IkReal x755=(cj15*px); IkReal x756=((1000.0)*pz); IkReal x757=((321.0)*cj18); IkReal x758=(py*sj15); CheckValue<IkReal> x759 = IKatan2WithCheck(IkReal(((((100.0)*pz))+(((103.041)*cj18*sj18))+(((-1.0)*x755*x756))+(((-1.0)*x756*x758))+(((128.4)*sj18)))),IkReal(((160.0)+(((256.8)*cj18))+(((-1.0)*pz*x756))+(((103.041)*(cj18*cj18))))),IKFAST_ATAN2_MAGTHRESH); if(!x759.valid){ continue; } CheckValue<IkReal> x760=IKPowWithIntegerCheck(IKsign(((-40.0)+(((-321.0)*pz*sj18))+(((-32.1)*cj18))+(((400.0)*x755))+(((400.0)*x758))+((x755*x757))+((x757*x758)))),-1); if(!x760.valid){ continue; } j16array[0]=((-1.5707963267949)+(x759.value)+(((1.5707963267949)*(x760.value)))); sj16array[0]=IKsin(j16array[0]); cj16array[0]=IKcos(j16array[0]); if( j16array[0] > IKPI ) { j16array[0]-=IK2PI; } else if( j16array[0] < -IKPI ) { j16array[0]+=IK2PI; } j16valid[0] = true; for(int ij16 = 0; ij16 < 1; ++ij16) { if( !j16valid[ij16] ) { continue; } _ij16[0] = ij16; _ij16[1] = -1; for(int iij16 = ij16+1; iij16 < 1; ++iij16) { if( j16valid[iij16] && IKabs(cj16array[ij16]-cj16array[iij16]) < IKFAST_SOLUTION_THRESH && IKabs(sj16array[ij16]-sj16array[iij16]) < IKFAST_SOLUTION_THRESH ) { j16valid[iij16]=false; _ij16[1] = iij16; break; } } j16 = j16array[ij16]; cj16 = cj16array[ij16]; sj16 = sj16array[ij16]; { IkReal evalcond[5]; IkReal x761=IKsin(j16); IkReal x762=IKcos(j16); IkReal x763=((0.321)*sj18); IkReal x764=((0.321)*cj18); IkReal x765=(cj15*px); IkReal x766=(py*sj15); IkReal x767=(pz*x761); IkReal x768=((1.0)*x761); IkReal x769=((1.0)*x762); IkReal x770=(x762*x765); evalcond[0]=((((-1.0)*x762*x763))+((x761*x764))+pz+(((0.4)*x761))); evalcond[1]=((0.1)+((x761*x763))+((x762*x764))+(((-1.0)*x765))+(((-1.0)*x766))+(((0.4)*x762))); evalcond[2]=((0.4)+(((-1.0)*x765*x769))+(((-1.0)*x766*x769))+(((0.1)*x762))+x764+x767); evalcond[3]=((((-1.0)*x765*x768))+(((-1.0)*x766*x768))+(((0.1)*x761))+x763+(((-1.0)*pz*x769))); evalcond[4]=((-0.066959)+(((0.8)*x762*x766))+(((0.8)*x770))+(((-0.08)*x762))+(((0.2)*x766))+(((0.2)*x765))+(((-1.0)*pp))+(((-0.8)*x767))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j16array[1], cj16array[1], sj16array[1]; bool j16valid[1]={false}; _nj16 = 1; IkReal x771=((321000.0)*pz); IkReal x772=((321000.0)*py*sj15); IkReal x773=((321000.0)*cj15*px); CheckValue<IkReal> x774 = IKatan2WithCheck(IkReal(((((400000.0)*pz))+(((-1.0)*sj18*x772))+(((-1.0)*sj18*x773))+(((32100.0)*sj18))+((cj18*x771)))),IkReal(((40000.0)+(((32100.0)*cj18))+(((-1.0)*cj18*x773))+(((-1.0)*cj18*x772))+(((-1.0)*sj18*x771))+(((-400000.0)*cj15*px))+(((-400000.0)*py*sj15)))),IKFAST_ATAN2_MAGTHRESH); if(!x774.valid){ continue; } CheckValue<IkReal> x775=IKPowWithIntegerCheck(IKsign(((-263041.0)+(((-256800.0)*cj18)))),-1); if(!x775.valid){ continue; } j16array[0]=((-1.5707963267949)+(x774.value)+(((1.5707963267949)*(x775.value)))); sj16array[0]=IKsin(j16array[0]); cj16array[0]=IKcos(j16array[0]); if( j16array[0] > IKPI ) { j16array[0]-=IK2PI; } else if( j16array[0] < -IKPI ) { j16array[0]+=IK2PI; } j16valid[0] = true; for(int ij16 = 0; ij16 < 1; ++ij16) { if( !j16valid[ij16] ) { continue; } _ij16[0] = ij16; _ij16[1] = -1; for(int iij16 = ij16+1; iij16 < 1; ++iij16) { if( j16valid[iij16] && IKabs(cj16array[ij16]-cj16array[iij16]) < IKFAST_SOLUTION_THRESH && IKabs(sj16array[ij16]-sj16array[iij16]) < IKFAST_SOLUTION_THRESH ) { j16valid[iij16]=false; _ij16[1] = iij16; break; } } j16 = j16array[ij16]; cj16 = cj16array[ij16]; sj16 = sj16array[ij16]; { IkReal evalcond[5]; IkReal x776=IKsin(j16); IkReal x777=IKcos(j16); IkReal x778=((0.321)*sj18); IkReal x779=((0.321)*cj18); IkReal x780=(cj15*px); IkReal x781=(py*sj15); IkReal x782=(pz*x776); IkReal x783=((1.0)*x776); IkReal x784=((1.0)*x777); IkReal x785=(x777*x780); evalcond[0]=(((x776*x779))+pz+(((0.4)*x776))+(((-1.0)*x777*x778))); evalcond[1]=((0.1)+((x776*x778))+((x777*x779))+(((0.4)*x777))+(((-1.0)*x781))+(((-1.0)*x780))); evalcond[2]=((0.4)+(((0.1)*x777))+(((-1.0)*x781*x784))+x779+x782+(((-1.0)*x780*x784))); evalcond[3]=((((0.1)*x776))+(((-1.0)*x781*x783))+x778+(((-1.0)*pz*x784))+(((-1.0)*x780*x783))); evalcond[4]=((-0.066959)+(((-0.8)*x782))+(((-0.08)*x777))+(((0.2)*x781))+(((0.2)*x780))+(((-1.0)*pp))+(((0.8)*x777*x781))+(((0.8)*x785))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j16, j18] } } while(0); if( bgotonextstatement ) { } } } } } else { { IkReal j18array[1], cj18array[1], sj18array[1]; bool j18valid[1]={false}; _nj18 = 1; CheckValue<IkReal> x786=IKPowWithIntegerCheck(sj17,-1); if(!x786.valid){ continue; } if( IKabs(((0.00311526479750779)*(x786.value)*(((((-1000.0)*px*sj15))+(((1000.0)*cj15*py)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*cj15*px))+(((-0.778816199376947)*py*sj15)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((0.00311526479750779)*(x786.value)*(((((-1000.0)*px*sj15))+(((1000.0)*cj15*py))))))+IKsqr(((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*cj15*px))+(((-0.778816199376947)*py*sj15))))-1) <= IKFAST_SINCOS_THRESH ) continue; j18array[0]=IKatan2(((0.00311526479750779)*(x786.value)*(((((-1000.0)*px*sj15))+(((1000.0)*cj15*py))))), ((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*cj15*px))+(((-0.778816199376947)*py*sj15)))); sj18array[0]=IKsin(j18array[0]); cj18array[0]=IKcos(j18array[0]); if( j18array[0] > IKPI ) { j18array[0]-=IK2PI; } else if( j18array[0] < -IKPI ) { j18array[0]+=IK2PI; } j18valid[0] = true; for(int ij18 = 0; ij18 < 1; ++ij18) { if( !j18valid[ij18] ) { continue; } _ij18[0] = ij18; _ij18[1] = -1; for(int iij18 = ij18+1; iij18 < 1; ++iij18) { if( j18valid[iij18] && IKabs(cj18array[ij18]-cj18array[iij18]) < IKFAST_SOLUTION_THRESH && IKabs(sj18array[ij18]-sj18array[iij18]) < IKFAST_SOLUTION_THRESH ) { j18valid[iij18]=false; _ij18[1] = iij18; break; } } j18 = j18array[ij18]; cj18 = cj18array[ij18]; sj18 = sj18array[ij18]; { IkReal evalcond[2]; evalcond[0]=(((px*sj15))+(((-1.0)*cj15*py))+(((0.321)*sj17*(IKsin(j18))))); evalcond[1]=((0.253041)+(((0.2)*cj15*px))+(((0.2)*py*sj15))+(((-1.0)*pp))+(((0.2568)*(IKcos(j18))))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH ) { continue; } } { IkReal j16eval[3]; IkReal x787=(cj15*px); IkReal x788=((1000.0)*pz); IkReal x789=(py*sj15); IkReal x790=((10.0)*cj18); IkReal x791=((321.0)*cj18); IkReal x792=(cj17*sj18); IkReal x793=(pz*x792); j16eval[0]=((-1.24610591900312)+(((10.0)*x793))+(((12.4610591900312)*x789))+(((12.4610591900312)*x787))+((x787*x790))+(((-1.0)*cj18))+((x789*x790))); j16eval[1]=((IKabs(((((-128.4)*x792))+(((100.0)*pz))+(((-1.0)*x788*x789))+(((-1.0)*x787*x788))+(((-103.041)*cj18*x792)))))+(IKabs(((160.0)+(((256.8)*cj18))+(((-1.0)*pz*x788))+(((103.041)*(cj18*cj18))))))); j16eval[2]=IKsign(((-40.0)+(((400.0)*x789))+(((400.0)*x787))+(((321.0)*x793))+((x787*x791))+(((-32.1)*cj18))+((x789*x791)))); if( IKabs(j16eval[0]) < 0.0000010000000000 || IKabs(j16eval[1]) < 0.0000010000000000 || IKabs(j16eval[2]) < 0.0000010000000000 ) { { IkReal j16eval[3]; IkReal x794=cj17*cj17; IkReal x795=cj18*cj18; IkReal x796=(cj15*px); IkReal x797=(py*sj15); IkReal x798=((321000.0)*cj18); IkReal x799=((321000.0)*cj17*sj18); IkReal x800=((103041.0)*x795); j16eval[0]=((1.5527799613746)+(((2.49221183800623)*cj18))+(((-1.0)*x794*x795))+x795+x794); j16eval[1]=((IKabs(((((32100.0)*cj17*sj18))+(((-1.0)*x796*x799))+(((-1.0)*x797*x799))+(((-400000.0)*pz))+(((-1.0)*pz*x798)))))+(IKabs(((-40000.0)+((x796*x798))+(((-32100.0)*cj18))+(((-1.0)*pz*x799))+(((400000.0)*x796))+(((400000.0)*x797))+((x797*x798)))))); j16eval[2]=IKsign(((160000.0)+(((256800.0)*cj18))+x800+(((-1.0)*x794*x800))+(((103041.0)*x794)))); if( IKabs(j16eval[0]) < 0.0000010000000000 || IKabs(j16eval[1]) < 0.0000010000000000 || IKabs(j16eval[2]) < 0.0000010000000000 ) { { IkReal j16eval[2]; IkReal x801=(cj17*sj18); IkReal x802=(py*sj15); IkReal x803=(cj18*pz); IkReal x804=(cj15*px); j16eval[0]=((((-10.0)*x801*x804))+(((-10.0)*x801*x802))+(((10.0)*x803))+x801+(((12.4610591900312)*pz))); j16eval[1]=IKsign(((((-321.0)*x801*x802))+(((-321.0)*x801*x804))+(((32.1)*x801))+(((400.0)*pz))+(((321.0)*x803)))); if( IKabs(j16eval[0]) < 0.0000010000000000 || IKabs(j16eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { evalcond[0]=((IKabs(((-3.14159265358979)+(IKfmod(((1.5707963267949)+j17), 6.28318530717959)))))+(IKabs(pz))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j16eval[1]; IkReal x805=((-1.0)*py); pz=0; j17=1.5707963267949; sj17=1.0; cj17=0; pp=((px*px)+(py*py)); npx=(((px*r00))+((py*r10))); npy=(((px*r01))+((py*r11))); npz=(((px*r02))+((py*r12))); rxp0_0=(r20*x805); rxp0_1=(px*r20); rxp1_0=(r21*x805); rxp1_1=(px*r21); rxp2_0=(r22*x805); rxp2_1=(px*r22); j16eval[0]=((1.0)+(((-10.0)*cj15*px))+(((-10.0)*py*sj15))); if( IKabs(j16eval[0]) < 0.0000010000000000 ) { { IkReal j16eval[1]; IkReal x806=((-1.0)*py); pz=0; j17=1.5707963267949; sj17=1.0; cj17=0; pp=((px*px)+(py*py)); npx=(((px*r00))+((py*r10))); npy=(((px*r01))+((py*r11))); npz=(((px*r02))+((py*r12))); rxp0_0=(r20*x806); rxp0_1=(px*r20); rxp1_0=(r21*x806); rxp1_1=(px*r21); rxp2_0=(r22*x806); rxp2_1=(px*r22); j16eval[0]=((1.24610591900312)+cj18); if( IKabs(j16eval[0]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { IkReal x807=((((100.0)*(px*px)))+(((100.0)*(py*py)))); if((x807) < -0.00001) continue; IkReal x808=IKabs(IKsqrt(x807)); IkReal x814 = x807; if(IKabs(x814)==0){ continue; } IkReal x809=pow(x814,-0.5); CheckValue<IkReal> x815=IKPowWithIntegerCheck(x808,-1); if(!x815.valid){ continue; } IkReal x810=x815.value; IkReal x811=((10.0)*px*x809); IkReal x812=((10.0)*py*x809); if((((1.0)+(((-1.0)*(x810*x810))))) < -0.00001) continue; IkReal x813=IKsqrt(((1.0)+(((-1.0)*(x810*x810))))); if( (x810) < -1-IKFAST_SINCOS_THRESH || (x810) > 1+IKFAST_SINCOS_THRESH ) continue; CheckValue<IkReal> x816 = IKatan2WithCheck(IkReal(((-10.0)*px)),IkReal(((-10.0)*py)),IKFAST_ATAN2_MAGTHRESH); if(!x816.valid){ continue; } IkReal gconst25=(((x810*x812))+((x811*x813))); IkReal gconst26=((((-1.0)*x812*x813))+((x810*x811))); if((((((100.0)*(px*px)))+(((100.0)*(py*py))))) < -0.00001) continue; CheckValue<IkReal> x817=IKPowWithIntegerCheck(IKabs(IKsqrt(((((100.0)*(px*px)))+(((100.0)*(py*py)))))),-1); if(!x817.valid){ continue; } if( (x817.value) < -1-IKFAST_SINCOS_THRESH || (x817.value) > 1+IKFAST_SINCOS_THRESH ) continue; CheckValue<IkReal> x818 = IKatan2WithCheck(IkReal(((-10.0)*px)),IkReal(((-10.0)*py)),IKFAST_ATAN2_MAGTHRESH); if(!x818.valid){ continue; } evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((IKasin(x817.value))+j15+(x818.value))))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j16array[2], cj16array[2], sj16array[2]; bool j16valid[2]={false}; _nj16 = 2; CheckValue<IkReal> x820=IKPowWithIntegerCheck(((0.1)+(((-1.0)*gconst25*py))+(((-1.0)*gconst26*px))),-1); if(!x820.valid){ continue; } IkReal x819=x820.value; cj16array[0]=((((-0.321)*cj18*x819))+(((-0.4)*x819))); if( cj16array[0] >= -1-IKFAST_SINCOS_THRESH && cj16array[0] <= 1+IKFAST_SINCOS_THRESH ) { j16valid[0] = j16valid[1] = true; j16array[0] = IKacos(cj16array[0]); sj16array[0] = IKsin(j16array[0]); cj16array[1] = cj16array[0]; j16array[1] = -j16array[0]; sj16array[1] = -sj16array[0]; } else if( isnan(cj16array[0]) ) { // probably any value will work j16valid[0] = true; cj16array[0] = 1; sj16array[0] = 0; j16array[0] = 0; } for(int ij16 = 0; ij16 < 2; ++ij16) { if( !j16valid[ij16] ) { continue; } _ij16[0] = ij16; _ij16[1] = -1; for(int iij16 = ij16+1; iij16 < 2; ++iij16) { if( j16valid[iij16] && IKabs(cj16array[ij16]-cj16array[iij16]) < IKFAST_SOLUTION_THRESH && IKabs(sj16array[ij16]-sj16array[iij16]) < IKFAST_SOLUTION_THRESH ) { j16valid[iij16]=false; _ij16[1] = iij16; break; } } j16 = j16array[ij16]; cj16 = cj16array[ij16]; sj16 = sj16array[ij16]; { IkReal evalcond[4]; IkReal x821=IKsin(j16); IkReal x822=IKcos(j16); IkReal x823=(gconst26*px); IkReal x824=(gconst25*py); IkReal x825=((0.321)*cj18); IkReal x826=((0.8)*x822); IkReal x827=((1.0)*x821); evalcond[0]=(((x821*x825))+(((0.4)*x821))); evalcond[1]=((((0.1)*x821))+(((-1.0)*x823*x827))+(((-1.0)*x824*x827))); evalcond[2]=((0.1)+(((0.4)*x822))+(((-1.0)*x824))+(((-1.0)*x823))+((x822*x825))); evalcond[3]=((-0.066959)+(((-1.0)*(px*px)))+(((-0.08)*x822))+((x824*x826))+((x823*x826))+(((-1.0)*(py*py)))+(((0.2)*x823))+(((0.2)*x824))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { IkReal x828=((((100.0)*(px*px)))+(((100.0)*(py*py)))); IkReal x835 = x828; if(IKabs(x835)==0){ continue; } IkReal x829=pow(x835,-0.5); if((x828) < -0.00001) continue; IkReal x830=IKabs(IKsqrt(x828)); CheckValue<IkReal> x836=IKPowWithIntegerCheck(x830,-1); if(!x836.valid){ continue; } IkReal x831=x836.value; IkReal x832=((10.0)*px*x829); IkReal x833=((10.0)*py*x829); if((((1.0)+(((-1.0)*(x831*x831))))) < -0.00001) continue; IkReal x834=IKsqrt(((1.0)+(((-1.0)*(x831*x831))))); if( (x831) < -1-IKFAST_SINCOS_THRESH || (x831) > 1+IKFAST_SINCOS_THRESH ) continue; CheckValue<IkReal> x837 = IKatan2WithCheck(IkReal(((-10.0)*px)),IkReal(((-10.0)*py)),IKFAST_ATAN2_MAGTHRESH); if(!x837.valid){ continue; } IkReal gconst28=((((-1.0)*x832*x834))+((x831*x833))); IkReal gconst29=(((x831*x832))+((x833*x834))); if((((((100.0)*(px*px)))+(((100.0)*(py*py))))) < -0.00001) continue; CheckValue<IkReal> x838=IKPowWithIntegerCheck(IKabs(IKsqrt(((((100.0)*(px*px)))+(((100.0)*(py*py)))))),-1); if(!x838.valid){ continue; } if( (x838.value) < -1-IKFAST_SINCOS_THRESH || (x838.value) > 1+IKFAST_SINCOS_THRESH ) continue; CheckValue<IkReal> x839 = IKatan2WithCheck(IkReal(((-10.0)*px)),IkReal(((-10.0)*py)),IKFAST_ATAN2_MAGTHRESH); if(!x839.valid){ continue; } evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+(((-1.0)*(IKasin(x838.value))))+j15+(x839.value))))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j16array[2], cj16array[2], sj16array[2]; bool j16valid[2]={false}; _nj16 = 2; CheckValue<IkReal> x841=IKPowWithIntegerCheck(((0.1)+(((-1.0)*gconst29*px))+(((-1.0)*gconst28*py))),-1); if(!x841.valid){ continue; } IkReal x840=x841.value; cj16array[0]=((((-0.4)*x840))+(((-0.321)*cj18*x840))); if( cj16array[0] >= -1-IKFAST_SINCOS_THRESH && cj16array[0] <= 1+IKFAST_SINCOS_THRESH ) { j16valid[0] = j16valid[1] = true; j16array[0] = IKacos(cj16array[0]); sj16array[0] = IKsin(j16array[0]); cj16array[1] = cj16array[0]; j16array[1] = -j16array[0]; sj16array[1] = -sj16array[0]; } else if( isnan(cj16array[0]) ) { // probably any value will work j16valid[0] = true; cj16array[0] = 1; sj16array[0] = 0; j16array[0] = 0; } for(int ij16 = 0; ij16 < 2; ++ij16) { if( !j16valid[ij16] ) { continue; } _ij16[0] = ij16; _ij16[1] = -1; for(int iij16 = ij16+1; iij16 < 2; ++iij16) { if( j16valid[iij16] && IKabs(cj16array[ij16]-cj16array[iij16]) < IKFAST_SOLUTION_THRESH && IKabs(sj16array[ij16]-sj16array[iij16]) < IKFAST_SOLUTION_THRESH ) { j16valid[iij16]=false; _ij16[1] = iij16; break; } } j16 = j16array[ij16]; cj16 = cj16array[ij16]; sj16 = sj16array[ij16]; { IkReal evalcond[4]; IkReal x842=IKsin(j16); IkReal x843=IKcos(j16); IkReal x844=(gconst29*px); IkReal x845=((0.321)*cj18); IkReal x846=(gconst28*py); IkReal x847=((1.0)*x842); IkReal x848=((0.8)*x843); evalcond[0]=((((0.4)*x842))+((x842*x845))); evalcond[1]=((((-1.0)*x846*x847))+(((0.1)*x842))+(((-1.0)*x844*x847))); evalcond[2]=((0.1)+(((0.4)*x843))+((x843*x845))+(((-1.0)*x846))+(((-1.0)*x844))); evalcond[3]=((-0.066959)+(((-1.0)*(px*px)))+(((-0.08)*x843))+((x846*x848))+(((0.2)*x844))+(((0.2)*x846))+(((-1.0)*(py*py)))+((x844*x848))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j16] } } while(0); if( bgotonextstatement ) { } } } } } else { { IkReal j16array[2], cj16array[2], sj16array[2]; bool j16valid[2]={false}; _nj16 = 2; CheckValue<IkReal> x850=IKPowWithIntegerCheck(((0.4)+(((0.321)*cj18))),-1); if(!x850.valid){ continue; } IkReal x849=x850.value; cj16array[0]=(((py*sj15*x849))+(((-0.1)*x849))+((cj15*px*x849))); if( cj16array[0] >= -1-IKFAST_SINCOS_THRESH && cj16array[0] <= 1+IKFAST_SINCOS_THRESH ) { j16valid[0] = j16valid[1] = true; j16array[0] = IKacos(cj16array[0]); sj16array[0] = IKsin(j16array[0]); cj16array[1] = cj16array[0]; j16array[1] = -j16array[0]; sj16array[1] = -sj16array[0]; } else if( isnan(cj16array[0]) ) { // probably any value will work j16valid[0] = true; cj16array[0] = 1; sj16array[0] = 0; j16array[0] = 0; } for(int ij16 = 0; ij16 < 2; ++ij16) { if( !j16valid[ij16] ) { continue; } _ij16[0] = ij16; _ij16[1] = -1; for(int iij16 = ij16+1; iij16 < 2; ++iij16) { if( j16valid[iij16] && IKabs(cj16array[ij16]-cj16array[iij16]) < IKFAST_SOLUTION_THRESH && IKabs(sj16array[ij16]-sj16array[iij16]) < IKFAST_SOLUTION_THRESH ) { j16valid[iij16]=false; _ij16[1] = iij16; break; } } j16 = j16array[ij16]; cj16 = cj16array[ij16]; sj16 = sj16array[ij16]; { IkReal evalcond[4]; IkReal x851=IKsin(j16); IkReal x852=IKcos(j16); IkReal x853=(cj15*px); IkReal x854=((0.321)*cj18); IkReal x855=(py*sj15); IkReal x856=((1.0)*x855); IkReal x857=((0.8)*x852); evalcond[0]=(((x851*x854))+(((0.4)*x851))); evalcond[1]=((((0.1)*x851))+(((-1.0)*x851*x853))+(((-1.0)*x851*x856))); evalcond[2]=((0.4)+(((-1.0)*x852*x853))+(((0.1)*x852))+(((-1.0)*x852*x856))+x854); evalcond[3]=((-0.066959)+(((-1.0)*(px*px)))+((x855*x857))+(((-0.08)*x852))+(((-1.0)*(py*py)))+((x853*x857))+(((0.2)*x853))+(((0.2)*x855))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j16array[2], cj16array[2], sj16array[2]; bool j16valid[2]={false}; _nj16 = 2; CheckValue<IkReal> x859=IKPowWithIntegerCheck(((0.1)+(((-1.0)*cj15*px))+(((-1.0)*py*sj15))),-1); if(!x859.valid){ continue; } IkReal x858=x859.value; cj16array[0]=((((-0.321)*cj18*x858))+(((-0.4)*x858))); if( cj16array[0] >= -1-IKFAST_SINCOS_THRESH && cj16array[0] <= 1+IKFAST_SINCOS_THRESH ) { j16valid[0] = j16valid[1] = true; j16array[0] = IKacos(cj16array[0]); sj16array[0] = IKsin(j16array[0]); cj16array[1] = cj16array[0]; j16array[1] = -j16array[0]; sj16array[1] = -sj16array[0]; } else if( isnan(cj16array[0]) ) { // probably any value will work j16valid[0] = true; cj16array[0] = 1; sj16array[0] = 0; j16array[0] = 0; } for(int ij16 = 0; ij16 < 2; ++ij16) { if( !j16valid[ij16] ) { continue; } _ij16[0] = ij16; _ij16[1] = -1; for(int iij16 = ij16+1; iij16 < 2; ++iij16) { if( j16valid[iij16] && IKabs(cj16array[ij16]-cj16array[iij16]) < IKFAST_SOLUTION_THRESH && IKabs(sj16array[ij16]-sj16array[iij16]) < IKFAST_SOLUTION_THRESH ) { j16valid[iij16]=false; _ij16[1] = iij16; break; } } j16 = j16array[ij16]; cj16 = cj16array[ij16]; sj16 = sj16array[ij16]; { IkReal evalcond[4]; IkReal x860=IKsin(j16); IkReal x861=IKcos(j16); IkReal x862=(py*sj15); IkReal x863=((0.321)*cj18); IkReal x864=(cj15*px); IkReal x865=((1.0)*x860); IkReal x866=((0.8)*x861); evalcond[0]=((((0.4)*x860))+((x860*x863))); evalcond[1]=((((0.1)*x860))+(((-1.0)*x862*x865))+(((-1.0)*x864*x865))); evalcond[2]=((0.1)+(((-1.0)*x862))+(((-1.0)*x864))+((x861*x863))+(((0.4)*x861))); evalcond[3]=((-0.066959)+(((-1.0)*(px*px)))+(((0.2)*x864))+(((0.2)*x862))+((x862*x866))+((x864*x866))+(((-1.0)*(py*py)))+(((-0.08)*x861))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(((-3.14159265358979)+(IKfmod(((4.71238898038469)+j17), 6.28318530717959)))))+(IKabs(pz))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j16eval[1]; IkReal x867=((-1.0)*py); pz=0; j17=-1.5707963267949; sj17=-1.0; cj17=0; pp=((px*px)+(py*py)); npx=(((px*r00))+((py*r10))); npy=(((px*r01))+((py*r11))); npz=(((px*r02))+((py*r12))); rxp0_0=(r20*x867); rxp0_1=(px*r20); rxp1_0=(r21*x867); rxp1_1=(px*r21); rxp2_0=(r22*x867); rxp2_1=(px*r22); j16eval[0]=((1.0)+(((-10.0)*cj15*px))+(((-10.0)*py*sj15))); if( IKabs(j16eval[0]) < 0.0000010000000000 ) { { IkReal j16eval[1]; IkReal x868=((-1.0)*py); pz=0; j17=-1.5707963267949; sj17=-1.0; cj17=0; pp=((px*px)+(py*py)); npx=(((px*r00))+((py*r10))); npy=(((px*r01))+((py*r11))); npz=(((px*r02))+((py*r12))); rxp0_0=(r20*x868); rxp0_1=(px*r20); rxp1_0=(r21*x868); rxp1_1=(px*r21); rxp2_0=(r22*x868); rxp2_1=(px*r22); j16eval[0]=((1.24610591900312)+cj18); if( IKabs(j16eval[0]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { IkReal x869=((((100.0)*(px*px)))+(((100.0)*(py*py)))); if((x869) < -0.00001) continue; IkReal x870=IKabs(IKsqrt(x869)); IkReal x876 = x869; if(IKabs(x876)==0){ continue; } IkReal x871=pow(x876,-0.5); CheckValue<IkReal> x877=IKPowWithIntegerCheck(x870,-1); if(!x877.valid){ continue; } IkReal x872=x877.value; IkReal x873=((10.0)*px*x871); IkReal x874=((10.0)*py*x871); if((((1.0)+(((-1.0)*(x872*x872))))) < -0.00001) continue; IkReal x875=IKsqrt(((1.0)+(((-1.0)*(x872*x872))))); if( (x872) < -1-IKFAST_SINCOS_THRESH || (x872) > 1+IKFAST_SINCOS_THRESH ) continue; CheckValue<IkReal> x878 = IKatan2WithCheck(IkReal(((-10.0)*px)),IkReal(((-10.0)*py)),IKFAST_ATAN2_MAGTHRESH); if(!x878.valid){ continue; } IkReal gconst31=(((x872*x874))+((x873*x875))); IkReal gconst32=(((x872*x873))+(((-1.0)*x874*x875))); if((((((100.0)*(px*px)))+(((100.0)*(py*py))))) < -0.00001) continue; CheckValue<IkReal> x879=IKPowWithIntegerCheck(IKabs(IKsqrt(((((100.0)*(px*px)))+(((100.0)*(py*py)))))),-1); if(!x879.valid){ continue; } if( (x879.value) < -1-IKFAST_SINCOS_THRESH || (x879.value) > 1+IKFAST_SINCOS_THRESH ) continue; CheckValue<IkReal> x880 = IKatan2WithCheck(IkReal(((-10.0)*px)),IkReal(((-10.0)*py)),IKFAST_ATAN2_MAGTHRESH); if(!x880.valid){ continue; } evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((IKasin(x879.value))+j15+(x880.value))))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j16array[2], cj16array[2], sj16array[2]; bool j16valid[2]={false}; _nj16 = 2; CheckValue<IkReal> x882=IKPowWithIntegerCheck(((0.1)+(((-1.0)*gconst32*px))+(((-1.0)*gconst31*py))),-1); if(!x882.valid){ continue; } IkReal x881=x882.value; cj16array[0]=((((-0.4)*x881))+(((-0.321)*cj18*x881))); if( cj16array[0] >= -1-IKFAST_SINCOS_THRESH && cj16array[0] <= 1+IKFAST_SINCOS_THRESH ) { j16valid[0] = j16valid[1] = true; j16array[0] = IKacos(cj16array[0]); sj16array[0] = IKsin(j16array[0]); cj16array[1] = cj16array[0]; j16array[1] = -j16array[0]; sj16array[1] = -sj16array[0]; } else if( isnan(cj16array[0]) ) { // probably any value will work j16valid[0] = true; cj16array[0] = 1; sj16array[0] = 0; j16array[0] = 0; } for(int ij16 = 0; ij16 < 2; ++ij16) { if( !j16valid[ij16] ) { continue; } _ij16[0] = ij16; _ij16[1] = -1; for(int iij16 = ij16+1; iij16 < 2; ++iij16) { if( j16valid[iij16] && IKabs(cj16array[ij16]-cj16array[iij16]) < IKFAST_SOLUTION_THRESH && IKabs(sj16array[ij16]-sj16array[iij16]) < IKFAST_SOLUTION_THRESH ) { j16valid[iij16]=false; _ij16[1] = iij16; break; } } j16 = j16array[ij16]; cj16 = cj16array[ij16]; sj16 = sj16array[ij16]; { IkReal evalcond[4]; IkReal x883=IKsin(j16); IkReal x884=IKcos(j16); IkReal x885=(gconst32*px); IkReal x886=(gconst31*py); IkReal x887=((0.321)*cj18); IkReal x888=((0.8)*x884); evalcond[0]=(((x883*x887))+(((0.4)*x883))); evalcond[1]=(((x883*x885))+((x883*x886))+(((-0.1)*x883))); evalcond[2]=((0.1)+(((-1.0)*x885))+(((-1.0)*x886))+(((0.4)*x884))+((x884*x887))); evalcond[3]=((-0.066959)+((x886*x888))+(((-1.0)*(px*px)))+(((0.2)*x885))+(((0.2)*x886))+(((-1.0)*(py*py)))+((x885*x888))+(((-0.08)*x884))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { IkReal x889=((((100.0)*(px*px)))+(((100.0)*(py*py)))); IkReal x896 = x889; if(IKabs(x896)==0){ continue; } IkReal x890=pow(x896,-0.5); if((x889) < -0.00001) continue; IkReal x891=IKabs(IKsqrt(x889)); CheckValue<IkReal> x897=IKPowWithIntegerCheck(x891,-1); if(!x897.valid){ continue; } IkReal x892=x897.value; IkReal x893=((10.0)*px*x890); IkReal x894=((10.0)*py*x890); if((((1.0)+(((-1.0)*(x892*x892))))) < -0.00001) continue; IkReal x895=IKsqrt(((1.0)+(((-1.0)*(x892*x892))))); if( (x892) < -1-IKFAST_SINCOS_THRESH || (x892) > 1+IKFAST_SINCOS_THRESH ) continue; CheckValue<IkReal> x898 = IKatan2WithCheck(IkReal(((-10.0)*px)),IkReal(((-10.0)*py)),IKFAST_ATAN2_MAGTHRESH); if(!x898.valid){ continue; } IkReal gconst34=(((x892*x894))+(((-1.0)*x893*x895))); IkReal gconst35=(((x894*x895))+((x892*x893))); if((((((100.0)*(px*px)))+(((100.0)*(py*py))))) < -0.00001) continue; CheckValue<IkReal> x899=IKPowWithIntegerCheck(IKabs(IKsqrt(((((100.0)*(px*px)))+(((100.0)*(py*py)))))),-1); if(!x899.valid){ continue; } if( (x899.value) < -1-IKFAST_SINCOS_THRESH || (x899.value) > 1+IKFAST_SINCOS_THRESH ) continue; CheckValue<IkReal> x900 = IKatan2WithCheck(IkReal(((-10.0)*px)),IkReal(((-10.0)*py)),IKFAST_ATAN2_MAGTHRESH); if(!x900.valid){ continue; } evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+(((-1.0)*(IKasin(x899.value))))+j15+(x900.value))))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j16array[2], cj16array[2], sj16array[2]; bool j16valid[2]={false}; _nj16 = 2; CheckValue<IkReal> x902=IKPowWithIntegerCheck(((0.1)+(((-1.0)*gconst34*py))+(((-1.0)*gconst35*px))),-1); if(!x902.valid){ continue; } IkReal x901=x902.value; cj16array[0]=((((-0.321)*cj18*x901))+(((-0.4)*x901))); if( cj16array[0] >= -1-IKFAST_SINCOS_THRESH && cj16array[0] <= 1+IKFAST_SINCOS_THRESH ) { j16valid[0] = j16valid[1] = true; j16array[0] = IKacos(cj16array[0]); sj16array[0] = IKsin(j16array[0]); cj16array[1] = cj16array[0]; j16array[1] = -j16array[0]; sj16array[1] = -sj16array[0]; } else if( isnan(cj16array[0]) ) { // probably any value will work j16valid[0] = true; cj16array[0] = 1; sj16array[0] = 0; j16array[0] = 0; } for(int ij16 = 0; ij16 < 2; ++ij16) { if( !j16valid[ij16] ) { continue; } _ij16[0] = ij16; _ij16[1] = -1; for(int iij16 = ij16+1; iij16 < 2; ++iij16) { if( j16valid[iij16] && IKabs(cj16array[ij16]-cj16array[iij16]) < IKFAST_SOLUTION_THRESH && IKabs(sj16array[ij16]-sj16array[iij16]) < IKFAST_SOLUTION_THRESH ) { j16valid[iij16]=false; _ij16[1] = iij16; break; } } j16 = j16array[ij16]; cj16 = cj16array[ij16]; sj16 = sj16array[ij16]; { IkReal evalcond[4]; IkReal x903=IKsin(j16); IkReal x904=IKcos(j16); IkReal x905=(gconst34*py); IkReal x906=(gconst35*px); IkReal x907=((0.321)*cj18); IkReal x908=((0.8)*x904); evalcond[0]=(((x903*x907))+(((0.4)*x903))); evalcond[1]=(((x903*x905))+((x903*x906))+(((-0.1)*x903))); evalcond[2]=((0.1)+(((0.4)*x904))+(((-1.0)*x906))+(((-1.0)*x905))+((x904*x907))); evalcond[3]=((-0.066959)+((x905*x908))+(((-1.0)*(px*px)))+(((0.2)*x905))+(((0.2)*x906))+((x906*x908))+(((-0.08)*x904))+(((-1.0)*(py*py)))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j16] } } while(0); if( bgotonextstatement ) { } } } } } else { { IkReal j16array[2], cj16array[2], sj16array[2]; bool j16valid[2]={false}; _nj16 = 2; CheckValue<IkReal> x910=IKPowWithIntegerCheck(((0.4)+(((0.321)*cj18))),-1); if(!x910.valid){ continue; } IkReal x909=x910.value; cj16array[0]=(((py*sj15*x909))+((cj15*px*x909))+(((-0.1)*x909))); if( cj16array[0] >= -1-IKFAST_SINCOS_THRESH && cj16array[0] <= 1+IKFAST_SINCOS_THRESH ) { j16valid[0] = j16valid[1] = true; j16array[0] = IKacos(cj16array[0]); sj16array[0] = IKsin(j16array[0]); cj16array[1] = cj16array[0]; j16array[1] = -j16array[0]; sj16array[1] = -sj16array[0]; } else if( isnan(cj16array[0]) ) { // probably any value will work j16valid[0] = true; cj16array[0] = 1; sj16array[0] = 0; j16array[0] = 0; } for(int ij16 = 0; ij16 < 2; ++ij16) { if( !j16valid[ij16] ) { continue; } _ij16[0] = ij16; _ij16[1] = -1; for(int iij16 = ij16+1; iij16 < 2; ++iij16) { if( j16valid[iij16] && IKabs(cj16array[ij16]-cj16array[iij16]) < IKFAST_SOLUTION_THRESH && IKabs(sj16array[ij16]-sj16array[iij16]) < IKFAST_SOLUTION_THRESH ) { j16valid[iij16]=false; _ij16[1] = iij16; break; } } j16 = j16array[ij16]; cj16 = cj16array[ij16]; sj16 = sj16array[ij16]; { IkReal evalcond[4]; IkReal x911=IKsin(j16); IkReal x912=IKcos(j16); IkReal x913=(cj15*px); IkReal x914=(py*sj15); IkReal x915=((0.321)*cj18); IkReal x916=((1.0)*x912); IkReal x917=((0.8)*x912); evalcond[0]=(((x911*x915))+(((0.4)*x911))); evalcond[1]=(((x911*x914))+((x911*x913))+(((-0.1)*x911))); evalcond[2]=((0.4)+(((-1.0)*x913*x916))+(((0.1)*x912))+(((-1.0)*x914*x916))+x915); evalcond[3]=((-0.066959)+(((0.2)*x913))+(((0.2)*x914))+(((-1.0)*(px*px)))+(((-0.08)*x912))+((x914*x917))+((x913*x917))+(((-1.0)*(py*py)))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j16array[2], cj16array[2], sj16array[2]; bool j16valid[2]={false}; _nj16 = 2; CheckValue<IkReal> x919=IKPowWithIntegerCheck(((0.1)+(((-1.0)*cj15*px))+(((-1.0)*py*sj15))),-1); if(!x919.valid){ continue; } IkReal x918=x919.value; cj16array[0]=((((-0.4)*x918))+(((-0.321)*cj18*x918))); if( cj16array[0] >= -1-IKFAST_SINCOS_THRESH && cj16array[0] <= 1+IKFAST_SINCOS_THRESH ) { j16valid[0] = j16valid[1] = true; j16array[0] = IKacos(cj16array[0]); sj16array[0] = IKsin(j16array[0]); cj16array[1] = cj16array[0]; j16array[1] = -j16array[0]; sj16array[1] = -sj16array[0]; } else if( isnan(cj16array[0]) ) { // probably any value will work j16valid[0] = true; cj16array[0] = 1; sj16array[0] = 0; j16array[0] = 0; } for(int ij16 = 0; ij16 < 2; ++ij16) { if( !j16valid[ij16] ) { continue; } _ij16[0] = ij16; _ij16[1] = -1; for(int iij16 = ij16+1; iij16 < 2; ++iij16) { if( j16valid[iij16] && IKabs(cj16array[ij16]-cj16array[iij16]) < IKFAST_SOLUTION_THRESH && IKabs(sj16array[ij16]-sj16array[iij16]) < IKFAST_SOLUTION_THRESH ) { j16valid[iij16]=false; _ij16[1] = iij16; break; } } j16 = j16array[ij16]; cj16 = cj16array[ij16]; sj16 = sj16array[ij16]; { IkReal evalcond[4]; IkReal x920=IKsin(j16); IkReal x921=IKcos(j16); IkReal x922=(py*sj15); IkReal x923=((0.321)*cj18); IkReal x924=(cj15*px); IkReal x925=((0.8)*x921); evalcond[0]=(((x920*x923))+(((0.4)*x920))); evalcond[1]=((((-0.1)*x920))+((x920*x924))+((x920*x922))); evalcond[2]=((0.1)+((x921*x923))+(((-1.0)*x922))+(((-1.0)*x924))+(((0.4)*x921))); evalcond[3]=((-0.066959)+(((-1.0)*(px*px)))+(((-0.08)*x921))+((x924*x925))+(((0.2)*x924))+(((0.2)*x922))+((x922*x925))+(((-1.0)*(py*py)))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(pz))+(IKabs(((-3.14159265358979)+(IKfmod(((3.14159265358979)+j18), 6.28318530717959)))))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j16array[2], cj16array[2], sj16array[2]; bool j16valid[2]={false}; _nj16 = 2; cj16array[0]=((-0.13869625520111)+(((1.3869625520111)*py*sj15))+(((1.3869625520111)*cj15*px))); if( cj16array[0] >= -1-IKFAST_SINCOS_THRESH && cj16array[0] <= 1+IKFAST_SINCOS_THRESH ) { j16valid[0] = j16valid[1] = true; j16array[0] = IKacos(cj16array[0]); sj16array[0] = IKsin(j16array[0]); cj16array[1] = cj16array[0]; j16array[1] = -j16array[0]; sj16array[1] = -sj16array[0]; } else if( isnan(cj16array[0]) ) { // probably any value will work j16valid[0] = true; cj16array[0] = 1; sj16array[0] = 0; j16array[0] = 0; } for(int ij16 = 0; ij16 < 2; ++ij16) { if( !j16valid[ij16] ) { continue; } _ij16[0] = ij16; _ij16[1] = -1; for(int iij16 = ij16+1; iij16 < 2; ++iij16) { if( j16valid[iij16] && IKabs(cj16array[ij16]-cj16array[iij16]) < IKFAST_SOLUTION_THRESH && IKabs(sj16array[ij16]-sj16array[iij16]) < IKFAST_SOLUTION_THRESH ) { j16valid[iij16]=false; _ij16[1] = iij16; break; } } j16 = j16array[ij16]; cj16 = cj16array[ij16]; sj16 = sj16array[ij16]; { IkReal evalcond[5]; IkReal x926=IKcos(j16); IkReal x927=IKsin(j16); CheckValue<IkReal> x937=IKPowWithIntegerCheck(px,-1); if(!x937.valid){ continue; } IkReal x928=x937.value; IkReal x929=py*py; IkReal x930=((1.0)*cj15); IkReal x931=(cj15*cj17); IkReal x932=((0.8)*cj15); IkReal x933=(px*x926); IkReal x934=(px*x927); IkReal x935=((0.1)*x927); IkReal x936=(x927*x928*x929); evalcond[0]=((0.721)*x927); evalcond[1]=((0.721)+(((0.1)*x926))+(((-1.0)*x930*x933))+(((-1.0)*py*sj15*x926))); evalcond[2]=((-0.5768)+(((-0.08)*x926))+((x926*x928*x929*x932))+((x932*x933))); evalcond[3]=((((-1.0)*cj17*x935))+((x931*x936))+((x931*x934))); evalcond[4]=((((-1.0)*sj17*x930*x934))+(((-1.0)*sj17*x930*x936))+((sj17*x935))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(((-3.14159265358979)+(IKfmod(j18, 6.28318530717959)))))+(IKabs(pz))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j16array[2], cj16array[2], sj16array[2]; bool j16valid[2]={false}; _nj16 = 2; cj16array[0]=((-1.26582278481013)+(((12.6582278481013)*cj15*px))+(((12.6582278481013)*py*sj15))); if( cj16array[0] >= -1-IKFAST_SINCOS_THRESH && cj16array[0] <= 1+IKFAST_SINCOS_THRESH ) { j16valid[0] = j16valid[1] = true; j16array[0] = IKacos(cj16array[0]); sj16array[0] = IKsin(j16array[0]); cj16array[1] = cj16array[0]; j16array[1] = -j16array[0]; sj16array[1] = -sj16array[0]; } else if( isnan(cj16array[0]) ) { // probably any value will work j16valid[0] = true; cj16array[0] = 1; sj16array[0] = 0; j16array[0] = 0; } for(int ij16 = 0; ij16 < 2; ++ij16) { if( !j16valid[ij16] ) { continue; } _ij16[0] = ij16; _ij16[1] = -1; for(int iij16 = ij16+1; iij16 < 2; ++iij16) { if( j16valid[iij16] && IKabs(cj16array[ij16]-cj16array[iij16]) < IKFAST_SOLUTION_THRESH && IKabs(sj16array[ij16]-sj16array[iij16]) < IKFAST_SOLUTION_THRESH ) { j16valid[iij16]=false; _ij16[1] = iij16; break; } } j16 = j16array[ij16]; cj16 = cj16array[ij16]; sj16 = sj16array[ij16]; { IkReal evalcond[5]; IkReal x938=IKcos(j16); IkReal x939=IKsin(j16); CheckValue<IkReal> x949=IKPowWithIntegerCheck(px,-1); if(!x949.valid){ continue; } IkReal x940=x949.value; IkReal x941=py*py; IkReal x942=((1.0)*cj15); IkReal x943=(cj15*cj17); IkReal x944=((0.8)*cj15); IkReal x945=(px*x938); IkReal x946=(px*x939); IkReal x947=((0.1)*x939); IkReal x948=(x939*x940*x941); evalcond[0]=((0.079)*x939); evalcond[1]=((0.079)+(((0.1)*x938))+(((-1.0)*py*sj15*x938))+(((-1.0)*x942*x945))); evalcond[2]=((-0.0632)+(((-0.08)*x938))+((x938*x940*x941*x944))+((x944*x945))); evalcond[3]=((((-1.0)*cj17*x947))+((x943*x948))+((x943*x946))); evalcond[4]=((((-1.0)*sj17*x942*x946))+(((-1.0)*sj17*x942*x948))+((sj17*x947))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j16] } } while(0); if( bgotonextstatement ) { } } } } } } } else { { IkReal j16array[1], cj16array[1], sj16array[1]; bool j16valid[1]={false}; _nj16 = 1; IkReal x950=cj15*cj15; IkReal x951=py*py; IkReal x952=(py*sj15); IkReal x953=(cj15*px); IkReal x954=((1000.0)*pz); IkReal x955=(cj17*sj18); IkReal x956=((1000.0)*x950); CheckValue<IkReal> x957=IKPowWithIntegerCheck(IKsign(((((-321.0)*x953*x955))+(((321.0)*cj18*pz))+(((32.1)*x955))+(((400.0)*pz))+(((-321.0)*x952*x955)))),-1); if(!x957.valid){ continue; } CheckValue<IkReal> x958 = IKatan2WithCheck(IkReal(((-150.0)+(((2000.0)*x952*x953))+((x956*(px*px)))+(((-256.8)*cj18))+(((1000.0)*x951))+(((-1.0)*x951*x956))+(((-103.041)*(cj18*cj18)))+(((-200.0)*x953))+(((-200.0)*x952)))),IkReal(((((-100.0)*pz))+((x952*x954))+(((-128.4)*x955))+(((-103.041)*cj18*x955))+((x953*x954)))),IKFAST_ATAN2_MAGTHRESH); if(!x958.valid){ continue; } j16array[0]=((-1.5707963267949)+(((1.5707963267949)*(x957.value)))+(x958.value)); sj16array[0]=IKsin(j16array[0]); cj16array[0]=IKcos(j16array[0]); if( j16array[0] > IKPI ) { j16array[0]-=IK2PI; } else if( j16array[0] < -IKPI ) { j16array[0]+=IK2PI; } j16valid[0] = true; for(int ij16 = 0; ij16 < 1; ++ij16) { if( !j16valid[ij16] ) { continue; } _ij16[0] = ij16; _ij16[1] = -1; for(int iij16 = ij16+1; iij16 < 1; ++iij16) { if( j16valid[iij16] && IKabs(cj16array[ij16]-cj16array[iij16]) < IKFAST_SOLUTION_THRESH && IKabs(sj16array[ij16]-sj16array[iij16]) < IKFAST_SOLUTION_THRESH ) { j16valid[iij16]=false; _ij16[1] = iij16; break; } } j16 = j16array[ij16]; cj16 = cj16array[ij16]; sj16 = sj16array[ij16]; { IkReal evalcond[6]; IkReal x959=IKsin(j16); IkReal x960=IKcos(j16); IkReal x961=((0.321)*sj18); IkReal x962=(cj15*px); IkReal x963=(py*sj15); IkReal x964=(px*sj15); IkReal x965=((1.0)*sj17); IkReal x966=(cj15*py); IkReal x967=((0.321)*cj18); IkReal x968=(pz*x960); IkReal x969=((1.0)*x962); IkReal x971=(sj17*x959); IkReal x972=(pz*x959); IkReal x973=((0.8)*x960); IkReal x974=(cj17*x959); evalcond[0]=(((cj17*x960*x961))+pz+((x959*x967))+(((0.4)*x959))); evalcond[1]=((0.1)+(((-1.0)*x963))+((x960*x967))+(((-1.0)*x961*x974))+(((-1.0)*x969))+(((0.4)*x960))); evalcond[2]=((0.4)+(((-1.0)*x960*x969))+(((-1.0)*x960*x963))+(((0.1)*x960))+x972+x967); evalcond[3]=((-0.066959)+(((-0.8)*x972))+((x963*x973))+((x962*x973))+(((-1.0)*pp))+(((0.2)*x962))+(((0.2)*x963))+(((-0.08)*x960))); evalcond[4]=((((0.1)*x971))+(((-1.0)*x959*x962*x965))+(((-1.0)*x965*x968))+((cj17*x964))+(((-1.0)*cj17*x966))+(((-1.0)*x959*x963*x965))); evalcond[5]=((((-0.1)*x974))+((sj17*x964))+(((-1.0)*x965*x966))+((cj17*x968))+((x963*x974))+((x962*x974))+x961); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j16array[1], cj16array[1], sj16array[1]; bool j16valid[1]={false}; _nj16 = 1; IkReal x975=cj17*cj17; IkReal x976=cj18*cj18; IkReal x977=(cj15*px); IkReal x978=(py*sj15); IkReal x979=((321000.0)*cj18); IkReal x980=((321000.0)*cj17*sj18); IkReal x981=((103041.0)*x976); CheckValue<IkReal> x982=IKPowWithIntegerCheck(IKsign(((160000.0)+(((256800.0)*cj18))+(((103041.0)*x975))+(((-1.0)*x975*x981))+x981)),-1); if(!x982.valid){ continue; } CheckValue<IkReal> x983 = IKatan2WithCheck(IkReal(((((32100.0)*cj17*sj18))+(((-1.0)*pz*x979))+(((-1.0)*x978*x980))+(((-400000.0)*pz))+(((-1.0)*x977*x980)))),IkReal(((-40000.0)+((x978*x979))+(((-1.0)*pz*x980))+((x977*x979))+(((-32100.0)*cj18))+(((400000.0)*x978))+(((400000.0)*x977)))),IKFAST_ATAN2_MAGTHRESH); if(!x983.valid){ continue; } j16array[0]=((-1.5707963267949)+(((1.5707963267949)*(x982.value)))+(x983.value)); sj16array[0]=IKsin(j16array[0]); cj16array[0]=IKcos(j16array[0]); if( j16array[0] > IKPI ) { j16array[0]-=IK2PI; } else if( j16array[0] < -IKPI ) { j16array[0]+=IK2PI; } j16valid[0] = true; for(int ij16 = 0; ij16 < 1; ++ij16) { if( !j16valid[ij16] ) { continue; } _ij16[0] = ij16; _ij16[1] = -1; for(int iij16 = ij16+1; iij16 < 1; ++iij16) { if( j16valid[iij16] && IKabs(cj16array[ij16]-cj16array[iij16]) < IKFAST_SOLUTION_THRESH && IKabs(sj16array[ij16]-sj16array[iij16]) < IKFAST_SOLUTION_THRESH ) { j16valid[iij16]=false; _ij16[1] = iij16; break; } } j16 = j16array[ij16]; cj16 = cj16array[ij16]; sj16 = sj16array[ij16]; { IkReal evalcond[6]; IkReal x984=IKsin(j16); IkReal x985=IKcos(j16); IkReal x986=((0.321)*sj18); IkReal x987=(cj15*px); IkReal x988=(py*sj15); IkReal x989=(px*sj15); IkReal x990=((1.0)*sj17); IkReal x991=(cj15*py); IkReal x992=((0.321)*cj18); IkReal x993=(pz*x985); IkReal x994=((1.0)*x987); IkReal x996=(sj17*x984); IkReal x997=(pz*x984); IkReal x998=((0.8)*x985); IkReal x999=(cj17*x984); evalcond[0]=((((0.4)*x984))+pz+((cj17*x985*x986))+((x984*x992))); evalcond[1]=((0.1)+(((0.4)*x985))+(((-1.0)*x988))+(((-1.0)*x994))+(((-1.0)*x986*x999))+((x985*x992))); evalcond[2]=((0.4)+(((0.1)*x985))+(((-1.0)*x985*x994))+x992+x997+(((-1.0)*x985*x988))); evalcond[3]=((-0.066959)+(((-0.8)*x997))+((x988*x998))+(((-1.0)*pp))+(((0.2)*x988))+(((0.2)*x987))+((x987*x998))+(((-0.08)*x985))); evalcond[4]=((((-1.0)*cj17*x991))+((cj17*x989))+(((-1.0)*x984*x987*x990))+(((-1.0)*x990*x993))+(((0.1)*x996))+(((-1.0)*x984*x988*x990))); evalcond[5]=(((sj17*x989))+((x988*x999))+(((-1.0)*x990*x991))+(((-0.1)*x999))+((x987*x999))+((cj17*x993))+x986); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j16array[1], cj16array[1], sj16array[1]; bool j16valid[1]={false}; _nj16 = 1; IkReal x1000=(cj15*px); IkReal x1001=((1000.0)*pz); IkReal x1002=(cj17*sj18); IkReal x1003=((321.0)*cj18); IkReal x1004=(py*sj15); CheckValue<IkReal> x1005=IKPowWithIntegerCheck(IKsign(((-40.0)+((x1000*x1003))+(((400.0)*x1004))+(((400.0)*x1000))+(((-32.1)*cj18))+(((321.0)*pz*x1002))+((x1003*x1004)))),-1); if(!x1005.valid){ continue; } CheckValue<IkReal> x1006 = IKatan2WithCheck(IkReal(((((100.0)*pz))+(((-128.4)*x1002))+(((-1.0)*x1001*x1004))+(((-1.0)*x1000*x1001))+(((-103.041)*cj18*x1002)))),IkReal(((160.0)+(((-1.0)*pz*x1001))+(((256.8)*cj18))+(((103.041)*(cj18*cj18))))),IKFAST_ATAN2_MAGTHRESH); if(!x1006.valid){ continue; } j16array[0]=((-1.5707963267949)+(((1.5707963267949)*(x1005.value)))+(x1006.value)); sj16array[0]=IKsin(j16array[0]); cj16array[0]=IKcos(j16array[0]); if( j16array[0] > IKPI ) { j16array[0]-=IK2PI; } else if( j16array[0] < -IKPI ) { j16array[0]+=IK2PI; } j16valid[0] = true; for(int ij16 = 0; ij16 < 1; ++ij16) { if( !j16valid[ij16] ) { continue; } _ij16[0] = ij16; _ij16[1] = -1; for(int iij16 = ij16+1; iij16 < 1; ++iij16) { if( j16valid[iij16] && IKabs(cj16array[ij16]-cj16array[iij16]) < IKFAST_SOLUTION_THRESH && IKabs(sj16array[ij16]-sj16array[iij16]) < IKFAST_SOLUTION_THRESH ) { j16valid[iij16]=false; _ij16[1] = iij16; break; } } j16 = j16array[ij16]; cj16 = cj16array[ij16]; sj16 = sj16array[ij16]; { IkReal evalcond[6]; IkReal x1007=IKsin(j16); IkReal x1008=IKcos(j16); IkReal x1009=((0.321)*sj18); IkReal x1010=(cj15*px); IkReal x1011=(py*sj15); IkReal x1012=(px*sj15); IkReal x1013=((1.0)*sj17); IkReal x1014=(cj15*py); IkReal x1015=((0.321)*cj18); IkReal x1016=(pz*x1008); IkReal x1017=((1.0)*x1010); IkReal x1019=(sj17*x1007); IkReal x1020=(pz*x1007); IkReal x1021=((0.8)*x1008); IkReal x1022=(cj17*x1007); evalcond[0]=(((cj17*x1008*x1009))+(((0.4)*x1007))+pz+((x1007*x1015))); evalcond[1]=((0.1)+(((0.4)*x1008))+(((-1.0)*x1017))+(((-1.0)*x1009*x1022))+((x1008*x1015))+(((-1.0)*x1011))); evalcond[2]=((0.4)+(((0.1)*x1008))+x1015+x1020+(((-1.0)*x1008*x1011))+(((-1.0)*x1008*x1017))); evalcond[3]=((-0.066959)+((x1010*x1021))+((x1011*x1021))+(((-0.08)*x1008))+(((-1.0)*pp))+(((0.2)*x1011))+(((0.2)*x1010))+(((-0.8)*x1020))); evalcond[4]=((((-1.0)*x1007*x1011*x1013))+(((-1.0)*x1013*x1016))+((cj17*x1012))+(((0.1)*x1019))+(((-1.0)*cj17*x1014))+(((-1.0)*x1007*x1010*x1013))); evalcond[5]=(((x1010*x1022))+((x1011*x1022))+x1009+((sj17*x1012))+(((-0.1)*x1022))+(((-1.0)*x1013*x1014))+((cj17*x1016))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } } } } else { { IkReal j16array[1], cj16array[1], sj16array[1]; bool j16valid[1]={false}; _nj16 = 1; IkReal x1023=py*py; IkReal x1024=cj15*cj15; IkReal x1025=px*px; IkReal x1026=((5.0)*pp); IkReal x1027=(py*sj15); IkReal x1028=(pz*sj17); IkReal x1029=(cj17*py); IkReal x1030=(cj15*px*sj17); IkReal x1031=((4.0)*x1023); IkReal x1032=(cj15*cj17*sj15); IkReal x1033=(sj17*x1024); IkReal x1034=((4.0)*x1025); IkReal x1035=((4.0)*x1029); IkReal x1036=(cj17*px*sj15); CheckValue<IkReal> x1037 = IKatan2WithCheck(IkReal((((x1031*x1032))+(((0.4)*x1036))+(((-1.0)*x1032*x1034))+(((-0.4)*cj15*x1029))+(((0.334795)*x1028))+(((8.0)*px*x1024*x1029))+((x1026*x1028))+(((-1.0)*x1027*x1028))+(((-1.0)*cj15*px*x1028))+(((-1.0)*px*x1035)))),IkReal(((((-4.0)*pz*x1036))+(((-1.0)*x1023*x1033))+(((-1.0)*sj17*x1026*x1027))+(((-1.0)*x1026*x1030))+((sj17*x1023))+(((0.5)*pp*sj17))+(((-0.434795)*x1030))+((cj15*pz*x1035))+(((-0.434795)*sj17*x1027))+(((2.0)*x1027*x1030))+((x1025*x1033))+(((0.0334795)*sj17)))),IKFAST_ATAN2_MAGTHRESH); if(!x1037.valid){ continue; } CheckValue<IkReal> x1038=IKPowWithIntegerCheck(IKsign((((x1031*x1033))+(((-1.0)*x1033*x1034))+(((-8.0)*x1027*x1030))+(((0.8)*sj17*x1027))+(((0.8)*x1030))+(((-4.0)*pz*x1028))+(((-0.04)*sj17))+(((-1.0)*sj17*x1031)))),-1); if(!x1038.valid){ continue; } j16array[0]=((-1.5707963267949)+(x1037.value)+(((1.5707963267949)*(x1038.value)))); sj16array[0]=IKsin(j16array[0]); cj16array[0]=IKcos(j16array[0]); if( j16array[0] > IKPI ) { j16array[0]-=IK2PI; } else if( j16array[0] < -IKPI ) { j16array[0]+=IK2PI; } j16valid[0] = true; for(int ij16 = 0; ij16 < 1; ++ij16) { if( !j16valid[ij16] ) { continue; } _ij16[0] = ij16; _ij16[1] = -1; for(int iij16 = ij16+1; iij16 < 1; ++iij16) { if( j16valid[iij16] && IKabs(cj16array[ij16]-cj16array[iij16]) < IKFAST_SOLUTION_THRESH && IKabs(sj16array[ij16]-sj16array[iij16]) < IKFAST_SOLUTION_THRESH ) { j16valid[iij16]=false; _ij16[1] = iij16; break; } } j16 = j16array[ij16]; cj16 = cj16array[ij16]; sj16 = sj16array[ij16]; { IkReal evalcond[2]; IkReal x1039=IKcos(j16); IkReal x1040=IKsin(j16); IkReal x1041=((1.0)*py); IkReal x1042=(cj15*px); IkReal x1043=(py*sj15); IkReal x1044=(sj17*x1040); IkReal x1045=((0.8)*x1039); evalcond[0]=((-0.066959)+(((0.2)*x1042))+(((0.2)*x1043))+((x1042*x1045))+((x1043*x1045))+(((-0.08)*x1039))+(((-1.0)*pp))+(((-0.8)*pz*x1040))); evalcond[1]=((((0.1)*x1044))+(((-1.0)*pz*sj17*x1039))+(((-1.0)*sj15*x1041*x1044))+((cj17*px*sj15))+(((-1.0)*x1042*x1044))+(((-1.0)*cj15*cj17*x1041))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH ) { continue; } } { IkReal j18eval[1]; j18eval[0]=sj17; if( IKabs(j18eval[0]) < 0.0000010000000000 ) { { IkReal j18eval[2]; j18eval[0]=cj16; j18eval[1]=cj17; if( IKabs(j18eval[0]) < 0.0000010000000000 || IKabs(j18eval[1]) < 0.0000010000000000 ) { { IkReal j18eval[2]; j18eval[0]=sj17; j18eval[1]=sj16; if( IKabs(j18eval[0]) < 0.0000010000000000 || IKabs(j18eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j17))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j18array[1], cj18array[1], sj18array[1]; bool j18valid[1]={false}; _nj18 = 1; IkReal x1046=((3.11526479750779)*cj16); IkReal x1047=(py*sj15); IkReal x1048=((3.11526479750779)*sj16); IkReal x1049=(cj15*px); if( IKabs(((((0.311526479750779)*sj16))+(((-1.0)*pz*x1046))+(((-1.0)*x1048*x1049))+(((-1.0)*x1047*x1048)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.24610591900312)+(((-1.0)*pz*x1048))+(((-0.311526479750779)*cj16))+((x1046*x1049))+((x1046*x1047)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((0.311526479750779)*sj16))+(((-1.0)*pz*x1046))+(((-1.0)*x1048*x1049))+(((-1.0)*x1047*x1048))))+IKsqr(((-1.24610591900312)+(((-1.0)*pz*x1048))+(((-0.311526479750779)*cj16))+((x1046*x1049))+((x1046*x1047))))-1) <= IKFAST_SINCOS_THRESH ) continue; j18array[0]=IKatan2(((((0.311526479750779)*sj16))+(((-1.0)*pz*x1046))+(((-1.0)*x1048*x1049))+(((-1.0)*x1047*x1048))), ((-1.24610591900312)+(((-1.0)*pz*x1048))+(((-0.311526479750779)*cj16))+((x1046*x1049))+((x1046*x1047)))); sj18array[0]=IKsin(j18array[0]); cj18array[0]=IKcos(j18array[0]); if( j18array[0] > IKPI ) { j18array[0]-=IK2PI; } else if( j18array[0] < -IKPI ) { j18array[0]+=IK2PI; } j18valid[0] = true; for(int ij18 = 0; ij18 < 1; ++ij18) { if( !j18valid[ij18] ) { continue; } _ij18[0] = ij18; _ij18[1] = -1; for(int iij18 = ij18+1; iij18 < 1; ++iij18) { if( j18valid[iij18] && IKabs(cj18array[ij18]-cj18array[iij18]) < IKFAST_SOLUTION_THRESH && IKabs(sj18array[ij18]-sj18array[iij18]) < IKFAST_SOLUTION_THRESH ) { j18valid[iij18]=false; _ij18[1] = iij18; break; } } j18 = j18array[ij18]; cj18 = cj18array[ij18]; sj18 = sj18array[ij18]; { IkReal evalcond[5]; IkReal x1050=IKcos(j18); IkReal x1051=IKsin(j18); IkReal x1052=(py*sj15); IkReal x1053=(cj15*px); IkReal x1054=((1.0)*cj16); IkReal x1055=((0.321)*x1050); IkReal x1056=((0.321)*x1051); evalcond[0]=(((cj16*x1056))+(((0.4)*sj16))+pz+((sj16*x1055))); evalcond[1]=((0.253041)+(((0.2)*x1053))+(((0.2)*x1052))+(((-1.0)*pp))+(((0.2568)*x1050))); evalcond[2]=((((-0.1)*sj16))+x1056+((cj16*pz))+((sj16*x1053))+((sj16*x1052))); evalcond[3]=((0.4)+(((-1.0)*x1052*x1054))+x1055+((pz*sj16))+(((-1.0)*x1053*x1054))+(((0.1)*cj16))); evalcond[4]=((0.1)+((cj16*x1055))+(((-1.0)*sj16*x1056))+(((0.4)*cj16))+(((-1.0)*x1052))+(((-1.0)*x1053))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j17)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j18array[1], cj18array[1], sj18array[1]; bool j18valid[1]={false}; _nj18 = 1; IkReal x1057=((3.11526479750779)*cj16); IkReal x1058=((3.11526479750779)*sj16); IkReal x1059=(py*sj15); IkReal x1060=(cj15*px); if( IKabs(((((-0.311526479750779)*sj16))+((pz*x1057))+((x1058*x1059))+((x1058*x1060)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.24610591900312)+((x1057*x1059))+((x1057*x1060))+(((-1.0)*pz*x1058))+(((-0.311526479750779)*cj16)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-0.311526479750779)*sj16))+((pz*x1057))+((x1058*x1059))+((x1058*x1060))))+IKsqr(((-1.24610591900312)+((x1057*x1059))+((x1057*x1060))+(((-1.0)*pz*x1058))+(((-0.311526479750779)*cj16))))-1) <= IKFAST_SINCOS_THRESH ) continue; j18array[0]=IKatan2(((((-0.311526479750779)*sj16))+((pz*x1057))+((x1058*x1059))+((x1058*x1060))), ((-1.24610591900312)+((x1057*x1059))+((x1057*x1060))+(((-1.0)*pz*x1058))+(((-0.311526479750779)*cj16)))); sj18array[0]=IKsin(j18array[0]); cj18array[0]=IKcos(j18array[0]); if( j18array[0] > IKPI ) { j18array[0]-=IK2PI; } else if( j18array[0] < -IKPI ) { j18array[0]+=IK2PI; } j18valid[0] = true; for(int ij18 = 0; ij18 < 1; ++ij18) { if( !j18valid[ij18] ) { continue; } _ij18[0] = ij18; _ij18[1] = -1; for(int iij18 = ij18+1; iij18 < 1; ++iij18) { if( j18valid[iij18] && IKabs(cj18array[ij18]-cj18array[iij18]) < IKFAST_SOLUTION_THRESH && IKabs(sj18array[ij18]-sj18array[iij18]) < IKFAST_SOLUTION_THRESH ) { j18valid[iij18]=false; _ij18[1] = iij18; break; } } j18 = j18array[ij18]; cj18 = cj18array[ij18]; sj18 = sj18array[ij18]; { IkReal evalcond[5]; IkReal x1061=IKcos(j18); IkReal x1062=IKsin(j18); IkReal x1063=((1.0)*cj16); IkReal x1064=(py*sj15); IkReal x1065=(cj15*px); IkReal x1066=((0.321)*x1061); IkReal x1067=((1.0)*x1065); IkReal x1068=((0.321)*x1062); evalcond[0]=((((0.4)*sj16))+pz+(((-1.0)*cj16*x1068))+((sj16*x1066))); evalcond[1]=((0.253041)+(((0.2)*x1064))+(((0.2)*x1065))+(((-1.0)*pp))+(((0.2568)*x1061))); evalcond[2]=((0.4)+(((-1.0)*x1063*x1065))+(((-1.0)*x1063*x1064))+x1066+((pz*sj16))+(((0.1)*cj16))); evalcond[3]=(x1068+(((-1.0)*pz*x1063))+(((-1.0)*sj16*x1067))+(((-1.0)*sj16*x1064))+(((0.1)*sj16))); evalcond[4]=((0.1)+((cj16*x1066))+(((0.4)*cj16))+(((-1.0)*x1067))+((sj16*x1068))+(((-1.0)*x1064))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j16))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j18eval[1]; sj16=0; cj16=1.0; j16=0; j18eval[0]=cj17; if( IKabs(j18eval[0]) < 0.0000010000000000 ) { { IkReal j18eval[1]; sj16=0; cj16=1.0; j16=0; j18eval[0]=sj17; if( IKabs(j18eval[0]) < 0.0000010000000000 ) { { IkReal evalcond[2]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j17))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j18array[1], cj18array[1], sj18array[1]; bool j18valid[1]={false}; _nj18 = 1; if( IKabs(((-3.11526479750779)*pz)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.55763239875389)+(((3.11526479750779)*py*sj15))+(((3.11526479750779)*cj15*px)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-3.11526479750779)*pz))+IKsqr(((-1.55763239875389)+(((3.11526479750779)*py*sj15))+(((3.11526479750779)*cj15*px))))-1) <= IKFAST_SINCOS_THRESH ) continue; j18array[0]=IKatan2(((-3.11526479750779)*pz), ((-1.55763239875389)+(((3.11526479750779)*py*sj15))+(((3.11526479750779)*cj15*px)))); sj18array[0]=IKsin(j18array[0]); cj18array[0]=IKcos(j18array[0]); if( j18array[0] > IKPI ) { j18array[0]-=IK2PI; } else if( j18array[0] < -IKPI ) { j18array[0]+=IK2PI; } j18valid[0] = true; for(int ij18 = 0; ij18 < 1; ++ij18) { if( !j18valid[ij18] ) { continue; } _ij18[0] = ij18; _ij18[1] = -1; for(int iij18 = ij18+1; iij18 < 1; ++iij18) { if( j18valid[iij18] && IKabs(cj18array[ij18]-cj18array[iij18]) < IKFAST_SOLUTION_THRESH && IKabs(sj18array[ij18]-sj18array[iij18]) < IKFAST_SOLUTION_THRESH ) { j18valid[iij18]=false; _ij18[1] = iij18; break; } } j18 = j18array[ij18]; cj18 = cj18array[ij18]; sj18 = sj18array[ij18]; { IkReal evalcond[3]; IkReal x1069=IKcos(j18); IkReal x1070=(py*sj15); IkReal x1071=(cj15*px); evalcond[0]=(pz+(((0.321)*(IKsin(j18))))); evalcond[1]=((0.4)+(((-0.8)*x1070))+(((-0.8)*x1071))+(((0.2568)*x1069))); evalcond[2]=((0.5)+(((0.321)*x1069))+(((-1.0)*x1070))+(((-1.0)*x1071))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j17)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j18array[1], cj18array[1], sj18array[1]; bool j18valid[1]={false}; _nj18 = 1; if( IKabs(((3.11526479750779)*pz)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.55763239875389)+(((3.11526479750779)*py*sj15))+(((3.11526479750779)*cj15*px)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((3.11526479750779)*pz))+IKsqr(((-1.55763239875389)+(((3.11526479750779)*py*sj15))+(((3.11526479750779)*cj15*px))))-1) <= IKFAST_SINCOS_THRESH ) continue; j18array[0]=IKatan2(((3.11526479750779)*pz), ((-1.55763239875389)+(((3.11526479750779)*py*sj15))+(((3.11526479750779)*cj15*px)))); sj18array[0]=IKsin(j18array[0]); cj18array[0]=IKcos(j18array[0]); if( j18array[0] > IKPI ) { j18array[0]-=IK2PI; } else if( j18array[0] < -IKPI ) { j18array[0]+=IK2PI; } j18valid[0] = true; for(int ij18 = 0; ij18 < 1; ++ij18) { if( !j18valid[ij18] ) { continue; } _ij18[0] = ij18; _ij18[1] = -1; for(int iij18 = ij18+1; iij18 < 1; ++iij18) { if( j18valid[iij18] && IKabs(cj18array[ij18]-cj18array[iij18]) < IKFAST_SOLUTION_THRESH && IKabs(sj18array[ij18]-sj18array[iij18]) < IKFAST_SOLUTION_THRESH ) { j18valid[iij18]=false; _ij18[1] = iij18; break; } } j18 = j18array[ij18]; cj18 = cj18array[ij18]; sj18 = sj18array[ij18]; { IkReal evalcond[3]; IkReal x1072=IKcos(j18); IkReal x1073=(py*sj15); IkReal x1074=(cj15*px); evalcond[0]=((((-0.321)*(IKsin(j18))))+pz); evalcond[1]=((0.4)+(((-0.8)*x1074))+(((-0.8)*x1073))+(((0.2568)*x1072))); evalcond[2]=((0.5)+(((0.321)*x1072))+(((-1.0)*x1073))+(((-1.0)*x1074))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j17)))), 6.28318530717959))); evalcond[1]=pz; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j18array[1], cj18array[1], sj18array[1]; bool j18valid[1]={false}; _nj18 = 1; IkReal x1075=((3.11526479750779)*cj15); IkReal x1076=((3.11526479750779)*sj15); if( IKabs(((((-1.0)*px*x1076))+((py*x1075)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.55763239875389)+((px*x1075))+((py*x1076)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*px*x1076))+((py*x1075))))+IKsqr(((-1.55763239875389)+((px*x1075))+((py*x1076))))-1) <= IKFAST_SINCOS_THRESH ) continue; j18array[0]=IKatan2(((((-1.0)*px*x1076))+((py*x1075))), ((-1.55763239875389)+((px*x1075))+((py*x1076)))); sj18array[0]=IKsin(j18array[0]); cj18array[0]=IKcos(j18array[0]); if( j18array[0] > IKPI ) { j18array[0]-=IK2PI; } else if( j18array[0] < -IKPI ) { j18array[0]+=IK2PI; } j18valid[0] = true; for(int ij18 = 0; ij18 < 1; ++ij18) { if( !j18valid[ij18] ) { continue; } _ij18[0] = ij18; _ij18[1] = -1; for(int iij18 = ij18+1; iij18 < 1; ++iij18) { if( j18valid[iij18] && IKabs(cj18array[ij18]-cj18array[iij18]) < IKFAST_SOLUTION_THRESH && IKabs(sj18array[ij18]-sj18array[iij18]) < IKFAST_SOLUTION_THRESH ) { j18valid[iij18]=false; _ij18[1] = iij18; break; } } j18 = j18array[ij18]; cj18 = cj18array[ij18]; sj18 = sj18array[ij18]; { IkReal evalcond[3]; IkReal x1077=IKcos(j18); IkReal x1078=(py*sj15); IkReal x1079=(cj15*px); evalcond[0]=(((px*sj15))+(((-1.0)*cj15*py))+(((0.321)*(IKsin(j18))))); evalcond[1]=((0.4)+(((-0.8)*x1078))+(((-0.8)*x1079))+(((0.2568)*x1077))); evalcond[2]=((0.5)+(((0.321)*x1077))+(((-1.0)*x1078))+(((-1.0)*x1079))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j17)))), 6.28318530717959))); evalcond[1]=pz; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j18array[1], cj18array[1], sj18array[1]; bool j18valid[1]={false}; _nj18 = 1; IkReal x1080=((3.11526479750779)*cj15); IkReal x1081=((3.11526479750779)*sj15); if( IKabs(((((-1.0)*py*x1080))+((px*x1081)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.55763239875389)+((py*x1081))+((px*x1080)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*py*x1080))+((px*x1081))))+IKsqr(((-1.55763239875389)+((py*x1081))+((px*x1080))))-1) <= IKFAST_SINCOS_THRESH ) continue; j18array[0]=IKatan2(((((-1.0)*py*x1080))+((px*x1081))), ((-1.55763239875389)+((py*x1081))+((px*x1080)))); sj18array[0]=IKsin(j18array[0]); cj18array[0]=IKcos(j18array[0]); if( j18array[0] > IKPI ) { j18array[0]-=IK2PI; } else if( j18array[0] < -IKPI ) { j18array[0]+=IK2PI; } j18valid[0] = true; for(int ij18 = 0; ij18 < 1; ++ij18) { if( !j18valid[ij18] ) { continue; } _ij18[0] = ij18; _ij18[1] = -1; for(int iij18 = ij18+1; iij18 < 1; ++iij18) { if( j18valid[iij18] && IKabs(cj18array[ij18]-cj18array[iij18]) < IKFAST_SOLUTION_THRESH && IKabs(sj18array[ij18]-sj18array[iij18]) < IKFAST_SOLUTION_THRESH ) { j18valid[iij18]=false; _ij18[1] = iij18; break; } } j18 = j18array[ij18]; cj18 = cj18array[ij18]; sj18 = sj18array[ij18]; { IkReal evalcond[3]; IkReal x1082=IKcos(j18); IkReal x1083=(py*sj15); IkReal x1084=(cj15*px); evalcond[0]=(((px*sj15))+(((-1.0)*cj15*py))+(((-0.321)*(IKsin(j18))))); evalcond[1]=((0.4)+(((-0.8)*x1084))+(((-0.8)*x1083))+(((0.2568)*x1082))); evalcond[2]=((0.5)+(((-1.0)*x1084))+(((-1.0)*x1083))+(((0.321)*x1082))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j18] } } while(0); if( bgotonextstatement ) { } } } } } } } else { { IkReal j18array[1], cj18array[1], sj18array[1]; bool j18valid[1]={false}; _nj18 = 1; CheckValue<IkReal> x1085=IKPowWithIntegerCheck(sj17,-1); if(!x1085.valid){ continue; } if( IKabs(((0.00311526479750779)*(x1085.value)*(((((-1000.0)*px*sj15))+(((1000.0)*cj15*py)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.55763239875389)+(((3.11526479750779)*py*sj15))+(((3.11526479750779)*cj15*px)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((0.00311526479750779)*(x1085.value)*(((((-1000.0)*px*sj15))+(((1000.0)*cj15*py))))))+IKsqr(((-1.55763239875389)+(((3.11526479750779)*py*sj15))+(((3.11526479750779)*cj15*px))))-1) <= IKFAST_SINCOS_THRESH ) continue; j18array[0]=IKatan2(((0.00311526479750779)*(x1085.value)*(((((-1000.0)*px*sj15))+(((1000.0)*cj15*py))))), ((-1.55763239875389)+(((3.11526479750779)*py*sj15))+(((3.11526479750779)*cj15*px)))); sj18array[0]=IKsin(j18array[0]); cj18array[0]=IKcos(j18array[0]); if( j18array[0] > IKPI ) { j18array[0]-=IK2PI; } else if( j18array[0] < -IKPI ) { j18array[0]+=IK2PI; } j18valid[0] = true; for(int ij18 = 0; ij18 < 1; ++ij18) { if( !j18valid[ij18] ) { continue; } _ij18[0] = ij18; _ij18[1] = -1; for(int iij18 = ij18+1; iij18 < 1; ++iij18) { if( j18valid[iij18] && IKabs(cj18array[ij18]-cj18array[iij18]) < IKFAST_SOLUTION_THRESH && IKabs(sj18array[ij18]-sj18array[iij18]) < IKFAST_SOLUTION_THRESH ) { j18valid[iij18]=false; _ij18[1] = iij18; break; } } j18 = j18array[ij18]; cj18 = cj18array[ij18]; sj18 = sj18array[ij18]; { IkReal evalcond[5]; IkReal x1086=IKsin(j18); IkReal x1087=IKcos(j18); IkReal x1088=(py*sj15); IkReal x1089=(cj15*px); IkReal x1090=(px*sj15); IkReal x1091=((0.321)*x1086); IkReal x1092=((1.0)*cj15*py); evalcond[0]=(pz+((cj17*x1091))); evalcond[1]=(x1090+(((-1.0)*x1092))+((sj17*x1091))); evalcond[2]=((0.4)+(((-0.8)*x1089))+(((-0.8)*x1088))+(((0.2568)*x1087))); evalcond[3]=((0.5)+(((-1.0)*x1088))+(((-1.0)*x1089))+(((0.321)*x1087))); evalcond[4]=(x1091+((sj17*x1090))+(((-1.0)*sj17*x1092))+((cj17*pz))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j18array[1], cj18array[1], sj18array[1]; bool j18valid[1]={false}; _nj18 = 1; CheckValue<IkReal> x1093=IKPowWithIntegerCheck(cj17,-1); if(!x1093.valid){ continue; } if( IKabs(((-3.11526479750779)*pz*(x1093.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.55763239875389)+(((3.11526479750779)*py*sj15))+(((3.11526479750779)*cj15*px)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-3.11526479750779)*pz*(x1093.value)))+IKsqr(((-1.55763239875389)+(((3.11526479750779)*py*sj15))+(((3.11526479750779)*cj15*px))))-1) <= IKFAST_SINCOS_THRESH ) continue; j18array[0]=IKatan2(((-3.11526479750779)*pz*(x1093.value)), ((-1.55763239875389)+(((3.11526479750779)*py*sj15))+(((3.11526479750779)*cj15*px)))); sj18array[0]=IKsin(j18array[0]); cj18array[0]=IKcos(j18array[0]); if( j18array[0] > IKPI ) { j18array[0]-=IK2PI; } else if( j18array[0] < -IKPI ) { j18array[0]+=IK2PI; } j18valid[0] = true; for(int ij18 = 0; ij18 < 1; ++ij18) { if( !j18valid[ij18] ) { continue; } _ij18[0] = ij18; _ij18[1] = -1; for(int iij18 = ij18+1; iij18 < 1; ++iij18) { if( j18valid[iij18] && IKabs(cj18array[ij18]-cj18array[iij18]) < IKFAST_SOLUTION_THRESH && IKabs(sj18array[ij18]-sj18array[iij18]) < IKFAST_SOLUTION_THRESH ) { j18valid[iij18]=false; _ij18[1] = iij18; break; } } j18 = j18array[ij18]; cj18 = cj18array[ij18]; sj18 = sj18array[ij18]; { IkReal evalcond[5]; IkReal x1094=IKsin(j18); IkReal x1095=IKcos(j18); IkReal x1096=(py*sj15); IkReal x1097=(cj15*px); IkReal x1098=(px*sj15); IkReal x1099=((0.321)*x1094); IkReal x1100=((1.0)*cj15*py); evalcond[0]=(pz+((cj17*x1099))); evalcond[1]=(x1098+((sj17*x1099))+(((-1.0)*x1100))); evalcond[2]=((0.4)+(((0.2568)*x1095))+(((-0.8)*x1096))+(((-0.8)*x1097))); evalcond[3]=((0.5)+(((-1.0)*x1096))+(((-1.0)*x1097))+(((0.321)*x1095))); evalcond[4]=(x1099+(((-1.0)*sj17*x1100))+((sj17*x1098))+((cj17*pz))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j16)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j18eval[1]; sj16=0; cj16=-1.0; j16=3.14159265358979; j18eval[0]=cj17; if( IKabs(j18eval[0]) < 0.0000010000000000 ) { { IkReal j18eval[1]; sj16=0; cj16=-1.0; j16=3.14159265358979; j18eval[0]=sj17; if( IKabs(j18eval[0]) < 0.0000010000000000 ) { { IkReal evalcond[2]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j17))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j18array[1], cj18array[1], sj18array[1]; bool j18valid[1]={false}; _nj18 = 1; if( IKabs(((3.11526479750779)*pz)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-0.934579439252336)+(((-3.11526479750779)*py*sj15))+(((-3.11526479750779)*cj15*px)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((3.11526479750779)*pz))+IKsqr(((-0.934579439252336)+(((-3.11526479750779)*py*sj15))+(((-3.11526479750779)*cj15*px))))-1) <= IKFAST_SINCOS_THRESH ) continue; j18array[0]=IKatan2(((3.11526479750779)*pz), ((-0.934579439252336)+(((-3.11526479750779)*py*sj15))+(((-3.11526479750779)*cj15*px)))); sj18array[0]=IKsin(j18array[0]); cj18array[0]=IKcos(j18array[0]); if( j18array[0] > IKPI ) { j18array[0]-=IK2PI; } else if( j18array[0] < -IKPI ) { j18array[0]+=IK2PI; } j18valid[0] = true; for(int ij18 = 0; ij18 < 1; ++ij18) { if( !j18valid[ij18] ) { continue; } _ij18[0] = ij18; _ij18[1] = -1; for(int iij18 = ij18+1; iij18 < 1; ++iij18) { if( j18valid[iij18] && IKabs(cj18array[ij18]-cj18array[iij18]) < IKFAST_SOLUTION_THRESH && IKabs(sj18array[ij18]-sj18array[iij18]) < IKFAST_SOLUTION_THRESH ) { j18valid[iij18]=false; _ij18[1] = iij18; break; } } j18 = j18array[ij18]; cj18 = cj18array[ij18]; sj18 = sj18array[ij18]; { IkReal evalcond[3]; IkReal x1101=IKcos(j18); IkReal x1102=(py*sj15); IkReal x1103=(cj15*px); evalcond[0]=((((-0.321)*(IKsin(j18))))+pz); evalcond[1]=((0.3)+x1102+x1103+(((0.321)*x1101))); evalcond[2]=((0.24)+(((0.8)*x1102))+(((0.8)*x1103))+(((0.2568)*x1101))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j17)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j18array[1], cj18array[1], sj18array[1]; bool j18valid[1]={false}; _nj18 = 1; if( IKabs(((-3.11526479750779)*pz)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-0.934579439252336)+(((-3.11526479750779)*py*sj15))+(((-3.11526479750779)*cj15*px)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-3.11526479750779)*pz))+IKsqr(((-0.934579439252336)+(((-3.11526479750779)*py*sj15))+(((-3.11526479750779)*cj15*px))))-1) <= IKFAST_SINCOS_THRESH ) continue; j18array[0]=IKatan2(((-3.11526479750779)*pz), ((-0.934579439252336)+(((-3.11526479750779)*py*sj15))+(((-3.11526479750779)*cj15*px)))); sj18array[0]=IKsin(j18array[0]); cj18array[0]=IKcos(j18array[0]); if( j18array[0] > IKPI ) { j18array[0]-=IK2PI; } else if( j18array[0] < -IKPI ) { j18array[0]+=IK2PI; } j18valid[0] = true; for(int ij18 = 0; ij18 < 1; ++ij18) { if( !j18valid[ij18] ) { continue; } _ij18[0] = ij18; _ij18[1] = -1; for(int iij18 = ij18+1; iij18 < 1; ++iij18) { if( j18valid[iij18] && IKabs(cj18array[ij18]-cj18array[iij18]) < IKFAST_SOLUTION_THRESH && IKabs(sj18array[ij18]-sj18array[iij18]) < IKFAST_SOLUTION_THRESH ) { j18valid[iij18]=false; _ij18[1] = iij18; break; } } j18 = j18array[ij18]; cj18 = cj18array[ij18]; sj18 = sj18array[ij18]; { IkReal evalcond[3]; IkReal x1104=IKcos(j18); IkReal x1105=(py*sj15); IkReal x1106=(cj15*px); evalcond[0]=(pz+(((0.321)*(IKsin(j18))))); evalcond[1]=((0.3)+x1106+x1105+(((0.321)*x1104))); evalcond[2]=((0.24)+(((0.8)*x1106))+(((0.8)*x1105))+(((0.2568)*x1104))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j17)))), 6.28318530717959))); evalcond[1]=pz; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j18array[1], cj18array[1], sj18array[1]; bool j18valid[1]={false}; _nj18 = 1; IkReal x1107=((3.11526479750779)*cj15); IkReal x1108=((3.11526479750779)*sj15); if( IKabs(((((-1.0)*px*x1108))+((py*x1107)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-0.934579439252336)+(((-1.0)*px*x1107))+(((-1.0)*py*x1108)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*px*x1108))+((py*x1107))))+IKsqr(((-0.934579439252336)+(((-1.0)*px*x1107))+(((-1.0)*py*x1108))))-1) <= IKFAST_SINCOS_THRESH ) continue; j18array[0]=IKatan2(((((-1.0)*px*x1108))+((py*x1107))), ((-0.934579439252336)+(((-1.0)*px*x1107))+(((-1.0)*py*x1108)))); sj18array[0]=IKsin(j18array[0]); cj18array[0]=IKcos(j18array[0]); if( j18array[0] > IKPI ) { j18array[0]-=IK2PI; } else if( j18array[0] < -IKPI ) { j18array[0]+=IK2PI; } j18valid[0] = true; for(int ij18 = 0; ij18 < 1; ++ij18) { if( !j18valid[ij18] ) { continue; } _ij18[0] = ij18; _ij18[1] = -1; for(int iij18 = ij18+1; iij18 < 1; ++iij18) { if( j18valid[iij18] && IKabs(cj18array[ij18]-cj18array[iij18]) < IKFAST_SOLUTION_THRESH && IKabs(sj18array[ij18]-sj18array[iij18]) < IKFAST_SOLUTION_THRESH ) { j18valid[iij18]=false; _ij18[1] = iij18; break; } } j18 = j18array[ij18]; cj18 = cj18array[ij18]; sj18 = sj18array[ij18]; { IkReal evalcond[3]; IkReal x1109=IKcos(j18); IkReal x1110=(py*sj15); IkReal x1111=(cj15*px); evalcond[0]=(((px*sj15))+(((-1.0)*cj15*py))+(((0.321)*(IKsin(j18))))); evalcond[1]=((0.3)+x1111+x1110+(((0.321)*x1109))); evalcond[2]=((0.24)+(((0.8)*x1110))+(((0.8)*x1111))+(((0.2568)*x1109))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j17)))), 6.28318530717959))); evalcond[1]=pz; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j18array[1], cj18array[1], sj18array[1]; bool j18valid[1]={false}; _nj18 = 1; IkReal x1112=((3.11526479750779)*cj15); IkReal x1113=((3.11526479750779)*sj15); if( IKabs(((((-1.0)*py*x1112))+((px*x1113)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-0.934579439252336)+(((-1.0)*px*x1112))+(((-1.0)*py*x1113)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*py*x1112))+((px*x1113))))+IKsqr(((-0.934579439252336)+(((-1.0)*px*x1112))+(((-1.0)*py*x1113))))-1) <= IKFAST_SINCOS_THRESH ) continue; j18array[0]=IKatan2(((((-1.0)*py*x1112))+((px*x1113))), ((-0.934579439252336)+(((-1.0)*px*x1112))+(((-1.0)*py*x1113)))); sj18array[0]=IKsin(j18array[0]); cj18array[0]=IKcos(j18array[0]); if( j18array[0] > IKPI ) { j18array[0]-=IK2PI; } else if( j18array[0] < -IKPI ) { j18array[0]+=IK2PI; } j18valid[0] = true; for(int ij18 = 0; ij18 < 1; ++ij18) { if( !j18valid[ij18] ) { continue; } _ij18[0] = ij18; _ij18[1] = -1; for(int iij18 = ij18+1; iij18 < 1; ++iij18) { if( j18valid[iij18] && IKabs(cj18array[ij18]-cj18array[iij18]) < IKFAST_SOLUTION_THRESH && IKabs(sj18array[ij18]-sj18array[iij18]) < IKFAST_SOLUTION_THRESH ) { j18valid[iij18]=false; _ij18[1] = iij18; break; } } j18 = j18array[ij18]; cj18 = cj18array[ij18]; sj18 = sj18array[ij18]; { IkReal evalcond[3]; IkReal x1114=IKcos(j18); IkReal x1115=(py*sj15); IkReal x1116=(cj15*px); evalcond[0]=(((px*sj15))+(((-1.0)*cj15*py))+(((-0.321)*(IKsin(j18))))); evalcond[1]=((0.3)+x1115+x1116+(((0.321)*x1114))); evalcond[2]=((0.24)+(((0.8)*x1115))+(((0.8)*x1116))+(((0.2568)*x1114))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j18] } } while(0); if( bgotonextstatement ) { } } } } } } } else { { IkReal j18array[1], cj18array[1], sj18array[1]; bool j18valid[1]={false}; _nj18 = 1; CheckValue<IkReal> x1117=IKPowWithIntegerCheck(sj17,-1); if(!x1117.valid){ continue; } if( IKabs(((0.00311526479750779)*(x1117.value)*(((((-1000.0)*px*sj15))+(((1000.0)*cj15*py)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-0.934579439252336)+(((-3.11526479750779)*py*sj15))+(((-3.11526479750779)*cj15*px)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((0.00311526479750779)*(x1117.value)*(((((-1000.0)*px*sj15))+(((1000.0)*cj15*py))))))+IKsqr(((-0.934579439252336)+(((-3.11526479750779)*py*sj15))+(((-3.11526479750779)*cj15*px))))-1) <= IKFAST_SINCOS_THRESH ) continue; j18array[0]=IKatan2(((0.00311526479750779)*(x1117.value)*(((((-1000.0)*px*sj15))+(((1000.0)*cj15*py))))), ((-0.934579439252336)+(((-3.11526479750779)*py*sj15))+(((-3.11526479750779)*cj15*px)))); sj18array[0]=IKsin(j18array[0]); cj18array[0]=IKcos(j18array[0]); if( j18array[0] > IKPI ) { j18array[0]-=IK2PI; } else if( j18array[0] < -IKPI ) { j18array[0]+=IK2PI; } j18valid[0] = true; for(int ij18 = 0; ij18 < 1; ++ij18) { if( !j18valid[ij18] ) { continue; } _ij18[0] = ij18; _ij18[1] = -1; for(int iij18 = ij18+1; iij18 < 1; ++iij18) { if( j18valid[iij18] && IKabs(cj18array[ij18]-cj18array[iij18]) < IKFAST_SOLUTION_THRESH && IKabs(sj18array[ij18]-sj18array[iij18]) < IKFAST_SOLUTION_THRESH ) { j18valid[iij18]=false; _ij18[1] = iij18; break; } } j18 = j18array[ij18]; cj18 = cj18array[ij18]; sj18 = sj18array[ij18]; { IkReal evalcond[5]; IkReal x1118=IKsin(j18); IkReal x1119=IKcos(j18); IkReal x1120=(py*sj15); IkReal x1121=(cj15*px); IkReal x1122=(px*sj15); IkReal x1123=((0.321)*x1118); IkReal x1124=((1.0)*cj15*py); evalcond[0]=((((-1.0)*cj17*x1123))+pz); evalcond[1]=((0.3)+x1120+x1121+(((0.321)*x1119))); evalcond[2]=(x1122+((sj17*x1123))+(((-1.0)*x1124))); evalcond[3]=((0.24)+(((0.8)*x1120))+(((0.8)*x1121))+(((0.2568)*x1119))); evalcond[4]=(x1123+(((-1.0)*sj17*x1124))+((sj17*x1122))+(((-1.0)*cj17*pz))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j18array[1], cj18array[1], sj18array[1]; bool j18valid[1]={false}; _nj18 = 1; CheckValue<IkReal> x1125=IKPowWithIntegerCheck(cj17,-1); if(!x1125.valid){ continue; } if( IKabs(((3.11526479750779)*pz*(x1125.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-0.934579439252336)+(((-3.11526479750779)*py*sj15))+(((-3.11526479750779)*cj15*px)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((3.11526479750779)*pz*(x1125.value)))+IKsqr(((-0.934579439252336)+(((-3.11526479750779)*py*sj15))+(((-3.11526479750779)*cj15*px))))-1) <= IKFAST_SINCOS_THRESH ) continue; j18array[0]=IKatan2(((3.11526479750779)*pz*(x1125.value)), ((-0.934579439252336)+(((-3.11526479750779)*py*sj15))+(((-3.11526479750779)*cj15*px)))); sj18array[0]=IKsin(j18array[0]); cj18array[0]=IKcos(j18array[0]); if( j18array[0] > IKPI ) { j18array[0]-=IK2PI; } else if( j18array[0] < -IKPI ) { j18array[0]+=IK2PI; } j18valid[0] = true; for(int ij18 = 0; ij18 < 1; ++ij18) { if( !j18valid[ij18] ) { continue; } _ij18[0] = ij18; _ij18[1] = -1; for(int iij18 = ij18+1; iij18 < 1; ++iij18) { if( j18valid[iij18] && IKabs(cj18array[ij18]-cj18array[iij18]) < IKFAST_SOLUTION_THRESH && IKabs(sj18array[ij18]-sj18array[iij18]) < IKFAST_SOLUTION_THRESH ) { j18valid[iij18]=false; _ij18[1] = iij18; break; } } j18 = j18array[ij18]; cj18 = cj18array[ij18]; sj18 = sj18array[ij18]; { IkReal evalcond[5]; IkReal x1126=IKsin(j18); IkReal x1127=IKcos(j18); IkReal x1128=(py*sj15); IkReal x1129=(cj15*px); IkReal x1130=(px*sj15); IkReal x1131=((0.321)*x1126); IkReal x1132=((1.0)*cj15*py); evalcond[0]=((((-1.0)*cj17*x1131))+pz); evalcond[1]=((0.3)+x1128+x1129+(((0.321)*x1127))); evalcond[2]=(x1130+((sj17*x1131))+(((-1.0)*x1132))); evalcond[3]=((0.24)+(((0.8)*x1129))+(((0.8)*x1128))+(((0.2568)*x1127))); evalcond[4]=(x1131+(((-1.0)*sj17*x1132))+((sj17*x1130))+(((-1.0)*cj17*pz))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j16)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j18array[1], cj18array[1], sj18array[1]; bool j18valid[1]={false}; _nj18 = 1; IkReal x1133=((3.11526479750779)*cj15); IkReal x1134=((3.11526479750779)*sj15); if( IKabs(((((-1.0)*px*sj17*x1134))+(((-1.0)*cj17*px*x1133))+(((0.311526479750779)*cj17))+((py*sj17*x1133))+(((-1.0)*cj17*py*x1134)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.24610591900312)+(((-3.11526479750779)*pz)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*px*sj17*x1134))+(((-1.0)*cj17*px*x1133))+(((0.311526479750779)*cj17))+((py*sj17*x1133))+(((-1.0)*cj17*py*x1134))))+IKsqr(((-1.24610591900312)+(((-3.11526479750779)*pz))))-1) <= IKFAST_SINCOS_THRESH ) continue; j18array[0]=IKatan2(((((-1.0)*px*sj17*x1134))+(((-1.0)*cj17*px*x1133))+(((0.311526479750779)*cj17))+((py*sj17*x1133))+(((-1.0)*cj17*py*x1134))), ((-1.24610591900312)+(((-3.11526479750779)*pz)))); sj18array[0]=IKsin(j18array[0]); cj18array[0]=IKcos(j18array[0]); if( j18array[0] > IKPI ) { j18array[0]-=IK2PI; } else if( j18array[0] < -IKPI ) { j18array[0]+=IK2PI; } j18valid[0] = true; for(int ij18 = 0; ij18 < 1; ++ij18) { if( !j18valid[ij18] ) { continue; } _ij18[0] = ij18; _ij18[1] = -1; for(int iij18 = ij18+1; iij18 < 1; ++iij18) { if( j18valid[iij18] && IKabs(cj18array[ij18]-cj18array[iij18]) < IKFAST_SOLUTION_THRESH && IKabs(sj18array[ij18]-sj18array[iij18]) < IKFAST_SOLUTION_THRESH ) { j18valid[iij18]=false; _ij18[1] = iij18; break; } } j18 = j18array[ij18]; cj18 = cj18array[ij18]; sj18 = sj18array[ij18]; { IkReal evalcond[5]; IkReal x1135=IKsin(j18); IkReal x1136=IKcos(j18); IkReal x1137=(py*sj15); IkReal x1138=(px*sj15); IkReal x1139=(cj15*px); IkReal x1140=((0.321)*x1135); IkReal x1141=((1.0)*cj15*py); evalcond[0]=((0.4)+pz+(((0.321)*x1136))); evalcond[1]=(x1138+(((-1.0)*x1141))+((sj17*x1140))); evalcond[2]=((0.1)+(((-1.0)*x1137))+(((-1.0)*x1139))+(((-1.0)*cj17*x1140))); evalcond[3]=((0.253041)+(((-1.0)*pp))+(((0.2)*x1139))+(((0.2)*x1137))+(((0.2568)*x1136))); evalcond[4]=(x1140+(((-0.1)*cj17))+((sj17*x1138))+((cj17*x1137))+((cj17*x1139))+(((-1.0)*sj17*x1141))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j16)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j18eval[1]; sj16=-1.0; cj16=0; j16=-1.5707963267949; j18eval[0]=sj17; if( IKabs(j18eval[0]) < 0.0000010000000000 ) { { IkReal j18eval[1]; sj16=-1.0; cj16=0; j16=-1.5707963267949; j18eval[0]=cj17; if( IKabs(j18eval[0]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j17)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j18array[1], cj18array[1], sj18array[1]; bool j18valid[1]={false}; _nj18 = 1; if( IKabs(((((-3.11526479750779)*px*sj15))+(((3.11526479750779)*cj15*py)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.24610591900312)+(((3.11526479750779)*pz)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-3.11526479750779)*px*sj15))+(((3.11526479750779)*cj15*py))))+IKsqr(((-1.24610591900312)+(((3.11526479750779)*pz))))-1) <= IKFAST_SINCOS_THRESH ) continue; j18array[0]=IKatan2(((((-3.11526479750779)*px*sj15))+(((3.11526479750779)*cj15*py))), ((-1.24610591900312)+(((3.11526479750779)*pz)))); sj18array[0]=IKsin(j18array[0]); cj18array[0]=IKcos(j18array[0]); if( j18array[0] > IKPI ) { j18array[0]-=IK2PI; } else if( j18array[0] < -IKPI ) { j18array[0]+=IK2PI; } j18valid[0] = true; for(int ij18 = 0; ij18 < 1; ++ij18) { if( !j18valid[ij18] ) { continue; } _ij18[0] = ij18; _ij18[1] = -1; for(int iij18 = ij18+1; iij18 < 1; ++iij18) { if( j18valid[iij18] && IKabs(cj18array[ij18]-cj18array[iij18]) < IKFAST_SOLUTION_THRESH && IKabs(sj18array[ij18]-sj18array[iij18]) < IKFAST_SOLUTION_THRESH ) { j18valid[iij18]=false; _ij18[1] = iij18; break; } } j18 = j18array[ij18]; cj18 = cj18array[ij18]; sj18 = sj18array[ij18]; { IkReal evalcond[3]; IkReal x1142=IKcos(j18); evalcond[0]=((-0.4)+pz+(((-0.321)*x1142))); evalcond[1]=((0.273041)+(((-1.0)*pp))+(((0.2568)*x1142))); evalcond[2]=(((px*sj15))+(((-1.0)*cj15*py))+(((0.321)*(IKsin(j18))))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j17)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j18array[1], cj18array[1], sj18array[1]; bool j18valid[1]={false}; _nj18 = 1; if( IKabs(((((3.11526479750779)*px*sj15))+(((-3.11526479750779)*cj15*py)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.24610591900312)+(((3.11526479750779)*pz)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((3.11526479750779)*px*sj15))+(((-3.11526479750779)*cj15*py))))+IKsqr(((-1.24610591900312)+(((3.11526479750779)*pz))))-1) <= IKFAST_SINCOS_THRESH ) continue; j18array[0]=IKatan2(((((3.11526479750779)*px*sj15))+(((-3.11526479750779)*cj15*py))), ((-1.24610591900312)+(((3.11526479750779)*pz)))); sj18array[0]=IKsin(j18array[0]); cj18array[0]=IKcos(j18array[0]); if( j18array[0] > IKPI ) { j18array[0]-=IK2PI; } else if( j18array[0] < -IKPI ) { j18array[0]+=IK2PI; } j18valid[0] = true; for(int ij18 = 0; ij18 < 1; ++ij18) { if( !j18valid[ij18] ) { continue; } _ij18[0] = ij18; _ij18[1] = -1; for(int iij18 = ij18+1; iij18 < 1; ++iij18) { if( j18valid[iij18] && IKabs(cj18array[ij18]-cj18array[iij18]) < IKFAST_SOLUTION_THRESH && IKabs(sj18array[ij18]-sj18array[iij18]) < IKFAST_SOLUTION_THRESH ) { j18valid[iij18]=false; _ij18[1] = iij18; break; } } j18 = j18array[ij18]; cj18 = cj18array[ij18]; sj18 = sj18array[ij18]; { IkReal evalcond[3]; IkReal x1143=IKcos(j18); evalcond[0]=((-0.4)+pz+(((-0.321)*x1143))); evalcond[1]=((0.273041)+(((-1.0)*pp))+(((0.2568)*x1143))); evalcond[2]=(((px*sj15))+(((-1.0)*cj15*py))+(((-0.321)*(IKsin(j18))))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j17))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j18array[1], cj18array[1], sj18array[1]; bool j18valid[1]={false}; _nj18 = 1; if( IKabs(((-0.311526479750779)+(((3.11526479750779)*py*sj15))+(((3.11526479750779)*cj15*px)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.24610591900312)+(((3.11526479750779)*pz)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-0.311526479750779)+(((3.11526479750779)*py*sj15))+(((3.11526479750779)*cj15*px))))+IKsqr(((-1.24610591900312)+(((3.11526479750779)*pz))))-1) <= IKFAST_SINCOS_THRESH ) continue; j18array[0]=IKatan2(((-0.311526479750779)+(((3.11526479750779)*py*sj15))+(((3.11526479750779)*cj15*px))), ((-1.24610591900312)+(((3.11526479750779)*pz)))); sj18array[0]=IKsin(j18array[0]); cj18array[0]=IKcos(j18array[0]); if( j18array[0] > IKPI ) { j18array[0]-=IK2PI; } else if( j18array[0] < -IKPI ) { j18array[0]+=IK2PI; } j18valid[0] = true; for(int ij18 = 0; ij18 < 1; ++ij18) { if( !j18valid[ij18] ) { continue; } _ij18[0] = ij18; _ij18[1] = -1; for(int iij18 = ij18+1; iij18 < 1; ++iij18) { if( j18valid[iij18] && IKabs(cj18array[ij18]-cj18array[iij18]) < IKFAST_SOLUTION_THRESH && IKabs(sj18array[ij18]-sj18array[iij18]) < IKFAST_SOLUTION_THRESH ) { j18valid[iij18]=false; _ij18[1] = iij18; break; } } j18 = j18array[ij18]; cj18 = cj18array[ij18]; sj18 = sj18array[ij18]; { IkReal evalcond[3]; IkReal x1144=IKcos(j18); IkReal x1145=(cj15*px); IkReal x1146=(py*sj15); evalcond[0]=((-0.4)+pz+(((-0.321)*x1144))); evalcond[1]=((0.1)+(((-1.0)*x1145))+(((-1.0)*x1146))+(((0.321)*(IKsin(j18))))); evalcond[2]=((0.253041)+(((-1.0)*pp))+(((0.2)*x1145))+(((0.2)*x1146))+(((0.2568)*x1144))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j17)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j18array[1], cj18array[1], sj18array[1]; bool j18valid[1]={false}; _nj18 = 1; if( IKabs(((0.311526479750779)+(((-3.11526479750779)*py*sj15))+(((-3.11526479750779)*cj15*px)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.24610591900312)+(((3.11526479750779)*pz)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((0.311526479750779)+(((-3.11526479750779)*py*sj15))+(((-3.11526479750779)*cj15*px))))+IKsqr(((-1.24610591900312)+(((3.11526479750779)*pz))))-1) <= IKFAST_SINCOS_THRESH ) continue; j18array[0]=IKatan2(((0.311526479750779)+(((-3.11526479750779)*py*sj15))+(((-3.11526479750779)*cj15*px))), ((-1.24610591900312)+(((3.11526479750779)*pz)))); sj18array[0]=IKsin(j18array[0]); cj18array[0]=IKcos(j18array[0]); if( j18array[0] > IKPI ) { j18array[0]-=IK2PI; } else if( j18array[0] < -IKPI ) { j18array[0]+=IK2PI; } j18valid[0] = true; for(int ij18 = 0; ij18 < 1; ++ij18) { if( !j18valid[ij18] ) { continue; } _ij18[0] = ij18; _ij18[1] = -1; for(int iij18 = ij18+1; iij18 < 1; ++iij18) { if( j18valid[iij18] && IKabs(cj18array[ij18]-cj18array[iij18]) < IKFAST_SOLUTION_THRESH && IKabs(sj18array[ij18]-sj18array[iij18]) < IKFAST_SOLUTION_THRESH ) { j18valid[iij18]=false; _ij18[1] = iij18; break; } } j18 = j18array[ij18]; cj18 = cj18array[ij18]; sj18 = sj18array[ij18]; { IkReal evalcond[3]; IkReal x1147=IKcos(j18); IkReal x1148=(cj15*px); IkReal x1149=(py*sj15); evalcond[0]=((-0.4)+pz+(((-0.321)*x1147))); evalcond[1]=((0.1)+(((-1.0)*x1148))+(((-1.0)*x1149))+(((-0.321)*(IKsin(j18))))); evalcond[2]=((0.253041)+(((-1.0)*pp))+(((0.2)*x1149))+(((0.2)*x1148))+(((0.2568)*x1147))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j18] } } while(0); if( bgotonextstatement ) { } } } } } } } else { { IkReal j18array[1], cj18array[1], sj18array[1]; bool j18valid[1]={false}; _nj18 = 1; CheckValue<IkReal> x1150=IKPowWithIntegerCheck(cj17,-1); if(!x1150.valid){ continue; } if( IKabs(((0.00311526479750779)*(x1150.value)*(((-100.0)+(((1000.0)*py*sj15))+(((1000.0)*cj15*px)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.24610591900312)+(((3.11526479750779)*pz)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((0.00311526479750779)*(x1150.value)*(((-100.0)+(((1000.0)*py*sj15))+(((1000.0)*cj15*px))))))+IKsqr(((-1.24610591900312)+(((3.11526479750779)*pz))))-1) <= IKFAST_SINCOS_THRESH ) continue; j18array[0]=IKatan2(((0.00311526479750779)*(x1150.value)*(((-100.0)+(((1000.0)*py*sj15))+(((1000.0)*cj15*px))))), ((-1.24610591900312)+(((3.11526479750779)*pz)))); sj18array[0]=IKsin(j18array[0]); cj18array[0]=IKcos(j18array[0]); if( j18array[0] > IKPI ) { j18array[0]-=IK2PI; } else if( j18array[0] < -IKPI ) { j18array[0]+=IK2PI; } j18valid[0] = true; for(int ij18 = 0; ij18 < 1; ++ij18) { if( !j18valid[ij18] ) { continue; } _ij18[0] = ij18; _ij18[1] = -1; for(int iij18 = ij18+1; iij18 < 1; ++iij18) { if( j18valid[iij18] && IKabs(cj18array[ij18]-cj18array[iij18]) < IKFAST_SOLUTION_THRESH && IKabs(sj18array[ij18]-sj18array[iij18]) < IKFAST_SOLUTION_THRESH ) { j18valid[iij18]=false; _ij18[1] = iij18; break; } } j18 = j18array[ij18]; cj18 = cj18array[ij18]; sj18 = sj18array[ij18]; { IkReal evalcond[5]; IkReal x1151=IKsin(j18); IkReal x1152=IKcos(j18); IkReal x1153=(py*sj15); IkReal x1154=((1.0)*cj15); IkReal x1155=(px*sj15); IkReal x1156=((0.321)*x1151); evalcond[0]=((-0.4)+(((-0.321)*x1152))+pz); evalcond[1]=(x1155+(((-1.0)*py*x1154))+((sj17*x1156))); evalcond[2]=((0.1)+(((-1.0)*px*x1154))+(((-1.0)*x1153))+((cj17*x1156))); evalcond[3]=((0.253041)+(((0.2)*x1153))+(((0.2568)*x1152))+(((0.2)*cj15*px))+(((-1.0)*pp))); evalcond[4]=((((-1.0)*cj17*px*x1154))+x1156+(((-1.0)*py*sj17*x1154))+(((-1.0)*cj17*x1153))+((sj17*x1155))+(((0.1)*cj17))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j18array[1], cj18array[1], sj18array[1]; bool j18valid[1]={false}; _nj18 = 1; CheckValue<IkReal> x1157=IKPowWithIntegerCheck(sj17,-1); if(!x1157.valid){ continue; } if( IKabs(((0.00311526479750779)*(x1157.value)*(((((-1000.0)*px*sj15))+(((1000.0)*cj15*py)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.24610591900312)+(((3.11526479750779)*pz)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((0.00311526479750779)*(x1157.value)*(((((-1000.0)*px*sj15))+(((1000.0)*cj15*py))))))+IKsqr(((-1.24610591900312)+(((3.11526479750779)*pz))))-1) <= IKFAST_SINCOS_THRESH ) continue; j18array[0]=IKatan2(((0.00311526479750779)*(x1157.value)*(((((-1000.0)*px*sj15))+(((1000.0)*cj15*py))))), ((-1.24610591900312)+(((3.11526479750779)*pz)))); sj18array[0]=IKsin(j18array[0]); cj18array[0]=IKcos(j18array[0]); if( j18array[0] > IKPI ) { j18array[0]-=IK2PI; } else if( j18array[0] < -IKPI ) { j18array[0]+=IK2PI; } j18valid[0] = true; for(int ij18 = 0; ij18 < 1; ++ij18) { if( !j18valid[ij18] ) { continue; } _ij18[0] = ij18; _ij18[1] = -1; for(int iij18 = ij18+1; iij18 < 1; ++iij18) { if( j18valid[iij18] && IKabs(cj18array[ij18]-cj18array[iij18]) < IKFAST_SOLUTION_THRESH && IKabs(sj18array[ij18]-sj18array[iij18]) < IKFAST_SOLUTION_THRESH ) { j18valid[iij18]=false; _ij18[1] = iij18; break; } } j18 = j18array[ij18]; cj18 = cj18array[ij18]; sj18 = sj18array[ij18]; { IkReal evalcond[5]; IkReal x1158=IKsin(j18); IkReal x1159=IKcos(j18); IkReal x1160=(py*sj15); IkReal x1161=((1.0)*cj15); IkReal x1162=(px*sj15); IkReal x1163=((0.321)*x1158); evalcond[0]=((-0.4)+(((-0.321)*x1159))+pz); evalcond[1]=(x1162+((sj17*x1163))+(((-1.0)*py*x1161))); evalcond[2]=((0.1)+((cj17*x1163))+(((-1.0)*px*x1161))+(((-1.0)*x1160))); evalcond[3]=((0.253041)+(((0.2568)*x1159))+(((0.2)*cj15*px))+(((-1.0)*pp))+(((0.2)*x1160))); evalcond[4]=(x1163+(((-1.0)*cj17*px*x1161))+((sj17*x1162))+(((-1.0)*py*sj17*x1161))+(((-1.0)*cj17*x1160))+(((0.1)*cj17))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j17)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j18array[1], cj18array[1], sj18array[1]; bool j18valid[1]={false}; _nj18 = 1; if( IKabs(((((-3.11526479750779)*px*sj15))+(((3.11526479750779)*cj15*py)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*cj15*px))+(((-0.778816199376947)*py*sj15)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-3.11526479750779)*px*sj15))+(((3.11526479750779)*cj15*py))))+IKsqr(((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*cj15*px))+(((-0.778816199376947)*py*sj15))))-1) <= IKFAST_SINCOS_THRESH ) continue; j18array[0]=IKatan2(((((-3.11526479750779)*px*sj15))+(((3.11526479750779)*cj15*py))), ((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*cj15*px))+(((-0.778816199376947)*py*sj15)))); sj18array[0]=IKsin(j18array[0]); cj18array[0]=IKcos(j18array[0]); if( j18array[0] > IKPI ) { j18array[0]-=IK2PI; } else if( j18array[0] < -IKPI ) { j18array[0]+=IK2PI; } j18valid[0] = true; for(int ij18 = 0; ij18 < 1; ++ij18) { if( !j18valid[ij18] ) { continue; } _ij18[0] = ij18; _ij18[1] = -1; for(int iij18 = ij18+1; iij18 < 1; ++iij18) { if( j18valid[iij18] && IKabs(cj18array[ij18]-cj18array[iij18]) < IKFAST_SOLUTION_THRESH && IKabs(sj18array[ij18]-sj18array[iij18]) < IKFAST_SOLUTION_THRESH ) { j18valid[iij18]=false; _ij18[1] = iij18; break; } } j18 = j18array[ij18]; cj18 = cj18array[ij18]; sj18 = sj18array[ij18]; { IkReal evalcond[5]; IkReal x1164=IKcos(j18); IkReal x1165=(py*sj15); IkReal x1166=((1.0)*cj16); IkReal x1167=((1.0)*cj15); IkReal x1168=(cj15*px); IkReal x1169=((0.321)*x1164); evalcond[0]=(((sj16*x1169))+(((0.4)*sj16))+pz); evalcond[1]=(((px*sj15))+(((-1.0)*py*x1167))+(((0.321)*(IKsin(j18))))); evalcond[2]=((0.253041)+(((0.2568)*x1164))+(((-1.0)*pp))+(((0.2)*x1165))+(((0.2)*x1168))); evalcond[3]=((0.1)+((cj16*x1169))+(((0.4)*cj16))+(((-1.0)*px*x1167))+(((-1.0)*x1165))); evalcond[4]=((0.4)+(((-1.0)*x1166*x1168))+x1169+((pz*sj16))+(((-1.0)*x1165*x1166))+(((0.1)*cj16))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j17)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j18array[1], cj18array[1], sj18array[1]; bool j18valid[1]={false}; _nj18 = 1; if( IKabs(((((3.11526479750779)*px*sj15))+(((-3.11526479750779)*cj15*py)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*cj15*px))+(((-0.778816199376947)*py*sj15)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((3.11526479750779)*px*sj15))+(((-3.11526479750779)*cj15*py))))+IKsqr(((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*cj15*px))+(((-0.778816199376947)*py*sj15))))-1) <= IKFAST_SINCOS_THRESH ) continue; j18array[0]=IKatan2(((((3.11526479750779)*px*sj15))+(((-3.11526479750779)*cj15*py))), ((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*cj15*px))+(((-0.778816199376947)*py*sj15)))); sj18array[0]=IKsin(j18array[0]); cj18array[0]=IKcos(j18array[0]); if( j18array[0] > IKPI ) { j18array[0]-=IK2PI; } else if( j18array[0] < -IKPI ) { j18array[0]+=IK2PI; } j18valid[0] = true; for(int ij18 = 0; ij18 < 1; ++ij18) { if( !j18valid[ij18] ) { continue; } _ij18[0] = ij18; _ij18[1] = -1; for(int iij18 = ij18+1; iij18 < 1; ++iij18) { if( j18valid[iij18] && IKabs(cj18array[ij18]-cj18array[iij18]) < IKFAST_SOLUTION_THRESH && IKabs(sj18array[ij18]-sj18array[iij18]) < IKFAST_SOLUTION_THRESH ) { j18valid[iij18]=false; _ij18[1] = iij18; break; } } j18 = j18array[ij18]; cj18 = cj18array[ij18]; sj18 = sj18array[ij18]; { IkReal evalcond[5]; IkReal x1170=IKcos(j18); IkReal x1171=(py*sj15); IkReal x1172=((1.0)*cj16); IkReal x1173=((1.0)*cj15); IkReal x1174=(cj15*px); IkReal x1175=((0.321)*x1170); evalcond[0]=(((sj16*x1175))+(((0.4)*sj16))+pz); evalcond[1]=(((px*sj15))+(((-1.0)*py*x1173))+(((-0.321)*(IKsin(j18))))); evalcond[2]=((0.253041)+(((0.2568)*x1170))+(((0.2)*x1171))+(((0.2)*x1174))+(((-1.0)*pp))); evalcond[3]=((0.1)+((cj16*x1175))+(((0.4)*cj16))+(((-1.0)*px*x1173))+(((-1.0)*x1171))); evalcond[4]=((0.4)+x1175+(((-1.0)*x1172*x1174))+((pz*sj16))+(((-1.0)*x1171*x1172))+(((0.1)*cj16))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j18] } } while(0); if( bgotonextstatement ) { } } } } } } } } } } } else { { IkReal j18array[1], cj18array[1], sj18array[1]; bool j18valid[1]={false}; _nj18 = 1; CheckValue<IkReal> x1181=IKPowWithIntegerCheck(sj17,-1); if(!x1181.valid){ continue; } IkReal x1176=x1181.value; IkReal x1177=((0.00311526479750779)*x1176); IkReal x1178=(px*sj15); IkReal x1179=(cj15*py); IkReal x1180=((1000.0)*cj16*cj17); CheckValue<IkReal> x1182=IKPowWithIntegerCheck(sj16,-1); if(!x1182.valid){ continue; } if( IKabs((x1177*(((((-1000.0)*x1178))+(((1000.0)*x1179)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs((x1177*(x1182.value)*(((((-1000.0)*pz*sj17))+((x1178*x1180))+(((-400.0)*sj16*sj17))+(((-1.0)*x1179*x1180)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((x1177*(((((-1000.0)*x1178))+(((1000.0)*x1179))))))+IKsqr((x1177*(x1182.value)*(((((-1000.0)*pz*sj17))+((x1178*x1180))+(((-400.0)*sj16*sj17))+(((-1.0)*x1179*x1180))))))-1) <= IKFAST_SINCOS_THRESH ) continue; j18array[0]=IKatan2((x1177*(((((-1000.0)*x1178))+(((1000.0)*x1179))))), (x1177*(x1182.value)*(((((-1000.0)*pz*sj17))+((x1178*x1180))+(((-400.0)*sj16*sj17))+(((-1.0)*x1179*x1180)))))); sj18array[0]=IKsin(j18array[0]); cj18array[0]=IKcos(j18array[0]); if( j18array[0] > IKPI ) { j18array[0]-=IK2PI; } else if( j18array[0] < -IKPI ) { j18array[0]+=IK2PI; } j18valid[0] = true; for(int ij18 = 0; ij18 < 1; ++ij18) { if( !j18valid[ij18] ) { continue; } _ij18[0] = ij18; _ij18[1] = -1; for(int iij18 = ij18+1; iij18 < 1; ++iij18) { if( j18valid[iij18] && IKabs(cj18array[ij18]-cj18array[iij18]) < IKFAST_SOLUTION_THRESH && IKabs(sj18array[ij18]-sj18array[iij18]) < IKFAST_SOLUTION_THRESH ) { j18valid[iij18]=false; _ij18[1] = iij18; break; } } j18 = j18array[ij18]; cj18 = cj18array[ij18]; sj18 = sj18array[ij18]; { IkReal evalcond[6]; IkReal x1183=IKcos(j18); IkReal x1184=IKsin(j18); IkReal x1185=(cj17*sj16); IkReal x1186=(cj16*cj17); IkReal x1187=(cj15*px); IkReal x1188=((1.0)*cj16); IkReal x1189=(py*sj15); IkReal x1190=(px*sj15); IkReal x1191=((0.321)*x1184); IkReal x1192=((0.321)*x1183); IkReal x1193=((1.0)*cj15*py); evalcond[0]=(x1190+(((-1.0)*x1193))+((sj17*x1191))); evalcond[1]=((0.253041)+(((-1.0)*pp))+(((0.2)*x1189))+(((0.2)*x1187))+(((0.2568)*x1183))); evalcond[2]=(((x1186*x1191))+(((0.4)*sj16))+((sj16*x1192))+pz); evalcond[3]=((0.4)+x1192+(((-1.0)*x1188*x1189))+((pz*sj16))+(((-1.0)*x1187*x1188))+(((0.1)*cj16))); evalcond[4]=((0.1)+((cj16*x1192))+(((0.4)*cj16))+(((-1.0)*x1185*x1191))+(((-1.0)*x1189))+(((-1.0)*x1187))); evalcond[5]=(x1191+((pz*x1186))+(((-0.1)*x1185))+(((-1.0)*sj17*x1193))+((x1185*x1187))+((x1185*x1189))+((sj17*x1190))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j18array[1], cj18array[1], sj18array[1]; bool j18valid[1]={false}; _nj18 = 1; IkReal x1194=((250.0)*sj16); IkReal x1195=(py*sj15); IkReal x1196=(cj15*px); CheckValue<IkReal> x1197=IKPowWithIntegerCheck(cj16,-1); if(!x1197.valid){ continue; } CheckValue<IkReal> x1198=IKPowWithIntegerCheck(cj17,-1); if(!x1198.valid){ continue; } if( IKabs(((0.00311526479750779)*(x1197.value)*(x1198.value)*(((((-1000.0)*pz))+((x1194*x1196))+((x1194*x1195))+(((-1250.0)*pp*sj16))+(((-83.69875)*sj16)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*x1196))+(((-0.778816199376947)*x1195)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((0.00311526479750779)*(x1197.value)*(x1198.value)*(((((-1000.0)*pz))+((x1194*x1196))+((x1194*x1195))+(((-1250.0)*pp*sj16))+(((-83.69875)*sj16))))))+IKsqr(((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*x1196))+(((-0.778816199376947)*x1195))))-1) <= IKFAST_SINCOS_THRESH ) continue; j18array[0]=IKatan2(((0.00311526479750779)*(x1197.value)*(x1198.value)*(((((-1000.0)*pz))+((x1194*x1196))+((x1194*x1195))+(((-1250.0)*pp*sj16))+(((-83.69875)*sj16))))), ((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*x1196))+(((-0.778816199376947)*x1195)))); sj18array[0]=IKsin(j18array[0]); cj18array[0]=IKcos(j18array[0]); if( j18array[0] > IKPI ) { j18array[0]-=IK2PI; } else if( j18array[0] < -IKPI ) { j18array[0]+=IK2PI; } j18valid[0] = true; for(int ij18 = 0; ij18 < 1; ++ij18) { if( !j18valid[ij18] ) { continue; } _ij18[0] = ij18; _ij18[1] = -1; for(int iij18 = ij18+1; iij18 < 1; ++iij18) { if( j18valid[iij18] && IKabs(cj18array[ij18]-cj18array[iij18]) < IKFAST_SOLUTION_THRESH && IKabs(sj18array[ij18]-sj18array[iij18]) < IKFAST_SOLUTION_THRESH ) { j18valid[iij18]=false; _ij18[1] = iij18; break; } } j18 = j18array[ij18]; cj18 = cj18array[ij18]; sj18 = sj18array[ij18]; { IkReal evalcond[6]; IkReal x1199=IKcos(j18); IkReal x1200=IKsin(j18); IkReal x1201=(cj17*sj16); IkReal x1202=(cj16*cj17); IkReal x1203=(cj15*px); IkReal x1204=((1.0)*cj16); IkReal x1205=(py*sj15); IkReal x1206=(px*sj15); IkReal x1207=((0.321)*x1200); IkReal x1208=((0.321)*x1199); IkReal x1209=((1.0)*cj15*py); evalcond[0]=(x1206+((sj17*x1207))+(((-1.0)*x1209))); evalcond[1]=((0.253041)+(((-1.0)*pp))+(((0.2568)*x1199))+(((0.2)*x1205))+(((0.2)*x1203))); evalcond[2]=(((sj16*x1208))+((x1202*x1207))+(((0.4)*sj16))+pz); evalcond[3]=((0.4)+(((-1.0)*x1204*x1205))+x1208+((pz*sj16))+(((-1.0)*x1203*x1204))+(((0.1)*cj16))); evalcond[4]=((0.1)+(((0.4)*cj16))+(((-1.0)*x1203))+(((-1.0)*x1205))+((cj16*x1208))+(((-1.0)*x1201*x1207))); evalcond[5]=(x1207+(((-0.1)*x1201))+((sj17*x1206))+(((-1.0)*sj17*x1209))+((pz*x1202))+((x1201*x1203))+((x1201*x1205))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } else { { IkReal j18array[1], cj18array[1], sj18array[1]; bool j18valid[1]={false}; _nj18 = 1; CheckValue<IkReal> x1210=IKPowWithIntegerCheck(sj17,-1); if(!x1210.valid){ continue; } if( IKabs(((0.00311526479750779)*(x1210.value)*(((((-1000.0)*px*sj15))+(((1000.0)*cj15*py)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*cj15*px))+(((-0.778816199376947)*py*sj15)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((0.00311526479750779)*(x1210.value)*(((((-1000.0)*px*sj15))+(((1000.0)*cj15*py))))))+IKsqr(((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*cj15*px))+(((-0.778816199376947)*py*sj15))))-1) <= IKFAST_SINCOS_THRESH ) continue; j18array[0]=IKatan2(((0.00311526479750779)*(x1210.value)*(((((-1000.0)*px*sj15))+(((1000.0)*cj15*py))))), ((-0.98536214953271)+(((3.89408099688474)*pp))+(((-0.778816199376947)*cj15*px))+(((-0.778816199376947)*py*sj15)))); sj18array[0]=IKsin(j18array[0]); cj18array[0]=IKcos(j18array[0]); if( j18array[0] > IKPI ) { j18array[0]-=IK2PI; } else if( j18array[0] < -IKPI ) { j18array[0]+=IK2PI; } j18valid[0] = true; for(int ij18 = 0; ij18 < 1; ++ij18) { if( !j18valid[ij18] ) { continue; } _ij18[0] = ij18; _ij18[1] = -1; for(int iij18 = ij18+1; iij18 < 1; ++iij18) { if( j18valid[iij18] && IKabs(cj18array[ij18]-cj18array[iij18]) < IKFAST_SOLUTION_THRESH && IKabs(sj18array[ij18]-sj18array[iij18]) < IKFAST_SOLUTION_THRESH ) { j18valid[iij18]=false; _ij18[1] = iij18; break; } } j18 = j18array[ij18]; cj18 = cj18array[ij18]; sj18 = sj18array[ij18]; { IkReal evalcond[6]; IkReal x1211=IKcos(j18); IkReal x1212=IKsin(j18); IkReal x1213=(cj17*sj16); IkReal x1214=(cj16*cj17); IkReal x1215=(cj15*px); IkReal x1216=((1.0)*cj16); IkReal x1217=(py*sj15); IkReal x1218=(px*sj15); IkReal x1219=((0.321)*x1212); IkReal x1220=((0.321)*x1211); IkReal x1221=((1.0)*cj15*py); evalcond[0]=(x1218+(((-1.0)*x1221))+((sj17*x1219))); evalcond[1]=((0.253041)+(((0.2)*x1215))+(((0.2)*x1217))+(((0.2568)*x1211))+(((-1.0)*pp))); evalcond[2]=(((x1214*x1219))+(((0.4)*sj16))+pz+((sj16*x1220))); evalcond[3]=((0.4)+x1220+(((-1.0)*x1215*x1216))+(((-1.0)*x1216*x1217))+((pz*sj16))+(((0.1)*cj16))); evalcond[4]=((0.1)+((cj16*x1220))+(((-1.0)*x1213*x1219))+(((0.4)*cj16))+(((-1.0)*x1217))+(((-1.0)*x1215))); evalcond[5]=(x1219+(((-0.1)*x1213))+((x1213*x1215))+((x1213*x1217))+(((-1.0)*sj17*x1221))+((sj17*x1218))+((pz*x1214))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } rotationfunction0(solutions); } } } } } } } } } } return solutions.GetNumSolutions()>0; } inline void rotationfunction0(IkSolutionListBase<IkReal>& solutions) { for(int rotationiter = 0; rotationiter < 1; ++rotationiter) { IkReal x206=((1.0)*cj17); IkReal x207=(cj18*sj16); IkReal x208=(cj16*sj17); IkReal x209=(sj16*sj18); IkReal x210=(sj16*sj17); IkReal x211=(cj16*cj18); IkReal x212=(sj17*sj18); IkReal x213=(cj16*sj18); IkReal x214=(cj18*sj15*sj17); IkReal x215=((((-1.0)*x206*x211))+x209); IkReal x216=(((sj15*x210))+((cj15*cj17))); IkReal x217=(((cj15*x210))+(((-1.0)*sj15*x206))); IkReal x218=((((-1.0)*x206*x209))+x211); IkReal x219=(cj15*x218); IkReal x220=((((-1.0)*x206*x207))+(((-1.0)*x213))); IkReal x221=((((-1.0)*x206*x213))+(((-1.0)*x207))); IkReal x222=(cj15*x220); IkReal x223=(((cj15*x212))+((sj15*x218))); IkReal x224=((((-1.0)*sj15*x212))+x219); IkReal x225=(((cj15*cj18*sj17))+((sj15*x220))); IkReal x226=(x222+(((-1.0)*x214))); new_r00=(((r00*x226))+((r10*x225))+((r20*x215))); new_r01=(((r21*x215))+((r01*x226))+((r11*x225))); new_r02=(((r02*((x222+(((-1.0)*x214))))))+((r12*x225))+((r22*x215))); new_r10=(((r20*x208))+((r00*x217))+((r10*x216))); new_r11=(((r11*x216))+((r21*x208))+((r01*x217))); new_r12=(((r22*x208))+((r12*x216))+((r02*x217))); new_r20=(((r20*x221))+((r10*x223))+((r00*(((((-1.0)*sj15*x212))+x219))))); new_r21=(((r01*x224))+((r11*x223))+((r21*x221))); new_r22=(((r12*x223))+((r02*x224))+((r22*x221))); { IkReal j20array[2], cj20array[2], sj20array[2]; bool j20valid[2]={false}; _nj20 = 2; cj20array[0]=new_r22; if( cj20array[0] >= -1-IKFAST_SINCOS_THRESH && cj20array[0] <= 1+IKFAST_SINCOS_THRESH ) { j20valid[0] = j20valid[1] = true; j20array[0] = IKacos(cj20array[0]); sj20array[0] = IKsin(j20array[0]); cj20array[1] = cj20array[0]; j20array[1] = -j20array[0]; sj20array[1] = -sj20array[0]; } else if( isnan(cj20array[0]) ) { // probably any value will work j20valid[0] = true; cj20array[0] = 1; sj20array[0] = 0; j20array[0] = 0; } for(int ij20 = 0; ij20 < 2; ++ij20) { if( !j20valid[ij20] ) { continue; } _ij20[0] = ij20; _ij20[1] = -1; for(int iij20 = ij20+1; iij20 < 2; ++iij20) { if( j20valid[iij20] && IKabs(cj20array[ij20]-cj20array[iij20]) < IKFAST_SOLUTION_THRESH && IKabs(sj20array[ij20]-sj20array[iij20]) < IKFAST_SOLUTION_THRESH ) { j20valid[iij20]=false; _ij20[1] = iij20; break; } } j20 = j20array[ij20]; cj20 = cj20array[ij20]; sj20 = sj20array[ij20]; { IkReal j19eval[3]; j19eval[0]=sj20; j19eval[1]=((IKabs(new_r12))+(IKabs(new_r02))); j19eval[2]=IKsign(sj20); if( IKabs(j19eval[0]) < 0.0000010000000000 || IKabs(j19eval[1]) < 0.0000010000000000 || IKabs(j19eval[2]) < 0.0000010000000000 ) { { IkReal j21eval[3]; j21eval[0]=sj20; j21eval[1]=((IKabs(new_r20))+(IKabs(new_r21))); j21eval[2]=IKsign(sj20); if( IKabs(j21eval[0]) < 0.0000010000000000 || IKabs(j21eval[1]) < 0.0000010000000000 || IKabs(j21eval[2]) < 0.0000010000000000 ) { { IkReal j19eval[2]; j19eval[0]=new_r12; j19eval[1]=sj20; if( IKabs(j19eval[0]) < 0.0000010000000000 || IKabs(j19eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[5]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j20))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r12; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; IkReal j21mul = 1; j21=0; j19mul=-1.0; if( IKabs(((-1.0)*new_r01)) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r00) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r01))+IKsqr(new_r00)-1) <= IKFAST_SINCOS_THRESH ) continue; j19=IKatan2(((-1.0)*new_r01), new_r00); { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].fmul = j19mul; vinfos[5].freeind = 0; vinfos[5].maxsolutions = 0; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].fmul = j21mul; vinfos[7].freeind = 0; vinfos[7].maxsolutions = 0; std::vector<int> vfree(1); vfree[0] = 7; solutions.AddSolution(vinfos,vfree); } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j20)))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r12; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; IkReal j21mul = 1; j21=0; j19mul=1.0; if( IKabs(((-1.0)*new_r01)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r00)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r01))+IKsqr(((-1.0)*new_r00))-1) <= IKFAST_SINCOS_THRESH ) continue; j19=IKatan2(((-1.0)*new_r01), ((-1.0)*new_r00)); { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].fmul = j19mul; vinfos[5].freeind = 0; vinfos[5].maxsolutions = 0; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].fmul = j21mul; vinfos[7].freeind = 0; vinfos[7].maxsolutions = 0; std::vector<int> vfree(1); vfree[0] = 7; solutions.AddSolution(vinfos,vfree); } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r12))+(IKabs(new_r02))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j19eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; IkReal x227=new_r22*new_r22; IkReal x228=((16.0)*new_r10); IkReal x229=((16.0)*new_r01); IkReal x230=((16.0)*new_r22); IkReal x231=((8.0)*new_r11); IkReal x232=((8.0)*new_r00); IkReal x233=(x227*x228); IkReal x234=(x227*x229); j19eval[0]=((IKabs(((((-1.0)*new_r22*x232))+((x227*x231)))))+(IKabs(((((32.0)*new_r11))+(((-16.0)*new_r11*x227))+(((-1.0)*new_r00*x230)))))+(IKabs((x233+(((-1.0)*x228)))))+(IKabs((((new_r11*x230))+(((16.0)*new_r00))+(((-32.0)*new_r00*x227)))))+(IKabs(((((-1.0)*x233))+x228)))+(IKabs(((((-1.0)*x234))+x229)))+(IKabs((x234+(((-1.0)*x229)))))+(IKabs((((new_r22*x231))+(((-1.0)*x232)))))); if( IKabs(j19eval[0]) < 0.0000000100000000 ) { continue; // no branches [j19, j21] } else { IkReal op[4+1], zeror[4]; int numroots; IkReal j19evalpoly[1]; IkReal x235=new_r22*new_r22; IkReal x236=((16.0)*new_r10); IkReal x237=(new_r11*new_r22); IkReal x238=(x235*x236); IkReal x239=((((8.0)*x237))+(((-8.0)*new_r00))); op[0]=x239; op[1]=((((-1.0)*x238))+x236); op[2]=((((16.0)*new_r00))+(((16.0)*x237))+(((-32.0)*new_r00*x235))); op[3]=((((-1.0)*x236))+x238); op[4]=x239; polyroots4(op,zeror,numroots); IkReal j19array[4], cj19array[4], sj19array[4], tempj19array[1]; int numsolutions = 0; for(int ij19 = 0; ij19 < numroots; ++ij19) { IkReal htj19 = zeror[ij19]; tempj19array[0]=((2.0)*(atan(htj19))); for(int kj19 = 0; kj19 < 1; ++kj19) { j19array[numsolutions] = tempj19array[kj19]; if( j19array[numsolutions] > IKPI ) { j19array[numsolutions]-=IK2PI; } else if( j19array[numsolutions] < -IKPI ) { j19array[numsolutions]+=IK2PI; } sj19array[numsolutions] = IKsin(j19array[numsolutions]); cj19array[numsolutions] = IKcos(j19array[numsolutions]); numsolutions++; } } bool j19valid[4]={true,true,true,true}; _nj19 = 4; for(int ij19 = 0; ij19 < numsolutions; ++ij19) { if( !j19valid[ij19] ) { continue; } j19 = j19array[ij19]; cj19 = cj19array[ij19]; sj19 = sj19array[ij19]; htj19 = IKtan(j19/2); IkReal x240=((16.0)*new_r01); IkReal x241=new_r22*new_r22; IkReal x242=(new_r00*new_r22); IkReal x243=((8.0)*x242); IkReal x244=(new_r11*x241); IkReal x245=(x240*x241); IkReal x246=((8.0)*x244); j19evalpoly[0]=(((htj19*((x240+(((-1.0)*x245))))))+(((htj19*htj19*htj19)*((x245+(((-1.0)*x240))))))+x246+(((-1.0)*x243))+(((htj19*htj19*htj19*htj19)*((x246+(((-1.0)*x243))))))+(((htj19*htj19)*(((((32.0)*new_r11))+(((-16.0)*x244))+(((-16.0)*x242))))))); if( IKabs(j19evalpoly[0]) > 0.0000001000000000 ) { continue; } _ij19[0] = ij19; _ij19[1] = -1; for(int iij19 = ij19+1; iij19 < numsolutions; ++iij19) { if( j19valid[iij19] && IKabs(cj19array[ij19]-cj19array[iij19]) < IKFAST_SOLUTION_THRESH && IKabs(sj19array[ij19]-sj19array[iij19]) < IKFAST_SOLUTION_THRESH ) { j19valid[iij19]=false; _ij19[1] = iij19; break; } } { IkReal j21eval[3]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; IkReal x247=cj19*cj19; IkReal x248=(cj19*new_r22); IkReal x249=((-1.0)+x247+(((-1.0)*x247*(new_r22*new_r22)))); j21eval[0]=x249; j21eval[1]=((IKabs(((((-1.0)*new_r00*x248))+((new_r01*sj19)))))+(IKabs((((new_r01*x248))+((new_r00*sj19)))))); j21eval[2]=IKsign(x249); if( IKabs(j21eval[0]) < 0.0000010000000000 || IKabs(j21eval[1]) < 0.0000010000000000 || IKabs(j21eval[2]) < 0.0000010000000000 ) { { IkReal j21eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; j21eval[0]=new_r22; if( IKabs(j21eval[0]) < 0.0000010000000000 ) { { IkReal j21eval[2]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; IkReal x250=new_r22*new_r22; j21eval[0]=(((cj19*x250))+(((-1.0)*cj19))); j21eval[1]=(((sj19*x250))+(((-1.0)*sj19))); if( IKabs(j21eval[0]) < 0.0000010000000000 || IKabs(j21eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[1]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j19)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; if( IKabs(((-1.0)*new_r00)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r01)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r00))+IKsqr(((-1.0)*new_r01))-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2(((-1.0)*new_r00), ((-1.0)*new_r01)); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[4]; IkReal x251=IKsin(j21); IkReal x252=IKcos(j21); evalcond[0]=x251; evalcond[1]=((-1.0)*x252); evalcond[2]=((((-1.0)*new_r00))+(((-1.0)*x251))); evalcond[3]=((((-1.0)*new_r01))+(((-1.0)*x252))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j19)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; if( IKabs(new_r00) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r01) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r00)+IKsqr(new_r01)-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2(new_r00, new_r01); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[4]; IkReal x253=IKsin(j21); IkReal x254=IKcos(j21); evalcond[0]=x253; evalcond[1]=((-1.0)*x254); evalcond[2]=(new_r00+(((-1.0)*x253))); evalcond[3]=(new_r01+(((-1.0)*x254))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j19))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; if( IKabs(new_r10) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r11) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r10)+IKsqr(new_r11)-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2(new_r10, new_r11); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[4]; IkReal x255=IKsin(j21); IkReal x256=IKcos(j21); evalcond[0]=x255; evalcond[1]=((-1.0)*x256); evalcond[2]=(new_r10+(((-1.0)*x255))); evalcond[3]=(new_r11+(((-1.0)*x256))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j19)))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; if( IKabs(((-1.0)*new_r10)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r11)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r10))+IKsqr(((-1.0)*new_r11))-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2(((-1.0)*new_r10), ((-1.0)*new_r11)); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[4]; IkReal x257=IKsin(j21); IkReal x258=IKcos(j21); evalcond[0]=x257; evalcond[1]=((-1.0)*x258); evalcond[2]=((((-1.0)*new_r10))+(((-1.0)*x257))); evalcond[3]=((((-1.0)*new_r11))+(((-1.0)*x258))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { CheckValue<IkReal> x259=IKPowWithIntegerCheck(((1.0)+(((-1.0)*(new_r22*new_r22)))),-1); if(!x259.valid){ continue; } if((x259.value) < -0.00001) continue; IkReal gconst36=((-1.0)*(IKsqrt(x259.value))); evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.0)+(IKsign(sj19)))))+(IKabs((cj19+(((-1.0)*gconst36)))))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; if((((1.0)+(((-1.0)*(gconst36*gconst36))))) < -0.00001) continue; sj19=IKsqrt(((1.0)+(((-1.0)*(gconst36*gconst36))))); cj19=gconst36; if( (gconst36) < -1-IKFAST_SINCOS_THRESH || (gconst36) > 1+IKFAST_SINCOS_THRESH ) continue; j19=IKacos(gconst36); CheckValue<IkReal> x260=IKPowWithIntegerCheck(((1.0)+(((-1.0)*(new_r22*new_r22)))),-1); if(!x260.valid){ continue; } if((x260.value) < -0.00001) continue; IkReal gconst36=((-1.0)*(IKsqrt(x260.value))); j21eval[0]=((IKabs(new_r11))+(IKabs(new_r10))); if( IKabs(j21eval[0]) < 0.0000010000000000 ) { { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; if((((1.0)+(((-1.0)*(gconst36*gconst36))))) < -0.00001) continue; CheckValue<IkReal> x261=IKPowWithIntegerCheck(gconst36,-1); if(!x261.valid){ continue; } if( IKabs((((gconst36*new_r10))+(((-1.0)*new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst36*gconst36)))))))))) < IKFAST_ATAN2_MAGTHRESH && IKabs((new_r11*(x261.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((((gconst36*new_r10))+(((-1.0)*new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst36*gconst36))))))))))+IKsqr((new_r11*(x261.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2((((gconst36*new_r10))+(((-1.0)*new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst36*gconst36))))))))), (new_r11*(x261.value))); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[8]; IkReal x262=IKcos(j21); IkReal x263=IKsin(j21); IkReal x264=((1.0)*x263); IkReal x265=((1.0)*x262); if((((1.0)+(((-1.0)*(gconst36*gconst36))))) < -0.00001) continue; IkReal x266=IKsqrt(((1.0)+(((-1.0)*(gconst36*gconst36))))); IkReal x267=((1.0)*x266); evalcond[0]=x263; evalcond[1]=((-1.0)*x262); evalcond[2]=((((-1.0)*gconst36*x265))+new_r11); evalcond[3]=((((-1.0)*gconst36*x264))+new_r10); evalcond[4]=(((x262*x266))+new_r01); evalcond[5]=(((x263*x266))+new_r00); evalcond[6]=((((-1.0)*new_r00*x267))+((gconst36*new_r10))+(((-1.0)*x264))); evalcond[7]=((((-1.0)*new_r01*x267))+((gconst36*new_r11))+(((-1.0)*x265))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } else { { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; CheckValue<IkReal> x268 = IKatan2WithCheck(IkReal(new_r10),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x268.valid){ continue; } CheckValue<IkReal> x269=IKPowWithIntegerCheck(IKsign(gconst36),-1); if(!x269.valid){ continue; } j21array[0]=((-1.5707963267949)+(x268.value)+(((1.5707963267949)*(x269.value)))); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[8]; IkReal x270=IKcos(j21); IkReal x271=IKsin(j21); IkReal x272=((1.0)*x271); IkReal x273=((1.0)*x270); if((((1.0)+(((-1.0)*(gconst36*gconst36))))) < -0.00001) continue; IkReal x274=IKsqrt(((1.0)+(((-1.0)*(gconst36*gconst36))))); IkReal x275=((1.0)*x274); evalcond[0]=x271; evalcond[1]=((-1.0)*x270); evalcond[2]=((((-1.0)*gconst36*x273))+new_r11); evalcond[3]=((((-1.0)*gconst36*x272))+new_r10); evalcond[4]=(((x270*x274))+new_r01); evalcond[5]=(((x271*x274))+new_r00); evalcond[6]=((((-1.0)*new_r00*x275))+((gconst36*new_r10))+(((-1.0)*x272))); evalcond[7]=((((-1.0)*new_r01*x275))+((gconst36*new_r11))+(((-1.0)*x273))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { CheckValue<IkReal> x276=IKPowWithIntegerCheck(((1.0)+(((-1.0)*(new_r22*new_r22)))),-1); if(!x276.valid){ continue; } if((x276.value) < -0.00001) continue; IkReal gconst36=((-1.0)*(IKsqrt(x276.value))); evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.0)+(IKsign(sj19)))))+(IKabs((cj19+(((-1.0)*gconst36)))))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; if((((1.0)+(((-1.0)*(gconst36*gconst36))))) < -0.00001) continue; sj19=((-1.0)*(IKsqrt(((1.0)+(((-1.0)*(gconst36*gconst36))))))); cj19=gconst36; if( (gconst36) < -1-IKFAST_SINCOS_THRESH || (gconst36) > 1+IKFAST_SINCOS_THRESH ) continue; j19=((-1.0)*(IKacos(gconst36))); CheckValue<IkReal> x277=IKPowWithIntegerCheck(((1.0)+(((-1.0)*(new_r22*new_r22)))),-1); if(!x277.valid){ continue; } if((x277.value) < -0.00001) continue; IkReal gconst36=((-1.0)*(IKsqrt(x277.value))); j21eval[0]=((IKabs(new_r11))+(IKabs(new_r10))); if( IKabs(j21eval[0]) < 0.0000010000000000 ) { { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; if((((1.0)+(((-1.0)*(gconst36*gconst36))))) < -0.00001) continue; CheckValue<IkReal> x278=IKPowWithIntegerCheck(gconst36,-1); if(!x278.valid){ continue; } if( IKabs((((new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst36*gconst36))))))))+((gconst36*new_r10)))) < IKFAST_ATAN2_MAGTHRESH && IKabs((new_r11*(x278.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((((new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst36*gconst36))))))))+((gconst36*new_r10))))+IKsqr((new_r11*(x278.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2((((new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst36*gconst36))))))))+((gconst36*new_r10))), (new_r11*(x278.value))); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[8]; IkReal x279=IKcos(j21); IkReal x280=IKsin(j21); IkReal x281=((1.0)*x280); IkReal x282=((1.0)*x279); if((((1.0)+(((-1.0)*(gconst36*gconst36))))) < -0.00001) continue; IkReal x283=IKsqrt(((1.0)+(((-1.0)*(gconst36*gconst36))))); evalcond[0]=x280; evalcond[1]=((-1.0)*x279); evalcond[2]=((((-1.0)*gconst36*x282))+new_r11); evalcond[3]=((((-1.0)*gconst36*x281))+new_r10); evalcond[4]=((((-1.0)*x282*x283))+new_r01); evalcond[5]=((((-1.0)*x281*x283))+new_r00); evalcond[6]=(((gconst36*new_r10))+(((-1.0)*x281))+((new_r00*x283))); evalcond[7]=(((gconst36*new_r11))+(((-1.0)*x282))+((new_r01*x283))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } else { { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; CheckValue<IkReal> x285 = IKatan2WithCheck(IkReal(new_r10),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x285.valid){ continue; } CheckValue<IkReal> x286=IKPowWithIntegerCheck(IKsign(gconst36),-1); if(!x286.valid){ continue; } j21array[0]=((-1.5707963267949)+(x285.value)+(((1.5707963267949)*(x286.value)))); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[8]; IkReal x287=IKcos(j21); IkReal x288=IKsin(j21); IkReal x289=((1.0)*x288); IkReal x290=((1.0)*x287); if((((1.0)+(((-1.0)*(gconst36*gconst36))))) < -0.00001) continue; IkReal x291=IKsqrt(((1.0)+(((-1.0)*(gconst36*gconst36))))); evalcond[0]=x288; evalcond[1]=((-1.0)*x287); evalcond[2]=((((-1.0)*gconst36*x290))+new_r11); evalcond[3]=((((-1.0)*gconst36*x289))+new_r10); evalcond[4]=((((-1.0)*x290*x291))+new_r01); evalcond[5]=((((-1.0)*x289*x291))+new_r00); evalcond[6]=(((new_r00*x291))+((gconst36*new_r10))+(((-1.0)*x289))); evalcond[7]=((((-1.0)*x290))+((new_r01*x291))+((gconst36*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { CheckValue<IkReal> x293=IKPowWithIntegerCheck(((1.0)+(((-1.0)*(new_r22*new_r22)))),-1); if(!x293.valid){ continue; } if((x293.value) < -0.00001) continue; IkReal gconst37=IKsqrt(x293.value); evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.0)+(IKsign(sj19)))))+(IKabs((cj19+(((-1.0)*gconst37)))))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; if((((1.0)+(((-1.0)*(gconst37*gconst37))))) < -0.00001) continue; sj19=IKsqrt(((1.0)+(((-1.0)*(gconst37*gconst37))))); cj19=gconst37; if( (gconst37) < -1-IKFAST_SINCOS_THRESH || (gconst37) > 1+IKFAST_SINCOS_THRESH ) continue; j19=IKacos(gconst37); CheckValue<IkReal> x294=IKPowWithIntegerCheck(((1.0)+(((-1.0)*(new_r22*new_r22)))),-1); if(!x294.valid){ continue; } if((x294.value) < -0.00001) continue; IkReal gconst37=IKsqrt(x294.value); j21eval[0]=((IKabs(new_r11))+(IKabs(new_r10))); if( IKabs(j21eval[0]) < 0.0000010000000000 ) { { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; if((((1.0)+(((-1.0)*(gconst37*gconst37))))) < -0.00001) continue; CheckValue<IkReal> x295=IKPowWithIntegerCheck(gconst37,-1); if(!x295.valid){ continue; } if( IKabs(((((-1.0)*new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst37*gconst37))))))))+((gconst37*new_r10)))) < IKFAST_ATAN2_MAGTHRESH && IKabs((new_r11*(x295.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst37*gconst37))))))))+((gconst37*new_r10))))+IKsqr((new_r11*(x295.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2(((((-1.0)*new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst37*gconst37))))))))+((gconst37*new_r10))), (new_r11*(x295.value))); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[8]; IkReal x296=IKcos(j21); IkReal x297=IKsin(j21); IkReal x298=((1.0)*x297); IkReal x299=((1.0)*x296); if((((1.0)+(((-1.0)*(gconst37*gconst37))))) < -0.00001) continue; IkReal x300=IKsqrt(((1.0)+(((-1.0)*(gconst37*gconst37))))); IkReal x301=((1.0)*x300); evalcond[0]=x297; evalcond[1]=((-1.0)*x296); evalcond[2]=((((-1.0)*gconst37*x299))+new_r11); evalcond[3]=((((-1.0)*gconst37*x298))+new_r10); evalcond[4]=(((x296*x300))+new_r01); evalcond[5]=(((x297*x300))+new_r00); evalcond[6]=((((-1.0)*x298))+((gconst37*new_r10))+(((-1.0)*new_r00*x301))); evalcond[7]=((((-1.0)*x299))+(((-1.0)*new_r01*x301))+((gconst37*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } else { { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; CheckValue<IkReal> x302=IKPowWithIntegerCheck(IKsign(gconst37),-1); if(!x302.valid){ continue; } CheckValue<IkReal> x303 = IKatan2WithCheck(IkReal(new_r10),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x303.valid){ continue; } j21array[0]=((-1.5707963267949)+(((1.5707963267949)*(x302.value)))+(x303.value)); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[8]; IkReal x304=IKcos(j21); IkReal x305=IKsin(j21); IkReal x306=((1.0)*x305); IkReal x307=((1.0)*x304); if((((1.0)+(((-1.0)*(gconst37*gconst37))))) < -0.00001) continue; IkReal x308=IKsqrt(((1.0)+(((-1.0)*(gconst37*gconst37))))); IkReal x309=((1.0)*x308); evalcond[0]=x305; evalcond[1]=((-1.0)*x304); evalcond[2]=(new_r11+(((-1.0)*gconst37*x307))); evalcond[3]=(new_r10+(((-1.0)*gconst37*x306))); evalcond[4]=(((x304*x308))+new_r01); evalcond[5]=(((x305*x308))+new_r00); evalcond[6]=(((gconst37*new_r10))+(((-1.0)*new_r00*x309))+(((-1.0)*x306))); evalcond[7]=((((-1.0)*new_r01*x309))+((gconst37*new_r11))+(((-1.0)*x307))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { CheckValue<IkReal> x310=IKPowWithIntegerCheck(((1.0)+(((-1.0)*(new_r22*new_r22)))),-1); if(!x310.valid){ continue; } if((x310.value) < -0.00001) continue; IkReal gconst37=IKsqrt(x310.value); evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.0)+(IKsign(sj19)))))+(IKabs((cj19+(((-1.0)*gconst37)))))), 6.28318530717959))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; if((((1.0)+(((-1.0)*(gconst37*gconst37))))) < -0.00001) continue; sj19=((-1.0)*(IKsqrt(((1.0)+(((-1.0)*(gconst37*gconst37))))))); cj19=gconst37; if( (gconst37) < -1-IKFAST_SINCOS_THRESH || (gconst37) > 1+IKFAST_SINCOS_THRESH ) continue; j19=((-1.0)*(IKacos(gconst37))); CheckValue<IkReal> x311=IKPowWithIntegerCheck(((1.0)+(((-1.0)*(new_r22*new_r22)))),-1); if(!x311.valid){ continue; } if((x311.value) < -0.00001) continue; IkReal gconst37=IKsqrt(x311.value); j21eval[0]=((IKabs(new_r11))+(IKabs(new_r10))); if( IKabs(j21eval[0]) < 0.0000010000000000 ) { { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; if((((1.0)+(((-1.0)*(gconst37*gconst37))))) < -0.00001) continue; CheckValue<IkReal> x312=IKPowWithIntegerCheck(gconst37,-1); if(!x312.valid){ continue; } if( IKabs((((gconst37*new_r10))+((new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst37*gconst37)))))))))) < IKFAST_ATAN2_MAGTHRESH && IKabs((new_r11*(x312.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((((gconst37*new_r10))+((new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst37*gconst37))))))))))+IKsqr((new_r11*(x312.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2((((gconst37*new_r10))+((new_r00*(IKsqrt(((1.0)+(((-1.0)*(gconst37*gconst37))))))))), (new_r11*(x312.value))); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[8]; IkReal x313=IKcos(j21); IkReal x314=IKsin(j21); IkReal x315=((1.0)*x313); IkReal x316=((1.0)*x314); if((((1.0)+(((-1.0)*(gconst37*gconst37))))) < -0.00001) continue; IkReal x317=IKsqrt(((1.0)+(((-1.0)*(gconst37*gconst37))))); evalcond[0]=x314; evalcond[1]=((-1.0)*x313); evalcond[2]=((((-1.0)*gconst37*x315))+new_r11); evalcond[3]=((((-1.0)*gconst37*x316))+new_r10); evalcond[4]=((((-1.0)*x315*x317))+new_r01); evalcond[5]=(new_r00+(((-1.0)*x316*x317))); evalcond[6]=(((new_r00*x317))+(((-1.0)*x316))+((gconst37*new_r10))); evalcond[7]=(((new_r01*x317))+(((-1.0)*x315))+((gconst37*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } else { { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; CheckValue<IkReal> x318=IKPowWithIntegerCheck(IKsign(gconst37),-1); if(!x318.valid){ continue; } CheckValue<IkReal> x319 = IKatan2WithCheck(IkReal(new_r10),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x319.valid){ continue; } j21array[0]=((-1.5707963267949)+(((1.5707963267949)*(x318.value)))+(x319.value)); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[8]; IkReal x320=IKcos(j21); IkReal x321=IKsin(j21); IkReal x322=((1.0)*x320); IkReal x323=((1.0)*x321); if((((1.0)+(((-1.0)*(gconst37*gconst37))))) < -0.00001) continue; IkReal x324=IKsqrt(((1.0)+(((-1.0)*(gconst37*gconst37))))); evalcond[0]=x321; evalcond[1]=((-1.0)*x320); evalcond[2]=((((-1.0)*gconst37*x322))+new_r11); evalcond[3]=((((-1.0)*gconst37*x323))+new_r10); evalcond[4]=((((-1.0)*x322*x324))+new_r01); evalcond[5]=((((-1.0)*x323*x324))+new_r00); evalcond[6]=(((new_r00*x324))+(((-1.0)*x323))+((gconst37*new_r10))); evalcond[7]=(((new_r01*x324))+(((-1.0)*x322))+((gconst37*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j21] } } while(0); if( bgotonextstatement ) { } } } } } } } } } } } else { { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; IkReal x325=new_r22*new_r22; CheckValue<IkReal> x326=IKPowWithIntegerCheck((((cj19*x325))+(((-1.0)*cj19))),-1); if(!x326.valid){ continue; } CheckValue<IkReal> x327=IKPowWithIntegerCheck((((sj19*x325))+(((-1.0)*sj19))),-1); if(!x327.valid){ continue; } if( IKabs(((x326.value)*(((((-1.0)*new_r01*new_r22))+(((-1.0)*new_r10)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((x327.value)*((((new_r10*new_r22))+new_r01)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((x326.value)*(((((-1.0)*new_r01*new_r22))+(((-1.0)*new_r10))))))+IKsqr(((x327.value)*((((new_r10*new_r22))+new_r01))))-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2(((x326.value)*(((((-1.0)*new_r01*new_r22))+(((-1.0)*new_r10))))), ((x327.value)*((((new_r10*new_r22))+new_r01)))); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[10]; IkReal x328=IKsin(j21); IkReal x329=IKcos(j21); IkReal x330=(cj19*new_r22); IkReal x331=(new_r22*sj19); IkReal x332=((1.0)*sj19); IkReal x333=((1.0)*x329); IkReal x334=((1.0)*x328); evalcond[0]=(((new_r22*x328))+((cj19*new_r01))+((new_r11*sj19))); evalcond[1]=(((new_r01*x330))+((new_r11*x331))+x328); evalcond[2]=((((-1.0)*new_r00*x332))+(((-1.0)*x334))+((cj19*new_r10))); evalcond[3]=((((-1.0)*x333))+((cj19*new_r11))+(((-1.0)*new_r01*x332))); evalcond[4]=(((sj19*x329))+((x328*x330))+new_r01); evalcond[5]=((((-1.0)*new_r22*x333))+((new_r10*sj19))+((cj19*new_r00))); evalcond[6]=(((sj19*x328))+(((-1.0)*x330*x333))+new_r00); evalcond[7]=((((-1.0)*cj19*x333))+((x328*x331))+new_r11); evalcond[8]=(((new_r00*x330))+((new_r10*x331))+(((-1.0)*x333))); evalcond[9]=((((-1.0)*cj19*x334))+(((-1.0)*x331*x333))+new_r10); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; IkReal x335=((1.0)*new_r01); CheckValue<IkReal> x336=IKPowWithIntegerCheck(new_r22,-1); if(!x336.valid){ continue; } if( IKabs(((x336.value)*(((((-1.0)*cj19*x335))+(((-1.0)*new_r11*sj19)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((((-1.0)*sj19*x335))+((cj19*new_r11)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((x336.value)*(((((-1.0)*cj19*x335))+(((-1.0)*new_r11*sj19))))))+IKsqr(((((-1.0)*sj19*x335))+((cj19*new_r11))))-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2(((x336.value)*(((((-1.0)*cj19*x335))+(((-1.0)*new_r11*sj19))))), ((((-1.0)*sj19*x335))+((cj19*new_r11)))); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[10]; IkReal x337=IKsin(j21); IkReal x338=IKcos(j21); IkReal x339=(cj19*new_r22); IkReal x340=(new_r22*sj19); IkReal x341=((1.0)*sj19); IkReal x342=((1.0)*x338); IkReal x343=((1.0)*x337); evalcond[0]=(((new_r22*x337))+((cj19*new_r01))+((new_r11*sj19))); evalcond[1]=(((new_r01*x339))+((new_r11*x340))+x337); evalcond[2]=((((-1.0)*new_r00*x341))+((cj19*new_r10))+(((-1.0)*x343))); evalcond[3]=((((-1.0)*new_r01*x341))+((cj19*new_r11))+(((-1.0)*x342))); evalcond[4]=(((sj19*x338))+((x337*x339))+new_r01); evalcond[5]=(((new_r10*sj19))+((cj19*new_r00))+(((-1.0)*new_r22*x342))); evalcond[6]=(((sj19*x337))+new_r00+(((-1.0)*x339*x342))); evalcond[7]=(((x337*x340))+(((-1.0)*cj19*x342))+new_r11); evalcond[8]=(((new_r00*x339))+((new_r10*x340))+(((-1.0)*x342))); evalcond[9]=((((-1.0)*cj19*x343))+(((-1.0)*x340*x342))+new_r10); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; IkReal x344=cj19*cj19; IkReal x345=(cj19*new_r22); CheckValue<IkReal> x346 = IKatan2WithCheck(IkReal((((new_r01*x345))+((new_r00*sj19)))),IkReal(((((-1.0)*new_r00*x345))+((new_r01*sj19)))),IKFAST_ATAN2_MAGTHRESH); if(!x346.valid){ continue; } CheckValue<IkReal> x347=IKPowWithIntegerCheck(IKsign(((-1.0)+(((-1.0)*x344*(new_r22*new_r22)))+x344)),-1); if(!x347.valid){ continue; } j21array[0]=((-1.5707963267949)+(x346.value)+(((1.5707963267949)*(x347.value)))); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[10]; IkReal x348=IKsin(j21); IkReal x349=IKcos(j21); IkReal x350=(cj19*new_r22); IkReal x351=(new_r22*sj19); IkReal x352=((1.0)*sj19); IkReal x353=((1.0)*x349); IkReal x354=((1.0)*x348); evalcond[0]=(((new_r22*x348))+((cj19*new_r01))+((new_r11*sj19))); evalcond[1]=(((new_r01*x350))+x348+((new_r11*x351))); evalcond[2]=((((-1.0)*x354))+(((-1.0)*new_r00*x352))+((cj19*new_r10))); evalcond[3]=((((-1.0)*x353))+(((-1.0)*new_r01*x352))+((cj19*new_r11))); evalcond[4]=(((sj19*x349))+((x348*x350))+new_r01); evalcond[5]=((((-1.0)*new_r22*x353))+((new_r10*sj19))+((cj19*new_r00))); evalcond[6]=(((sj19*x348))+new_r00+(((-1.0)*x350*x353))); evalcond[7]=((((-1.0)*cj19*x353))+((x348*x351))+new_r11); evalcond[8]=((((-1.0)*x353))+((new_r10*x351))+((new_r00*x350))); evalcond[9]=((((-1.0)*cj19*x354))+(((-1.0)*x351*x353))+new_r10); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j19, j21] } } while(0); if( bgotonextstatement ) { } } } } } } else { { IkReal j19array[1], cj19array[1], sj19array[1]; bool j19valid[1]={false}; _nj19 = 1; CheckValue<IkReal> x356=IKPowWithIntegerCheck(sj20,-1); if(!x356.valid){ continue; } IkReal x355=x356.value; CheckValue<IkReal> x357=IKPowWithIntegerCheck(new_r12,-1); if(!x357.valid){ continue; } if( IKabs((x355*(x357.value)*(((1.0)+(((-1.0)*(new_r02*new_r02)))+(((-1.0)*(cj20*cj20))))))) < IKFAST_ATAN2_MAGTHRESH && IKabs((new_r02*x355)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((x355*(x357.value)*(((1.0)+(((-1.0)*(new_r02*new_r02)))+(((-1.0)*(cj20*cj20)))))))+IKsqr((new_r02*x355))-1) <= IKFAST_SINCOS_THRESH ) continue; j19array[0]=IKatan2((x355*(x357.value)*(((1.0)+(((-1.0)*(new_r02*new_r02)))+(((-1.0)*(cj20*cj20)))))), (new_r02*x355)); sj19array[0]=IKsin(j19array[0]); cj19array[0]=IKcos(j19array[0]); if( j19array[0] > IKPI ) { j19array[0]-=IK2PI; } else if( j19array[0] < -IKPI ) { j19array[0]+=IK2PI; } j19valid[0] = true; for(int ij19 = 0; ij19 < 1; ++ij19) { if( !j19valid[ij19] ) { continue; } _ij19[0] = ij19; _ij19[1] = -1; for(int iij19 = ij19+1; iij19 < 1; ++iij19) { if( j19valid[iij19] && IKabs(cj19array[ij19]-cj19array[iij19]) < IKFAST_SOLUTION_THRESH && IKabs(sj19array[ij19]-sj19array[iij19]) < IKFAST_SOLUTION_THRESH ) { j19valid[iij19]=false; _ij19[1] = iij19; break; } } j19 = j19array[ij19]; cj19 = cj19array[ij19]; sj19 = sj19array[ij19]; { IkReal evalcond[8]; IkReal x358=IKcos(j19); IkReal x359=IKsin(j19); IkReal x360=((1.0)*sj20); IkReal x361=(new_r02*x358); IkReal x362=(new_r12*x359); IkReal x363=(sj20*x358); IkReal x364=(sj20*x359); evalcond[0]=((((-1.0)*x358*x360))+new_r02); evalcond[1]=((((-1.0)*x359*x360))+new_r12); evalcond[2]=((((-1.0)*new_r02*x359))+((new_r12*x358))); evalcond[3]=((((-1.0)*x360))+x361+x362); evalcond[4]=(((new_r00*x363))+((cj20*new_r20))+((new_r10*x364))); evalcond[5]=(((new_r01*x363))+((cj20*new_r21))+((new_r11*x364))); evalcond[6]=((-1.0)+((cj20*new_r22))+((sj20*x361))+((sj20*x362))); evalcond[7]=((((-1.0)*new_r22*x360))+((cj20*x362))+((cj20*x361))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { IkReal j21eval[3]; j21eval[0]=sj20; j21eval[1]=((IKabs(new_r20))+(IKabs(new_r21))); j21eval[2]=IKsign(sj20); if( IKabs(j21eval[0]) < 0.0000010000000000 || IKabs(j21eval[1]) < 0.0000010000000000 || IKabs(j21eval[2]) < 0.0000010000000000 ) { { IkReal j21eval[2]; j21eval[0]=sj20; j21eval[1]=sj19; if( IKabs(j21eval[0]) < 0.0000010000000000 || IKabs(j21eval[1]) < 0.0000010000000000 ) { { IkReal j21eval[3]; j21eval[0]=cj20; j21eval[1]=sj19; j21eval[2]=sj20; if( IKabs(j21eval[0]) < 0.0000010000000000 || IKabs(j21eval[1]) < 0.0000010000000000 || IKabs(j21eval[2]) < 0.0000010000000000 ) { { IkReal evalcond[5]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j20)))), 6.28318530717959))); evalcond[1]=new_r22; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; if( IKabs(new_r21) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r21)+IKsqr(((-1.0)*new_r20))-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2(new_r21, ((-1.0)*new_r20)); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[8]; IkReal x365=IKcos(j21); IkReal x366=IKsin(j21); IkReal x367=((1.0)*cj19); IkReal x368=((1.0)*sj19); IkReal x369=((1.0)*x366); evalcond[0]=(x365+new_r20); evalcond[1]=((((-1.0)*x369))+new_r21); evalcond[2]=(((sj19*x365))+new_r01); evalcond[3]=(((sj19*x366))+new_r00); evalcond[4]=(new_r11+(((-1.0)*x365*x367))); evalcond[5]=((((-1.0)*x366*x367))+new_r10); evalcond[6]=((((-1.0)*new_r00*x368))+(((-1.0)*x369))+((cj19*new_r10))); evalcond[7]=((((-1.0)*x365))+((cj19*new_r11))+(((-1.0)*new_r01*x368))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j20)))), 6.28318530717959))); evalcond[1]=new_r22; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; if( IKabs(((-1.0)*new_r21)) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r20) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r21))+IKsqr(new_r20)-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2(((-1.0)*new_r21), new_r20); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[8]; IkReal x370=IKcos(j21); IkReal x371=IKsin(j21); IkReal x372=((1.0)*cj19); IkReal x373=((1.0)*sj19); IkReal x374=((1.0)*x370); evalcond[0]=(x371+new_r21); evalcond[1]=((((-1.0)*x374))+new_r20); evalcond[2]=(((sj19*x370))+new_r01); evalcond[3]=(((sj19*x371))+new_r00); evalcond[4]=((((-1.0)*x370*x372))+new_r11); evalcond[5]=((((-1.0)*x371*x372))+new_r10); evalcond[6]=((((-1.0)*new_r00*x373))+(((-1.0)*x371))+((cj19*new_r10))); evalcond[7]=((((-1.0)*x374))+((cj19*new_r11))+(((-1.0)*new_r01*x373))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j19))), 6.28318530717959))); evalcond[1]=new_r12; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; if( IKabs(new_r10) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r11) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r10)+IKsqr(new_r11)-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2(new_r10, new_r11); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[8]; IkReal x375=IKcos(j21); IkReal x376=IKsin(j21); IkReal x377=((1.0)*sj20); IkReal x378=((1.0)*x375); IkReal x379=((1.0)*x376); evalcond[0]=(new_r20+((sj20*x375))); evalcond[1]=((((-1.0)*x379))+new_r10); evalcond[2]=((((-1.0)*x378))+new_r11); evalcond[3]=(new_r01+((cj20*x376))); evalcond[4]=((((-1.0)*x376*x377))+new_r21); evalcond[5]=((((-1.0)*cj20*x378))+new_r00); evalcond[6]=((((-1.0)*new_r21*x377))+((cj20*new_r01))+x376); evalcond[7]=((((-1.0)*new_r20*x377))+((cj20*new_r00))+(((-1.0)*x378))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j19)))), 6.28318530717959))); evalcond[1]=new_r12; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21eval[3]; sj19=0; cj19=-1.0; j19=3.14159265358979; j21eval[0]=sj20; j21eval[1]=((IKabs(new_r20))+(IKabs(new_r21))); j21eval[2]=IKsign(sj20); if( IKabs(j21eval[0]) < 0.0000010000000000 || IKabs(j21eval[1]) < 0.0000010000000000 || IKabs(j21eval[2]) < 0.0000010000000000 ) { { IkReal j21eval[1]; sj19=0; cj19=-1.0; j19=3.14159265358979; j21eval[0]=sj20; if( IKabs(j21eval[0]) < 0.0000010000000000 ) { { IkReal j21eval[2]; sj19=0; cj19=-1.0; j19=3.14159265358979; j21eval[0]=cj20; j21eval[1]=sj20; if( IKabs(j21eval[0]) < 0.0000010000000000 || IKabs(j21eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[4]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j20)))), 6.28318530717959))); evalcond[1]=new_r22; evalcond[2]=new_r01; evalcond[3]=new_r00; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; if( IKabs(new_r21) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r21)+IKsqr(((-1.0)*new_r20))-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2(new_r21, ((-1.0)*new_r20)); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[4]; IkReal x380=IKcos(j21); IkReal x381=((1.0)*(IKsin(j21))); evalcond[0]=(x380+new_r20); evalcond[1]=((((-1.0)*x381))+new_r21); evalcond[2]=((((-1.0)*x381))+(((-1.0)*new_r10))); evalcond[3]=((((-1.0)*x380))+(((-1.0)*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j20)))), 6.28318530717959))); evalcond[1]=new_r22; evalcond[2]=new_r01; evalcond[3]=new_r00; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; if( IKabs(((-1.0)*new_r21)) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r20) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r21))+IKsqr(new_r20)-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2(((-1.0)*new_r21), new_r20); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[4]; IkReal x382=IKsin(j21); IkReal x383=((1.0)*(IKcos(j21))); evalcond[0]=(x382+new_r21); evalcond[1]=((((-1.0)*x383))+new_r20); evalcond[2]=((((-1.0)*x382))+(((-1.0)*new_r10))); evalcond[3]=((((-1.0)*x383))+(((-1.0)*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j20))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; if( IKabs(new_r01) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r11)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r01)+IKsqr(((-1.0)*new_r11))-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2(new_r01, ((-1.0)*new_r11)); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[4]; IkReal x384=IKsin(j21); IkReal x385=((1.0)*(IKcos(j21))); evalcond[0]=(x384+(((-1.0)*new_r01))); evalcond[1]=((((-1.0)*x384))+(((-1.0)*new_r10))); evalcond[2]=((((-1.0)*x385))+(((-1.0)*new_r11))); evalcond[3]=((((-1.0)*x385))+(((-1.0)*new_r00))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j20)))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; if( IKabs(((-1.0)*new_r10)) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r00) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r10))+IKsqr(new_r00)-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2(((-1.0)*new_r10), new_r00); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[4]; IkReal x386=IKcos(j21); IkReal x387=((1.0)*(IKsin(j21))); evalcond[0]=(x386+(((-1.0)*new_r00))); evalcond[1]=((((-1.0)*x387))+(((-1.0)*new_r10))); evalcond[2]=((((-1.0)*x386))+(((-1.0)*new_r11))); evalcond[3]=((((-1.0)*x387))+(((-1.0)*new_r01))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; if( IKabs(((-1.0)*new_r10)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r11)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r10))+IKsqr(((-1.0)*new_r11))-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2(((-1.0)*new_r10), ((-1.0)*new_r11)); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[6]; IkReal x388=IKsin(j21); IkReal x389=IKcos(j21); IkReal x390=((-1.0)*x389); evalcond[0]=x388; evalcond[1]=(new_r22*x388); evalcond[2]=x390; evalcond[3]=(new_r22*x390); evalcond[4]=((((-1.0)*x388))+(((-1.0)*new_r10))); evalcond[5]=((((-1.0)*x389))+(((-1.0)*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j21] } } while(0); if( bgotonextstatement ) { } } } } } } } } else { { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; CheckValue<IkReal> x391=IKPowWithIntegerCheck(cj20,-1); if(!x391.valid){ continue; } CheckValue<IkReal> x392=IKPowWithIntegerCheck(sj20,-1); if(!x392.valid){ continue; } if( IKabs((new_r01*(x391.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20*(x392.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((new_r01*(x391.value)))+IKsqr(((-1.0)*new_r20*(x392.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2((new_r01*(x391.value)), ((-1.0)*new_r20*(x392.value))); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[8]; IkReal x393=IKsin(j21); IkReal x394=IKcos(j21); IkReal x395=((1.0)*sj20); IkReal x396=((1.0)*new_r00); IkReal x397=((1.0)*new_r01); IkReal x398=((1.0)*x394); IkReal x399=((1.0)*x393); evalcond[0]=(new_r20+((sj20*x394))); evalcond[1]=(new_r21+(((-1.0)*x393*x395))); evalcond[2]=((((-1.0)*x399))+(((-1.0)*new_r10))); evalcond[3]=((((-1.0)*x398))+(((-1.0)*new_r11))); evalcond[4]=((((-1.0)*x397))+((cj20*x393))); evalcond[5]=((((-1.0)*cj20*x398))+(((-1.0)*x396))); evalcond[6]=((((-1.0)*cj20*x397))+(((-1.0)*new_r21*x395))+x393); evalcond[7]=((((-1.0)*cj20*x396))+(((-1.0)*x398))+(((-1.0)*new_r20*x395))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; CheckValue<IkReal> x400=IKPowWithIntegerCheck(sj20,-1); if(!x400.valid){ continue; } if( IKabs((new_r21*(x400.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r11)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((new_r21*(x400.value)))+IKsqr(((-1.0)*new_r11))-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2((new_r21*(x400.value)), ((-1.0)*new_r11)); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[8]; IkReal x401=IKsin(j21); IkReal x402=IKcos(j21); IkReal x403=((1.0)*sj20); IkReal x404=((1.0)*new_r00); IkReal x405=((1.0)*new_r01); IkReal x406=((1.0)*x402); IkReal x407=((1.0)*x401); evalcond[0]=(((sj20*x402))+new_r20); evalcond[1]=((((-1.0)*x401*x403))+new_r21); evalcond[2]=((((-1.0)*new_r10))+(((-1.0)*x407))); evalcond[3]=((((-1.0)*new_r11))+(((-1.0)*x406))); evalcond[4]=(((cj20*x401))+(((-1.0)*x405))); evalcond[5]=((((-1.0)*cj20*x406))+(((-1.0)*x404))); evalcond[6]=((((-1.0)*cj20*x405))+x401+(((-1.0)*new_r21*x403))); evalcond[7]=((((-1.0)*cj20*x404))+(((-1.0)*new_r20*x403))+(((-1.0)*x406))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; CheckValue<IkReal> x408=IKPowWithIntegerCheck(IKsign(sj20),-1); if(!x408.valid){ continue; } CheckValue<IkReal> x409 = IKatan2WithCheck(IkReal(new_r21),IkReal(((-1.0)*new_r20)),IKFAST_ATAN2_MAGTHRESH); if(!x409.valid){ continue; } j21array[0]=((-1.5707963267949)+(((1.5707963267949)*(x408.value)))+(x409.value)); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[8]; IkReal x410=IKsin(j21); IkReal x411=IKcos(j21); IkReal x412=((1.0)*sj20); IkReal x413=((1.0)*new_r00); IkReal x414=((1.0)*new_r01); IkReal x415=((1.0)*x411); IkReal x416=((1.0)*x410); evalcond[0]=(((sj20*x411))+new_r20); evalcond[1]=((((-1.0)*x410*x412))+new_r21); evalcond[2]=((((-1.0)*new_r10))+(((-1.0)*x416))); evalcond[3]=((((-1.0)*new_r11))+(((-1.0)*x415))); evalcond[4]=(((cj20*x410))+(((-1.0)*x414))); evalcond[5]=((((-1.0)*cj20*x415))+(((-1.0)*x413))); evalcond[6]=((((-1.0)*cj20*x414))+x410+(((-1.0)*new_r21*x412))); evalcond[7]=((((-1.0)*cj20*x413))+(((-1.0)*new_r20*x412))+(((-1.0)*x415))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j20))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r12; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; IkReal x417=((1.0)*sj19); if( IKabs(((((-1.0)*cj19*new_r01))+(((-1.0)*new_r00*x417)))) < IKFAST_ATAN2_MAGTHRESH && IKabs((((cj19*new_r00))+(((-1.0)*new_r01*x417)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*cj19*new_r01))+(((-1.0)*new_r00*x417))))+IKsqr((((cj19*new_r00))+(((-1.0)*new_r01*x417))))-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2(((((-1.0)*cj19*new_r01))+(((-1.0)*new_r00*x417))), (((cj19*new_r00))+(((-1.0)*new_r01*x417)))); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[8]; IkReal x418=IKsin(j21); IkReal x419=IKcos(j21); IkReal x420=((1.0)*sj19); IkReal x421=((1.0)*x419); IkReal x422=(sj19*x418); IkReal x423=((1.0)*x418); IkReal x424=(cj19*x421); evalcond[0]=(x418+((cj19*new_r01))+((new_r11*sj19))); evalcond[1]=(((cj19*x418))+new_r01+((sj19*x419))); evalcond[2]=((((-1.0)*x421))+((new_r10*sj19))+((cj19*new_r00))); evalcond[3]=((((-1.0)*new_r00*x420))+(((-1.0)*x423))+((cj19*new_r10))); evalcond[4]=((((-1.0)*x421))+((cj19*new_r11))+(((-1.0)*new_r01*x420))); evalcond[5]=((((-1.0)*x424))+x422+new_r00); evalcond[6]=((((-1.0)*x424))+x422+new_r11); evalcond[7]=((((-1.0)*x419*x420))+new_r10+(((-1.0)*cj19*x423))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j20)))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r12; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; IkReal x425=((1.0)*sj19); if( IKabs(((((-1.0)*new_r00*x425))+((cj19*new_r01)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((((-1.0)*cj19*new_r00))+(((-1.0)*new_r01*x425)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*new_r00*x425))+((cj19*new_r01))))+IKsqr(((((-1.0)*cj19*new_r00))+(((-1.0)*new_r01*x425))))-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2(((((-1.0)*new_r00*x425))+((cj19*new_r01))), ((((-1.0)*cj19*new_r00))+(((-1.0)*new_r01*x425)))); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[8]; IkReal x426=IKsin(j21); IkReal x427=IKcos(j21); IkReal x428=((1.0)*cj19); IkReal x429=((1.0)*sj19); IkReal x430=((1.0)*x426); IkReal x431=(sj19*x427); IkReal x432=(sj19*x426); IkReal x433=(x426*x428); evalcond[0]=(x427+((new_r10*sj19))+((cj19*new_r00))); evalcond[1]=((((-1.0)*x430))+((cj19*new_r01))+((new_r11*sj19))); evalcond[2]=(((cj19*x427))+x432+new_r00); evalcond[3]=((((-1.0)*x430))+(((-1.0)*new_r00*x429))+((cj19*new_r10))); evalcond[4]=((((-1.0)*x427))+((cj19*new_r11))+(((-1.0)*new_r01*x429))); evalcond[5]=((((-1.0)*x433))+x431+new_r01); evalcond[6]=((((-1.0)*x433))+x431+new_r10); evalcond[7]=((((-1.0)*x427*x428))+(((-1.0)*x426*x429))+new_r11); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21eval[1]; new_r21=0; new_r20=0; new_r02=0; new_r12=0; j21eval[0]=1.0; if( IKabs(j21eval[0]) < 0.0000000100000000 ) { continue; // no branches [j21] } else { IkReal op[2+1], zeror[2]; int numroots; op[0]=1.0; op[1]=0; op[2]=-1.0; polyroots2(op,zeror,numroots); IkReal j21array[2], cj21array[2], sj21array[2], tempj21array[1]; int numsolutions = 0; for(int ij21 = 0; ij21 < numroots; ++ij21) { IkReal htj21 = zeror[ij21]; tempj21array[0]=((2.0)*(atan(htj21))); for(int kj21 = 0; kj21 < 1; ++kj21) { j21array[numsolutions] = tempj21array[kj21]; if( j21array[numsolutions] > IKPI ) { j21array[numsolutions]-=IK2PI; } else if( j21array[numsolutions] < -IKPI ) { j21array[numsolutions]+=IK2PI; } sj21array[numsolutions] = IKsin(j21array[numsolutions]); cj21array[numsolutions] = IKcos(j21array[numsolutions]); numsolutions++; } } bool j21valid[2]={true,true}; _nj21 = 2; for(int ij21 = 0; ij21 < numsolutions; ++ij21) { if( !j21valid[ij21] ) { continue; } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; htj21 = IKtan(j21/2); _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < numsolutions; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j21] } } while(0); if( bgotonextstatement ) { } } } } } } } } } } else { { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; CheckValue<IkReal> x435=IKPowWithIntegerCheck(sj20,-1); if(!x435.valid){ continue; } IkReal x434=x435.value; CheckValue<IkReal> x436=IKPowWithIntegerCheck(cj20,-1); if(!x436.valid){ continue; } CheckValue<IkReal> x437=IKPowWithIntegerCheck(sj19,-1); if(!x437.valid){ continue; } if( IKabs((x434*(x436.value)*(x437.value)*(((((-1.0)*new_r11*sj20))+(((-1.0)*cj19*new_r20)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20*x434)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((x434*(x436.value)*(x437.value)*(((((-1.0)*new_r11*sj20))+(((-1.0)*cj19*new_r20))))))+IKsqr(((-1.0)*new_r20*x434))-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2((x434*(x436.value)*(x437.value)*(((((-1.0)*new_r11*sj20))+(((-1.0)*cj19*new_r20))))), ((-1.0)*new_r20*x434)); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[12]; IkReal x438=IKsin(j21); IkReal x439=IKcos(j21); IkReal x440=(cj20*sj19); IkReal x441=(cj19*new_r01); IkReal x442=((1.0)*sj20); IkReal x443=(cj19*new_r00); IkReal x444=((1.0)*sj19); IkReal x445=((1.0)*x439); IkReal x446=(cj20*x438); IkReal x447=((1.0)*x438); IkReal x448=(cj19*x445); evalcond[0]=(((sj20*x439))+new_r20); evalcond[1]=((((-1.0)*x438*x442))+new_r21); evalcond[2]=(x446+x441+((new_r11*sj19))); evalcond[3]=((((-1.0)*x447))+(((-1.0)*new_r00*x444))+((cj19*new_r10))); evalcond[4]=((((-1.0)*x445))+(((-1.0)*new_r01*x444))+((cj19*new_r11))); evalcond[5]=(((cj19*x446))+((sj19*x439))+new_r01); evalcond[6]=((((-1.0)*cj20*x445))+x443+((new_r10*sj19))); evalcond[7]=(((sj19*x438))+(((-1.0)*cj20*x448))+new_r00); evalcond[8]=((((-1.0)*x448))+((x438*x440))+new_r11); evalcond[9]=((((-1.0)*cj19*x447))+new_r10+(((-1.0)*x440*x445))); evalcond[10]=(((new_r11*x440))+x438+((cj20*x441))+(((-1.0)*new_r21*x442))); evalcond[11]=((((-1.0)*x445))+((new_r10*x440))+(((-1.0)*new_r20*x442))+((cj20*x443))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; CheckValue<IkReal> x450=IKPowWithIntegerCheck(sj20,-1); if(!x450.valid){ continue; } IkReal x449=x450.value; CheckValue<IkReal> x451=IKPowWithIntegerCheck(sj19,-1); if(!x451.valid){ continue; } if( IKabs((new_r21*x449)) < IKFAST_ATAN2_MAGTHRESH && IKabs((x449*(x451.value)*(((((-1.0)*new_r01*sj20))+(((-1.0)*cj19*cj20*new_r21)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((new_r21*x449))+IKsqr((x449*(x451.value)*(((((-1.0)*new_r01*sj20))+(((-1.0)*cj19*cj20*new_r21))))))-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2((new_r21*x449), (x449*(x451.value)*(((((-1.0)*new_r01*sj20))+(((-1.0)*cj19*cj20*new_r21)))))); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[12]; IkReal x452=IKsin(j21); IkReal x453=IKcos(j21); IkReal x454=(cj20*sj19); IkReal x455=(cj19*new_r01); IkReal x456=((1.0)*sj20); IkReal x457=(cj19*new_r00); IkReal x458=((1.0)*sj19); IkReal x459=((1.0)*x453); IkReal x460=(cj20*x452); IkReal x461=((1.0)*x452); IkReal x462=(cj19*x459); evalcond[0]=(((sj20*x453))+new_r20); evalcond[1]=((((-1.0)*x452*x456))+new_r21); evalcond[2]=(x455+x460+((new_r11*sj19))); evalcond[3]=((((-1.0)*x461))+(((-1.0)*new_r00*x458))+((cj19*new_r10))); evalcond[4]=((((-1.0)*new_r01*x458))+(((-1.0)*x459))+((cj19*new_r11))); evalcond[5]=(((cj19*x460))+((sj19*x453))+new_r01); evalcond[6]=(x457+((new_r10*sj19))+(((-1.0)*cj20*x459))); evalcond[7]=(((sj19*x452))+new_r00+(((-1.0)*cj20*x462))); evalcond[8]=(((x452*x454))+(((-1.0)*x462))+new_r11); evalcond[9]=((((-1.0)*cj19*x461))+(((-1.0)*x454*x459))+new_r10); evalcond[10]=((((-1.0)*new_r21*x456))+((new_r11*x454))+((cj20*x455))+x452); evalcond[11]=(((new_r10*x454))+(((-1.0)*new_r20*x456))+((cj20*x457))+(((-1.0)*x459))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; CheckValue<IkReal> x463=IKPowWithIntegerCheck(IKsign(sj20),-1); if(!x463.valid){ continue; } CheckValue<IkReal> x464 = IKatan2WithCheck(IkReal(new_r21),IkReal(((-1.0)*new_r20)),IKFAST_ATAN2_MAGTHRESH); if(!x464.valid){ continue; } j21array[0]=((-1.5707963267949)+(((1.5707963267949)*(x463.value)))+(x464.value)); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[12]; IkReal x465=IKsin(j21); IkReal x466=IKcos(j21); IkReal x467=(cj20*sj19); IkReal x468=(cj19*new_r01); IkReal x469=((1.0)*sj20); IkReal x470=(cj19*new_r00); IkReal x471=((1.0)*sj19); IkReal x472=((1.0)*x466); IkReal x473=(cj20*x465); IkReal x474=((1.0)*x465); IkReal x475=(cj19*x472); evalcond[0]=(new_r20+((sj20*x466))); evalcond[1]=((((-1.0)*x465*x469))+new_r21); evalcond[2]=(x468+x473+((new_r11*sj19))); evalcond[3]=((((-1.0)*new_r00*x471))+(((-1.0)*x474))+((cj19*new_r10))); evalcond[4]=((((-1.0)*x472))+(((-1.0)*new_r01*x471))+((cj19*new_r11))); evalcond[5]=(((sj19*x466))+((cj19*x473))+new_r01); evalcond[6]=(x470+(((-1.0)*cj20*x472))+((new_r10*sj19))); evalcond[7]=(((sj19*x465))+new_r00+(((-1.0)*cj20*x475))); evalcond[8]=(((x465*x467))+(((-1.0)*x475))+new_r11); evalcond[9]=((((-1.0)*x467*x472))+(((-1.0)*cj19*x474))+new_r10); evalcond[10]=((((-1.0)*new_r21*x469))+((new_r11*x467))+((cj20*x468))+x465); evalcond[11]=(((cj20*x470))+((new_r10*x467))+(((-1.0)*new_r20*x469))+(((-1.0)*x472))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } } } } else { { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; CheckValue<IkReal> x476=IKPowWithIntegerCheck(IKsign(sj20),-1); if(!x476.valid){ continue; } CheckValue<IkReal> x477 = IKatan2WithCheck(IkReal(new_r21),IkReal(((-1.0)*new_r20)),IKFAST_ATAN2_MAGTHRESH); if(!x477.valid){ continue; } j21array[0]=((-1.5707963267949)+(((1.5707963267949)*(x476.value)))+(x477.value)); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[2]; evalcond[0]=(((sj20*(IKcos(j21))))+new_r20); evalcond[1]=((((-1.0)*sj20*(IKsin(j21))))+new_r21); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH ) { continue; } } { IkReal j19eval[3]; j19eval[0]=sj20; j19eval[1]=((IKabs(new_r12))+(IKabs(new_r02))); j19eval[2]=IKsign(sj20); if( IKabs(j19eval[0]) < 0.0000010000000000 || IKabs(j19eval[1]) < 0.0000010000000000 || IKabs(j19eval[2]) < 0.0000010000000000 ) { { IkReal j19eval[2]; j19eval[0]=cj21; j19eval[1]=sj20; if( IKabs(j19eval[0]) < 0.0000010000000000 || IKabs(j19eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[5]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j21)))), 6.28318530717959))); evalcond[1]=new_r20; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j19array[1], cj19array[1], sj19array[1]; bool j19valid[1]={false}; _nj19 = 1; if( IKabs(((-1.0)*new_r00)) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r10) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r00))+IKsqr(new_r10)-1) <= IKFAST_SINCOS_THRESH ) continue; j19array[0]=IKatan2(((-1.0)*new_r00), new_r10); sj19array[0]=IKsin(j19array[0]); cj19array[0]=IKcos(j19array[0]); if( j19array[0] > IKPI ) { j19array[0]-=IK2PI; } else if( j19array[0] < -IKPI ) { j19array[0]+=IK2PI; } j19valid[0] = true; for(int ij19 = 0; ij19 < 1; ++ij19) { if( !j19valid[ij19] ) { continue; } _ij19[0] = ij19; _ij19[1] = -1; for(int iij19 = ij19+1; iij19 < 1; ++iij19) { if( j19valid[iij19] && IKabs(cj19array[ij19]-cj19array[iij19]) < IKFAST_SOLUTION_THRESH && IKabs(sj19array[ij19]-sj19array[iij19]) < IKFAST_SOLUTION_THRESH ) { j19valid[iij19]=false; _ij19[1] = iij19; break; } } j19 = j19array[ij19]; cj19 = cj19array[ij19]; sj19 = sj19array[ij19]; { IkReal evalcond[18]; IkReal x478=IKsin(j19); IkReal x479=IKcos(j19); IkReal x480=((1.0)*sj20); IkReal x481=(new_r11*x478); IkReal x482=(new_r00*x479); IkReal x483=(sj20*x478); IkReal x484=(sj20*x479); IkReal x485=((1.0)*x478); IkReal x486=(new_r10*x478); IkReal x487=(new_r02*x479); IkReal x488=(new_r22*x478); IkReal x489=(new_r01*x479); evalcond[0]=(x478+new_r00); evalcond[1]=(((new_r22*x479))+new_r01); evalcond[2]=(x488+new_r11); evalcond[3]=((((-1.0)*x479))+new_r10); evalcond[4]=((((-1.0)*x479*x480))+new_r02); evalcond[5]=(new_r12+(((-1.0)*x478*x480))); evalcond[6]=(x482+x486); evalcond[7]=(((new_r12*x479))+(((-1.0)*new_r02*x485))); evalcond[8]=((((-1.0)*new_r01*x485))+((new_r11*x479))); evalcond[9]=(x489+x481+new_r22); evalcond[10]=((-1.0)+(((-1.0)*new_r00*x485))+((new_r10*x479))); evalcond[11]=(((sj20*x482))+((new_r10*x483))); evalcond[12]=(((new_r22*x482))+((new_r22*x486))); evalcond[13]=(((new_r12*x478))+(((-1.0)*x480))+x487); evalcond[14]=(((sj20*x481))+((cj20*new_r21))+((new_r01*x484))); evalcond[15]=((-1.0)+(new_r22*new_r22)+((new_r02*x484))+((new_r12*x483))); evalcond[16]=(((new_r12*x488))+(((-1.0)*new_r22*x480))+((new_r22*x487))); evalcond[17]=((1.0)+((new_r22*x481))+((new_r22*x489))+(((-1.0)*sj20*x480))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[12]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[13]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[14]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[15]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[16]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[17]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j21)))), 6.28318530717959))); evalcond[1]=new_r20; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j19array[1], cj19array[1], sj19array[1]; bool j19valid[1]={false}; _nj19 = 1; if( IKabs(new_r00) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r10)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r00)+IKsqr(((-1.0)*new_r10))-1) <= IKFAST_SINCOS_THRESH ) continue; j19array[0]=IKatan2(new_r00, ((-1.0)*new_r10)); sj19array[0]=IKsin(j19array[0]); cj19array[0]=IKcos(j19array[0]); if( j19array[0] > IKPI ) { j19array[0]-=IK2PI; } else if( j19array[0] < -IKPI ) { j19array[0]+=IK2PI; } j19valid[0] = true; for(int ij19 = 0; ij19 < 1; ++ij19) { if( !j19valid[ij19] ) { continue; } _ij19[0] = ij19; _ij19[1] = -1; for(int iij19 = ij19+1; iij19 < 1; ++iij19) { if( j19valid[iij19] && IKabs(cj19array[ij19]-cj19array[iij19]) < IKFAST_SOLUTION_THRESH && IKabs(sj19array[ij19]-sj19array[iij19]) < IKFAST_SOLUTION_THRESH ) { j19valid[iij19]=false; _ij19[1] = iij19; break; } } j19 = j19array[ij19]; cj19 = cj19array[ij19]; sj19 = sj19array[ij19]; { IkReal evalcond[18]; IkReal x490=IKcos(j19); IkReal x491=IKsin(j19); IkReal x492=((1.0)*sj20); IkReal x493=(new_r11*x491); IkReal x494=(new_r00*x490); IkReal x495=(sj20*x491); IkReal x496=(new_r22*x490); IkReal x497=(sj20*x490); IkReal x498=((1.0)*x491); IkReal x499=(new_r10*x491); IkReal x500=(new_r12*x491); evalcond[0]=(x490+new_r10); evalcond[1]=((((-1.0)*x498))+new_r00); evalcond[2]=((((-1.0)*x490*x492))+new_r02); evalcond[3]=((((-1.0)*x491*x492))+new_r12); evalcond[4]=((((-1.0)*x496))+new_r01); evalcond[5]=((((-1.0)*new_r22*x498))+new_r11); evalcond[6]=(x499+x494); evalcond[7]=((((-1.0)*new_r02*x498))+((new_r12*x490))); evalcond[8]=((((-1.0)*new_r01*x498))+((new_r11*x490))); evalcond[9]=((1.0)+(((-1.0)*new_r00*x498))+((new_r10*x490))); evalcond[10]=(((sj20*x494))+((new_r10*x495))); evalcond[11]=(((new_r22*x494))+((new_r22*x499))); evalcond[12]=(((new_r02*x490))+(((-1.0)*x492))+x500); evalcond[13]=(x493+(((-1.0)*new_r22))+((new_r01*x490))); evalcond[14]=(((sj20*x493))+((cj20*new_r21))+((new_r01*x497))); evalcond[15]=((-1.0)+(new_r22*new_r22)+((new_r02*x497))+((new_r12*x495))); evalcond[16]=(((new_r02*x496))+((new_r22*x500))+(((-1.0)*new_r22*x492))); evalcond[17]=((-1.0)+(sj20*sj20)+((new_r22*x493))+((new_r01*x496))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[12]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[13]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[14]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[15]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[16]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[17]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j20))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r12; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j19array[1], cj19array[1], sj19array[1]; bool j19valid[1]={false}; _nj19 = 1; IkReal x501=((1.0)*sj21); if( IKabs(((((-1.0)*new_r00*x501))+(((-1.0)*cj21*new_r01)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((((-1.0)*new_r01*x501))+((cj21*new_r00)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*new_r00*x501))+(((-1.0)*cj21*new_r01))))+IKsqr(((((-1.0)*new_r01*x501))+((cj21*new_r00))))-1) <= IKFAST_SINCOS_THRESH ) continue; j19array[0]=IKatan2(((((-1.0)*new_r00*x501))+(((-1.0)*cj21*new_r01))), ((((-1.0)*new_r01*x501))+((cj21*new_r00)))); sj19array[0]=IKsin(j19array[0]); cj19array[0]=IKcos(j19array[0]); if( j19array[0] > IKPI ) { j19array[0]-=IK2PI; } else if( j19array[0] < -IKPI ) { j19array[0]+=IK2PI; } j19valid[0] = true; for(int ij19 = 0; ij19 < 1; ++ij19) { if( !j19valid[ij19] ) { continue; } _ij19[0] = ij19; _ij19[1] = -1; for(int iij19 = ij19+1; iij19 < 1; ++iij19) { if( j19valid[iij19] && IKabs(cj19array[ij19]-cj19array[iij19]) < IKFAST_SOLUTION_THRESH && IKabs(sj19array[ij19]-sj19array[iij19]) < IKFAST_SOLUTION_THRESH ) { j19valid[iij19]=false; _ij19[1] = iij19; break; } } j19 = j19array[ij19]; cj19 = cj19array[ij19]; sj19 = sj19array[ij19]; { IkReal evalcond[8]; IkReal x502=IKcos(j19); IkReal x503=IKsin(j19); IkReal x504=((1.0)*cj21); IkReal x505=(sj21*x503); IkReal x506=((1.0)*x502); IkReal x507=((1.0)*x503); IkReal x508=(x502*x504); evalcond[0]=(((new_r11*x503))+sj21+((new_r01*x502))); evalcond[1]=(new_r01+((sj21*x502))+((cj21*x503))); evalcond[2]=((((-1.0)*x508))+x505+new_r00); evalcond[3]=((((-1.0)*x508))+x505+new_r11); evalcond[4]=((((-1.0)*x504))+((new_r10*x503))+((new_r00*x502))); evalcond[5]=((((-1.0)*x503*x504))+(((-1.0)*sj21*x506))+new_r10); evalcond[6]=((((-1.0)*new_r00*x507))+(((-1.0)*sj21))+((new_r10*x502))); evalcond[7]=((((-1.0)*new_r01*x507))+(((-1.0)*x504))+((new_r11*x502))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j20)))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r12; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j19array[1], cj19array[1], sj19array[1]; bool j19valid[1]={false}; _nj19 = 1; IkReal x509=((1.0)*new_r00); if( IKabs(((((-1.0)*cj21*new_r01))+(((-1.0)*sj21*x509)))) < IKFAST_ATAN2_MAGTHRESH && IKabs((((new_r01*sj21))+(((-1.0)*cj21*x509)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*cj21*new_r01))+(((-1.0)*sj21*x509))))+IKsqr((((new_r01*sj21))+(((-1.0)*cj21*x509))))-1) <= IKFAST_SINCOS_THRESH ) continue; j19array[0]=IKatan2(((((-1.0)*cj21*new_r01))+(((-1.0)*sj21*x509))), (((new_r01*sj21))+(((-1.0)*cj21*x509)))); sj19array[0]=IKsin(j19array[0]); cj19array[0]=IKcos(j19array[0]); if( j19array[0] > IKPI ) { j19array[0]-=IK2PI; } else if( j19array[0] < -IKPI ) { j19array[0]+=IK2PI; } j19valid[0] = true; for(int ij19 = 0; ij19 < 1; ++ij19) { if( !j19valid[ij19] ) { continue; } _ij19[0] = ij19; _ij19[1] = -1; for(int iij19 = ij19+1; iij19 < 1; ++iij19) { if( j19valid[iij19] && IKabs(cj19array[ij19]-cj19array[iij19]) < IKFAST_SOLUTION_THRESH && IKabs(sj19array[ij19]-sj19array[iij19]) < IKFAST_SOLUTION_THRESH ) { j19valid[iij19]=false; _ij19[1] = iij19; break; } } j19 = j19array[ij19]; cj19 = cj19array[ij19]; sj19 = sj19array[ij19]; { IkReal evalcond[8]; IkReal x510=IKcos(j19); IkReal x511=IKsin(j19); IkReal x512=((1.0)*sj21); IkReal x513=(cj21*x511); IkReal x514=((1.0)*x510); IkReal x515=((1.0)*x511); IkReal x516=(x510*x512); evalcond[0]=(((new_r00*x510))+((new_r10*x511))+cj21); evalcond[1]=(((cj21*x510))+((sj21*x511))+new_r00); evalcond[2]=(x513+new_r01+(((-1.0)*x516))); evalcond[3]=(x513+new_r10+(((-1.0)*x516))); evalcond[4]=(((new_r01*x510))+((new_r11*x511))+(((-1.0)*x512))); evalcond[5]=((((-1.0)*x511*x512))+(((-1.0)*cj21*x514))+new_r11); evalcond[6]=(((new_r10*x510))+(((-1.0)*new_r00*x515))+(((-1.0)*x512))); evalcond[7]=(((new_r11*x510))+(((-1.0)*cj21))+(((-1.0)*new_r01*x515))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r12))+(IKabs(new_r02))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j19eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; j19eval[0]=((IKabs(new_r11))+(IKabs(new_r01))); if( IKabs(j19eval[0]) < 0.0000010000000000 ) { { IkReal j19eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; j19eval[0]=((IKabs(new_r10))+(IKabs(new_r00))); if( IKabs(j19eval[0]) < 0.0000010000000000 ) { { IkReal j19eval[1]; new_r02=0; new_r12=0; new_r20=0; new_r21=0; j19eval[0]=((IKabs((new_r11*new_r22)))+(IKabs((new_r01*new_r22)))); if( IKabs(j19eval[0]) < 0.0000010000000000 ) { continue; // no branches [j19] } else { { IkReal j19array[2], cj19array[2], sj19array[2]; bool j19valid[2]={false}; _nj19 = 2; CheckValue<IkReal> x518 = IKatan2WithCheck(IkReal((new_r01*new_r22)),IkReal((new_r11*new_r22)),IKFAST_ATAN2_MAGTHRESH); if(!x518.valid){ continue; } IkReal x517=x518.value; j19array[0]=((-1.0)*x517); sj19array[0]=IKsin(j19array[0]); cj19array[0]=IKcos(j19array[0]); j19array[1]=((3.14159265358979)+(((-1.0)*x517))); sj19array[1]=IKsin(j19array[1]); cj19array[1]=IKcos(j19array[1]); if( j19array[0] > IKPI ) { j19array[0]-=IK2PI; } else if( j19array[0] < -IKPI ) { j19array[0]+=IK2PI; } j19valid[0] = true; if( j19array[1] > IKPI ) { j19array[1]-=IK2PI; } else if( j19array[1] < -IKPI ) { j19array[1]+=IK2PI; } j19valid[1] = true; for(int ij19 = 0; ij19 < 2; ++ij19) { if( !j19valid[ij19] ) { continue; } _ij19[0] = ij19; _ij19[1] = -1; for(int iij19 = ij19+1; iij19 < 2; ++iij19) { if( j19valid[iij19] && IKabs(cj19array[ij19]-cj19array[iij19]) < IKFAST_SOLUTION_THRESH && IKabs(sj19array[ij19]-sj19array[iij19]) < IKFAST_SOLUTION_THRESH ) { j19valid[iij19]=false; _ij19[1] = iij19; break; } } j19 = j19array[ij19]; cj19 = cj19array[ij19]; sj19 = sj19array[ij19]; { IkReal evalcond[5]; IkReal x519=IKcos(j19); IkReal x520=IKsin(j19); IkReal x521=(new_r10*x520); IkReal x522=((1.0)*x520); IkReal x523=(new_r00*x519); evalcond[0]=(((new_r01*x519))+((new_r11*x520))); evalcond[1]=(x523+x521); evalcond[2]=(((new_r10*x519))+(((-1.0)*new_r00*x522))); evalcond[3]=(((new_r11*x519))+(((-1.0)*new_r01*x522))); evalcond[4]=(((new_r22*x521))+((new_r22*x523))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j19array[2], cj19array[2], sj19array[2]; bool j19valid[2]={false}; _nj19 = 2; CheckValue<IkReal> x525 = IKatan2WithCheck(IkReal(new_r00),IkReal(new_r10),IKFAST_ATAN2_MAGTHRESH); if(!x525.valid){ continue; } IkReal x524=x525.value; j19array[0]=((-1.0)*x524); sj19array[0]=IKsin(j19array[0]); cj19array[0]=IKcos(j19array[0]); j19array[1]=((3.14159265358979)+(((-1.0)*x524))); sj19array[1]=IKsin(j19array[1]); cj19array[1]=IKcos(j19array[1]); if( j19array[0] > IKPI ) { j19array[0]-=IK2PI; } else if( j19array[0] < -IKPI ) { j19array[0]+=IK2PI; } j19valid[0] = true; if( j19array[1] > IKPI ) { j19array[1]-=IK2PI; } else if( j19array[1] < -IKPI ) { j19array[1]+=IK2PI; } j19valid[1] = true; for(int ij19 = 0; ij19 < 2; ++ij19) { if( !j19valid[ij19] ) { continue; } _ij19[0] = ij19; _ij19[1] = -1; for(int iij19 = ij19+1; iij19 < 2; ++iij19) { if( j19valid[iij19] && IKabs(cj19array[ij19]-cj19array[iij19]) < IKFAST_SOLUTION_THRESH && IKabs(sj19array[ij19]-sj19array[iij19]) < IKFAST_SOLUTION_THRESH ) { j19valid[iij19]=false; _ij19[1] = iij19; break; } } j19 = j19array[ij19]; cj19 = cj19array[ij19]; sj19 = sj19array[ij19]; { IkReal evalcond[5]; IkReal x526=IKcos(j19); IkReal x527=IKsin(j19); IkReal x528=(new_r22*x527); IkReal x529=((1.0)*x527); IkReal x530=(new_r01*x526); evalcond[0]=(((new_r11*x527))+x530); evalcond[1]=((((-1.0)*new_r00*x529))+((new_r10*x526))); evalcond[2]=(((new_r11*x526))+(((-1.0)*new_r01*x529))); evalcond[3]=(((new_r11*x528))+((new_r22*x530))); evalcond[4]=(((new_r00*new_r22*x526))+((new_r10*x528))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j19array[2], cj19array[2], sj19array[2]; bool j19valid[2]={false}; _nj19 = 2; CheckValue<IkReal> x532 = IKatan2WithCheck(IkReal(new_r01),IkReal(new_r11),IKFAST_ATAN2_MAGTHRESH); if(!x532.valid){ continue; } IkReal x531=x532.value; j19array[0]=((-1.0)*x531); sj19array[0]=IKsin(j19array[0]); cj19array[0]=IKcos(j19array[0]); j19array[1]=((3.14159265358979)+(((-1.0)*x531))); sj19array[1]=IKsin(j19array[1]); cj19array[1]=IKcos(j19array[1]); if( j19array[0] > IKPI ) { j19array[0]-=IK2PI; } else if( j19array[0] < -IKPI ) { j19array[0]+=IK2PI; } j19valid[0] = true; if( j19array[1] > IKPI ) { j19array[1]-=IK2PI; } else if( j19array[1] < -IKPI ) { j19array[1]+=IK2PI; } j19valid[1] = true; for(int ij19 = 0; ij19 < 2; ++ij19) { if( !j19valid[ij19] ) { continue; } _ij19[0] = ij19; _ij19[1] = -1; for(int iij19 = ij19+1; iij19 < 2; ++iij19) { if( j19valid[iij19] && IKabs(cj19array[ij19]-cj19array[iij19]) < IKFAST_SOLUTION_THRESH && IKabs(sj19array[ij19]-sj19array[iij19]) < IKFAST_SOLUTION_THRESH ) { j19valid[iij19]=false; _ij19[1] = iij19; break; } } j19 = j19array[ij19]; cj19 = cj19array[ij19]; sj19 = sj19array[ij19]; { IkReal evalcond[5]; IkReal x533=IKcos(j19); IkReal x534=IKsin(j19); IkReal x535=(new_r22*x534); IkReal x536=((1.0)*x534); IkReal x537=(new_r00*x533); evalcond[0]=(((new_r10*x534))+x537); evalcond[1]=((((-1.0)*new_r00*x536))+((new_r10*x533))); evalcond[2]=(((new_r11*x533))+(((-1.0)*new_r01*x536))); evalcond[3]=(((new_r11*x535))+((new_r01*new_r22*x533))); evalcond[4]=(((new_r10*x535))+((new_r22*x537))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j19] } } while(0); if( bgotonextstatement ) { } } } } } } } } else { { IkReal j19array[1], cj19array[1], sj19array[1]; bool j19valid[1]={false}; _nj19 = 1; CheckValue<IkReal> x539=IKPowWithIntegerCheck(sj20,-1); if(!x539.valid){ continue; } IkReal x538=x539.value; CheckValue<IkReal> x540=IKPowWithIntegerCheck(cj21,-1); if(!x540.valid){ continue; } if( IKabs((x538*(x540.value)*(((((-1.0)*new_r01*sj20))+(((-1.0)*cj20*new_r02*sj21)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs((new_r02*x538)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((x538*(x540.value)*(((((-1.0)*new_r01*sj20))+(((-1.0)*cj20*new_r02*sj21))))))+IKsqr((new_r02*x538))-1) <= IKFAST_SINCOS_THRESH ) continue; j19array[0]=IKatan2((x538*(x540.value)*(((((-1.0)*new_r01*sj20))+(((-1.0)*cj20*new_r02*sj21))))), (new_r02*x538)); sj19array[0]=IKsin(j19array[0]); cj19array[0]=IKcos(j19array[0]); if( j19array[0] > IKPI ) { j19array[0]-=IK2PI; } else if( j19array[0] < -IKPI ) { j19array[0]+=IK2PI; } j19valid[0] = true; for(int ij19 = 0; ij19 < 1; ++ij19) { if( !j19valid[ij19] ) { continue; } _ij19[0] = ij19; _ij19[1] = -1; for(int iij19 = ij19+1; iij19 < 1; ++iij19) { if( j19valid[iij19] && IKabs(cj19array[ij19]-cj19array[iij19]) < IKFAST_SOLUTION_THRESH && IKabs(sj19array[ij19]-sj19array[iij19]) < IKFAST_SOLUTION_THRESH ) { j19valid[iij19]=false; _ij19[1] = iij19; break; } } j19 = j19array[ij19]; cj19 = cj19array[ij19]; sj19 = sj19array[ij19]; { IkReal evalcond[18]; IkReal x541=IKcos(j19); IkReal x542=IKsin(j19); IkReal x543=((1.0)*cj21); IkReal x544=((1.0)*sj21); IkReal x545=((1.0)*sj20); IkReal x546=(new_r11*x542); IkReal x547=(new_r00*x541); IkReal x548=(cj20*x542); IkReal x549=(sj20*x542); IkReal x550=(new_r01*x541); IkReal x551=((1.0)*x542); IkReal x552=(new_r02*x541); IkReal x553=(cj20*x541); evalcond[0]=((((-1.0)*x541*x545))+new_r02); evalcond[1]=((((-1.0)*x542*x545))+new_r12); evalcond[2]=(((new_r12*x541))+(((-1.0)*new_r02*x551))); evalcond[3]=(((sj21*x553))+((cj21*x542))+new_r01); evalcond[4]=(((new_r12*x542))+(((-1.0)*x545))+x552); evalcond[5]=(x550+x546+((cj20*sj21))); evalcond[6]=(((sj21*x542))+(((-1.0)*x543*x553))+new_r00); evalcond[7]=((((-1.0)*x541*x543))+((sj21*x548))+new_r11); evalcond[8]=(((new_r10*x541))+(((-1.0)*x544))+(((-1.0)*new_r00*x551))); evalcond[9]=((((-1.0)*new_r01*x551))+((new_r11*x541))+(((-1.0)*x543))); evalcond[10]=(((new_r10*x542))+x547+(((-1.0)*cj20*x543))); evalcond[11]=((((-1.0)*x541*x544))+new_r10+(((-1.0)*x543*x548))); evalcond[12]=(((sj20*x547))+((new_r10*x549))+((cj20*new_r20))); evalcond[13]=(((sj20*x550))+((sj20*x546))+((cj20*new_r21))); evalcond[14]=((-1.0)+((sj20*x552))+((new_r12*x549))+((cj20*new_r22))); evalcond[15]=(((cj20*x552))+(((-1.0)*new_r22*x545))+((new_r12*x548))); evalcond[16]=(((cj20*x550))+(((-1.0)*new_r21*x545))+sj21+((cj20*x546))); evalcond[17]=(((new_r10*x548))+(((-1.0)*new_r20*x545))+(((-1.0)*x543))+((cj20*x547))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[12]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[13]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[14]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[15]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[16]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[17]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j19array[1], cj19array[1], sj19array[1]; bool j19valid[1]={false}; _nj19 = 1; CheckValue<IkReal> x554=IKPowWithIntegerCheck(IKsign(sj20),-1); if(!x554.valid){ continue; } CheckValue<IkReal> x555 = IKatan2WithCheck(IkReal(new_r12),IkReal(new_r02),IKFAST_ATAN2_MAGTHRESH); if(!x555.valid){ continue; } j19array[0]=((-1.5707963267949)+(((1.5707963267949)*(x554.value)))+(x555.value)); sj19array[0]=IKsin(j19array[0]); cj19array[0]=IKcos(j19array[0]); if( j19array[0] > IKPI ) { j19array[0]-=IK2PI; } else if( j19array[0] < -IKPI ) { j19array[0]+=IK2PI; } j19valid[0] = true; for(int ij19 = 0; ij19 < 1; ++ij19) { if( !j19valid[ij19] ) { continue; } _ij19[0] = ij19; _ij19[1] = -1; for(int iij19 = ij19+1; iij19 < 1; ++iij19) { if( j19valid[iij19] && IKabs(cj19array[ij19]-cj19array[iij19]) < IKFAST_SOLUTION_THRESH && IKabs(sj19array[ij19]-sj19array[iij19]) < IKFAST_SOLUTION_THRESH ) { j19valid[iij19]=false; _ij19[1] = iij19; break; } } j19 = j19array[ij19]; cj19 = cj19array[ij19]; sj19 = sj19array[ij19]; { IkReal evalcond[18]; IkReal x556=IKcos(j19); IkReal x557=IKsin(j19); IkReal x558=((1.0)*cj21); IkReal x559=((1.0)*sj21); IkReal x560=((1.0)*sj20); IkReal x561=(new_r11*x557); IkReal x562=(new_r00*x556); IkReal x563=(cj20*x557); IkReal x564=(sj20*x557); IkReal x565=(new_r01*x556); IkReal x566=((1.0)*x557); IkReal x567=(new_r02*x556); IkReal x568=(cj20*x556); evalcond[0]=((((-1.0)*x556*x560))+new_r02); evalcond[1]=((((-1.0)*x557*x560))+new_r12); evalcond[2]=((((-1.0)*new_r02*x566))+((new_r12*x556))); evalcond[3]=(((cj21*x557))+((sj21*x568))+new_r01); evalcond[4]=(((new_r12*x557))+x567+(((-1.0)*x560))); evalcond[5]=(x565+x561+((cj20*sj21))); evalcond[6]=(((sj21*x557))+(((-1.0)*x558*x568))+new_r00); evalcond[7]=((((-1.0)*x556*x558))+((sj21*x563))+new_r11); evalcond[8]=((((-1.0)*new_r00*x566))+((new_r10*x556))+(((-1.0)*x559))); evalcond[9]=(((new_r11*x556))+(((-1.0)*x558))+(((-1.0)*new_r01*x566))); evalcond[10]=(((new_r10*x557))+x562+(((-1.0)*cj20*x558))); evalcond[11]=((((-1.0)*x556*x559))+(((-1.0)*x558*x563))+new_r10); evalcond[12]=(((sj20*x562))+((cj20*new_r20))+((new_r10*x564))); evalcond[13]=(((sj20*x565))+((sj20*x561))+((cj20*new_r21))); evalcond[14]=((-1.0)+((sj20*x567))+((cj20*new_r22))+((new_r12*x564))); evalcond[15]=(((cj20*x567))+(((-1.0)*new_r22*x560))+((new_r12*x563))); evalcond[16]=(sj21+((cj20*x561))+((cj20*x565))+(((-1.0)*new_r21*x560))); evalcond[17]=((((-1.0)*new_r20*x560))+(((-1.0)*x558))+((cj20*x562))+((new_r10*x563))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[12]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[13]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[14]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[15]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[16]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[17]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } } } } else { { IkReal j19array[1], cj19array[1], sj19array[1]; bool j19valid[1]={false}; _nj19 = 1; CheckValue<IkReal> x569=IKPowWithIntegerCheck(IKsign(sj20),-1); if(!x569.valid){ continue; } CheckValue<IkReal> x570 = IKatan2WithCheck(IkReal(new_r12),IkReal(new_r02),IKFAST_ATAN2_MAGTHRESH); if(!x570.valid){ continue; } j19array[0]=((-1.5707963267949)+(((1.5707963267949)*(x569.value)))+(x570.value)); sj19array[0]=IKsin(j19array[0]); cj19array[0]=IKcos(j19array[0]); if( j19array[0] > IKPI ) { j19array[0]-=IK2PI; } else if( j19array[0] < -IKPI ) { j19array[0]+=IK2PI; } j19valid[0] = true; for(int ij19 = 0; ij19 < 1; ++ij19) { if( !j19valid[ij19] ) { continue; } _ij19[0] = ij19; _ij19[1] = -1; for(int iij19 = ij19+1; iij19 < 1; ++iij19) { if( j19valid[iij19] && IKabs(cj19array[ij19]-cj19array[iij19]) < IKFAST_SOLUTION_THRESH && IKabs(sj19array[ij19]-sj19array[iij19]) < IKFAST_SOLUTION_THRESH ) { j19valid[iij19]=false; _ij19[1] = iij19; break; } } j19 = j19array[ij19]; cj19 = cj19array[ij19]; sj19 = sj19array[ij19]; { IkReal evalcond[8]; IkReal x571=IKcos(j19); IkReal x572=IKsin(j19); IkReal x573=((1.0)*sj20); IkReal x574=(new_r02*x571); IkReal x575=(new_r12*x572); IkReal x576=(sj20*x571); IkReal x577=(sj20*x572); evalcond[0]=((((-1.0)*x571*x573))+new_r02); evalcond[1]=(new_r12+(((-1.0)*x572*x573))); evalcond[2]=((((-1.0)*new_r02*x572))+((new_r12*x571))); evalcond[3]=((((-1.0)*x573))+x575+x574); evalcond[4]=(((new_r00*x576))+((new_r10*x577))+((cj20*new_r20))); evalcond[5]=(((new_r11*x577))+((new_r01*x576))+((cj20*new_r21))); evalcond[6]=((-1.0)+((sj20*x575))+((sj20*x574))+((cj20*new_r22))); evalcond[7]=(((cj20*x574))+((cj20*x575))+(((-1.0)*new_r22*x573))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { IkReal j21eval[3]; j21eval[0]=sj20; j21eval[1]=((IKabs(new_r20))+(IKabs(new_r21))); j21eval[2]=IKsign(sj20); if( IKabs(j21eval[0]) < 0.0000010000000000 || IKabs(j21eval[1]) < 0.0000010000000000 || IKabs(j21eval[2]) < 0.0000010000000000 ) { { IkReal j21eval[2]; j21eval[0]=sj20; j21eval[1]=sj19; if( IKabs(j21eval[0]) < 0.0000010000000000 || IKabs(j21eval[1]) < 0.0000010000000000 ) { { IkReal j21eval[3]; j21eval[0]=cj20; j21eval[1]=sj19; j21eval[2]=sj20; if( IKabs(j21eval[0]) < 0.0000010000000000 || IKabs(j21eval[1]) < 0.0000010000000000 || IKabs(j21eval[2]) < 0.0000010000000000 ) { { IkReal evalcond[5]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j20)))), 6.28318530717959))); evalcond[1]=new_r22; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; if( IKabs(new_r21) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r21)+IKsqr(((-1.0)*new_r20))-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2(new_r21, ((-1.0)*new_r20)); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[8]; IkReal x578=IKcos(j21); IkReal x579=IKsin(j21); IkReal x580=((1.0)*cj19); IkReal x581=((1.0)*sj19); IkReal x582=((1.0)*x579); evalcond[0]=(x578+new_r20); evalcond[1]=(new_r21+(((-1.0)*x582))); evalcond[2]=(((sj19*x578))+new_r01); evalcond[3]=(((sj19*x579))+new_r00); evalcond[4]=((((-1.0)*x578*x580))+new_r11); evalcond[5]=((((-1.0)*x579*x580))+new_r10); evalcond[6]=(((cj19*new_r10))+(((-1.0)*x582))+(((-1.0)*new_r00*x581))); evalcond[7]=((((-1.0)*new_r01*x581))+(((-1.0)*x578))+((cj19*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j20)))), 6.28318530717959))); evalcond[1]=new_r22; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; if( IKabs(((-1.0)*new_r21)) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r20) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r21))+IKsqr(new_r20)-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2(((-1.0)*new_r21), new_r20); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[8]; IkReal x583=IKcos(j21); IkReal x584=IKsin(j21); IkReal x585=((1.0)*cj19); IkReal x586=((1.0)*sj19); IkReal x587=((1.0)*x583); evalcond[0]=(x584+new_r21); evalcond[1]=(new_r20+(((-1.0)*x587))); evalcond[2]=(((sj19*x583))+new_r01); evalcond[3]=(((sj19*x584))+new_r00); evalcond[4]=((((-1.0)*x583*x585))+new_r11); evalcond[5]=((((-1.0)*x584*x585))+new_r10); evalcond[6]=((((-1.0)*x584))+((cj19*new_r10))+(((-1.0)*new_r00*x586))); evalcond[7]=((((-1.0)*new_r01*x586))+((cj19*new_r11))+(((-1.0)*x587))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j19))), 6.28318530717959))); evalcond[1]=new_r12; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; if( IKabs(new_r10) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r11) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r10)+IKsqr(new_r11)-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2(new_r10, new_r11); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[8]; IkReal x588=IKcos(j21); IkReal x589=IKsin(j21); IkReal x590=((1.0)*sj20); IkReal x591=((1.0)*x588); IkReal x592=((1.0)*x589); evalcond[0]=(((sj20*x588))+new_r20); evalcond[1]=((((-1.0)*x592))+new_r10); evalcond[2]=((((-1.0)*x591))+new_r11); evalcond[3]=(((cj20*x589))+new_r01); evalcond[4]=((((-1.0)*x589*x590))+new_r21); evalcond[5]=((((-1.0)*cj20*x591))+new_r00); evalcond[6]=((((-1.0)*new_r21*x590))+((cj20*new_r01))+x589); evalcond[7]=((((-1.0)*new_r20*x590))+((cj20*new_r00))+(((-1.0)*x591))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j19)))), 6.28318530717959))); evalcond[1]=new_r12; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21eval[3]; sj19=0; cj19=-1.0; j19=3.14159265358979; j21eval[0]=sj20; j21eval[1]=((IKabs(new_r20))+(IKabs(new_r21))); j21eval[2]=IKsign(sj20); if( IKabs(j21eval[0]) < 0.0000010000000000 || IKabs(j21eval[1]) < 0.0000010000000000 || IKabs(j21eval[2]) < 0.0000010000000000 ) { { IkReal j21eval[1]; sj19=0; cj19=-1.0; j19=3.14159265358979; j21eval[0]=sj20; if( IKabs(j21eval[0]) < 0.0000010000000000 ) { { IkReal j21eval[2]; sj19=0; cj19=-1.0; j19=3.14159265358979; j21eval[0]=cj20; j21eval[1]=sj20; if( IKabs(j21eval[0]) < 0.0000010000000000 || IKabs(j21eval[1]) < 0.0000010000000000 ) { { IkReal evalcond[4]; bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-1.5707963267949)+j20)))), 6.28318530717959))); evalcond[1]=new_r22; evalcond[2]=new_r01; evalcond[3]=new_r00; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; if( IKabs(new_r21) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r21)+IKsqr(((-1.0)*new_r20))-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2(new_r21, ((-1.0)*new_r20)); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[4]; IkReal x593=IKcos(j21); IkReal x594=((1.0)*(IKsin(j21))); evalcond[0]=(x593+new_r20); evalcond[1]=((((-1.0)*x594))+new_r21); evalcond[2]=((((-1.0)*x594))+(((-1.0)*new_r10))); evalcond[3]=((((-1.0)*x593))+(((-1.0)*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((1.5707963267949)+j20)))), 6.28318530717959))); evalcond[1]=new_r22; evalcond[2]=new_r01; evalcond[3]=new_r00; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; if( IKabs(((-1.0)*new_r21)) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r20) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r21))+IKsqr(new_r20)-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2(((-1.0)*new_r21), new_r20); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[4]; IkReal x595=IKsin(j21); IkReal x596=((1.0)*(IKcos(j21))); evalcond[0]=(x595+new_r21); evalcond[1]=((((-1.0)*x596))+new_r20); evalcond[2]=((((-1.0)*x595))+(((-1.0)*new_r10))); evalcond[3]=((((-1.0)*x596))+(((-1.0)*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j20))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; if( IKabs(new_r01) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r11)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(new_r01)+IKsqr(((-1.0)*new_r11))-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2(new_r01, ((-1.0)*new_r11)); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[4]; IkReal x597=IKsin(j21); IkReal x598=((1.0)*(IKcos(j21))); evalcond[0]=(x597+(((-1.0)*new_r01))); evalcond[1]=((((-1.0)*x597))+(((-1.0)*new_r10))); evalcond[2]=((((-1.0)*x598))+(((-1.0)*new_r11))); evalcond[3]=((((-1.0)*x598))+(((-1.0)*new_r00))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j20)))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; if( IKabs(((-1.0)*new_r10)) < IKFAST_ATAN2_MAGTHRESH && IKabs(new_r00) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r10))+IKsqr(new_r00)-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2(((-1.0)*new_r10), new_r00); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[4]; IkReal x599=IKcos(j21); IkReal x600=((1.0)*(IKsin(j21))); evalcond[0]=(x599+(((-1.0)*new_r00))); evalcond[1]=((((-1.0)*new_r10))+(((-1.0)*x600))); evalcond[2]=((((-1.0)*x599))+(((-1.0)*new_r11))); evalcond[3]=((((-1.0)*x600))+(((-1.0)*new_r01))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; if( IKabs(((-1.0)*new_r10)) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r11)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((-1.0)*new_r10))+IKsqr(((-1.0)*new_r11))-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2(((-1.0)*new_r10), ((-1.0)*new_r11)); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[6]; IkReal x601=IKsin(j21); IkReal x602=IKcos(j21); IkReal x603=((-1.0)*x602); evalcond[0]=x601; evalcond[1]=(new_r22*x601); evalcond[2]=x603; evalcond[3]=(new_r22*x603); evalcond[4]=((((-1.0)*x601))+(((-1.0)*new_r10))); evalcond[5]=((((-1.0)*x602))+(((-1.0)*new_r11))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j21] } } while(0); if( bgotonextstatement ) { } } } } } } } } else { { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; CheckValue<IkReal> x604=IKPowWithIntegerCheck(cj20,-1); if(!x604.valid){ continue; } CheckValue<IkReal> x605=IKPowWithIntegerCheck(sj20,-1); if(!x605.valid){ continue; } if( IKabs((new_r01*(x604.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20*(x605.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((new_r01*(x604.value)))+IKsqr(((-1.0)*new_r20*(x605.value)))-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2((new_r01*(x604.value)), ((-1.0)*new_r20*(x605.value))); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[8]; IkReal x606=IKsin(j21); IkReal x607=IKcos(j21); IkReal x608=((1.0)*sj20); IkReal x609=((1.0)*new_r00); IkReal x610=((1.0)*new_r01); IkReal x611=((1.0)*x607); IkReal x612=((1.0)*x606); evalcond[0]=(((sj20*x607))+new_r20); evalcond[1]=(new_r21+(((-1.0)*x606*x608))); evalcond[2]=((((-1.0)*x612))+(((-1.0)*new_r10))); evalcond[3]=((((-1.0)*x611))+(((-1.0)*new_r11))); evalcond[4]=((((-1.0)*x610))+((cj20*x606))); evalcond[5]=((((-1.0)*cj20*x611))+(((-1.0)*x609))); evalcond[6]=((((-1.0)*cj20*x610))+x606+(((-1.0)*new_r21*x608))); evalcond[7]=((((-1.0)*new_r20*x608))+(((-1.0)*cj20*x609))+(((-1.0)*x611))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; CheckValue<IkReal> x613=IKPowWithIntegerCheck(sj20,-1); if(!x613.valid){ continue; } if( IKabs((new_r21*(x613.value))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r11)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((new_r21*(x613.value)))+IKsqr(((-1.0)*new_r11))-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2((new_r21*(x613.value)), ((-1.0)*new_r11)); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[8]; IkReal x614=IKsin(j21); IkReal x615=IKcos(j21); IkReal x616=((1.0)*sj20); IkReal x617=((1.0)*new_r00); IkReal x618=((1.0)*new_r01); IkReal x619=((1.0)*x615); IkReal x620=((1.0)*x614); evalcond[0]=(((sj20*x615))+new_r20); evalcond[1]=((((-1.0)*x614*x616))+new_r21); evalcond[2]=((((-1.0)*x620))+(((-1.0)*new_r10))); evalcond[3]=((((-1.0)*x619))+(((-1.0)*new_r11))); evalcond[4]=(((cj20*x614))+(((-1.0)*x618))); evalcond[5]=((((-1.0)*cj20*x619))+(((-1.0)*x617))); evalcond[6]=((((-1.0)*new_r21*x616))+(((-1.0)*cj20*x618))+x614); evalcond[7]=((((-1.0)*cj20*x617))+(((-1.0)*x619))+(((-1.0)*new_r20*x616))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; CheckValue<IkReal> x621=IKPowWithIntegerCheck(IKsign(sj20),-1); if(!x621.valid){ continue; } CheckValue<IkReal> x622 = IKatan2WithCheck(IkReal(new_r21),IkReal(((-1.0)*new_r20)),IKFAST_ATAN2_MAGTHRESH); if(!x622.valid){ continue; } j21array[0]=((-1.5707963267949)+(((1.5707963267949)*(x621.value)))+(x622.value)); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[8]; IkReal x623=IKsin(j21); IkReal x624=IKcos(j21); IkReal x625=((1.0)*sj20); IkReal x626=((1.0)*new_r00); IkReal x627=((1.0)*new_r01); IkReal x628=((1.0)*x624); IkReal x629=((1.0)*x623); evalcond[0]=(new_r20+((sj20*x624))); evalcond[1]=((((-1.0)*x623*x625))+new_r21); evalcond[2]=((((-1.0)*x629))+(((-1.0)*new_r10))); evalcond[3]=((((-1.0)*x628))+(((-1.0)*new_r11))); evalcond[4]=(((cj20*x623))+(((-1.0)*x627))); evalcond[5]=((((-1.0)*cj20*x628))+(((-1.0)*x626))); evalcond[6]=((((-1.0)*cj20*x627))+(((-1.0)*new_r21*x625))+x623); evalcond[7]=((((-1.0)*cj20*x626))+(((-1.0)*x628))+(((-1.0)*new_r20*x625))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(j20))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r12; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; IkReal x630=((1.0)*sj19); if( IKabs(((((-1.0)*new_r00*x630))+(((-1.0)*cj19*new_r01)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((((-1.0)*new_r01*x630))+((cj19*new_r00)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*new_r00*x630))+(((-1.0)*cj19*new_r01))))+IKsqr(((((-1.0)*new_r01*x630))+((cj19*new_r00))))-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2(((((-1.0)*new_r00*x630))+(((-1.0)*cj19*new_r01))), ((((-1.0)*new_r01*x630))+((cj19*new_r00)))); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[8]; IkReal x631=IKsin(j21); IkReal x632=IKcos(j21); IkReal x633=((1.0)*sj19); IkReal x634=((1.0)*x632); IkReal x635=(sj19*x631); IkReal x636=((1.0)*x631); IkReal x637=(cj19*x634); evalcond[0]=(x631+((cj19*new_r01))+((new_r11*sj19))); evalcond[1]=(((cj19*x631))+((sj19*x632))+new_r01); evalcond[2]=((((-1.0)*x634))+((new_r10*sj19))+((cj19*new_r00))); evalcond[3]=((((-1.0)*new_r00*x633))+(((-1.0)*x636))+((cj19*new_r10))); evalcond[4]=((((-1.0)*new_r01*x633))+(((-1.0)*x634))+((cj19*new_r11))); evalcond[5]=((((-1.0)*x637))+x635+new_r00); evalcond[6]=((((-1.0)*x637))+x635+new_r11); evalcond[7]=(new_r10+(((-1.0)*cj19*x636))+(((-1.0)*x632*x633))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((-3.14159265358979)+(IKfmod(((3.14159265358979)+(IKabs(((-3.14159265358979)+j20)))), 6.28318530717959))); evalcond[1]=new_r20; evalcond[2]=new_r02; evalcond[3]=new_r12; evalcond[4]=new_r21; if( IKabs(evalcond[0]) < 0.0000050000000000 && IKabs(evalcond[1]) < 0.0000050000000000 && IKabs(evalcond[2]) < 0.0000050000000000 && IKabs(evalcond[3]) < 0.0000050000000000 && IKabs(evalcond[4]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; IkReal x638=((1.0)*sj19); if( IKabs(((((-1.0)*new_r00*x638))+((cj19*new_r01)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((((-1.0)*new_r01*x638))+(((-1.0)*cj19*new_r00)))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr(((((-1.0)*new_r00*x638))+((cj19*new_r01))))+IKsqr(((((-1.0)*new_r01*x638))+(((-1.0)*cj19*new_r00))))-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2(((((-1.0)*new_r00*x638))+((cj19*new_r01))), ((((-1.0)*new_r01*x638))+(((-1.0)*cj19*new_r00)))); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[8]; IkReal x639=IKsin(j21); IkReal x640=IKcos(j21); IkReal x641=((1.0)*cj19); IkReal x642=((1.0)*sj19); IkReal x643=((1.0)*x639); IkReal x644=(sj19*x640); IkReal x645=(sj19*x639); IkReal x646=(x639*x641); evalcond[0]=(x640+((new_r10*sj19))+((cj19*new_r00))); evalcond[1]=((((-1.0)*x643))+((cj19*new_r01))+((new_r11*sj19))); evalcond[2]=(((cj19*x640))+x645+new_r00); evalcond[3]=((((-1.0)*x643))+(((-1.0)*new_r00*x642))+((cj19*new_r10))); evalcond[4]=((((-1.0)*x640))+(((-1.0)*new_r01*x642))+((cj19*new_r11))); evalcond[5]=((((-1.0)*x646))+x644+new_r01); evalcond[6]=((((-1.0)*x646))+x644+new_r10); evalcond[7]=((((-1.0)*x640*x641))+(((-1.0)*x639*x642))+new_r11); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { evalcond[0]=((IKabs(new_r20))+(IKabs(new_r21))); if( IKabs(evalcond[0]) < 0.0000050000000000 ) { bgotonextstatement=false; { IkReal j21eval[1]; new_r21=0; new_r20=0; new_r02=0; new_r12=0; j21eval[0]=1.0; if( IKabs(j21eval[0]) < 0.0000000100000000 ) { continue; // no branches [j21] } else { IkReal op[2+1], zeror[2]; int numroots; op[0]=1.0; op[1]=0; op[2]=-1.0; polyroots2(op,zeror,numroots); IkReal j21array[2], cj21array[2], sj21array[2], tempj21array[1]; int numsolutions = 0; for(int ij21 = 0; ij21 < numroots; ++ij21) { IkReal htj21 = zeror[ij21]; tempj21array[0]=((2.0)*(atan(htj21))); for(int kj21 = 0; kj21 < 1; ++kj21) { j21array[numsolutions] = tempj21array[kj21]; if( j21array[numsolutions] > IKPI ) { j21array[numsolutions]-=IK2PI; } else if( j21array[numsolutions] < -IKPI ) { j21array[numsolutions]+=IK2PI; } sj21array[numsolutions] = IKsin(j21array[numsolutions]); cj21array[numsolutions] = IKcos(j21array[numsolutions]); numsolutions++; } } bool j21valid[2]={true,true}; _nj21 = 2; for(int ij21 = 0; ij21 < numsolutions; ++ij21) { if( !j21valid[ij21] ) { continue; } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; htj21 = IKtan(j21/2); _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < numsolutions; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } while(0); if( bgotonextstatement ) { bool bgotonextstatement = true; do { if( 1 ) { bgotonextstatement=false; continue; // branch miss [j21] } } while(0); if( bgotonextstatement ) { } } } } } } } } } } else { { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; CheckValue<IkReal> x648=IKPowWithIntegerCheck(sj20,-1); if(!x648.valid){ continue; } IkReal x647=x648.value; CheckValue<IkReal> x649=IKPowWithIntegerCheck(cj20,-1); if(!x649.valid){ continue; } CheckValue<IkReal> x650=IKPowWithIntegerCheck(sj19,-1); if(!x650.valid){ continue; } if( IKabs((x647*(x649.value)*(x650.value)*(((((-1.0)*new_r11*sj20))+(((-1.0)*cj19*new_r20)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(((-1.0)*new_r20*x647)) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((x647*(x649.value)*(x650.value)*(((((-1.0)*new_r11*sj20))+(((-1.0)*cj19*new_r20))))))+IKsqr(((-1.0)*new_r20*x647))-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2((x647*(x649.value)*(x650.value)*(((((-1.0)*new_r11*sj20))+(((-1.0)*cj19*new_r20))))), ((-1.0)*new_r20*x647)); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[12]; IkReal x651=IKsin(j21); IkReal x652=IKcos(j21); IkReal x653=(cj20*sj19); IkReal x654=(cj19*new_r01); IkReal x655=((1.0)*sj20); IkReal x656=(cj19*new_r00); IkReal x657=((1.0)*sj19); IkReal x658=((1.0)*x652); IkReal x659=(cj20*x651); IkReal x660=((1.0)*x651); IkReal x661=(cj19*x658); evalcond[0]=(((sj20*x652))+new_r20); evalcond[1]=((((-1.0)*x651*x655))+new_r21); evalcond[2]=(x654+x659+((new_r11*sj19))); evalcond[3]=((((-1.0)*new_r00*x657))+(((-1.0)*x660))+((cj19*new_r10))); evalcond[4]=((((-1.0)*x658))+(((-1.0)*new_r01*x657))+((cj19*new_r11))); evalcond[5]=(((cj19*x659))+new_r01+((sj19*x652))); evalcond[6]=((((-1.0)*cj20*x658))+x656+((new_r10*sj19))); evalcond[7]=((((-1.0)*cj20*x661))+new_r00+((sj19*x651))); evalcond[8]=(((x651*x653))+(((-1.0)*x661))+new_r11); evalcond[9]=((((-1.0)*cj19*x660))+new_r10+(((-1.0)*x653*x658))); evalcond[10]=(((cj20*x654))+x651+((new_r11*x653))+(((-1.0)*new_r21*x655))); evalcond[11]=(((cj20*x656))+(((-1.0)*x658))+(((-1.0)*new_r20*x655))+((new_r10*x653))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; CheckValue<IkReal> x663=IKPowWithIntegerCheck(sj20,-1); if(!x663.valid){ continue; } IkReal x662=x663.value; CheckValue<IkReal> x664=IKPowWithIntegerCheck(sj19,-1); if(!x664.valid){ continue; } if( IKabs((new_r21*x662)) < IKFAST_ATAN2_MAGTHRESH && IKabs((x662*(x664.value)*(((((-1.0)*new_r01*sj20))+(((-1.0)*cj19*cj20*new_r21)))))) < IKFAST_ATAN2_MAGTHRESH && IKabs(IKsqr((new_r21*x662))+IKsqr((x662*(x664.value)*(((((-1.0)*new_r01*sj20))+(((-1.0)*cj19*cj20*new_r21))))))-1) <= IKFAST_SINCOS_THRESH ) continue; j21array[0]=IKatan2((new_r21*x662), (x662*(x664.value)*(((((-1.0)*new_r01*sj20))+(((-1.0)*cj19*cj20*new_r21)))))); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[12]; IkReal x665=IKsin(j21); IkReal x666=IKcos(j21); IkReal x667=(cj20*sj19); IkReal x668=(cj19*new_r01); IkReal x669=((1.0)*sj20); IkReal x670=(cj19*new_r00); IkReal x671=((1.0)*sj19); IkReal x672=((1.0)*x666); IkReal x673=(cj20*x665); IkReal x674=((1.0)*x665); IkReal x675=(cj19*x672); evalcond[0]=(new_r20+((sj20*x666))); evalcond[1]=((((-1.0)*x665*x669))+new_r21); evalcond[2]=(x668+x673+((new_r11*sj19))); evalcond[3]=((((-1.0)*new_r00*x671))+((cj19*new_r10))+(((-1.0)*x674))); evalcond[4]=((((-1.0)*new_r01*x671))+((cj19*new_r11))+(((-1.0)*x672))); evalcond[5]=(((sj19*x666))+((cj19*x673))+new_r01); evalcond[6]=(x670+((new_r10*sj19))+(((-1.0)*cj20*x672))); evalcond[7]=(((sj19*x665))+new_r00+(((-1.0)*cj20*x675))); evalcond[8]=(((x665*x667))+new_r11+(((-1.0)*x675))); evalcond[9]=((((-1.0)*cj19*x674))+(((-1.0)*x667*x672))+new_r10); evalcond[10]=((((-1.0)*new_r21*x669))+((new_r11*x667))+((cj20*x668))+x665); evalcond[11]=(((cj20*x670))+((new_r10*x667))+(((-1.0)*x672))+(((-1.0)*new_r20*x669))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } else { { IkReal j21array[1], cj21array[1], sj21array[1]; bool j21valid[1]={false}; _nj21 = 1; CheckValue<IkReal> x676=IKPowWithIntegerCheck(IKsign(sj20),-1); if(!x676.valid){ continue; } CheckValue<IkReal> x677 = IKatan2WithCheck(IkReal(new_r21),IkReal(((-1.0)*new_r20)),IKFAST_ATAN2_MAGTHRESH); if(!x677.valid){ continue; } j21array[0]=((-1.5707963267949)+(((1.5707963267949)*(x676.value)))+(x677.value)); sj21array[0]=IKsin(j21array[0]); cj21array[0]=IKcos(j21array[0]); if( j21array[0] > IKPI ) { j21array[0]-=IK2PI; } else if( j21array[0] < -IKPI ) { j21array[0]+=IK2PI; } j21valid[0] = true; for(int ij21 = 0; ij21 < 1; ++ij21) { if( !j21valid[ij21] ) { continue; } _ij21[0] = ij21; _ij21[1] = -1; for(int iij21 = ij21+1; iij21 < 1; ++iij21) { if( j21valid[iij21] && IKabs(cj21array[ij21]-cj21array[iij21]) < IKFAST_SOLUTION_THRESH && IKabs(sj21array[ij21]-sj21array[iij21]) < IKFAST_SOLUTION_THRESH ) { j21valid[iij21]=false; _ij21[1] = iij21; break; } } j21 = j21array[ij21]; cj21 = cj21array[ij21]; sj21 = sj21array[ij21]; { IkReal evalcond[12]; IkReal x678=IKsin(j21); IkReal x679=IKcos(j21); IkReal x680=(cj20*sj19); IkReal x681=(cj19*new_r01); IkReal x682=((1.0)*sj20); IkReal x683=(cj19*new_r00); IkReal x684=((1.0)*sj19); IkReal x685=((1.0)*x679); IkReal x686=(cj20*x678); IkReal x687=((1.0)*x678); IkReal x688=(cj19*x685); evalcond[0]=(new_r20+((sj20*x679))); evalcond[1]=((((-1.0)*x678*x682))+new_r21); evalcond[2]=(x681+x686+((new_r11*sj19))); evalcond[3]=((((-1.0)*x687))+((cj19*new_r10))+(((-1.0)*new_r00*x684))); evalcond[4]=((((-1.0)*new_r01*x684))+(((-1.0)*x685))+((cj19*new_r11))); evalcond[5]=(((cj19*x686))+((sj19*x679))+new_r01); evalcond[6]=(x683+((new_r10*sj19))+(((-1.0)*cj20*x685))); evalcond[7]=(((sj19*x678))+new_r00+(((-1.0)*cj20*x688))); evalcond[8]=(((x678*x680))+(((-1.0)*x688))+new_r11); evalcond[9]=((((-1.0)*x680*x685))+(((-1.0)*cj19*x687))+new_r10); evalcond[10]=((((-1.0)*new_r21*x682))+x678+((new_r11*x680))+((cj20*x681))); evalcond[11]=((((-1.0)*x685))+(((-1.0)*new_r20*x682))+((new_r10*x680))+((cj20*x683))); if( IKabs(evalcond[0]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[1]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[2]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[3]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[4]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[5]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[6]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[7]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[8]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[9]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[10]) > IKFAST_EVALCOND_THRESH || IKabs(evalcond[11]) > IKFAST_EVALCOND_THRESH ) { continue; } } { std::vector<IkSingleDOFSolutionBase<IkReal> > vinfos(8); vinfos[0].jointtype = 17; vinfos[0].foffset = j12; vinfos[0].indices[0] = _ij12[0]; vinfos[0].indices[1] = _ij12[1]; vinfos[0].maxsolutions = _nj12; vinfos[1].jointtype = 1; vinfos[1].foffset = j15; vinfos[1].indices[0] = _ij15[0]; vinfos[1].indices[1] = _ij15[1]; vinfos[1].maxsolutions = _nj15; vinfos[2].jointtype = 1; vinfos[2].foffset = j16; vinfos[2].indices[0] = _ij16[0]; vinfos[2].indices[1] = _ij16[1]; vinfos[2].maxsolutions = _nj16; vinfos[3].jointtype = 1; vinfos[3].foffset = j17; vinfos[3].indices[0] = _ij17[0]; vinfos[3].indices[1] = _ij17[1]; vinfos[3].maxsolutions = _nj17; vinfos[4].jointtype = 1; vinfos[4].foffset = j18; vinfos[4].indices[0] = _ij18[0]; vinfos[4].indices[1] = _ij18[1]; vinfos[4].maxsolutions = _nj18; vinfos[5].jointtype = 1; vinfos[5].foffset = j19; vinfos[5].indices[0] = _ij19[0]; vinfos[5].indices[1] = _ij19[1]; vinfos[5].maxsolutions = _nj19; vinfos[6].jointtype = 1; vinfos[6].foffset = j20; vinfos[6].indices[0] = _ij20[0]; vinfos[6].indices[1] = _ij20[1]; vinfos[6].maxsolutions = _nj20; vinfos[7].jointtype = 1; vinfos[7].foffset = j21; vinfos[7].indices[0] = _ij21[0]; vinfos[7].indices[1] = _ij21[1]; vinfos[7].maxsolutions = _nj21; std::vector<int> vfree(0); solutions.AddSolution(vinfos,vfree); } } } } } } } } } } } } }static inline void polyroots3(IkReal rawcoeffs[3+1], IkReal rawroots[3], int& numroots) { using std::complex; if( rawcoeffs[0] == 0 ) { // solve with one reduced degree polyroots2(&rawcoeffs[1], &rawroots[0], numroots); return; } IKFAST_ASSERT(rawcoeffs[0] != 0); const IkReal tol = 128.0*std::numeric_limits<IkReal>::epsilon(); const IkReal tolsqrt = sqrt(std::numeric_limits<IkReal>::epsilon()); complex<IkReal> coeffs[3]; const int maxsteps = 110; for(int i = 0; i < 3; ++i) { coeffs[i] = complex<IkReal>(rawcoeffs[i+1]/rawcoeffs[0]); } complex<IkReal> roots[3]; IkReal err[3]; roots[0] = complex<IkReal>(1,0); roots[1] = complex<IkReal>(0.4,0.9); // any complex number not a root of unity works err[0] = 1.0; err[1] = 1.0; for(int i = 2; i < 3; ++i) { roots[i] = roots[i-1]*roots[1]; err[i] = 1.0; } for(int step = 0; step < maxsteps; ++step) { bool changed = false; for(int i = 0; i < 3; ++i) { if ( err[i] >= tol ) { changed = true; // evaluate complex<IkReal> x = roots[i] + coeffs[0]; for(int j = 1; j < 3; ++j) { x = roots[i] * x + coeffs[j]; } for(int j = 0; j < 3; ++j) { if( i != j ) { if( roots[i] != roots[j] ) { x /= (roots[i] - roots[j]); } } } roots[i] -= x; err[i] = abs(x); } } if( !changed ) { break; } } numroots = 0; bool visited[3] = {false}; for(int i = 0; i < 3; ++i) { if( !visited[i] ) { // might be a multiple root, in which case it will have more error than the other roots // find any neighboring roots, and take the average complex<IkReal> newroot=roots[i]; int n = 1; for(int j = i+1; j < 3; ++j) { // care about error in real much more than imaginary if( abs(real(roots[i])-real(roots[j])) < tolsqrt && abs(imag(roots[i])-imag(roots[j])) < 0.002 ) { newroot += roots[j]; n += 1; visited[j] = true; } } if( n > 1 ) { newroot /= n; } // there are still cases where even the mean is not accurate enough, until a better multi-root algorithm is used, need to use the sqrt if( IKabs(imag(newroot)) < tolsqrt ) { rawroots[numroots++] = real(newroot); } } } } static inline void polyroots2(IkReal rawcoeffs[2+1], IkReal rawroots[2], int& numroots) { IkReal det = rawcoeffs[1]*rawcoeffs[1]-4*rawcoeffs[0]*rawcoeffs[2]; if( det < 0 ) { numroots=0; } else if( det == 0 ) { rawroots[0] = -0.5*rawcoeffs[1]/rawcoeffs[0]; numroots = 1; } else { det = IKsqrt(det); rawroots[0] = (-rawcoeffs[1]+det)/(2*rawcoeffs[0]); rawroots[1] = (-rawcoeffs[1]-det)/(2*rawcoeffs[0]);//rawcoeffs[2]/(rawcoeffs[0]*rawroots[0]); numroots = 2; } } static inline void polyroots5(IkReal rawcoeffs[5+1], IkReal rawroots[5], int& numroots) { using std::complex; if( rawcoeffs[0] == 0 ) { // solve with one reduced degree polyroots4(&rawcoeffs[1], &rawroots[0], numroots); return; } IKFAST_ASSERT(rawcoeffs[0] != 0); const IkReal tol = 128.0*std::numeric_limits<IkReal>::epsilon(); const IkReal tolsqrt = sqrt(std::numeric_limits<IkReal>::epsilon()); complex<IkReal> coeffs[5]; const int maxsteps = 110; for(int i = 0; i < 5; ++i) { coeffs[i] = complex<IkReal>(rawcoeffs[i+1]/rawcoeffs[0]); } complex<IkReal> roots[5]; IkReal err[5]; roots[0] = complex<IkReal>(1,0); roots[1] = complex<IkReal>(0.4,0.9); // any complex number not a root of unity works err[0] = 1.0; err[1] = 1.0; for(int i = 2; i < 5; ++i) { roots[i] = roots[i-1]*roots[1]; err[i] = 1.0; } for(int step = 0; step < maxsteps; ++step) { bool changed = false; for(int i = 0; i < 5; ++i) { if ( err[i] >= tol ) { changed = true; // evaluate complex<IkReal> x = roots[i] + coeffs[0]; for(int j = 1; j < 5; ++j) { x = roots[i] * x + coeffs[j]; } for(int j = 0; j < 5; ++j) { if( i != j ) { if( roots[i] != roots[j] ) { x /= (roots[i] - roots[j]); } } } roots[i] -= x; err[i] = abs(x); } } if( !changed ) { break; } } numroots = 0; bool visited[5] = {false}; for(int i = 0; i < 5; ++i) { if( !visited[i] ) { // might be a multiple root, in which case it will have more error than the other roots // find any neighboring roots, and take the average complex<IkReal> newroot=roots[i]; int n = 1; for(int j = i+1; j < 5; ++j) { // care about error in real much more than imaginary if( abs(real(roots[i])-real(roots[j])) < tolsqrt && abs(imag(roots[i])-imag(roots[j])) < 0.002 ) { newroot += roots[j]; n += 1; visited[j] = true; } } if( n > 1 ) { newroot /= n; } // there are still cases where even the mean is not accurate enough, until a better multi-root algorithm is used, need to use the sqrt if( IKabs(imag(newroot)) < tolsqrt ) { rawroots[numroots++] = real(newroot); } } } } static inline void polyroots4(IkReal rawcoeffs[4+1], IkReal rawroots[4], int& numroots) { using std::complex; if( rawcoeffs[0] == 0 ) { // solve with one reduced degree polyroots3(&rawcoeffs[1], &rawroots[0], numroots); return; } IKFAST_ASSERT(rawcoeffs[0] != 0); const IkReal tol = 128.0*std::numeric_limits<IkReal>::epsilon(); const IkReal tolsqrt = sqrt(std::numeric_limits<IkReal>::epsilon()); complex<IkReal> coeffs[4]; const int maxsteps = 110; for(int i = 0; i < 4; ++i) { coeffs[i] = complex<IkReal>(rawcoeffs[i+1]/rawcoeffs[0]); } complex<IkReal> roots[4]; IkReal err[4]; roots[0] = complex<IkReal>(1,0); roots[1] = complex<IkReal>(0.4,0.9); // any complex number not a root of unity works err[0] = 1.0; err[1] = 1.0; for(int i = 2; i < 4; ++i) { roots[i] = roots[i-1]*roots[1]; err[i] = 1.0; } for(int step = 0; step < maxsteps; ++step) { bool changed = false; for(int i = 0; i < 4; ++i) { if ( err[i] >= tol ) { changed = true; // evaluate complex<IkReal> x = roots[i] + coeffs[0]; for(int j = 1; j < 4; ++j) { x = roots[i] * x + coeffs[j]; } for(int j = 0; j < 4; ++j) { if( i != j ) { if( roots[i] != roots[j] ) { x /= (roots[i] - roots[j]); } } } roots[i] -= x; err[i] = abs(x); } } if( !changed ) { break; } } numroots = 0; bool visited[4] = {false}; for(int i = 0; i < 4; ++i) { if( !visited[i] ) { // might be a multiple root, in which case it will have more error than the other roots // find any neighboring roots, and take the average complex<IkReal> newroot=roots[i]; int n = 1; for(int j = i+1; j < 4; ++j) { // care about error in real much more than imaginary if( abs(real(roots[i])-real(roots[j])) < tolsqrt && abs(imag(roots[i])-imag(roots[j])) < 0.002 ) { newroot += roots[j]; n += 1; visited[j] = true; } } if( n > 1 ) { newroot /= n; } // there are still cases where even the mean is not accurate enough, until a better multi-root algorithm is used, need to use the sqrt if( IKabs(imag(newroot)) < tolsqrt ) { rawroots[numroots++] = real(newroot); } } } } static inline void polyroots7(IkReal rawcoeffs[7+1], IkReal rawroots[7], int& numroots) { using std::complex; if( rawcoeffs[0] == 0 ) { // solve with one reduced degree polyroots6(&rawcoeffs[1], &rawroots[0], numroots); return; } IKFAST_ASSERT(rawcoeffs[0] != 0); const IkReal tol = 128.0*std::numeric_limits<IkReal>::epsilon(); const IkReal tolsqrt = sqrt(std::numeric_limits<IkReal>::epsilon()); complex<IkReal> coeffs[7]; const int maxsteps = 110; for(int i = 0; i < 7; ++i) { coeffs[i] = complex<IkReal>(rawcoeffs[i+1]/rawcoeffs[0]); } complex<IkReal> roots[7]; IkReal err[7]; roots[0] = complex<IkReal>(1,0); roots[1] = complex<IkReal>(0.4,0.9); // any complex number not a root of unity works err[0] = 1.0; err[1] = 1.0; for(int i = 2; i < 7; ++i) { roots[i] = roots[i-1]*roots[1]; err[i] = 1.0; } for(int step = 0; step < maxsteps; ++step) { bool changed = false; for(int i = 0; i < 7; ++i) { if ( err[i] >= tol ) { changed = true; // evaluate complex<IkReal> x = roots[i] + coeffs[0]; for(int j = 1; j < 7; ++j) { x = roots[i] * x + coeffs[j]; } for(int j = 0; j < 7; ++j) { if( i != j ) { if( roots[i] != roots[j] ) { x /= (roots[i] - roots[j]); } } } roots[i] -= x; err[i] = abs(x); } } if( !changed ) { break; } } numroots = 0; bool visited[7] = {false}; for(int i = 0; i < 7; ++i) { if( !visited[i] ) { // might be a multiple root, in which case it will have more error than the other roots // find any neighboring roots, and take the average complex<IkReal> newroot=roots[i]; int n = 1; for(int j = i+1; j < 7; ++j) { // care about error in real much more than imaginary if( abs(real(roots[i])-real(roots[j])) < tolsqrt && abs(imag(roots[i])-imag(roots[j])) < 0.002 ) { newroot += roots[j]; n += 1; visited[j] = true; } } if( n > 1 ) { newroot /= n; } // there are still cases where even the mean is not accurate enough, until a better multi-root algorithm is used, need to use the sqrt if( IKabs(imag(newroot)) < tolsqrt ) { rawroots[numroots++] = real(newroot); } } } } static inline void polyroots6(IkReal rawcoeffs[6+1], IkReal rawroots[6], int& numroots) { using std::complex; if( rawcoeffs[0] == 0 ) { // solve with one reduced degree polyroots5(&rawcoeffs[1], &rawroots[0], numroots); return; } IKFAST_ASSERT(rawcoeffs[0] != 0); const IkReal tol = 128.0*std::numeric_limits<IkReal>::epsilon(); const IkReal tolsqrt = sqrt(std::numeric_limits<IkReal>::epsilon()); complex<IkReal> coeffs[6]; const int maxsteps = 110; for(int i = 0; i < 6; ++i) { coeffs[i] = complex<IkReal>(rawcoeffs[i+1]/rawcoeffs[0]); } complex<IkReal> roots[6]; IkReal err[6]; roots[0] = complex<IkReal>(1,0); roots[1] = complex<IkReal>(0.4,0.9); // any complex number not a root of unity works err[0] = 1.0; err[1] = 1.0; for(int i = 2; i < 6; ++i) { roots[i] = roots[i-1]*roots[1]; err[i] = 1.0; } for(int step = 0; step < maxsteps; ++step) { bool changed = false; for(int i = 0; i < 6; ++i) { if ( err[i] >= tol ) { changed = true; // evaluate complex<IkReal> x = roots[i] + coeffs[0]; for(int j = 1; j < 6; ++j) { x = roots[i] * x + coeffs[j]; } for(int j = 0; j < 6; ++j) { if( i != j ) { if( roots[i] != roots[j] ) { x /= (roots[i] - roots[j]); } } } roots[i] -= x; err[i] = abs(x); } } if( !changed ) { break; } } numroots = 0; bool visited[6] = {false}; for(int i = 0; i < 6; ++i) { if( !visited[i] ) { // might be a multiple root, in which case it will have more error than the other roots // find any neighboring roots, and take the average complex<IkReal> newroot=roots[i]; int n = 1; for(int j = i+1; j < 6; ++j) { // care about error in real much more than imaginary if( abs(real(roots[i])-real(roots[j])) < tolsqrt && abs(imag(roots[i])-imag(roots[j])) < 0.002 ) { newroot += roots[j]; n += 1; visited[j] = true; } } if( n > 1 ) { newroot /= n; } // there are still cases where even the mean is not accurate enough, until a better multi-root algorithm is used, need to use the sqrt if( IKabs(imag(newroot)) < tolsqrt ) { rawroots[numroots++] = real(newroot); } } } } static inline void polyroots8(IkReal rawcoeffs[8+1], IkReal rawroots[8], int& numroots) { using std::complex; if( rawcoeffs[0] == 0 ) { // solve with one reduced degree polyroots7(&rawcoeffs[1], &rawroots[0], numroots); return; } IKFAST_ASSERT(rawcoeffs[0] != 0); const IkReal tol = 128.0*std::numeric_limits<IkReal>::epsilon(); const IkReal tolsqrt = sqrt(std::numeric_limits<IkReal>::epsilon()); complex<IkReal> coeffs[8]; const int maxsteps = 110; for(int i = 0; i < 8; ++i) { coeffs[i] = complex<IkReal>(rawcoeffs[i+1]/rawcoeffs[0]); } complex<IkReal> roots[8]; IkReal err[8]; roots[0] = complex<IkReal>(1,0); roots[1] = complex<IkReal>(0.4,0.9); // any complex number not a root of unity works err[0] = 1.0; err[1] = 1.0; for(int i = 2; i < 8; ++i) { roots[i] = roots[i-1]*roots[1]; err[i] = 1.0; } for(int step = 0; step < maxsteps; ++step) { bool changed = false; for(int i = 0; i < 8; ++i) { if ( err[i] >= tol ) { changed = true; // evaluate complex<IkReal> x = roots[i] + coeffs[0]; for(int j = 1; j < 8; ++j) { x = roots[i] * x + coeffs[j]; } for(int j = 0; j < 8; ++j) { if( i != j ) { if( roots[i] != roots[j] ) { x /= (roots[i] - roots[j]); } } } roots[i] -= x; err[i] = abs(x); } } if( !changed ) { break; } } numroots = 0; bool visited[8] = {false}; for(int i = 0; i < 8; ++i) { if( !visited[i] ) { // might be a multiple root, in which case it will have more error than the other roots // find any neighboring roots, and take the average complex<IkReal> newroot=roots[i]; int n = 1; for(int j = i+1; j < 8; ++j) { // care about error in real much more than imaginary if( abs(real(roots[i])-real(roots[j])) < tolsqrt && abs(imag(roots[i])-imag(roots[j])) < 0.002 ) { newroot += roots[j]; n += 1; visited[j] = true; } } if( n > 1 ) { newroot /= n; } // there are still cases where even the mean is not accurate enough, until a better multi-root algorithm is used, need to use the sqrt if( IKabs(imag(newroot)) < tolsqrt ) { rawroots[numroots++] = real(newroot); } } } } }; /// solves the inverse kinematics equations. /// \param pfree is an array specifying the free joints of the chain. IKFAST_API bool ComputeIk(const IkReal* eetrans, const IkReal* eerot, const IkReal* pfree, IkSolutionListBase<IkReal>& solutions) { IKSolver solver; return solver.ComputeIk(eetrans,eerot,pfree,solutions); } IKFAST_API bool ComputeIk2(const IkReal* eetrans, const IkReal* eerot, const IkReal* pfree, IkSolutionListBase<IkReal>& solutions, void* pOpenRAVEManip) { IKSolver solver; return solver.ComputeIk(eetrans,eerot,pfree,solutions); } IKFAST_API const char* GetKinematicsHash() { return ""; } IKFAST_API const char* GetIkFastVersion() { return "0x1000004a"; } #ifdef IKFAST_NAMESPACE } // end namespace #endif #ifndef IKFAST_NO_MAIN #include <stdio.h> #include <stdlib.h> #ifdef IKFAST_NAMESPACE using namespace IKFAST_NAMESPACE; #endif int main(int argc, char** argv) { if( argc != 12+GetNumFreeParameters()+1 ) { printf("\nUsage: ./ik r00 r01 r02 t0 r10 r11 r12 t1 r20 r21 r22 t2 free0 ...\n\n" "Returns the ik solutions given the transformation of the end effector specified by\n" "a 3x3 rotation R (rXX), and a 3x1 translation (tX).\n" "There are %d free parameters that have to be specified.\n\n",GetNumFreeParameters()); return 1; } IkSolutionList<IkReal> solutions; std::vector<IkReal> vfree(GetNumFreeParameters()); IkReal eerot[9],eetrans[3]; eerot[0] = atof(argv[1]); eerot[1] = atof(argv[2]); eerot[2] = atof(argv[3]); eetrans[0] = atof(argv[4]); eerot[3] = atof(argv[5]); eerot[4] = atof(argv[6]); eerot[5] = atof(argv[7]); eetrans[1] = atof(argv[8]); eerot[6] = atof(argv[9]); eerot[7] = atof(argv[10]); eerot[8] = atof(argv[11]); eetrans[2] = atof(argv[12]); for(std::size_t i = 0; i < vfree.size(); ++i) vfree[i] = atof(argv[13+i]); bool bSuccess = ComputeIk(eetrans, eerot, vfree.size() > 0 ? &vfree[0] : NULL, solutions); if( !bSuccess ) { fprintf(stderr,"Failed to get ik solution\n"); return -1; } printf("Found %d ik solutions:\n", (int)solutions.GetNumSolutions()); std::vector<IkReal> solvalues(GetNumJoints()); for(std::size_t i = 0; i < solutions.GetNumSolutions(); ++i) { const IkSolutionBase<IkReal>& sol = solutions.GetSolution(i); printf("sol%d (free=%d): ", (int)i, (int)sol.GetFree().size()); std::vector<IkReal> vsolfree(sol.GetFree().size()); sol.GetSolution(&solvalues[0],vsolfree.size()>0?&vsolfree[0]:NULL); for( std::size_t j = 0; j < solvalues.size(); ++j) printf("%.15f, ", solvalues[j]); printf("\n"); } return 0; } #endif //// START static PyObject *left_arm_ik(PyObject *self, PyObject *args) { IkSolutionList<IkReal> solutions; // Should only have two free parameters (torso and upper arm) std::vector<IkReal> vfree(GetNumFreeParameters()); IkReal eerot[9], eetrans[3]; // First list if 3x3 rotation matrix, easier to compute in Python. // Next list is [x, y, z] translation matrix. // Last list is free joints (torso and upper arm roll (in that order)). PyObject *rotList; // 3x3 rotation matrix PyObject *transList; // [x,y,z] PyObject *freeList; // [torso, upper arm] if(!PyArg_ParseTuple(args, "O!O!O!", &PyList_Type, &rotList, &PyList_Type, &transList, &PyList_Type, &freeList)) { return NULL; } for(std::size_t i = 0; i < 3; ++i) { eetrans[i] = PyFloat_AsDouble(PyList_GetItem(transList, i)); PyObject* rowList = PyList_GetItem(rotList, i); for( std::size_t j = 0; j < 3; ++j) { eerot[3*i + j] = PyFloat_AsDouble(PyList_GetItem(rowList, j)); } } for(int i = 0; i < GetNumFreeParameters(); ++i) { vfree[i] = PyFloat_AsDouble(PyList_GetItem(freeList, i)); } // I don't understand why we pass &vfree[0] instead of just vfree. // Clearly ComputeIk takes an IkReal* parameter there, but it treats that parameter like an array. // It probably does work because the computeIk call in main specifically makes this change. // So it's hopefully right, and I don't understand because I don't know C++. bool bSuccess = ComputeIk(eetrans, eerot, &vfree[0], solutions); if (!bSuccess) { return Py_BuildValue(""); // Equivalent to returning None } // There are 8 joints in each solution (torso + 7 arm joints). std::vector<IkReal> solvalues(GetNumJoints()); PyObject *solutionList = PyList_New(solutions.GetNumSolutions()); for(std::size_t i = 0; i < solutions.GetNumSolutions(); ++i) { const IkSolutionBase<IkReal>& sol = solutions.GetSolution(i); std::vector<IkReal> vsolfree(sol.GetFree().size()); sol.GetSolution(&solvalues[0],vsolfree.size()>0?&vsolfree[0]:NULL); PyObject *individualSolution = PyList_New(GetNumJoints()); for( std::size_t j = 0; j < solvalues.size(); ++j) { // I think IkReal is just a wrapper for double. So this should work. PyList_SetItem(individualSolution, j, PyFloat_FromDouble(solvalues[j])); } PyList_SetItem(solutionList, i, individualSolution); } return solutionList; } static PyObject *left_arm_fk(PyObject *self, PyObject *args) { std::vector<IkReal> joints(8); IkReal eerot[9], eetrans[3]; // First double is torso height. Next 7 doubles are arm joints PyObject *jointList; if(!PyArg_ParseTuple(args, "O!", &PyList_Type, &jointList)) { return NULL; } for(std::size_t i = 0; i < 8; ++i){ joints[i] = PyFloat_AsDouble(PyList_GetItem(jointList, i)); } ComputeFk(&joints[0], eetrans, eerot); PyObject *pose = PyList_New(2); PyObject *pos = PyList_New(3); PyObject *rot = PyList_New(3); for(std::size_t i = 0; i < 3; ++i) { PyList_SetItem(pos, i, PyFloat_FromDouble(eetrans[i])); PyObject *row = PyList_New(3); for( std::size_t j = 0; j < 3; ++j) { PyList_SetItem(row, j, PyFloat_FromDouble(eerot[3*i + j])); } PyList_SetItem(rot, i, row); } PyList_SetItem(pose, 0, pos); PyList_SetItem(pose, 1, rot); return pose; } static PyMethodDef ikLeftMethods[] = { {"get_ik", left_arm_ik, METH_VARARGS, "Compute ik solutions using ikfast."}, {"get_fk", left_arm_fk, METH_VARARGS, "Compute fk solutions using ikfast."}, // TODO: deprecate {"leftIK", left_arm_ik, METH_VARARGS, "Compute IK for the PR2's left arm."}, {"leftFK", left_arm_fk, METH_VARARGS, "Compute FK for the PR2's left arm."}, {NULL, NULL, 0, NULL} // Not sure why/if this is needed. It shows up in the examples though(something about Sentinel). }; // OLD WAY /*#if PY_MAJOR_VERSION >= 3 //// This is the python3.4 version. static struct PyModuleDef ikLeftModule = { PyModuleDef_HEAD_INIT, "ikLeft", NULL, -1, ikLeftMethods }; PyMODINIT_FUNC PyInit_ikLeft(void) { return PyModule_Create(&ikLeftModule); } #else //// This is the python2.7 version. PyMODINIT_FUNC initikLeft(void) { (void) Py_InitModule("ikLeft", ikLeftMethods); } #endif*/ // NEW WAY #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef ikLeftModule = { PyModuleDef_HEAD_INIT, "ikLeft", /* name of module */ NULL, /* module documentation, may be NULL */ -1, /* size of per-interpreter state of the module, or -1 if the module keeps state in global variables. */ ikLeftMethods }; #define INITERROR return NULL PyMODINIT_FUNC PyInit_ikLeft(void) #else // PY_MAJOR_VERSION < 3 #define INITERROR return PyMODINIT_FUNC initikLeft(void) #endif { #if PY_MAJOR_VERSION >= 3 PyObject *module = PyModule_Create(&ikLeftModule); #else PyObject *module = Py_InitModule("ikLeft", ikLeftMethods); #endif if (module == NULL) INITERROR; #if PY_MAJOR_VERSION >= 3 return module; #endif } //// END
413,242
C++
30.439668
874
0.634328
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/pybullet_tools/ikfast/pr2/setup_old.py
#!/usr/bin/env python from __future__ import print_function import os, shutil, sys #sys.args.append('build') from distutils.core import setup, Extension # pr2_without_sensor_ik_files # python setup.py build LEFT_IK = 'ikLeft' RIGHT_IK = 'ikRight' LIBRARY_TEMPLATE = '{}.so' leftModule = Extension(LEFT_IK, sources=['left_arm_ik.cpp']) rightModule = Extension(RIGHT_IK, sources=['right_arm_ik.cpp']) setup(name=LEFT_IK, version='1.0', description="IK for PR2's left arm", ext_modules=[leftModule]) setup(name=RIGHT_IK, version='1.0', description="IK for PR2's right arm", ext_modules=[rightModule]) LEFT_LIBRARY = LIBRARY_TEMPLATE.format(LEFT_IK) RIGHT_LIBRARY = LIBRARY_TEMPLATE.format(RIGHT_IK) ik_folder = os.getcwd() # TODO: refactor left_path = None right_path = None for dirpath, _, filenames in os.walk(os.getcwd()): if LEFT_LIBRARY in filenames: left_path = os.path.join(dirpath, LEFT_LIBRARY) if RIGHT_LIBRARY in filenames: right_path = os.path.join(dirpath, RIGHT_LIBRARY) left_target = os.path.join(ik_folder, LEFT_LIBRARY) right_target = os.path.join(ik_folder, RIGHT_LIBRARY) ik_files = os.listdir(ik_folder) if LEFT_LIBRARY in ik_files: os.remove(left_target) if RIGHT_IK in ik_files: os.remove(right_target) os.rename(left_path, left_target) os.rename(right_path, right_target) build_folder = os.path.join(os.getcwd(), 'build') shutil.rmtree(build_folder) try: import ikLeft, ikRight print('IK Successful') except ImportError as e: print('IK Failed') raise e
1,506
Python
22.546875
63
0.727092
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/pybullet_tools/ikfast/hsrb/ik.py
import random import numpy as np import pybullet as p from scipy.spatial.transform import Rotation as R from ..utils import get_ik_limits, compute_forward_kinematics, compute_inverse_kinematics, select_solution, \ USE_ALL, USE_CURRENT from ...hsrb_utils import HSR_TOOL_FRAMES, get_torso_arm_joints, get_base_joints, \ get_gripper_link, get_arm_joints, get_base_arm_joints from ...utils import multiply, get_link_pose, link_from_name, get_joint_positions, \ joint_from_name, invert, all_between, sub_inverse_kinematics, set_joint_positions, \ inverse_kinematics, get_joint_positions, pairwise_collision, \ get_custom_limits, get_custom_limits_with_base from ...ikfast.utils import IKFastInfo BASE_FRAME = 'base_footprint' TORSO_JOINT = 'torso_lift_joint' ROTATION_JOINT = 'joint_rz' LIFT_JOINT = 'arm_lift_joint' IK_FRAME = {'arm': 'hand_palm_link'} ##################################### HSRB_INFOS = {arm: IKFastInfo( module_name='hsrb.ikArm', base_link=BASE_FRAME, ee_link=IK_FRAME[arm], free_joints=[TORSO_JOINT] ) for arm in IK_FRAME} def get_if_info(arm): return HSRB_INFOS[arm] ##################################### def get_tool_pose(robot, arm): from .ikArm import armFK arm_fk = {'arm': armFK} ik_joints = get_base_arm_joints(robot, arm) conf = get_joint_positions(robot, ik_joints) assert len(conf) == 8 base_from_tool = compute_forward_kinematics(arm_fk[arm], conf) world_from_base = get_link_pose(robot, link_from_name(robot, BASE_FRAME)) return multiply(world_from_base, base_from_tool) ##################################### def is_ik_compiled(): try: from .ikArm import armIK return True except ImportError: return False def get_ikfast_generator(robot, arm, ik_pose, rotation_limits=USE_ALL, lift_limits=USE_ALL, custom_limits={}): from .ikArm import armIK arm_ik = {'arm': armIK} world_from_base = get_link_pose(robot, link_from_name(robot, BASE_FRAME)) base_from_ik = multiply(invert(world_from_base), ik_pose) sampled_joints = [joint_from_name(robot, name) for name in [ROTATION_JOINT, LIFT_JOINT]] sampled_limits = [get_ik_limits(robot, joint, limits) for joint, limits in zip(sampled_joints, [rotation_limits, lift_limits])] arm_joints = get_arm_joints(robot, arm) base_joints = get_base_joints(robot, arm) min_limits, max_limits = get_custom_limits_with_base(robot, arm_joints, base_joints, custom_limits) # arm_rot = R.from_quat(ik_pose[1]).as_euler('xyz')[0] arm_rot = np.pi # TODO: modify sampled_limits = [(arm_rot-np.pi, arm_rot-np.pi), (0.0, 0.34)] while True: sampled_values = [random.uniform(*limits) for limits in sampled_limits] confs = compute_inverse_kinematics(arm_ik[arm], base_from_ik, sampled_values) solutions = [q for q in confs if all_between(min_limits, q, max_limits)] yield solutions if all(lower == upper for lower, upper in sampled_limits): break def get_pybullet_generator(robot, arm, ik_pose, torso_limits=USE_ALL, upper_limits=USE_ALL, custom_limits={}): world_from_base = get_link_pose(robot, link_from_name(robot, BASE_FRAME)) base_from_ik = multiply(invert(world_from_base), ik_pose) sampled_joints = [joint_from_name(robot, name) for name in [TORSO_JOINT]] sampled_limits = [get_ik_limits(robot, joint, limits) for joint, limits in zip(sampled_joints, [torso_limits])] arm_joints = get_torso_arm_joints(robot, arm) min_limits, max_limits = get_custom_limits(robot, arm_joints, custom_limits) while True: sampled_values = [random.uniform(*limits) for limits in sampled_limits] confs = inverse_kinematics(robot, 35, base_from_ik) confs = ((confs[3], confs[6], confs[7], confs[8], confs[9], 1.0),) solutions = [q for q in confs if all_between(min_limits, q, max_limits)] yield solutions if all(lower == upper for lower, upper in sampled_limits): break def get_tool_from_ik(robot, arm): world_from_tool = get_link_pose(robot, link_from_name(robot, HSR_TOOL_FRAMES[arm])) world_from_ik = get_link_pose(robot, link_from_name(robot, IK_FRAME[arm])) return multiply(invert(world_from_tool), world_from_ik) def sample_tool_ik(robot, arm, tool_pose, nearby_conf=USE_CURRENT, max_attempts=100, solver='ikfast', **kwargs): ik_pose = multiply(tool_pose, get_tool_from_ik(robot, arm)) if solver == 'ikfast': generator = get_ikfast_generator(robot, arm, ik_pose, **kwargs) elif solver == 'pybullet': generator = get_pybullet_generator(robot, arm, ik_pose, **kwargs) else: pass # generator = get_pinocchio_generator(robot, arm, ik_pose, **kwargs) base_arm_joints = get_base_arm_joints(robot, arm) for _ in range(max_attempts): try: solutions = next(generator) if solutions: return select_solution(robot, base_arm_joints, solutions, nearby_conf=nearby_conf) except StopIteration: break return None def hsr_inverse_kinematics(robot, arm, gripper_pose, obstacles=[], custom_limits={}, solver='ikfast', set_pose=True, **kwargs): arm_link = get_gripper_link(robot, arm) arm_joints = get_arm_joints(robot, arm) base_arm_joints = get_base_arm_joints(robot, arm) if is_ik_compiled(): ik_joints = get_base_arm_joints(robot, arm) base_arm_conf = sample_tool_ik(robot, arm, gripper_pose, custom_limits=custom_limits, solver=solver, **kwargs) if base_arm_conf is None: return None if set_pose: set_joint_positions(robot, ik_joints, base_arm_conf) else: arm_conf = sub_inverse_kinematics(robot, arm_joints[0], arm_link, gripper_pose, custom_limits=custom_limits) if arm_conf is None: return None if any(pairwise_collision(robot, b) for b in obstacles): return None return get_joint_positions(robot, base_arm_joints)
6,266
Python
40.78
131
0.630386
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/pybullet_tools/ikfast/hsrb/setup.py
#!/usr/bin/env python from __future__ import print_function import sys import os sys.path.append(os.path.join(os.pardir, os.pardir, os.pardir)) from pybullet_tools.ikfast.compile import compile_ikfast # Build C++ extension by running: 'python setup.py' # see: https://docs.python.org/3/extending/building.html ARMS = ['arm'] def main(): sys.argv[:] = sys.argv[:1] + ['build'] compile_ikfast(module_name='ikArm', cpp_filename='arm_ik.cpp') if __name__ == '__main__': main()
492
Python
21.40909
66
0.674797
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/models/dinnerware/generate.py
from __future__ import print_function import numpy as np class Obj: def __init__(self, fn): self.ind_v = 0 self.ind_vt = 0 self.ind_vn = 0 self.fn = fn self.out = open(fn + ".tmp", "w") self.out.write("mtllib dinnerware.mtl\n") def __del__(self): self.out.close() import shutil shutil.move(self.fn + ".tmp", self.fn) def push_v(self, v): self.out.write("v %f %f %f\n" % (v[0],v[1],v[2])) self.ind_v += 1 return self.ind_v def push_vt(self, vt): self.out.write("vt %f %f\n" % (vt[0],vt[1])) self.ind_vt += 1 return self.ind_vt def push_vn(self, vn): vn /= np.linalg.norm(vn) self.out.write("vn %f %f %f\n" % (vn[0],vn[1],vn[2])) self.ind_vn += 1 return self.ind_vn def convex_hull(points, vind, nind, tind, obj): "super ineffective" cnt = len(points) for a in range(cnt): for b in range(a+1,cnt): for c in range(b+1,cnt): vec1 = points[a] - points[b] vec2 = points[a] - points[c] n = np.cross(vec1, vec2) n /= np.linalg.norm(n) C = np.dot(n, points[a]) inner = np.inner(n, points) pos = (inner <= C+0.0001).all() neg = (inner >= C-0.0001).all() if not pos and not neg: continue obj.out.write("f %i//%i %i//%i %i//%i\n" % ( (vind[a], nind[a], vind[b], nind[b], vind[c], nind[c]) if (inner - C).sum() < 0 else (vind[a], nind[a], vind[c], nind[c], vind[b], nind[b]) ) ) #obj.out.write("f %i/%i/%i %i/%i/%i %i/%i/%i\n" % ( # (vind[a], tind[a], nind[a], vind[b], tind[b], nind[b], vind[c], tind[c], nind[c]) # if (inner - C).sum() < 0 else # (vind[a], tind[a], nind[a], vind[c], tind[c], nind[c], vind[b], tind[b], nind[b]) ) ) def test_convex_hull(): obj = Obj("convex_test.obj") vlist = np.random.uniform( low=-0.1, high=+0.1, size=(100,3) ) nlist = vlist.copy() tlist = np.random.uniform( low=0, high=+1, size=(100,2) ) vind = [obj.push_v(xyz) for xyz in vlist] nind = [obj.push_vn(xyz) for xyz in nlist] tind = [obj.push_vt(uv) for uv in tlist] convex_hull(vlist, vind, nind, tind, obj) class Contour: def __init__(self): self.vprev_vind = None def f(self, obj, vlist_vind, vlist_tind, vlist_nind): cnt = len(vlist_vind) for i1 in range(cnt): i2 = i1-1 obj.out.write("f %i/%i/%i %i/%i/%i %i/%i/%i\n" % ( vlist_vind[i2], vlist_tind[i2], vlist_nind[i2], vlist_vind[i1], vlist_tind[i1], vlist_nind[i1], self.vprev_vind[i1], self.vprev_tind[i1], self.vprev_nind[i1], ) ) obj.out.write("f %i/%i/%i %i/%i/%i %i/%i/%i\n" % ( vlist_vind[i2], vlist_tind[i2], vlist_nind[i2], self.vprev_vind[i1], self.vprev_tind[i1], self.vprev_nind[i1], self.vprev_vind[i2], self.vprev_tind[i2], self.vprev_nind[i2], ) ) def belt(self, obj, vlist, nlist, tlist): vlist_vind = [obj.push_v(xyz) for xyz in vlist] vlist_tind = [obj.push_vt(xyz) for xyz in tlist] vlist_nind = [obj.push_vn(xyz) for xyz in nlist] if self.vprev_vind: self.f(obj, vlist_vind, vlist_tind, vlist_nind) else: self.first_vind = vlist_vind self.first_tind = vlist_tind self.first_nind = vlist_nind self.vprev_vind = vlist_vind self.vprev_tind = vlist_tind self.vprev_nind = vlist_nind def finish(self, obj): self.f(obj, self.first_vind, self.first_tind, self.first_nind) def test_contour(): RAD1 = 2.0 RAD2 = 1.5 obj = Obj("torus.obj") obj.out.write("usemtl porcelain\n") contour = Contour() for step in range(100): angle = step/100.0*2*np.pi belt_v = [] belt_n = [] belt_t = [] for b in range(50): beta = b/50.0*2*np.pi r = RAD2*np.cos(beta) + RAD1 z = RAD2*np.sin(beta) belt_v.append( np.array( [ np.cos(angle)*r, np.sin(angle)*r, z] ) ) belt_n.append( np.array( [ np.cos(angle)*np.cos(beta), np.sin(angle)*np.cos(beta), np.sin(beta)] ) ) belt_t.append( (0,0) ) contour.belt(obj, belt_v, belt_n, belt_t) contour.finish(obj) #test_convex_hull() #test_contour() class RotationFigureParams: pass def generate_plate(p, obj, collision_prefix): contour = Contour() belt_vlist_3d_prev = None for step in range(p.N_VIZ+1): angle = step/float(p.N_VIZ)*2*np.pi if step % p.COLLISION_EVERY == 0: vlist_3d = [] for x,y in p.belt_simple: vlist_3d.append( [ np.cos(angle)*x*1.06, np.sin(angle)*x*1.06, y ] ) if belt_vlist_3d_prev: obj2 = Obj(collision_prefix % (step / p.COLLISION_EVERY)) obj2.out.write("usemtl pan_tefal\n") vlist = np.array( vlist_3d + belt_vlist_3d_prev ) vlist[len(vlist_3d):] *= 1.01 # break points on one plane vlist[0,0:2] += 0.01*vlist[len(vlist_3d),0:2] vlist[len(vlist_3d),0:2] += 0.01*vlist[0,0:2] nlist = np.random.uniform( low=-1, high=+1, size=vlist.shape ) tlist = np.random.uniform( low=0, high=+1, size=(len(vlist),2) ) vind = [obj2.push_v(xyz) for xyz in vlist] nind = [obj2.push_vn(xyz) for xyz in nlist] convex_hull(vlist, vind, nind, None, obj2) belt_vlist_3d_prev = vlist_3d if step==p.N_VIZ: break belt_v = [] belt_n = [] belt_t = [] for x,y,nx,ny in p.belt: belt_v.append( np.array( [ np.cos(angle)*x, np.sin(angle)*x, y ] ) ) belt_n.append( np.array( [ np.cos(angle)*nx, np.sin(angle)*nx, ny ] ) ) if ny-nx >= 0: belt_t.append( ( 127.0/512 + np.cos(angle)*x/p.RAD_HIGH*105/512, (512-135.0)/512 + np.sin(angle)*x/p.RAD_HIGH*105/512) ) else: belt_t.append( ( 382.0/512 + np.cos(angle)*x/p.RAD_HIGH*125/512, (512-380.0)/512 + np.sin(angle)*x/p.RAD_HIGH*125/512) ) contour.belt(obj, belt_v, belt_n, belt_t) contour.finish(obj) def tefal(): p = RotationFigureParams() p.RAD_LOW = 0.240/2 p.RAD_HIGH = 0.255/2 p.H = 0.075 p.THICK = 0.005 p.N_VIZ = 30 p.COLLISION_EVERY = 5 p.belt = [ (p.RAD_HIGH-p.THICK, p.H, -1,0), # x y norm (p.RAD_HIGH , p.H, 0,1), (p.RAD_HIGH+p.THICK, p.H, +1,0), (p.RAD_LOW+p.THICK, p.THICK, +1,0), (p.RAD_LOW , 0, 0,-1), ( 0, 0, 0,-1), ( 0, p.THICK, 0,1), (p.RAD_LOW-p.THICK, p.THICK, 0,1), (p.RAD_LOW-p.THICK, 3*p.THICK,-1,0), ] p.belt.reverse() p.belt_simple = [ (p.RAD_HIGH-p.THICK, p.H), (p.RAD_HIGH+p.THICK, p.H), (p.RAD_LOW , 0), (p.RAD_LOW-p.THICK , 0) ] obj = Obj("pan_tefal.obj") obj.out.write("usemtl pan_tefal\n") generate_plate(p, obj, "pan_tefal-collision%02i.obj") def plate(): p = RotationFigureParams() p.RAD_LOW = 0.110/2 p.RAD_HIGH = 0.190/2 p.H = 0.060 p.THICK = 0.003 p.N_VIZ = 30 p.COLLISION_EVERY = 5 p.belt = [ (p.RAD_HIGH-p.THICK, p.H, -0.9,0.5), # x y norm (p.RAD_HIGH , p.H, 0,1), (p.RAD_HIGH+p.THICK, p.H, +1,0), (p.RAD_LOW+p.THICK, p.THICK, +1,0), (p.RAD_LOW , 0, 0,-1), ( 0, 0, 0,-1), ( 0, p.THICK, 0,1), (p.RAD_LOW-3*p.THICK, p.THICK, 0,1), (p.RAD_LOW-p.THICK, 3*p.THICK,-0.5,1.0), ] p.belt.reverse() p.belt_simple = [ (p.RAD_HIGH-p.THICK, p.H), (p.RAD_HIGH+p.THICK, p.H), (p.RAD_LOW , 0), (p.RAD_LOW-p.THICK , 0) ] obj = Obj("plate.obj") obj.out.write("usemtl solid_color\n") generate_plate(p, obj, "plate-collision%02i.obj") plate()
7,164
Python
27.320158
91
0.569654
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/models/drake/iiwa_description/README.md
Execute the following commands to regenerate the URDF files using xacro. Note that ROS Jade or newer must be used becase the xacro scripts make use of more expressive conditional statements [1]. ``` source /opt/ros/kinetic/setup.bash cd drake/manipulation/models export ROS_PACKAGE_PATH=`pwd`:$ROS_PACKAGE_PATH cd iiwa_description rosrun xacro xacro -o urdf/iiwa14_primitive_collision.urdf urdf/iiwa14_primitive_collision.urdf.xacro rosrun xacro xacro -o urdf/iiwa14_polytope_collision.urdf urdf/iiwa14_polytope_collision.urdf.xacro rosrun xacro xacro -o urdf/dual_iiwa14_polytope_collision.urdf urdf/dual_iiwa14_polytope_collision.urdf.xacro ``` [1] http://wiki.ros.org/xacro#Conditional_Blocks
698
Markdown
42.687497
109
0.809456
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/models/drake/iiwa_description/urdf/test/dual_iiwa14_polytope_collision_test.cc
#include <string> #include <gtest/gtest.h> #include "drake/common/find_resource.h" #include "drake/multibody/joints/floating_base_types.h" #include "drake/multibody/parsers/urdf_parser.h" #include "drake/multibody/rigid_body_tree.h" namespace drake { namespace manipulation { namespace { // Tests that dual_iiwa14_polytope_collision.urdf can be loaded into a // RigidBodyTree. This unit test also verifies that the URDF can be parsed by // the URDF parser. GTEST_TEST(DualIiwa14PolytopeCollisionTest, TestLoadTree) { const std::string kPath(FindResourceOrThrow( "drake/manipulation/models/iiwa_description/urdf/" "dual_iiwa14_polytope_collision.urdf")); auto tree = std::make_unique<RigidBodyTree<double>>(); parsers::urdf::AddModelInstanceFromUrdfFileToWorld( kPath, multibody::joints::kFixed, tree.get()); // Each robot has 8 bodies and an end effector with 2 bodies. In addition, // there are two bodies that are not part of either robot: world and base. // Since there are two robots, there should be a total of // 2 * (8 + 2) + 2 = 22 bodies in the tree. EXPECT_EQ(tree->get_num_bodies(), 22); // TODO(liang.fok) Once the URDF parser is able to recognize body and joint // name prefixes, the following test should expect that there be two model // instances. For more details, see #5317. EXPECT_EQ(tree->get_num_model_instances(), 1); } } // namespace } // namespace manipulation } // namespace drake
1,458
C++
34.585365
77
0.729081
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/models/drake/wsg_50_description/README.md
Execute the following commands to regenerate the URDF files using `xacro`. Note that ROS Jade or newer must be used because the `xacro` scripts make use of more expressive conditional statements [1]. ``` source /opt/ros/kinetic/setup.bash cd drake/manipulation/models export ROS_PACKAGE_PATH=`pwd`:$ROS_PACKAGE_PATH cd wsg_50_description rosrun xacro xacro -o urdf/wsg_50_mesh_collision.urdf urdf/wsg_50_mesh_collision.urdf.xacro ``` [1] http://wiki.ros.org/xacro#Conditional_Blocks
485
Markdown
33.714283
91
0.781443
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/models/drake/wsg_50_description/urdf/test/wsg50_mesh_collision_test.cc
#include <string> #include <gtest/gtest.h> #include "drake/common/find_resource.h" #include "drake/multibody/joints/floating_base_types.h" #include "drake/multibody/parsers/urdf_parser.h" #include "drake/multibody/rigid_body_tree.h" namespace drake { namespace manipulation { namespace { bool ends_with(const std::string& s, const std::string& suffix) { return s.rfind(suffix) == (s.size() - suffix.size()); } // Tests that wsg_50_mesh_collision.urdf can be loaded into a RigidBodyTree. // This unit test also verifies that the URDF can be parsed by the URDF parser. GTEST_TEST(Wsg50DescriptionTest, TestMeshCollisionModelLoadTree) { const std::string kPath(FindResourceOrThrow( "drake/manipulation/models/wsg_50_description/urdf/" "wsg_50_mesh_collision.urdf")); auto tree = std::make_unique<RigidBodyTree<double>>(); parsers::urdf::AddModelInstanceFromUrdfFileToWorld( kPath, multibody::joints::kFixed, tree.get()); const std::vector<std::string> expected_body_names { "world", "base_link", "gripper_left", "finger_left", "gripper_right", "finger_right"}; EXPECT_EQ(tree->get_num_bodies(), 6); for (int i = 0; i < tree->get_num_bodies(); ++i) { EXPECT_TRUE(ends_with(tree->get_body(i).get_name(), expected_body_names.at(i))); } EXPECT_EQ(tree->get_num_model_instances(), 1); EXPECT_EQ(tree->get_num_positions(), 2); EXPECT_EQ(tree->get_num_velocities(), 2); } } // namespace } // namespace manipulation } // namespace drake
1,545
C++
28.730769
79
0.677023
makolon/hsr_isaac_tamp/hsr_tamp/experiments/env_3d/utils/models/drake/jaco_description/urdf/test/jaco_arm_test.cc
#include <string> #include <gtest/gtest.h> #include "drake/common/find_resource.h" #include "drake/multibody/joints/floating_base_types.h" #include "drake/multibody/parsers/urdf_parser.h" #include "drake/multibody/rigid_body_tree.h" namespace drake { namespace manipulation { namespace { // Tests that j2n6s300.urdf can be loaded into a RigidBodyTree. This // unit test also verifies that the URDF can be parsed by the URDF // parser. GTEST_TEST(JacoArmTest, TestLoad6DofTree) { const std::string kPath(FindResourceOrThrow( "drake/manipulation/models/jaco_description/urdf/" "j2n6s300.urdf")); auto tree = std::make_unique<RigidBodyTree<double>>(); parsers::urdf::AddModelInstanceFromUrdfFileToWorld( kPath, multibody::joints::kFixed, tree.get()); // There should be actuators for all 6 degrees of freedom and 3 // fingers. EXPECT_EQ(tree->get_num_actuators(), 9); // Each robot has 6 bodies, an end effector, and with 6 finger // bodies. In addition, there are three bodies that are not part of // the robot: world, root, and base. Hence, there should be a total // of 6 + 1 + 6 + 3 = 16 bodies in the tree. EXPECT_EQ(tree->get_num_bodies(), 16); } // Tests that j2s7s300.urdf can be loaded into a RigidBodyTree. This // unit test also verifies that the URDF can be parsed by the URDF // parser. GTEST_TEST(JacoArmTest, TestLoad7DofTree) { const std::string kPath(FindResourceOrThrow( "drake/manipulation/models/jaco_description/urdf/" "j2s7s300.urdf")); auto tree = std::make_unique<RigidBodyTree<double>>(); parsers::urdf::AddModelInstanceFromUrdfFileToWorld( kPath, multibody::joints::kFixed, tree.get()); // There should be actuators for all 7 degrees of freedom and 3 // fingers. EXPECT_EQ(tree->get_num_actuators(), 10); // Each robot has 7 bodies, an end effector, and with 6 finger // bodies. In addition, there are three bodies that are not part of // the robot: world, root, and base. Hence, there should be a total // of 7 + 1 + 6 + 3 = 16 bodies in the tree. EXPECT_EQ(tree->get_num_bodies(), 17); } } // namespace } // namespace manipulation } // namespace drake
2,172
C++
33.492063
70
0.709945
makolon/hsr_isaac_tamp/hsr_tamp/downward/CHANGES.md
# Release notes Fast Downward has been in development since 2003, but the current timed release model was not adopted until 2019. This file documents the changes since the first timed release, Fast Downward 19.06. For more details, check the repository history (<https://github.com/aibasel/downward>) and the issue tracker (<http://issues.fast-downward.org>). Repository branches are named after the corresponding tracker issues. ## Changes since the last release - Add debugging methods to LP solver interface. <http://issues.fast-downward.org/issue960> You can now assign names to LP variables and constraints for easier debugging. Since this incurs a slight runtime penalty, we recommend against using this feature when running experiments. - Support integer variables in linear programs. <http://issues.fast-downward.org/issue891> You can now use the LP solver interface to solve mixed integer programs. In particular, the operator-counting heuristics now have an option `use_integer_operator_counts` that improves the heuristic value by forcing operator counts to take integer values. Solving a MIP is NP-hard and usually takes much longer than solving the corresponding LP. - For developers: move functionality used during search away from LandmarkGraph, making it constant after creation. <http://issues.fast-downward.org/issue988> <http://issues.fast-downward.org/issue1000> - For developers: new state class <http://issues.fast-downward.org/issue348> We unified the classes GlobalState and State into a new class also called State. This removed a lot of code duplication and hacks from the code. A description of the new class can be found in the wiki: <http://www.fast-downward.org/ForDevelopers/Blog/A%20Deeper%20Look%20at%20States> - For developers: introduce class for delete-relaxation based landmark factories and move usage of exploration object to subclasses of (abstract) landmark factory class. <http://issues.fast-downward.org/issue990> - For users: We removed options from LandmarkFactories that were not relevant, renamed the option "no_orders" to "use_orders" and changed the reasonable_orders option to a Factory. <http://issues.fast-downward.org/issue995> Removed options: lm_exhaust: disjunctive_landmarks, conjunctive_landmarks, no_orders, reasonable_orders lm_hm: disjunctive_landmarks, only_causal_landmarks, no_orders, reasonable_orders lm_merged: disjunctive_landmarks, conjunctive_landmarks, only_causal_landmarks, no_orders, reasonable_orders lm_rhw: conjunctive_landmarks, no_orders, reasonable_orders lm_zg: disjunctive_landmarks, conjunctive_landmarks, only_causal_landmarks, no_orders, reasonable_orders Added options: lm_hm/lm_rhw/lm_zg: use_orders (negation of removed option "no_orders") New Factory "lm_reasonable_orders_hps": This factory approximates reasonable orders according to Hoffman, Porteus and Sebastia ("Ordered Landmarks in Planning", JAIR 2004) and is equivalent to the removed option "reasonable_orders", i.e. the command line argument --evaluator hlm=lmcount(lm_factory=lm_reasonable_orders_hps(lm_rhw())) is equivalent to the removed command line argument --evaluator hlm=lmcount(lm_factory=lm_rhw(reasonable_orders=true)) - For developers: add support for Github actions <http://issues.fast-downward.org/issue940> - For developers: We cleaned up the code of LandmarkGraph. Some of the public methods were renamed. This class will undergo further changes in the future. <http://issues.fast-downward.org/issue989> - Debug builds with LP solvers vs. the _GLIBCXX_DEBUG flag <http://issues.fast-downward.org/issue982> Previously, we used the flag _GLIBCXX_DEBUG in debug builds for additional checks. This makes the binary incompatible with external libraries such as LP solvers. The flag is now disabled by default. If no LP solvers are present or LP solvers are disabled, it can be enabled by setting the CMake option USE_GLIBCXX_DEBUG. The build configurations debugnolp and releasenolp have been removed, and the build configuration glibcxx_debug has been added. - For developers: decide on rules regarding software support and improve Github actions accordingly <http://issues.fast-downward.org/issue1003> - For developers: add CPLEX support to our GitHub Actions for Windows <http://issues.fast-downward.org/issue1005> - Fix a bug in the computation of RHW landmarks <http://issues.fast-downward.org/issue1004> - Only build configurations defined in `build_configs.py` are loaded in the `build.py` script. <http://issues.fast-downward.org/issue1016> - Replace size_t by int for abstract state hashes in PDB-related code <http://issues.fast-downward.org/issue1018> - Integrate the pattern generation methods based on CEGAR <http://issues.fast-downward.org/issue1007> ## Fast Downward 20.06 Released on July 26, 2020. Highlights: - The Singularity and Docker distributions of the planner now include LP support using the SoPlex solver out of the box. Thank you to ZIB for their solver and for giving permission to include it in the release. - The Vagrant distribution of the planner now includes LP support using the SoPlex and/or CPLEX solvers out of the box if they are made available when the virtual machine is first provisioned. See <http://www.fast-downward.org/QuickStart> for more information. - A long-standing bug in the computation of derived predicates has been fixed. Thanks to everyone who provided bug reports for their help and for their patience! - A new and much faster method for computing stubborn sets has been added to the planner. - The deprecated merge strategy aliases `merge_linear` and `merge_dfp` have been removed. Details: - Fix crash of `--show-aliases` option of fast-downward.py. - Fix incorrect computation of derived predicates. <http://issues.fast-downward.org/issue453> Derived predicates that were only needed in negated form and cyclically depended on other derived predicates could be computed incorrectly. - Integrate new pruning method `atom_centric_stubborn_sets`. <http://issues.fast-downward.org/issue781> We merged the code for the SoCS 2020 paper "An Atom-Centric Perspective on Stubborn Sets" (<https://ai.dmi.unibas.ch/papers/roeger-et-al-socs2020.pdf>). See <http://www.fast-downward.org/Doc/PruningMethod>. - Remove deprecated merge strategy aliases `merge_linear` and `merge_dfp`. The deprecated merge strategy aliases `merge_linear` for linear merge strategies and `merge_dfp` for the DFP merge strategy are no longer available. See http://www.fast-downward.org/Doc/MergeStrategy for equivalent command line options to use these merge strategies. - For developers: use global logging mechanism for all output. <http://issues.fast-downward.org/issue963> All output of the planner is now handled by a global logging mechanism, which prefaces printed lines with time and memory information. For developers, this means that output should no longer be passed to `cout` but to `utils::g_log`. Further changes to logging are in the works. - For developers: store enum options as enums (not ints) in Options objects. <http://issues.fast-downward.org/issue962> - For developers: allow creating Timers in stopped state. <http://issues.fast-downward.org/issue965> ## Fast Downward 19.12 Released on December 20, 2019. Highlights: - Fast Downward no longer supports Python 2.7, which reaches its end of support on January 1, 2020. The minimum supported Python version is now 3.6. - Fast Downward now supports the SoPlex LP solver. Details: - general: raise minimum supported Python version to 3.6 <http://issues.fast-downward.org/issue939> Fast Downward now requires Python 3.6 or newer; support for Python 2.7 and Python 3.2-3.5 has been dropped. The main reason for this change is Python 2 reaching its end of support on January 1, 2020. See https://python3statement.org/ for more background. - LP solver: add support for the solver [SoPlex](https://soplex.zib.de/) <http://issues.fast-downward.org/issue752> The relative performance of CPLEX and SoPlex depends on the domain and configuration with each solver outperforming the other in some cases. See the issue for a more detailed discussion of performance. - LP solver: add support for version 12.9 of CPLEX <http://issues.fast-downward.org/issue925> Older versions are still supported but we recommend using 12.9. In our experiments, we saw performance differences between version 12.8 and 12.9, as well as between using static and dynamic linking. However, on average there was no significant advantage for any configuration. See the issue for details. - LP solver: update build instructions of the open solver interface <http://issues.fast-downward.org/issue752> <http://issues.fast-downward.org/issue925> The way we recommend building OSI now links dynamically against the solvers and uses zlib. If your existing OSI installation stops working, try installing zlib (sudo apt install zlib1g-dev) or re-install OSI (http://www.fast-downward.org/LPBuildInstructions). - merge-and-shrink: remove trivial factors <http://issues.fast-downward.org/issue914> When the merge-and-shrink computation terminates with several factors (due to using a time limit), only keep those factors that are non-trivial, i.e., which have a non-goal state or which represent a non-total function. - tests: use pytest for running most tests <http://issues.fast-downward.org/issue935> <http://issues.fast-downward.org/issue936> - tests: test Python code with all supported Python versions using tox <http://issues.fast-downward.org/issue930> - tests: adjust style of Python code as suggested by flake8 and add this style check to the continuous integration test suite <http://issues.fast-downward.org/issue929> <http://issues.fast-downward.org/issue931> <http://issues.fast-downward.org/issue934> - scripts: move Stone Soup generator scripts to separate repository at https://github.com/aibasel/stonesoup. <http://issues.fast-downward.org/issue932> ## Fast Downward 19.06 Released on June 11, 2019. First time-based release.
10,274
Markdown
41.991632
83
0.771559
makolon/hsr_isaac_tamp/hsr_tamp/downward/build_configs.py
release = ["-DCMAKE_BUILD_TYPE=Release"] debug = ["-DCMAKE_BUILD_TYPE=Debug"] # USE_GLIBCXX_DEBUG is not compatible with USE_LP (see issue983). glibcxx_debug = ["-DCMAKE_BUILD_TYPE=Debug", "-DUSE_LP=NO", "-DUSE_GLIBCXX_DEBUG=YES"] minimal = ["-DCMAKE_BUILD_TYPE=Release", "-DDISABLE_PLUGINS_BY_DEFAULT=YES"] DEFAULT = "release" DEBUG = "debug"
345
Python
37.44444
86
0.704348
makolon/hsr_isaac_tamp/hsr_tamp/downward/fast-downward.py
#! /usr/bin/env python3 if __name__ == "__main__": from driver.main import main main()
96
Python
15.166664
32
0.5625
makolon/hsr_isaac_tamp/hsr_tamp/downward/build.py
#!/usr/bin/env python3 import errno import multiprocessing import os import subprocess import sys import build_configs CONFIGS = {config: params for config, params in build_configs.__dict__.items() if not config.startswith("_")} DEFAULT_CONFIG_NAME = CONFIGS.pop("DEFAULT") DEBUG_CONFIG_NAME = CONFIGS.pop("DEBUG") CMAKE = "cmake" DEFAULT_MAKE_PARAMETERS = [] if os.name == "posix": MAKE = "make" try: num_cpus = multiprocessing.cpu_count() except NotImplementedError: pass else: DEFAULT_MAKE_PARAMETERS.append('-j{}'.format(num_cpus)) CMAKE_GENERATOR = "Unix Makefiles" elif os.name == "nt": MAKE = "nmake" CMAKE_GENERATOR = "NMake Makefiles" else: print("Unsupported OS: " + os.name) sys.exit(1) def print_usage(): script_name = os.path.basename(__file__) configs = [] for name, args in sorted(CONFIGS.items()): if name == DEFAULT_CONFIG_NAME: name += " (default)" if name == DEBUG_CONFIG_NAME: name += " (default with --debug)" configs.append(name + "\n " + " ".join(args)) configs_string = "\n ".join(configs) cmake_name = os.path.basename(CMAKE) make_name = os.path.basename(MAKE) generator_name = CMAKE_GENERATOR.lower() default_config_name = DEFAULT_CONFIG_NAME debug_config_name = DEBUG_CONFIG_NAME print("""Usage: {script_name} [BUILD [BUILD ...]] [--all] [--debug] [MAKE_OPTIONS] Build one or more predefined build configurations of Fast Downward. Each build uses {cmake_name} to generate {generator_name} and then uses {make_name} to compile the code. Build configurations differ in the parameters they pass to {cmake_name}. By default, the build uses N threads on a machine with N cores if the number of cores can be determined. Use the "-j" option for {cmake_name} to override this default behaviour. Build configurations {configs_string} --all Alias to build all build configurations. --debug Alias to build the default debug build configuration. --help Print this message and exit. Make options All other parameters are forwarded to {make_name}. Example usage: ./{script_name} # build {default_config_name} in #cores threads ./{script_name} -j4 # build {default_config_name} in 4 threads ./{script_name} debug # build debug ./{script_name} --debug # build {debug_config_name} ./{script_name} release debug # build release and debug configs ./{script_name} --all VERBOSE=true # build all build configs with detailed logs """.format(**locals())) def get_project_root_path(): import __main__ return os.path.dirname(__main__.__file__) def get_builds_path(): return os.path.join(get_project_root_path(), "builds") def get_src_path(): return os.path.join(get_project_root_path(), "src") def get_build_path(config_name): return os.path.join(get_builds_path(), config_name) def try_run(cmd, cwd): print('Executing command "{}" in directory "{}".'.format(" ".join(cmd), cwd)) try: subprocess.check_call(cmd, cwd=cwd) except OSError as exc: if exc.errno == errno.ENOENT: print("Could not find '%s' on your PATH. For installation instructions, " "see http://www.fast-downward.org/ObtainingAndRunningFastDownward." % cmd[0]) sys.exit(1) else: raise def build(config_name, cmake_parameters, make_parameters): print("Building configuration {config_name}.".format(**locals())) build_path = get_build_path(config_name) rel_src_path = os.path.relpath(get_src_path(), build_path) try: os.makedirs(build_path) except OSError as exc: if exc.errno == errno.EEXIST and os.path.isdir(build_path): pass else: raise try_run([CMAKE, "-G", CMAKE_GENERATOR] + cmake_parameters + [rel_src_path], cwd=build_path) try_run([MAKE] + make_parameters, cwd=build_path) print("Built configuration {config_name} successfully.".format(**locals())) def main(): config_names = set() make_parameters = DEFAULT_MAKE_PARAMETERS for arg in sys.argv[1:]: if arg == "--help" or arg == "-h": print_usage() sys.exit(0) elif arg == "--debug": config_names.add(DEBUG_CONFIG_NAME) elif arg == "--all": config_names |= set(CONFIGS.keys()) elif arg in CONFIGS: config_names.add(arg) else: make_parameters.append(arg) if not config_names: config_names.add(DEFAULT_CONFIG_NAME) for config_name in config_names: build(config_name, CONFIGS[config_name], make_parameters) if __name__ == "__main__": main()
4,830
Python
31.206666
87
0.624638
makolon/hsr_isaac_tamp/hsr_tamp/downward/README.md
# Fast Downward Fast Downward is a domain-independent classical planning system. Copyright 2003-2020 Fast Downward contributors (see below). For further information: - Fast Downward website: <http://www.fast-downward.org> - Report a bug or file an issue: <http://issues.fast-downward.org> - Fast Downward mailing list: <https://groups.google.com/forum/#!forum/fast-downward> - Fast Downward main repository: <https://github.com/aibasel/downward> ## Tested software versions This version of Fast Downward has been tested with the following software versions: | OS | Python | C++ compiler | CMake | | ------------ | ------ | ---------------------------------------------------------------- | ----- | | Ubuntu 20.04 | 3.8 | GCC 9, GCC 10, Clang 10, Clang 11 | 3.16 | | Ubuntu 18.04 | 3.6 | GCC 7, Clang 6 | 3.10 | | macOS 10.15 | 3.6 | AppleClang 12 | 3.19 | | Windows 10 | 3.6 | Visual Studio Enterprise 2017 (MSVC 19.16) and 2019 (MSVC 19.28) | 3.19 | We test LP support with CPLEX 12.9, SoPlex 3.1.1 and Osi 0.107.9. On Ubuntu, we test both CPLEX and SoPlex. On Windows, we currently only test CPLEX, and on macOS, we do not test LP solvers (yet). ## Contributors The following list includes all people that actively contributed to Fast Downward, i.e. all people that appear in some commits in Fast Downward's history (see below for a history on how Fast Downward emerged) or people that influenced the development of such commits. Currently, this list is sorted by the last year the person has been active, and in case of ties, by the earliest year the person started contributing, and finally by last name. - 2003-2020 Malte Helmert - 2008-2016, 2018-2020 Gabriele Roeger - 2010-2020 Jendrik Seipp - 2010-2011, 2013-2020 Silvan Sievers - 2012-2020 Florian Pommerening - 2013, 2015-2020 Salome Eriksson - 2016-2020 Cedric Geissmann - 2017-2020 Guillem Francès - 2018-2020 Augusto B. Corrêa - 2018-2020 Patrick Ferber - 2015-2019 Manuel Heusner - 2017 Daniel Killenberger - 2016 Yusra Alkhazraji - 2016 Martin Wehrle - 2014-2015 Patrick von Reth - 2015 Thomas Keller - 2009-2014 Erez Karpas - 2014 Robert P. Goldman - 2010-2012 Andrew Coles - 2010, 2012 Patrik Haslum - 2003-2011 Silvia Richter - 2009-2011 Emil Keyder - 2010-2011 Moritz Gronbach - 2010-2011 Manuela Ortlieb - 2011 Vidal Alcázar Saiz - 2011 Michael Katz - 2011 Raz Nissim - 2010 Moritz Goebelbecker - 2007-2009 Matthias Westphal - 2009 Christian Muise ## History The current version of Fast Downward is the merger of three different projects: - the original version of Fast Downward developed by Malte Helmert and Silvia Richter - LAMA, developed by Silvia Richter and Matthias Westphal based on the original Fast Downward - FD-Tech, a modified version of Fast Downward developed by Erez Karpas and Michael Katz based on the original code In addition to these three main sources, the codebase incorporates code and features from numerous branches of the Fast Downward codebase developed for various research papers. The main contributors to these branches are Malte Helmert, Gabi Röger and Silvia Richter. ## License The following directory is not part of Fast Downward as covered by this license: - ./src/search/ext For the rest, the following license applies: ``` Fast Downward is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Fast Downward is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. ```
4,093
Markdown
35.230088
100
0.708282
makolon/hsr_isaac_tamp/hsr_tamp/downward/LICENSE.md
### GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. ### Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. ### TERMS AND CONDITIONS #### 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. #### 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. #### 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. #### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. #### 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. #### 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: - a) The work must carry prominent notices stating that you modified it, and giving a relevant date. - b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". - c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. - d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. #### 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: - a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. - b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. - c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. - d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. - e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. #### 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: - a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or - b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or - c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or - d) Limiting the use for publicity purposes of names of licensors or authors of the material; or - e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or - f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. #### 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. #### 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. #### 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. #### 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. #### 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. #### 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. #### 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. #### 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. #### 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. #### 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS ### How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: <program> Copyright (C) <year> <name of author> This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands \`show w' and \`show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/licenses/why-not-lgpl.html>.
34,916
Markdown
50.652367
82
0.796254
makolon/hsr_isaac_tamp/hsr_tamp/downward/misc/autodoc/markup.py
import logging from external import txt2tags def _get_config(target): config = {} # Set the configuration on the 'config' dict. config = txt2tags.ConfigMaster()._get_defaults() # The Pre (and Post) processing config is a list of lists: # [ [this, that], [foo, bar], [patt, replace] ] config['postproc'] = [] config['preproc'] = [] if target in ['xhtml', 'html']: config['encoding'] = 'UTF-8' # document encoding config['toc'] = 0 config['css-inside'] = 1 config['css-sugar'] = 1 # Allow line breaks, r'\\\\' are 2 \ for regexes config['postproc'].append([r'\\\\', r'<br />']) # {{Roter Text|color:red}} -> <span style="color:red">Roter Text</span> config['postproc'].append([r'\{\{(.*?)\|color:(.+?)\}\}', r'<span style="color:\2">\1</span>']) elif target == 'tex': config['style'] = [] config['style'].append('color') # Do not clear the title page config['postproc'].append([r'\\clearpage', r'']) config['postproc'].append([r'usepackage{color}', r'usepackage[usenames,dvipsnames]{color}']) config['encoding'] = 'utf8' config['preproc'].append(['€', 'Euro']) # Latex only allows whitespace and underscores in filenames if # the filename is surrounded by "...". This is in turn only possible # if the extension is omitted config['preproc'].append([r'\[""', r'["""']) config['preproc'].append([r'""\.', r'""".']) # For images we have to omit the file:// prefix config['postproc'].append([r'includegraphics\{(.*)"file://', r'includegraphics{"\1']) # Allow line breaks, r'\\\\' are 2 \ for regexes config['postproc'].append([r'\$\\backslash\$\$\\backslash\$', r'\\\\']) # {{Roter Text|color:red}} -> \textcolor{red}{Roter Text} config['postproc'].append([r'\\{\\{(.*?)\$\|\$color:(.+?)\\}\\}', r'\\textcolor{\2}{\1}']) elif target == 'txt': # Allow line breaks, r'\\\\' are 2 \ for regexes config['postproc'].append([r'\\\\', '\n']) return config class Document: def __init__(self, title='', author='', date='%%date(%Y-%m-%d)'): self.title = title self.author = author self.date = date self.text = '' def add_text(self, text): self.text += text + '\n' def __str__(self): return self.text def render(self, target, options=None): # We always want xhtml if target == 'html': target = 'xhtml' # Bug in txt2tags: Titles are not escaped if target == 'tex': self.title = self.title.replace('_', r'\_') # Here is the marked body text, it must be a list. txt = self.text.split('\n') # Set the three header fields headers = [self.title, self.author, self.date] config = _get_config(target) config['outfile'] = txt2tags.MODULEOUT # results as list config['target'] = target if options is not None: config.update(options) # Let's do the conversion try: headers = txt2tags.doHeader(headers, config) body, toc = txt2tags.convert(txt, config) footer = txt2tags.doFooter(config) toc = txt2tags.toc_tagger(toc, config) toc = txt2tags.toc_formatter(toc, config) full_doc = headers + toc + body + footer finished = txt2tags.finish_him(full_doc, config) result = '\n'.join(finished) # Txt2tags error, show the messsage to the user except txt2tags.error as err: logging.error(err) result = err # Unknown error, show the traceback to the user except Exception: result = txt2tags.getUnknownErrorMessage() logging.error(result) return result if __name__ == '__main__': doc = Document('MyTitle', 'Max Mustermann') doc.add_text('{{Roter Text|color:red}}') print(doc) print() print(doc.render('tex'))
4,237
Python
30.626865
79
0.529384
makolon/hsr_isaac_tamp/hsr_tamp/downward/misc/autodoc/autodoc.py
#! /usr/bin/env python3 import argparse import logging import os from os.path import dirname, join import re import subprocess import sys import time import xmlrpc.client as xmlrpclib import markup # How many seconds to wait after a failed requests. Will be doubled after each failed request. # Don't lower this below ~5, or we may get locked out for an hour. sleep_time = 10 BOT_USERNAME = "XmlRpcBot" ENV_VAR_PASSWORD = "DOWNWARD_AUTODOC_PASSWORD" PASSWORD = os.environ.get(ENV_VAR_PASSWORD) WIKI_URL = "http://www.fast-downward.org" DOC_PREFIX = "Doc/" # a list of characters allowed to be used in doc titles TITLE_WHITE_LIST = r"[\w\+-]" # match 'word characters' (including '_'), '+', and '-' SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__)) REPO_ROOT_DIR = os.path.dirname(os.path.dirname(SCRIPT_DIR)) def parse_args(): parser = argparse.ArgumentParser() parser.add_argument("--build", default="release") parser.add_argument("--dry-run", action="store_true") return parser.parse_args() def connect(): wiki = xmlrpclib.ServerProxy(f"{WIKI_URL}?action=xmlrpc2", allow_none=True) auth_token = wiki.getAuthToken(BOT_USERNAME, PASSWORD) multi_call = xmlrpclib.MultiCall(wiki) multi_call.applyAuthToken(auth_token) return multi_call def get_all_titles_from_wiki(): multi_call = connect() multi_call.getAllPages() response = list(multi_call()) assert(response[0] == 'SUCCESS' and len(response) == 2) return response[1] def get_pages_from_wiki(titles): multi_call = connect() for title in titles: multi_call.getPage(title) response = list(multi_call()) assert(response[0] == 'SUCCESS') return dict(zip(titles, response[1:])) def send_pages(pages): multi_call = connect() for page_name, page_text in pages: multi_call.putPage(page_name, page_text) return multi_call() def attempt(func, *args): global sleep_time try: result = func(*args) except xmlrpclib.Fault as error: # This usually means the page content did not change. logging.exception(f"Error: {error}\nShould not happen anymore.") sys.exit(1) except xmlrpclib.ProtocolError as err: logging.warning(f"Error: {err.errcode}\n" f"Will retry after {sleep_time} seconds.") # Retry after sleeping. time.sleep(sleep_time) sleep_time *= 2 return attempt(func, *args) except Exception: logging.exception(f"Unexpected error: {sys.exc_info()[0]}") sys.exit(1) else: for entry in result: logging.info(repr(entry)) logging.info(f"Call to {func.__name__} successful.") return result def insert_wiki_links(text, titles): def make_link(m, prefix=''): anchor = m.group('anchor') or '' link_name = m.group('link') target = prefix + link_name if anchor: target += '#' + anchor link_name = anchor link_name = link_name.replace("_", " ") # Leave out the prefix in the link name. result = m.group('before') + "[[" + target + "|" + link_name + "]]" + m.group('after') return result def make_doc_link(m): return make_link(m, prefix=DOC_PREFIX) re_link = r"(?P<before>\W)(?P<link>%s)(#(?P<anchor>" + TITLE_WHITE_LIST + r"+))?(?P<after>\W)" doctitles = [title[4:] for title in titles if title.startswith(DOC_PREFIX)] for key in doctitles: text = re.sub(re_link % key, make_doc_link, text) othertitles = [title for title in titles if not title.startswith(DOC_PREFIX) and title not in doctitles] for key in othertitles: text = re.sub(re_link % key, make_link, text) return text def build_planner(build): subprocess.check_call([sys.executable, "build.py", build, "downward"], cwd=REPO_ROOT_DIR) def get_pages_from_planner(build): out = subprocess.check_output( ["./fast-downward.py", "--build", build, "--search", "--", "--help", "--txt2tags"], cwd=REPO_ROOT_DIR).decode("utf-8") # Split the output into tuples (title, markup_text). pagesplitter = re.compile(r'>>>>CATEGORY: ([\w\s]+?)<<<<(.+?)>>>>CATEGORYEND<<<<', re.DOTALL) pages = dict() for title, markup_text in pagesplitter.findall(out): document = markup.Document(date='') document.add_text("<<TableOfContents>>") document.add_text(markup_text) rendered_text = document.render("moin").strip() pages[DOC_PREFIX + title] = rendered_text return pages def get_changed_pages(old_doc_pages, new_doc_pages, all_titles): def add_page(title, text): # Check if this page is new or changed. if old_doc_pages.get(title, '') != text: print(title, "changed") changed_pages.append([title, text]) else: print(title, "unchanged") changed_pages = [] overview_lines = [] for title, text in sorted(new_doc_pages.items()): overview_lines.append(" * [[" + title + "]]") text = insert_wiki_links(text, all_titles) add_page(title, text) overview_title = DOC_PREFIX + "Overview" overview_text = "\n".join(overview_lines) add_page(overview_title, overview_text) return changed_pages if __name__ == '__main__': args = parse_args() if not args.dry_run and PASSWORD is None: logging.critical(f"{ENV_VAR_PASSWORD} not set.") sys.exit(1) logging.info("building planner...") build_planner(args.build) logging.info("getting new pages from planner...") new_doc_pages = get_pages_from_planner(args.build) if args.dry_run: for title, content in sorted(new_doc_pages.items()): print("=" * 25, title, "=" * 25) print(content) print() print() sys.exit() logging.info("getting existing page titles from wiki...") old_titles = attempt(get_all_titles_from_wiki) old_doc_titles = [title for title in old_titles if title.startswith(DOC_PREFIX)] all_titles = set(old_titles) | set(new_doc_pages.keys()) logging.info("getting existing doc page contents from wiki...") old_doc_pages = attempt(get_pages_from_wiki, old_doc_titles) logging.info("looking for changed pages...") changed_pages = get_changed_pages(old_doc_pages, new_doc_pages, all_titles) if changed_pages: logging.info("sending changed pages...") attempt(send_pages, changed_pages) else: logging.info("no changes found") missing_titles = set(old_doc_titles) - set(new_doc_pages.keys()) - {DOC_PREFIX + "Overview"} if missing_titles: sys.exit( "There are pages in the wiki documentation " "that are not created by Fast Downward:\n" + "\n".join(sorted(missing_titles))) print("Done")
6,887
Python
33.44
98
0.624365
makolon/hsr_isaac_tamp/hsr_tamp/downward/misc/autodoc/external/txt2tags.py
#!/usr/bin/env python3 # txt2tags - generic text conversion tool # http://txt2tags.org # # Copyright 2001-2010 Aurelio Jargas # Copyright 2010-2019 Jendrik Seipp # # This file is based on txt2tags version 2.6. The changes compared to # the original version are: # # * use spaces instead of tabs # * support Python 3.6+ in addition to Python 2.7 # * don't escape underscores in tagged and raw LaTeX text # * don't use locale-dependent str.capitalize() # * support SVG images # # License: http://www.gnu.org/licenses/gpl-2.0.txt # Subversion: http://svn.txt2tags.org # Bug tracker: http://bugs.txt2tags.org # ######################################################################## # # BORING CODE EXPLANATION AHEAD # # Just read it if you wish to understand how the txt2tags code works. # ######################################################################## # # The code that [1] parses the marked text is separated from the # code that [2] insert the target tags. # # [1] made by: def convert() # [2] made by: class BlockMaster # # The structures of the marked text are identified and its contents are # extracted into a data holder (Python lists and dictionaries). # # When parsing the source file, the blocks (para, lists, quote, table) # are opened with BlockMaster, right when found. Then its contents, # which spans on several lines, are feeded into a special holder on the # BlockMaster instance. Just when the block is closed, the target tags # are inserted for the full block as a whole, in one pass. This way, we # have a better control on blocks. Much better than the previous line by # line approach. # # In other words, whenever inside a block, the parser *holds* the tag # insertion process, waiting until the full block is read. That was # needed primary to close paragraphs for the XHTML target, but # proved to be a very good adding, improving many other processing. # # ------------------------------------------------------------------- # # These important classes are all documented: # CommandLine, SourceDocument, ConfigMaster, ConfigLines. # # There is a RAW Config format and all kind of configuration is first # converted to this format. Then a generic method parses it. # # These functions get information about the input file(s) and take # care of the init processing: # get_infiles_config(), process_source_file() and convert_this_files() # ######################################################################## #XXX Python coding warning # Avoid common mistakes: # - do NOT use newlist=list instead newlist=list[:] # - do NOT use newdic=dic instead newdic=dic.copy() # - do NOT use dic[key] instead dic.get(key) # - do NOT use del dic[key] without has_key() before #XXX Smart Image Align don't work if the image is a link # Can't fix that because the image is expanded together with the # link, at the linkbank filling moment. Only the image is passed # to parse_images(), not the full line, so it is always 'middle'. #XXX Paragraph separation not valid inside Quote # Quote will not have <p></p> inside, instead will close and open # again the <blockquote>. This really sux in CSS, when defining a # different background color. Still don't know how to fix it. #XXX TODO (maybe) # New mark or macro which expands to an anchor full title. # It is necessary to parse the full document in this order: # DONE 1st scan: HEAD: get all settings, including %!includeconf # DONE 2nd scan: BODY: expand includes & apply %!preproc # 3rd scan: BODY: read titles and compose TOC info # 4th scan: BODY: full parsing, expanding [#anchor] 1st # Steps 2 and 3 can be made together, with no tag adding. # Two complete body scans will be *slow*, don't know if it worths. # One solution may be add the titles as postproc rules ############################################################################## # User config (1=ON, 0=OFF) USE_I18N = 1 # use gettext for i18ned messages? (default is 1) COLOR_DEBUG = 1 # show debug messages in colors? (default is 1) BG_LIGHT = 0 # your terminal background color is light (default is 0) HTML_LOWER = 0 # use lowercased HTML tags instead upper? (default is 0) ############################################################################## # These are all the core Python modules used by txt2tags (KISS!) import re, os, sys, time, getopt # The CSV module is new in Python version 2.3 try: import csv except ImportError: csv = None # Program information my_url = 'http://txt2tags.org' my_name = 'txt2tags' my_email = 'verde@aurelio.net' my_version = '2.6' # i18n - just use if available if USE_I18N: try: import gettext # If your locale dir is different, change it here cat = gettext.Catalog('txt2tags',localedir='/usr/share/locale/') _ = cat.gettext except: _ = lambda x:x else: _ = lambda x:x # FLAGS : the conversion related flags , may be used in %!options # OPTIONS : the conversion related options, may be used in %!options # ACTIONS : the other behavior modifiers, valid on command line only # MACROS : the valid macros with their default values for formatting # SETTINGS: global miscellaneous settings, valid on RC file only # NO_TARGET: actions that don't require a target specification # NO_MULTI_INPUT: actions that don't accept more than one input file # CONFIG_KEYWORDS: the valid %!key:val keywords # # FLAGS and OPTIONS are configs that affect the converted document. # They usually have also a --no-<option> to turn them OFF. # # ACTIONS are needed because when doing multiple input files, strange # behavior would be found, as use command line interface for the # first file and gui for the second. There is no --no-<action>. # --version and --help inside %!options are also odd # TARGETS = 'html xhtml sgml dbk tex lout man mgp wiki gwiki doku pmw moin pm6 txt art adoc creole'.split() TARGETS.sort() FLAGS = {'headers' :1 , 'enum-title' :0 , 'mask-email' :0 , 'toc-only' :0 , 'toc' :0 , 'rc' :1 , 'css-sugar' :0 , 'css-suggar' :0 , 'css-inside' :0 , 'quiet' :0 , 'slides' :0 } OPTIONS = {'target' :'', 'toc-level' :3 , 'style' :'', 'infile' :'', 'outfile' :'', 'encoding' :'', 'config-file':'', 'split' :0 , 'lang' :'', 'width' :0 , 'height' :0 , 'art-chars' :'', 'show-config-value':''} ACTIONS = {'help' :0 , 'version' :0 , 'gui' :0 , 'verbose' :0 , 'debug' :0 , 'dump-config':0 , 'dump-source':0 , 'targets' :0} MACROS = {'date' : '%Y%m%d', 'infile': '%f', 'mtime': '%Y%m%d', 'outfile': '%f'} SETTINGS = {} # for future use NO_TARGET = ['help', 'version', 'gui', 'toc-only', 'dump-config', 'dump-source', 'targets'] NO_MULTI_INPUT = ['gui','dump-config','dump-source'] CONFIG_KEYWORDS = [ 'target', 'encoding', 'style', 'options', 'preproc','postproc', 'guicolors'] TARGET_NAMES = { 'html' : _('HTML page'), 'xhtml' : _('XHTML page'), 'sgml' : _('SGML document'), 'dbk' : _('DocBook document'), 'tex' : _('LaTeX document'), 'lout' : _('Lout document'), 'man' : _('UNIX Manual page'), 'mgp' : _('MagicPoint presentation'), 'wiki' : _('Wikipedia page'), 'gwiki' : _('Google Wiki page'), 'doku' : _('DokuWiki page'), 'pmw' : _('PmWiki page'), 'moin' : _('MoinMoin page'), 'pm6' : _('PageMaker document'), 'txt' : _('Plain Text'), 'art' : _('ASCII Art text'), 'adoc' : _('AsciiDoc document'), 'creole' : _('Creole 1.0 document') } DEBUG = 0 # do not edit here, please use --debug VERBOSE = 0 # do not edit here, please use -v, -vv or -vvv QUIET = 0 # do not edit here, please use --quiet GUI = 0 # do not edit here, please use --gui AUTOTOC = 1 # do not edit here, please use --no-toc or %%toc DFT_TEXT_WIDTH = 72 # do not edit here, please use --width DFT_SLIDE_WIDTH = 80 # do not edit here, please use --width DFT_SLIDE_HEIGHT = 25 # do not edit here, please use --height # ASCII Art config AA_KEYS = 'corner border side bar1 bar2 level2 level3 level4 level5'.split() AA_VALUES = '+-|-==-^"' # do not edit here, please use --art-chars AA = dict(zip(AA_KEYS, AA_VALUES)) AA_COUNT = 0 AA_TITLE = '' RC_RAW = [] CMDLINE_RAW = [] CONF = {} BLOCK = None TITLE = None regex = {} TAGS = {} rules = {} # Gui globals askopenfilename = None showinfo = None showwarning = None showerror = None lang = 'english' TARGET = '' STDIN = STDOUT = '-' MODULEIN = MODULEOUT = '-module-' ESCCHAR = '\x00' SEPARATOR = '\x01' LISTNAMES = {'-':'list', '+':'numlist', ':':'deflist'} LINEBREAK = {'default':'\n', 'win':'\r\n', 'mac':'\r'} # Platform specific settings LB = LINEBREAK.get(sys.platform[:3]) or LINEBREAK['default'] VERSIONSTR = _("%s version %s <%s>")%(my_name,my_version,my_url) USAGE = '\n'.join([ '', _("Usage: %s [OPTIONS] [infile.t2t ...]") % my_name, '', _(" --targets print a list of all the available targets and exit"), _(" -t, --target=TYPE set target document type. currently supported:"), ' %s,' % ', '.join(TARGETS[:9]), ' %s' % ', '.join(TARGETS[9:]), _(" -i, --infile=FILE set FILE as the input file name ('-' for STDIN)"), _(" -o, --outfile=FILE set FILE as the output file name ('-' for STDOUT)"), _(" --encoding=ENC set target file encoding (utf-8, iso-8859-1, etc)"), _(" --toc add an automatic Table of Contents to the output"), _(" --toc-level=N set maximum TOC level (depth) to N"), _(" --toc-only print the Table of Contents and exit"), _(" -n, --enum-title enumerate all titles as 1, 1.1, 1.1.1, etc"), _(" --style=FILE use FILE as the document style (like HTML CSS)"), _(" --css-sugar insert CSS-friendly tags for HTML/XHTML"), _(" --css-inside insert CSS file contents inside HTML/XHTML headers"), _(" -H, --no-headers suppress header and footer from the output"), _(" --mask-email hide email from spam robots. x@y.z turns <x (a) y z>"), _(" --slides format output as presentation slides (used by -t art)"), _(" --width=N set the output's width to N columns (used by -t art)"), _(" --height=N set the output's height to N rows (used by -t art)"), _(" -C, --config-file=F read configuration from file F"), _(" --gui invoke Graphical Tk Interface"), _(" -q, --quiet quiet mode, suppress all output (except errors)"), _(" -v, --verbose print informative messages during conversion"), _(" -h, --help print this help information and exit"), _(" -V, --version print program version and exit"), _(" --dump-config print all the configuration found and exit"), _(" --dump-source print the document source, with includes expanded"), '', _("Turn OFF options:"), " --no-css-inside, --no-css-sugar, --no-dump-config, --no-dump-source,", " --no-encoding, --no-enum-title, --no-headers, --no-infile,", " --no-mask-email, --no-outfile, --no-quiet, --no-rc, --no-slides,", " --no-style, --no-targets, --no-toc, --no-toc-only", '', _("Example:"), " %s -t html --toc %s" % (my_name, _("file.t2t")), '', _("By default, converted output is saved to 'infile.<target>'."), _("Use --outfile to force an output file name."), _("If input file is '-', reads from STDIN."), _("If output file is '-', dumps output to STDOUT."), '', my_url, '' ]) ############################################################################## # Here is all the target's templates # You may edit them to fit your needs # - the %(HEADERn)s strings represent the Header lines # - the %(STYLE)s string is changed by --style contents # - the %(ENCODING)s string is changed by --encoding contents # - if any of the above is empty, the full line is removed # - use %% to represent a literal % # HEADER_TEMPLATE = { 'art':""" Fake template to respect the general process. """, 'txt': """\ %(HEADER1)s %(HEADER2)s %(HEADER3)s """, 'sgml': """\ <!doctype linuxdoc system> <article> <title>%(HEADER1)s <author>%(HEADER2)s <date>%(HEADER3)s """, 'html': """\ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <META NAME="generator" CONTENT="http://txt2tags.org"> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=%(ENCODING)s"> <LINK REL="stylesheet" TYPE="text/css" HREF="%(STYLE)s"> <TITLE>%(HEADER1)s</TITLE> </HEAD><BODY BGCOLOR="white" TEXT="black"> <CENTER> <H1>%(HEADER1)s</H1> <FONT SIZE="4"><I>%(HEADER2)s</I></FONT><BR> <FONT SIZE="4">%(HEADER3)s</FONT> </CENTER> """, 'htmlcss': """\ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <META NAME="generator" CONTENT="http://txt2tags.org"> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=%(ENCODING)s"> <LINK REL="stylesheet" TYPE="text/css" HREF="%(STYLE)s"> <TITLE>%(HEADER1)s</TITLE> </HEAD> <BODY> <DIV CLASS="header" ID="header"> <H1>%(HEADER1)s</H1> <H2>%(HEADER2)s</H2> <H3>%(HEADER3)s</H3> </DIV> """, 'xhtml': """\ <?xml version="1.0" encoding="%(ENCODING)s" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"\ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>%(HEADER1)s</title> <meta name="generator" content="http://txt2tags.org" /> <link rel="stylesheet" type="text/css" href="%(STYLE)s" /> </head> <body bgcolor="white" text="black"> <div align="center"> <h1>%(HEADER1)s</h1> <h2>%(HEADER2)s</h2> <h3>%(HEADER3)s</h3> </div> """, 'xhtmlcss': """\ <?xml version="1.0" encoding="%(ENCODING)s" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"\ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>%(HEADER1)s</title> <meta name="generator" content="http://txt2tags.org" /> <link rel="stylesheet" type="text/css" href="%(STYLE)s" /> </head> <body> <div class="header" id="header"> <h1>%(HEADER1)s</h1> <h2>%(HEADER2)s</h2> <h3>%(HEADER3)s</h3> </div> """, 'dbk': """\ <?xml version="1.0" encoding="%(ENCODING)s" ?> <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"\ "docbook/dtd/xml/4.5/docbookx.dtd"> <article lang="en"> <articleinfo> <title>%(HEADER1)s</title> <authorgroup> <author><othername>%(HEADER2)s</othername></author> </authorgroup> <date>%(HEADER3)s</date> </articleinfo> """, 'man': """\ .TH "%(HEADER1)s" 1 "%(HEADER3)s" "%(HEADER2)s" """, # TODO style to <HR> 'pm6': """\ <PMTags1.0 win><C-COLORTABLE ("Preto" 1 0 0 0) ><@Normal= <FONT "Times New Roman"><CCOLOR "Preto"><SIZE 11> <HORIZONTAL 100><LETTERSPACE 0><CTRACK 127><CSSIZE 70><C+SIZE 58.3> <C-POSITION 33.3><C+POSITION 33.3><P><CBASELINE 0><CNOBREAK 0><CLEADING -0.05> <GGRID 0><GLEFT 7.2><GRIGHT 0><GFIRST 0><G+BEFORE 7.2><G+AFTER 0> <GALIGNMENT "justify"><GMETHOD "proportional"><G& "ENGLISH"> <GPAIRS 12><G%% 120><GKNEXT 0><GKWIDOW 0><GKORPHAN 0><GTABS $> <GHYPHENATION 2 34 0><GWORDSPACE 75 100 150><GSPACE -5 0 25> ><@Bullet=<@-PARENT "Normal"><FONT "Abadi MT Condensed Light"> <GLEFT 14.4><G+BEFORE 2.15><G%% 110><GTABS(25.2 l "")> ><@PreFormat=<@-PARENT "Normal"><FONT "Lucida Console"><SIZE 8><CTRACK 0> <GLEFT 0><G+BEFORE 0><GALIGNMENT "left"><GWORDSPACE 100 100 100><GSPACE 0 0 0> ><@Title1=<@-PARENT "Normal"><FONT "Arial"><SIZE 14><B> <GCONTENTS><GLEFT 0><G+BEFORE 0><GALIGNMENT "left"> ><@Title2=<@-PARENT "Title1"><SIZE 12><G+BEFORE 3.6> ><@Title3=<@-PARENT "Title1"><SIZE 10><GLEFT 7.2><G+BEFORE 7.2> ><@Title4=<@-PARENT "Title3"> ><@Title5=<@-PARENT "Title3"> ><@Quote=<@-PARENT "Normal"><SIZE 10><I>> %(HEADER1)s %(HEADER2)s %(HEADER3)s """, 'mgp': """\ #!/usr/X11R6/bin/mgp -t 90 %%deffont "normal" xfont "utopia-medium-r", charset "iso8859-1" %%deffont "normal-i" xfont "utopia-medium-i", charset "iso8859-1" %%deffont "normal-b" xfont "utopia-bold-r" , charset "iso8859-1" %%deffont "normal-bi" xfont "utopia-bold-i" , charset "iso8859-1" %%deffont "mono" xfont "courier-medium-r", charset "iso8859-1" %%default 1 size 5 %%default 2 size 8, fore "yellow", font "normal-b", center %%default 3 size 5, fore "white", font "normal", left, prefix " " %%tab 1 size 4, vgap 30, prefix " ", icon arc "red" 40, leftfill %%tab 2 prefix " ", icon arc "orange" 40, leftfill %%tab 3 prefix " ", icon arc "brown" 40, leftfill %%tab 4 prefix " ", icon arc "darkmagenta" 40, leftfill %%tab 5 prefix " ", icon arc "magenta" 40, leftfill %%%%------------------------- end of headers ----------------------------- %%page %%size 10, center, fore "yellow" %(HEADER1)s %%font "normal-i", size 6, fore "white", center %(HEADER2)s %%font "mono", size 7, center %(HEADER3)s """, 'moin': """\ '''%(HEADER1)s''' ''%(HEADER2)s'' %(HEADER3)s """, 'gwiki': """\ *%(HEADER1)s* %(HEADER2)s _%(HEADER3)s_ """, 'adoc': """\ = %(HEADER1)s %(HEADER2)s %(HEADER3)s """, 'doku': """\ ===== %(HEADER1)s ===== **//%(HEADER2)s//** //%(HEADER3)s// """, 'pmw': """\ (:Title %(HEADER1)s:) (:Description %(HEADER2)s:) (:Summary %(HEADER3)s:) """, 'wiki': """\ '''%(HEADER1)s''' %(HEADER2)s ''%(HEADER3)s'' """, 'tex': \ r"""\documentclass{article} \usepackage{graphicx} \usepackage{paralist} %% needed for compact lists \usepackage[normalem]{ulem} %% needed by strike \usepackage[urlcolor=blue,colorlinks=true]{hyperref} \usepackage[%(ENCODING)s]{inputenc} %% char encoding \usepackage{%(STYLE)s} %% user defined \title{%(HEADER1)s} \author{%(HEADER2)s} \begin{document} \date{%(HEADER3)s} \maketitle \clearpage """, 'lout': """\ @SysInclude { doc } @Document @InitialFont { Times Base 12p } # Times, Courier, Helvetica, ... @PageOrientation { Portrait } # Portrait, Landscape @ColumnNumber { 1 } # Number of columns (2, 3, ...) @PageHeaders { Simple } # None, Simple, Titles, NoTitles @InitialLanguage { English } # German, French, Portuguese, ... @OptimizePages { Yes } # Yes/No smart page break feature // @Text @Begin @Display @Heading { %(HEADER1)s } @Display @I { %(HEADER2)s } @Display { %(HEADER3)s } #@NP # Break page after Headers """, 'creole': """\ %(HEADER1)s %(HEADER2)s %(HEADER3)s """ # @SysInclude { tbl } # Tables support # setup: @MakeContents { Yes } # show TOC # setup: @SectionGap # break page at each section } ############################################################################## def getTags(config): "Returns all the known tags for the specified target" keys = """ title1 numtitle1 title2 numtitle2 title3 numtitle3 title4 numtitle4 title5 numtitle5 title1Open title1Close title2Open title2Close title3Open title3Close title4Open title4Close title5Open title5Close blocktitle1Open blocktitle1Close blocktitle2Open blocktitle2Close blocktitle3Open blocktitle3Close paragraphOpen paragraphClose blockVerbOpen blockVerbClose blockQuoteOpen blockQuoteClose blockQuoteLine blockCommentOpen blockCommentClose fontMonoOpen fontMonoClose fontBoldOpen fontBoldClose fontItalicOpen fontItalicClose fontUnderlineOpen fontUnderlineClose fontStrikeOpen fontStrikeClose listOpen listClose listOpenCompact listCloseCompact listItemOpen listItemClose listItemLine numlistOpen numlistClose numlistOpenCompact numlistCloseCompact numlistItemOpen numlistItemClose numlistItemLine deflistOpen deflistClose deflistOpenCompact deflistCloseCompact deflistItem1Open deflistItem1Close deflistItem2Open deflistItem2Close deflistItem2LinePrefix bar1 bar2 url urlMark email emailMark img imgAlignLeft imgAlignRight imgAlignCenter _imgAlignLeft _imgAlignRight _imgAlignCenter tableOpen tableClose _tableBorder _tableAlignLeft _tableAlignCenter tableRowOpen tableRowClose tableRowSep tableTitleRowOpen tableTitleRowClose tableCellOpen tableCellClose tableCellSep tableTitleCellOpen tableTitleCellClose tableTitleCellSep _tableColAlignLeft _tableColAlignRight _tableColAlignCenter _tableCellAlignLeft _tableCellAlignRight _tableCellAlignCenter _tableCellColSpan tableColAlignSep _tableCellMulticolOpen _tableCellMulticolClose bodyOpen bodyClose cssOpen cssClose tocOpen tocClose TOC anchor comment pageBreak EOD """.split() # TIP: \a represents the current text inside the mark # TIP: ~A~, ~B~ and ~C~ are expanded to other tags parts alltags = { 'art': { 'title1' : '\a' , 'title2' : '\a' , 'title3' : '\a' , 'title4' : '\a' , 'title5' : '\a' , 'blockQuoteLine' : '\t' , 'listItemOpen' : '- ' , 'numlistItemOpen' : '\a. ' , 'bar1' : aa_line(AA['bar1'], config['width']), 'bar2' : aa_line(AA['bar2'], config['width']), 'url' : '\a' , 'urlMark' : '\a (\a)' , 'email' : '\a' , 'emailMark' : '\a (\a)' , 'img' : '[\a]' , }, 'txt': { 'title1' : ' \a' , 'title2' : '\t\a' , 'title3' : '\t\t\a' , 'title4' : '\t\t\t\a' , 'title5' : '\t\t\t\t\a', 'blockQuoteLine' : '\t' , 'listItemOpen' : '- ' , 'numlistItemOpen' : '\a. ' , 'bar1' : '\a' , 'url' : '\a' , 'urlMark' : '\a (\a)' , 'email' : '\a' , 'emailMark' : '\a (\a)' , 'img' : '[\a]' , }, 'html': { 'paragraphOpen' : '<P>' , 'paragraphClose' : '</P>' , 'title1' : '~A~<H1>\a</H1>' , 'title2' : '~A~<H2>\a</H2>' , 'title3' : '~A~<H3>\a</H3>' , 'title4' : '~A~<H4>\a</H4>' , 'title5' : '~A~<H5>\a</H5>' , 'anchor' : '<A NAME="\a"></A>\n', 'blockVerbOpen' : '<PRE>' , 'blockVerbClose' : '</PRE>' , 'blockQuoteOpen' : '<BLOCKQUOTE>' , 'blockQuoteClose' : '</BLOCKQUOTE>' , 'fontMonoOpen' : '<CODE>' , 'fontMonoClose' : '</CODE>' , 'fontBoldOpen' : '<B>' , 'fontBoldClose' : '</B>' , 'fontItalicOpen' : '<I>' , 'fontItalicClose' : '</I>' , 'fontUnderlineOpen' : '<U>' , 'fontUnderlineClose' : '</U>' , 'fontStrikeOpen' : '<S>' , 'fontStrikeClose' : '</S>' , 'listOpen' : '<UL>' , 'listClose' : '</UL>' , 'listItemOpen' : '<LI>' , 'numlistOpen' : '<OL>' , 'numlistClose' : '</OL>' , 'numlistItemOpen' : '<LI>' , 'deflistOpen' : '<DL>' , 'deflistClose' : '</DL>' , 'deflistItem1Open' : '<DT>' , 'deflistItem1Close' : '</DT>' , 'deflistItem2Open' : '<DD>' , 'bar1' : '<HR NOSHADE SIZE=1>' , 'bar2' : '<HR NOSHADE SIZE=5>' , 'url' : '<A HREF="\a">\a</A>' , 'urlMark' : '<A HREF="\a">\a</A>' , 'email' : '<A HREF="mailto:\a">\a</A>' , 'emailMark' : '<A HREF="mailto:\a">\a</A>' , 'img' : '<IMG~A~ SRC="\a" BORDER="0" ALT="">', '_imgAlignLeft' : ' ALIGN="left"' , '_imgAlignCenter' : ' ALIGN="middle"', '_imgAlignRight' : ' ALIGN="right"' , 'tableOpen' : '<TABLE~A~~B~ CELLPADDING="4">', 'tableClose' : '</TABLE>' , 'tableRowOpen' : '<TR>' , 'tableRowClose' : '</TR>' , 'tableCellOpen' : '<TD~A~~S~>' , 'tableCellClose' : '</TD>' , 'tableTitleCellOpen' : '<TH~S~>' , 'tableTitleCellClose' : '</TH>' , '_tableBorder' : ' BORDER="1"' , '_tableAlignCenter' : ' ALIGN="center"', '_tableCellAlignRight' : ' ALIGN="right"' , '_tableCellAlignCenter': ' ALIGN="center"', '_tableCellColSpan' : ' COLSPAN="\a"' , 'cssOpen' : '<STYLE TYPE="text/css">', 'cssClose' : '</STYLE>' , 'comment' : '<!-- \a -->' , 'EOD' : '</BODY></HTML>' }, #TIP xhtml inherits all HTML definitions (lowercased) #TIP http://www.w3.org/TR/xhtml1/#guidelines #TIP http://www.htmlref.com/samples/Chapt17/17_08.htm 'xhtml': { 'listItemClose' : '</li>' , 'numlistItemClose' : '</li>' , 'deflistItem2Close' : '</dd>' , 'bar1' : '<hr class="light" />', 'bar2' : '<hr class="heavy" />', 'anchor' : '<a id="\a" name="\a"></a>\n', 'img' : '<img~A~ src="\a" border="0" alt=""/>', }, 'sgml': { 'paragraphOpen' : '<p>' , 'title1' : '<sect>\a~A~<p>' , 'title2' : '<sect1>\a~A~<p>' , 'title3' : '<sect2>\a~A~<p>' , 'title4' : '<sect3>\a~A~<p>' , 'title5' : '<sect4>\a~A~<p>' , 'anchor' : '<label id="\a">' , 'blockVerbOpen' : '<tscreen><verb>' , 'blockVerbClose' : '</verb></tscreen>' , 'blockQuoteOpen' : '<quote>' , 'blockQuoteClose' : '</quote>' , 'fontMonoOpen' : '<tt>' , 'fontMonoClose' : '</tt>' , 'fontBoldOpen' : '<bf>' , 'fontBoldClose' : '</bf>' , 'fontItalicOpen' : '<em>' , 'fontItalicClose' : '</em>' , 'fontUnderlineOpen' : '<bf><em>' , 'fontUnderlineClose' : '</em></bf>' , 'listOpen' : '<itemize>' , 'listClose' : '</itemize>' , 'listItemOpen' : '<item>' , 'numlistOpen' : '<enum>' , 'numlistClose' : '</enum>' , 'numlistItemOpen' : '<item>' , 'deflistOpen' : '<descrip>' , 'deflistClose' : '</descrip>' , 'deflistItem1Open' : '<tag>' , 'deflistItem1Close' : '</tag>' , 'bar1' : '<!-- \a -->' , 'url' : '<htmlurl url="\a" name="\a">' , 'urlMark' : '<htmlurl url="\a" name="\a">' , 'email' : '<htmlurl url="mailto:\a" name="\a">' , 'emailMark' : '<htmlurl url="mailto:\a" name="\a">' , 'img' : '<figure><ph vspace=""><img src="\a"></figure>', 'tableOpen' : '<table><tabular ca="~C~">' , 'tableClose' : '</tabular></table>' , 'tableRowSep' : '<rowsep>' , 'tableCellSep' : '<colsep>' , '_tableColAlignLeft' : 'l' , '_tableColAlignRight' : 'r' , '_tableColAlignCenter' : 'c' , 'comment' : '<!-- \a -->' , 'TOC' : '<toc>' , 'EOD' : '</article>' }, 'dbk': { 'paragraphOpen' : '<para>' , 'paragraphClose' : '</para>' , 'title1Open' : '~A~<sect1><title>\a</title>' , 'title1Close' : '</sect1>' , 'title2Open' : '~A~ <sect2><title>\a</title>' , 'title2Close' : ' </sect2>' , 'title3Open' : '~A~ <sect3><title>\a</title>' , 'title3Close' : ' </sect3>' , 'title4Open' : '~A~ <sect4><title>\a</title>' , 'title4Close' : ' </sect4>' , 'title5Open' : '~A~ <sect5><title>\a</title>', 'title5Close' : ' </sect5>' , 'anchor' : '<anchor id="\a"/>\n' , 'blockVerbOpen' : '<programlisting>' , 'blockVerbClose' : '</programlisting>' , 'blockQuoteOpen' : '<blockquote><para>' , 'blockQuoteClose' : '</para></blockquote>' , 'fontMonoOpen' : '<code>' , 'fontMonoClose' : '</code>' , 'fontBoldOpen' : '<emphasis role="bold">' , 'fontBoldClose' : '</emphasis>' , 'fontItalicOpen' : '<emphasis>' , 'fontItalicClose' : '</emphasis>' , 'fontUnderlineOpen' : '<emphasis role="underline">' , 'fontUnderlineClose' : '</emphasis>' , # 'fontStrikeOpen' : '<emphasis role="strikethrough">' , # Don't know # 'fontStrikeClose' : '</emphasis>' , 'listOpen' : '<itemizedlist>' , 'listClose' : '</itemizedlist>' , 'listItemOpen' : '<listitem><para>' , 'listItemClose' : '</para></listitem>' , 'numlistOpen' : '<orderedlist numeration="arabic">' , 'numlistClose' : '</orderedlist>' , 'numlistItemOpen' : '<listitem><para>' , 'numlistItemClose' : '</para></listitem>' , 'deflistOpen' : '<variablelist>' , 'deflistClose' : '</variablelist>' , 'deflistItem1Open' : '<varlistentry><term>' , 'deflistItem1Close' : '</term>' , 'deflistItem2Open' : '<listitem><para>' , 'deflistItem2Close' : '</para></listitem></varlistentry>' , # 'bar1' : '<>' , # Don't know # 'bar2' : '<>' , # Don't know 'url' : '<ulink url="\a">\a</ulink>' , 'urlMark' : '<ulink url="\a">\a</ulink>' , 'email' : '<email>\a</email>' , 'emailMark' : '<email>\a</email>' , 'img' : '<mediaobject><imageobject><imagedata fileref="\a"/></imageobject></mediaobject>', # '_imgAlignLeft' : '' , # Don't know # '_imgAlignCenter' : '' , # Don't know # '_imgAlignRight' : '' , # Don't know # 'tableOpen' : '<informaltable><tgroup cols=""><tbody>', # Don't work, need to know number of cols # 'tableClose' : '</tbody></tgroup></informaltable>' , # 'tableRowOpen' : '<row>' , # 'tableRowClose' : '</row>' , # 'tableCellOpen' : '<entry>' , # 'tableCellClose' : '</entry>' , # 'tableTitleRowOpen' : '<thead>' , # 'tableTitleRowClose' : '</thead>' , # '_tableBorder' : ' frame="all"' , # '_tableAlignCenter' : ' align="center"' , # '_tableCellAlignRight' : ' align="right"' , # '_tableCellAlignCenter': ' align="center"' , # '_tableCellColSpan' : ' COLSPAN="\a"' , 'TOC' : '<index/>' , 'comment' : '<!-- \a -->' , 'EOD' : '</article>' }, 'tex': { 'title1' : '~A~\section*{\a}' , 'title2' : '~A~\\subsection*{\a}' , 'title3' : '~A~\\subsubsection*{\a}', # title 4/5: DIRTY: para+BF+\\+\n 'title4' : '~A~\\paragraph{}\\textbf{\a}\\\\\n', 'title5' : '~A~\\paragraph{}\\textbf{\a}\\\\\n', 'numtitle1' : '\n~A~\section{\a}' , 'numtitle2' : '~A~\\subsection{\a}' , 'numtitle3' : '~A~\\subsubsection{\a}' , 'anchor' : '\\hypertarget{\a}{}\n' , 'blockVerbOpen' : '\\begin{verbatim}' , 'blockVerbClose' : '\\end{verbatim}' , 'blockQuoteOpen' : '\\begin{quotation}' , 'blockQuoteClose' : '\\end{quotation}' , 'fontMonoOpen' : '\\texttt{' , 'fontMonoClose' : '}' , 'fontBoldOpen' : '\\textbf{' , 'fontBoldClose' : '}' , 'fontItalicOpen' : '\\textit{' , 'fontItalicClose' : '}' , 'fontUnderlineOpen' : '\\underline{' , 'fontUnderlineClose' : '}' , 'fontStrikeOpen' : '\\sout{' , 'fontStrikeClose' : '}' , 'listOpen' : '\\begin{itemize}' , 'listClose' : '\\end{itemize}' , 'listOpenCompact' : '\\begin{compactitem}', 'listCloseCompact' : '\\end{compactitem}' , 'listItemOpen' : '\\item ' , 'numlistOpen' : '\\begin{enumerate}' , 'numlistClose' : '\\end{enumerate}' , 'numlistOpenCompact' : '\\begin{compactenum}', 'numlistCloseCompact' : '\\end{compactenum}' , 'numlistItemOpen' : '\\item ' , 'deflistOpen' : '\\begin{description}', 'deflistClose' : '\\end{description}' , 'deflistOpenCompact' : '\\begin{compactdesc}', 'deflistCloseCompact' : '\\end{compactdesc}' , 'deflistItem1Open' : '\\item[' , 'deflistItem1Close' : ']' , 'bar1' : '\\hrulefill{}' , 'bar2' : '\\rule{\linewidth}{1mm}', 'url' : '\\htmladdnormallink{\a}{\a}', 'urlMark' : '\\htmladdnormallink{\a}{\a}', 'email' : '\\htmladdnormallink{\a}{mailto:\a}', 'emailMark' : '\\htmladdnormallink{\a}{mailto:\a}', 'img' : '\\includegraphics{\a}', 'tableOpen' : '\\begin{center}\\begin{tabular}{|~C~|}', 'tableClose' : '\\end{tabular}\\end{center}', 'tableRowOpen' : '\\hline ' , 'tableRowClose' : ' \\\\' , 'tableCellSep' : ' & ' , '_tableColAlignLeft' : 'l' , '_tableColAlignRight' : 'r' , '_tableColAlignCenter' : 'c' , '_tableCellAlignLeft' : 'l' , '_tableCellAlignRight' : 'r' , '_tableCellAlignCenter': 'c' , '_tableCellColSpan' : '\a' , '_tableCellMulticolOpen' : '\\multicolumn{\a}{|~C~|}{', '_tableCellMulticolClose' : '}', 'tableColAlignSep' : '|' , 'comment' : '% \a' , 'TOC' : '\\tableofcontents', 'pageBreak' : '\\clearpage', 'EOD' : '\\end{document}' }, 'lout': { 'paragraphOpen' : '@LP' , 'blockTitle1Open' : '@BeginSections' , 'blockTitle1Close' : '@EndSections' , 'blockTitle2Open' : ' @BeginSubSections' , 'blockTitle2Close' : ' @EndSubSections' , 'blockTitle3Open' : ' @BeginSubSubSections' , 'blockTitle3Close' : ' @EndSubSubSections' , 'title1Open' : '~A~@Section @Title { \a } @Begin', 'title1Close' : '@End @Section' , 'title2Open' : '~A~ @SubSection @Title { \a } @Begin', 'title2Close' : ' @End @SubSection' , 'title3Open' : '~A~ @SubSubSection @Title { \a } @Begin', 'title3Close' : ' @End @SubSubSection' , 'title4Open' : '~A~@LP @LeftDisplay @B { \a }', 'title5Open' : '~A~@LP @LeftDisplay @B { \a }', 'anchor' : '@Tag { \a }\n' , 'blockVerbOpen' : '@LP @ID @F @RawVerbatim @Begin', 'blockVerbClose' : '@End @RawVerbatim' , 'blockQuoteOpen' : '@QD {' , 'blockQuoteClose' : '}' , # enclosed inside {} to deal with joined**words** 'fontMonoOpen' : '{@F {' , 'fontMonoClose' : '}}' , 'fontBoldOpen' : '{@B {' , 'fontBoldClose' : '}}' , 'fontItalicOpen' : '{@II {' , 'fontItalicClose' : '}}' , 'fontUnderlineOpen' : '{@Underline{' , 'fontUnderlineClose' : '}}' , # the full form is more readable, but could be BL EL LI NL TL DTI 'listOpen' : '@BulletList' , 'listClose' : '@EndList' , 'listItemOpen' : '@ListItem{' , 'listItemClose' : '}' , 'numlistOpen' : '@NumberedList' , 'numlistClose' : '@EndList' , 'numlistItemOpen' : '@ListItem{' , 'numlistItemClose' : '}' , 'deflistOpen' : '@TaggedList' , 'deflistClose' : '@EndList' , 'deflistItem1Open' : '@DropTagItem {' , 'deflistItem1Close' : '}' , 'deflistItem2Open' : '{' , 'deflistItem2Close' : '}' , 'bar1' : '@DP @FullWidthRule' , 'url' : '{blue @Colour { \a }}' , 'urlMark' : '\a ({blue @Colour { \a }})' , 'email' : '{blue @Colour { \a }}' , 'emailMark' : '\a ({blue Colour{ \a }})' , 'img' : '~A~@IncludeGraphic { \a }' , # eps only! '_imgAlignLeft' : '@LeftDisplay ' , '_imgAlignRight' : '@RightDisplay ' , '_imgAlignCenter' : '@CentredDisplay ' , # lout tables are *way* complicated, no support for now #'tableOpen' : '~A~@Tbl~B~\naformat{ @Cell A | @Cell B } {', #'tableClose' : '}' , #'tableRowOpen' : '@Rowa\n' , #'tableTitleRowOpen' : '@HeaderRowa' , #'tableCenterAlign' : '@CentredDisplay ' , #'tableCellOpen' : '\a {' , # A, B, ... #'tableCellClose' : '}' , #'_tableBorder' : '\nrule {yes}' , 'comment' : '# \a' , # @MakeContents must be on the config file 'TOC' : '@DP @ContentsGoesHere @DP', 'pageBreak' : '@NP' , 'EOD' : '@End @Text' }, # http://moinmo.in/SyntaxReference 'moin': { 'title1' : '= \a =' , 'title2' : '== \a ==' , 'title3' : '=== \a ===' , 'title4' : '==== \a ====' , 'title5' : '===== \a =====', 'blockVerbOpen' : '{{{' , 'blockVerbClose' : '}}}' , 'blockQuoteLine' : ' ' , 'fontMonoOpen' : '{{{' , 'fontMonoClose' : '}}}' , 'fontBoldOpen' : "'''" , 'fontBoldClose' : "'''" , 'fontItalicOpen' : "''" , 'fontItalicClose' : "''" , 'fontUnderlineOpen' : '__' , 'fontUnderlineClose' : '__' , 'fontStrikeOpen' : '--(' , 'fontStrikeClose' : ')--' , 'listItemOpen' : ' * ' , 'numlistItemOpen' : ' \a. ' , 'deflistItem1Open' : ' ' , 'deflistItem1Close' : '::' , 'deflistItem2LinePrefix': ' :: ' , 'bar1' : '----' , 'bar2' : '--------' , 'url' : '[[\a]]' , 'urlMark' : '[[\a|\a]]' , 'email' : '\a' , 'emailMark' : '[[mailto:\a|\a]]', 'img' : '[\a]' , 'tableRowOpen' : '||' , 'tableCellOpen' : '~A~' , 'tableCellClose' : '||' , 'tableTitleCellClose' : '||' , '_tableCellAlignRight' : '<)>' , '_tableCellAlignCenter' : '<:>' , 'comment' : '/* \a */' , 'TOC' : '[[TableOfContents]]' }, # http://code.google.com/p/support/wiki/WikiSyntax 'gwiki': { 'title1' : '= \a =' , 'title2' : '== \a ==' , 'title3' : '=== \a ===' , 'title4' : '==== \a ====' , 'title5' : '===== \a =====', 'blockVerbOpen' : '{{{' , 'blockVerbClose' : '}}}' , 'blockQuoteLine' : ' ' , 'fontMonoOpen' : '{{{' , 'fontMonoClose' : '}}}' , 'fontBoldOpen' : '*' , 'fontBoldClose' : '*' , 'fontItalicOpen' : '_' , # underline == italic 'fontItalicClose' : '_' , 'fontStrikeOpen' : '~~' , 'fontStrikeClose' : '~~' , 'listItemOpen' : ' * ' , 'numlistItemOpen' : ' # ' , 'url' : '\a' , 'urlMark' : '[\a \a]' , 'email' : 'mailto:\a' , 'emailMark' : '[mailto:\a \a]', 'img' : '[\a]' , 'tableRowOpen' : '|| ' , 'tableRowClose' : ' ||' , 'tableCellSep' : ' || ' , }, # http://powerman.name/doc/asciidoc 'adoc': { 'title1' : '== \a' , 'title2' : '=== \a' , 'title3' : '==== \a' , 'title4' : '===== \a' , 'title5' : '===== \a' , 'blockVerbOpen' : '----' , 'blockVerbClose' : '----' , 'fontMonoOpen' : '+' , 'fontMonoClose' : '+' , 'fontBoldOpen' : '*' , 'fontBoldClose' : '*' , 'fontItalicOpen' : '_' , 'fontItalicClose' : '_' , 'listItemOpen' : '- ' , 'listItemLine' : '\t' , 'numlistItemOpen' : '. ' , 'url' : '\a' , 'urlMark' : '\a[\a]' , 'email' : 'mailto:\a' , 'emailMark' : 'mailto:\a[\a]' , 'img' : 'image::\a[]' , }, # http://wiki.splitbrain.org/wiki:syntax # Hint: <br> is \\ $ # Hint: You can add footnotes ((This is a footnote)) 'doku': { 'title1' : '===== \a =====', 'title2' : '==== \a ====' , 'title3' : '=== \a ===' , 'title4' : '== \a ==' , 'title5' : '= \a =' , # DokuWiki uses ' ' identation to mark verb blocks (see indentverbblock) 'blockQuoteLine' : '>' , 'fontMonoOpen' : "''" , 'fontMonoClose' : "''" , 'fontBoldOpen' : "**" , 'fontBoldClose' : "**" , 'fontItalicOpen' : "//" , 'fontItalicClose' : "//" , 'fontUnderlineOpen' : "__" , 'fontUnderlineClose' : "__" , 'fontStrikeOpen' : '<del>' , 'fontStrikeClose' : '</del>' , 'listItemOpen' : ' * ' , 'numlistItemOpen' : ' - ' , 'bar1' : '----' , 'url' : '[[\a]]' , 'urlMark' : '[[\a|\a]]' , 'email' : '[[\a]]' , 'emailMark' : '[[\a|\a]]' , 'img' : '{{\a}}' , 'imgAlignLeft' : '{{\a }}' , 'imgAlignRight' : '{{ \a}}' , 'imgAlignCenter' : '{{ \a }}' , 'tableTitleRowOpen' : '^ ' , 'tableTitleRowClose' : ' ^' , 'tableTitleCellSep' : ' ^ ' , 'tableRowOpen' : '| ' , 'tableRowClose' : ' |' , 'tableCellSep' : ' | ' , # DokuWiki has no attributes. The content must be aligned! # '_tableCellAlignRight' : '<)>' , # ?? # '_tableCellAlignCenter': '<:>' , # ?? # DokuWiki colspan is the same as txt2tags' with multiple ||| # 'comment' : '## \a' , # ?? # TOC is automatic }, # http://www.pmwiki.org/wiki/PmWiki/TextFormattingRules 'pmw': { 'title1' : '~A~! \a ' , 'title2' : '~A~!! \a ' , 'title3' : '~A~!!! \a ' , 'title4' : '~A~!!!! \a ' , 'title5' : '~A~!!!!! \a ' , 'blockQuoteOpen' : '->' , 'blockQuoteClose' : '\n' , # In-text font 'fontLargeOpen' : "[+" , 'fontLargeClose' : "+]" , 'fontLargerOpen' : "[++" , 'fontLargerClose' : "++]" , 'fontSmallOpen' : "[-" , 'fontSmallClose' : "-]" , 'fontLargerOpen' : "[--" , 'fontLargerClose' : "--]" , 'fontMonoOpen' : "@@" , 'fontMonoClose' : "@@" , 'fontBoldOpen' : "'''" , 'fontBoldClose' : "'''" , 'fontItalicOpen' : "''" , 'fontItalicClose' : "''" , 'fontUnderlineOpen' : "{+" , 'fontUnderlineClose' : "+}" , 'fontStrikeOpen' : '{-' , 'fontStrikeClose' : '-}' , # Lists 'listItemLine' : '*' , 'numlistItemLine' : '#' , 'deflistItem1Open' : ': ' , 'deflistItem1Close' : ':' , 'deflistItem2LineOpen' : '::' , 'deflistItem2LineClose' : ':' , # Verbatim block 'blockVerbOpen' : '[@' , 'blockVerbClose' : '@]' , 'bar1' : '----' , # URL, email and anchor 'url' : '\a' , 'urlMark' : '[[\a -> \a]]' , 'email' : '\a' , 'emailMark' : '[[\a -> mailto:\a]]', 'anchor' : '[[#\a]]\n' , # Image markup 'img' : '\a' , #'imgAlignLeft' : '{{\a }}' , #'imgAlignRight' : '{{ \a}}' , #'imgAlignCenter' : '{{ \a }}' , # Table attributes 'tableTitleRowOpen' : '||! ' , 'tableTitleRowClose' : '||' , 'tableTitleCellSep' : ' ||!' , 'tableRowOpen' : '||' , 'tableRowClose' : '||' , 'tableCellSep' : ' ||' , }, # http://en.wikipedia.org/wiki/Help:Editing 'wiki': { 'title1' : '== \a ==' , 'title2' : '=== \a ===' , 'title3' : '==== \a ====' , 'title4' : '===== \a =====' , 'title5' : '====== \a ======', 'blockVerbOpen' : '<pre>' , 'blockVerbClose' : '</pre>' , 'blockQuoteOpen' : '<blockquote>' , 'blockQuoteClose' : '</blockquote>' , 'fontMonoOpen' : '<tt>' , 'fontMonoClose' : '</tt>' , 'fontBoldOpen' : "'''" , 'fontBoldClose' : "'''" , 'fontItalicOpen' : "''" , 'fontItalicClose' : "''" , 'fontUnderlineOpen' : '<u>' , 'fontUnderlineClose' : '</u>' , 'fontStrikeOpen' : '<s>' , 'fontStrikeClose' : '</s>' , #XXX Mixed lists not working: *#* list inside numlist inside list 'listItemLine' : '*' , 'numlistItemLine' : '#' , 'deflistItem1Open' : '; ' , 'deflistItem2LinePrefix': ': ' , 'bar1' : '----' , 'url' : '[\a]' , 'urlMark' : '[\a \a]' , 'email' : 'mailto:\a' , 'emailMark' : '[mailto:\a \a]' , # [[Image:foo.png|right|Optional alt/caption text]] (right, left, center, none) 'img' : '[[Image:\a~A~]]' , '_imgAlignLeft' : '|left' , '_imgAlignCenter' : '|center' , '_imgAlignRight' : '|right' , # {| border="1" cellspacing="0" cellpadding="4" align="center" 'tableOpen' : '{|~A~~B~ cellpadding="4"', 'tableClose' : '|}' , 'tableRowOpen' : '|-\n| ' , 'tableTitleRowOpen' : '|-\n! ' , 'tableCellSep' : ' || ' , 'tableTitleCellSep' : ' !! ' , '_tableBorder' : ' border="1"' , '_tableAlignCenter' : ' align="center"' , 'comment' : '<!-- \a -->' , 'TOC' : '__TOC__' , }, # http://www.inference.phy.cam.ac.uk/mackay/mgp/SYNTAX # http://en.wikipedia.org/wiki/MagicPoint 'mgp': { 'paragraphOpen' : '%font "normal", size 5' , 'title1' : '%page\n\n\a\n' , 'title2' : '%page\n\n\a\n' , 'title3' : '%page\n\n\a\n' , 'title4' : '%page\n\n\a\n' , 'title5' : '%page\n\n\a\n' , 'blockVerbOpen' : '%font "mono"' , 'blockVerbClose' : '%font "normal"' , 'blockQuoteOpen' : '%prefix " "' , 'blockQuoteClose' : '%prefix " "' , 'fontMonoOpen' : '\n%cont, font "mono"\n' , 'fontMonoClose' : '\n%cont, font "normal"\n' , 'fontBoldOpen' : '\n%cont, font "normal-b"\n' , 'fontBoldClose' : '\n%cont, font "normal"\n' , 'fontItalicOpen' : '\n%cont, font "normal-i"\n' , 'fontItalicClose' : '\n%cont, font "normal"\n' , 'fontUnderlineOpen' : '\n%cont, fore "cyan"\n' , 'fontUnderlineClose' : '\n%cont, fore "white"\n' , 'listItemLine' : '\t' , 'numlistItemLine' : '\t' , 'numlistItemOpen' : '\a. ' , 'deflistItem1Open' : '\t\n%cont, font "normal-b"\n', 'deflistItem1Close' : '\n%cont, font "normal"\n' , 'bar1' : '%bar "white" 5' , 'bar2' : '%pause' , 'url' : '\n%cont, fore "cyan"\n\a' +\ '\n%cont, fore "white"\n' , 'urlMark' : '\a \n%cont, fore "cyan"\n\a'+\ '\n%cont, fore "white"\n' , 'email' : '\n%cont, fore "cyan"\n\a' +\ '\n%cont, fore "white"\n' , 'emailMark' : '\a \n%cont, fore "cyan"\n\a'+\ '\n%cont, fore "white"\n' , 'img' : '~A~\n%newimage "\a"\n%left\n', '_imgAlignLeft' : '\n%left' , '_imgAlignRight' : '\n%right' , '_imgAlignCenter' : '\n%center' , 'comment' : '%% \a' , 'pageBreak' : '%page\n\n\n' , 'EOD' : '%%EOD' }, # man groff_man ; man 7 groff 'man': { 'paragraphOpen' : '.P' , 'title1' : '.SH \a' , 'title2' : '.SS \a' , 'title3' : '.SS \a' , 'title4' : '.SS \a' , 'title5' : '.SS \a' , 'blockVerbOpen' : '.nf' , 'blockVerbClose' : '.fi\n' , 'blockQuoteOpen' : '.RS' , 'blockQuoteClose' : '.RE' , 'fontBoldOpen' : '\\fB' , 'fontBoldClose' : '\\fR' , 'fontItalicOpen' : '\\fI' , 'fontItalicClose' : '\\fR' , 'listOpen' : '.RS' , 'listItemOpen' : '.IP \(bu 3\n', 'listClose' : '.RE' , 'numlistOpen' : '.RS' , 'numlistItemOpen' : '.IP \a. 3\n', 'numlistClose' : '.RE' , 'deflistItem1Open' : '.TP\n' , 'bar1' : '\n\n' , 'url' : '\a' , 'urlMark' : '\a (\a)', 'email' : '\a' , 'emailMark' : '\a (\a)', 'img' : '\a' , 'tableOpen' : '.TS\n~A~~B~tab(^); ~C~.', 'tableClose' : '.TE' , 'tableRowOpen' : ' ' , 'tableCellSep' : '^' , '_tableAlignCenter' : 'center, ', '_tableBorder' : 'allbox, ', '_tableColAlignLeft' : 'l' , '_tableColAlignRight' : 'r' , '_tableColAlignCenter' : 'c' , 'comment' : '.\\" \a' }, 'pm6': { 'paragraphOpen' : '<@Normal:>' , 'title1' : '<@Title1:>\a', 'title2' : '<@Title2:>\a', 'title3' : '<@Title3:>\a', 'title4' : '<@Title4:>\a', 'title5' : '<@Title5:>\a', 'blockVerbOpen' : '<@PreFormat:>' , 'blockQuoteLine' : '<@Quote:>' , 'fontMonoOpen' : '<FONT "Lucida Console"><SIZE 9>' , 'fontMonoClose' : '<SIZE$><FONT$>', 'fontBoldOpen' : '<B>' , 'fontBoldClose' : '<P>' , 'fontItalicOpen' : '<I>' , 'fontItalicClose' : '<P>' , 'fontUnderlineOpen' : '<U>' , 'fontUnderlineClose' : '<P>' , 'listOpen' : '<@Bullet:>' , 'listItemOpen' : '\x95\t' , # \x95 == ~U 'numlistOpen' : '<@Bullet:>' , 'numlistItemOpen' : '\x95\t' , 'bar1' : '\a' , 'url' : '<U>\a<P>' , # underline 'urlMark' : '\a <U>\a<P>' , 'email' : '\a' , 'emailMark' : '\a \a' , 'img' : '\a' }, # http://www.wikicreole.org/wiki/AllMarkup 'creole': { 'title1' : '= \a =' , 'title2' : '== \a ==' , 'title3' : '=== \a ===' , 'title4' : '==== \a ====' , 'title5' : '===== \a =====', 'blockVerbOpen' : '{{{' , 'blockVerbClose' : '}}}' , 'blockQuoteLine' : ' ' , # 'fontMonoOpen' : '##' , # planned for 2.0, # 'fontMonoClose' : '##' , # meanwhile we disable it 'fontBoldOpen' : '**' , 'fontBoldClose' : '**' , 'fontItalicOpen' : '//' , 'fontItalicClose' : '//' , 'fontUnderlineOpen' : '//' , # no underline in 1.0, planned for 2.0, 'fontUnderlineClose' : '//' , # meanwhile we can use italic (emphasized) # 'fontStrikeOpen' : '--' , # planned for 2.0, # 'fontStrikeClose' : '--' , # meanwhile we disable it 'listItemLine' : '*' , 'numlistItemLine' : '#' , 'deflistItem2LinePrefix': ':' , 'bar1' : '----' , 'url' : '[[\a]]' , 'urlMark' : '[[\a|\a]]' , 'img' : '{{\a}}' , 'tableTitleRowOpen' : '|= ' , 'tableTitleRowClose' : '|' , 'tableTitleCellSep' : ' |= ' , 'tableRowOpen' : '| ' , 'tableRowClose' : ' |' , 'tableCellSep' : ' | ' , # TODO: placeholder (mark for unknown syntax) # if possible: http://www.wikicreole.org/wiki/Placeholder } } # Exceptions for --css-sugar if config['css-sugar'] and config['target'] in ('html','xhtml'): # Change just HTML because XHTML inherits it htmltags = alltags['html'] # Table with no cellpadding htmltags['tableOpen'] = htmltags['tableOpen'].replace(' CELLPADDING="4"', '') # DIVs htmltags['tocOpen' ] = '<DIV CLASS="toc">' htmltags['tocClose'] = '</DIV>' htmltags['bodyOpen'] = '<DIV CLASS="body" ID="body">' htmltags['bodyClose']= '</DIV>' # Make the HTML -> XHTML inheritance xhtml = alltags['html'].copy() for key in xhtml.keys(): xhtml[key] = xhtml[key].lower() # Some like HTML tags as lowercase, some don't... (headers out) if HTML_LOWER: alltags['html'] = xhtml.copy() xhtml.update(alltags['xhtml']) alltags['xhtml'] = xhtml.copy() # Compose the target tags dictionary tags = {} target_tags = alltags[config['target']].copy() for key in keys: tags[key] = '' # create empty keys for key in target_tags.keys(): tags[key] = maskEscapeChar(target_tags[key]) # populate # Map strong line to pagebreak if rules['mapbar2pagebreak'] and tags['pageBreak']: tags['bar2'] = tags['pageBreak'] # Map strong line to separator if not defined if not tags['bar2'] and tags['bar1']: tags['bar2'] = tags['bar1'] return tags ############################################################################## def getRules(config): "Returns all the target-specific syntax rules" ret = {} allrules = [ # target rules (ON/OFF) 'linkable', # target supports external links 'tableable', # target supports tables 'imglinkable', # target supports images as links 'imgalignable', # target supports image alignment 'imgasdefterm', # target supports image as definition term 'autonumberlist', # target supports numbered lists natively 'autonumbertitle', # target supports numbered titles natively 'stylable', # target supports external style files 'parainsidelist', # lists items supports paragraph 'compactlist', # separate enclosing tags for compact lists 'spacedlistitem', # lists support blank lines between items 'listnotnested', # lists cannot be nested 'quotenotnested', # quotes cannot be nested 'verbblocknotescaped', # don't escape specials in verb block 'verbblockfinalescape', # do final escapes in verb block 'escapeurl', # escape special in link URL 'labelbeforelink', # label comes before the link on the tag 'onelinepara', # dump paragraph as a single long line 'tabletitlerowinbold', # manually bold any cell on table titles 'tablecellstrip', # strip extra spaces from each table cell 'tablecellspannable', # the table cells can have span attribute 'tablecellmulticol', # separate open+close tags for multicol cells 'barinsidequote', # bars are allowed inside quote blocks 'finalescapetitle', # perform final escapes on title lines 'autotocnewpagebefore', # break page before automatic TOC 'autotocnewpageafter', # break page after automatic TOC 'autotocwithbars', # automatic TOC surrounded by bars 'mapbar2pagebreak', # map the strong bar to a page break 'titleblocks', # titles must be on open/close section blocks # Target code beautify (ON/OFF) 'indentverbblock', # add leading spaces to verb block lines 'breaktablecell', # break lines after any table cell 'breaktablelineopen', # break line after opening table line 'notbreaklistopen', # don't break line after opening a new list 'keepquoteindent', # don't remove the leading TABs on quotes 'keeplistindent', # don't remove the leading spaces on lists 'blankendautotoc', # append a blank line at the auto TOC end 'tagnotindentable', # tags must be placed at the line beginning 'spacedlistitemopen', # append a space after the list item open tag 'spacednumlistitemopen',# append a space after the numlist item open tag 'deflisttextstrip', # strip the contents of the deflist text 'blanksaroundpara', # put a blank line before and after paragraphs 'blanksaroundverb', # put a blank line before and after verb blocks 'blanksaroundquote', # put a blank line before and after quotes 'blanksaroundlist', # put a blank line before and after lists 'blanksaroundnumlist', # put a blank line before and after numlists 'blanksarounddeflist', # put a blank line before and after deflists 'blanksaroundtable', # put a blank line before and after tables 'blanksaroundbar', # put a blank line before and after bars 'blanksaroundtitle', # put a blank line before and after titles 'blanksaroundnumtitle', # put a blank line before and after numtitles # Value settings 'listmaxdepth', # maximum depth for lists 'quotemaxdepth', # maximum depth for quotes 'tablecellaligntype', # type of table cell align: cell, column ] rules_bank = { 'txt': { 'indentverbblock':1, 'spacedlistitem':1, 'parainsidelist':1, 'keeplistindent':1, 'barinsidequote':1, 'autotocwithbars':1, 'blanksaroundpara':1, 'blanksaroundverb':1, 'blanksaroundquote':1, 'blanksaroundlist':1, 'blanksaroundnumlist':1, 'blanksarounddeflist':1, 'blanksaroundtable':1, 'blanksaroundbar':1, 'blanksaroundtitle':1, 'blanksaroundnumtitle':1, }, 'art': { #TIP art inherits all TXT rules }, 'html': { 'indentverbblock':1, 'linkable':1, 'stylable':1, 'escapeurl':1, 'imglinkable':1, 'imgalignable':1, 'imgasdefterm':1, 'autonumberlist':1, 'spacedlistitem':1, 'parainsidelist':1, 'tableable':1, 'tablecellstrip':1, 'breaktablecell':1, 'breaktablelineopen':1, 'keeplistindent':1, 'keepquoteindent':1, 'barinsidequote':1, 'autotocwithbars':1, 'tablecellspannable':1, 'tablecellaligntype':'cell', # 'blanksaroundpara':1, 'blanksaroundverb':1, # 'blanksaroundquote':1, 'blanksaroundlist':1, 'blanksaroundnumlist':1, 'blanksarounddeflist':1, 'blanksaroundtable':1, 'blanksaroundbar':1, 'blanksaroundtitle':1, 'blanksaroundnumtitle':1, }, 'xhtml': { #TIP xhtml inherits all HTML rules }, 'sgml': { 'linkable':1, 'escapeurl':1, 'autonumberlist':1, 'spacedlistitem':1, 'tableable':1, 'tablecellstrip':1, 'blankendautotoc':1, 'quotenotnested':1, 'keeplistindent':1, 'keepquoteindent':1, 'barinsidequote':1, 'finalescapetitle':1, 'tablecellaligntype':'column', 'blanksaroundpara':1, 'blanksaroundverb':1, 'blanksaroundquote':1, 'blanksaroundlist':1, 'blanksaroundnumlist':1, 'blanksarounddeflist':1, 'blanksaroundtable':1, 'blanksaroundbar':1, 'blanksaroundtitle':1, 'blanksaroundnumtitle':1, }, 'dbk': { 'linkable':1, 'tableable':0, # activate when table tags are ready 'imglinkable':1, 'imgalignable':1, 'imgasdefterm':1, 'autonumberlist':1, 'autonumbertitle':1, 'parainsidelist':1, 'spacedlistitem':1, 'titleblocks':1, }, 'mgp': { 'tagnotindentable':1, 'spacedlistitem':1, 'imgalignable':1, 'autotocnewpagebefore':1, 'blanksaroundpara':1, 'blanksaroundverb':1, # 'blanksaroundquote':1, 'blanksaroundlist':1, 'blanksaroundnumlist':1, 'blanksarounddeflist':1, 'blanksaroundtable':1, 'blanksaroundbar':1, # 'blanksaroundtitle':1, # 'blanksaroundnumtitle':1, }, 'tex': { 'stylable':1, 'escapeurl':1, 'autonumberlist':1, 'autonumbertitle':1, 'spacedlistitem':1, 'compactlist':1, 'parainsidelist':1, 'tableable':1, 'tablecellstrip':1, 'tabletitlerowinbold':1, 'verbblocknotescaped':1, 'keeplistindent':1, 'listmaxdepth':4, # deflist is 6 'quotemaxdepth':6, 'barinsidequote':1, 'finalescapetitle':1, 'autotocnewpageafter':1, 'mapbar2pagebreak':1, 'tablecellaligntype':'column', 'tablecellmulticol':1, 'blanksaroundpara':1, 'blanksaroundverb':1, # 'blanksaroundquote':1, 'blanksaroundlist':1, 'blanksaroundnumlist':1, 'blanksarounddeflist':1, 'blanksaroundtable':1, 'blanksaroundbar':1, 'blanksaroundtitle':1, 'blanksaroundnumtitle':1, }, 'lout': { 'keepquoteindent':1, 'deflisttextstrip':1, 'escapeurl':1, 'verbblocknotescaped':1, 'imgalignable':1, 'mapbar2pagebreak':1, 'titleblocks':1, 'autonumberlist':1, 'parainsidelist':1, 'blanksaroundpara':1, 'blanksaroundverb':1, # 'blanksaroundquote':1, 'blanksaroundlist':1, 'blanksaroundnumlist':1, 'blanksarounddeflist':1, 'blanksaroundtable':1, 'blanksaroundbar':1, 'blanksaroundtitle':1, 'blanksaroundnumtitle':1, }, 'moin': { 'spacedlistitem':1, 'linkable':1, 'keeplistindent':1, 'tableable':1, 'barinsidequote':1, 'tabletitlerowinbold':1, 'tablecellstrip':1, 'autotocwithbars':1, 'tablecellaligntype':'cell', 'deflisttextstrip':1, 'blanksaroundpara':1, 'blanksaroundverb':1, # 'blanksaroundquote':1, 'blanksaroundlist':1, 'blanksaroundnumlist':1, 'blanksarounddeflist':1, 'blanksaroundtable':1, # 'blanksaroundbar':1, 'blanksaroundtitle':1, 'blanksaroundnumtitle':1, }, 'gwiki': { 'spacedlistitem':1, 'linkable':1, 'keeplistindent':1, 'tableable':1, 'tabletitlerowinbold':1, 'tablecellstrip':1, 'autonumberlist':1, 'blanksaroundpara':1, 'blanksaroundverb':1, # 'blanksaroundquote':1, 'blanksaroundlist':1, 'blanksaroundnumlist':1, 'blanksarounddeflist':1, 'blanksaroundtable':1, # 'blanksaroundbar':1, 'blanksaroundtitle':1, 'blanksaroundnumtitle':1, }, 'adoc': { 'spacedlistitem':1, 'linkable':1, 'keeplistindent':1, 'autonumberlist':1, 'autonumbertitle':1, 'listnotnested':1, 'blanksaroundpara':1, 'blanksaroundverb':1, 'blanksaroundlist':1, 'blanksaroundnumlist':1, 'blanksarounddeflist':1, 'blanksaroundtable':1, 'blanksaroundtitle':1, 'blanksaroundnumtitle':1, }, 'doku': { 'indentverbblock':1, # DokuWiki uses ' ' to mark verb blocks 'spacedlistitem':1, 'linkable':1, 'keeplistindent':1, 'tableable':1, 'barinsidequote':1, 'tablecellstrip':1, 'autotocwithbars':1, 'autonumberlist':1, 'imgalignable':1, 'tablecellaligntype':'cell', 'blanksaroundpara':1, 'blanksaroundverb':1, # 'blanksaroundquote':1, 'blanksaroundlist':1, 'blanksaroundnumlist':1, 'blanksarounddeflist':1, 'blanksaroundtable':1, 'blanksaroundbar':1, 'blanksaroundtitle':1, 'blanksaroundnumtitle':1, }, 'pmw': { 'indentverbblock':1, 'spacedlistitem':1, 'linkable':1, 'labelbeforelink':1, # 'keeplistindent':1, 'tableable':1, 'barinsidequote':1, 'tablecellstrip':1, 'autotocwithbars':1, 'autonumberlist':1, 'spacedlistitemopen':1, 'spacednumlistitemopen':1, 'imgalignable':1, 'tabletitlerowinbold':1, 'tablecellaligntype':'cell', 'blanksaroundpara':1, 'blanksaroundverb':1, 'blanksaroundquote':1, 'blanksaroundlist':1, 'blanksaroundnumlist':1, 'blanksarounddeflist':1, 'blanksaroundtable':1, 'blanksaroundbar':1, 'blanksaroundtitle':1, 'blanksaroundnumtitle':1, }, 'wiki': { 'linkable':1, 'tableable':1, 'tablecellstrip':1, 'autotocwithbars':1, 'spacedlistitemopen':1, 'spacednumlistitemopen':1, 'deflisttextstrip':1, 'autonumberlist':1, 'imgalignable':1, 'blanksaroundpara':1, 'blanksaroundverb':1, # 'blanksaroundquote':1, 'blanksaroundlist':1, 'blanksaroundnumlist':1, 'blanksarounddeflist':1, 'blanksaroundtable':1, 'blanksaroundbar':1, 'blanksaroundtitle':1, 'blanksaroundnumtitle':1, }, 'man': { 'spacedlistitem':1, 'tagnotindentable':1, 'tableable':1, 'tablecellaligntype':'column', 'tabletitlerowinbold':1, 'tablecellstrip':1, 'barinsidequote':1, 'parainsidelist':0, 'blanksaroundpara':1, 'blanksaroundverb':1, # 'blanksaroundquote':1, 'blanksaroundlist':1, 'blanksaroundnumlist':1, 'blanksarounddeflist':1, 'blanksaroundtable':1, # 'blanksaroundbar':1, 'blanksaroundtitle':1, 'blanksaroundnumtitle':1, }, 'pm6': { 'keeplistindent':1, 'verbblockfinalescape':1, #TODO add support for these # maybe set a JOINNEXT char and do it on addLineBreaks() 'notbreaklistopen':1, 'barinsidequote':1, 'autotocwithbars':1, 'onelinepara':1, 'blanksaroundpara':1, 'blanksaroundverb':1, # 'blanksaroundquote':1, 'blanksaroundlist':1, 'blanksaroundnumlist':1, 'blanksarounddeflist':1, # 'blanksaroundtable':1, # 'blanksaroundbar':1, 'blanksaroundtitle':1, 'blanksaroundnumtitle':1, }, 'creole': { 'linkable':1, 'tableable':1, 'imglinkable':1, 'tablecellstrip':1, 'autotocwithbars':1, 'spacedlistitemopen':1, 'spacednumlistitemopen':1, 'deflisttextstrip':1, 'verbblocknotescaped':1, 'blanksaroundpara':1, 'blanksaroundverb':1, 'blanksaroundquote':1, 'blanksaroundlist':1, 'blanksaroundnumlist':1, 'blanksarounddeflist':1, 'blanksaroundtable':1, 'blanksaroundbar':1, 'blanksaroundtitle':1, }, } # Exceptions for --css-sugar if config['css-sugar'] and config['target'] in ('html','xhtml'): rules_bank['html']['indentverbblock'] = 0 rules_bank['html']['autotocwithbars'] = 0 # Get the target specific rules if config['target'] == 'xhtml': myrules = rules_bank['html'].copy() # inheritance myrules.update(rules_bank['xhtml']) # get XHTML specific elif config['target'] == 'art': myrules = rules_bank['txt'].copy() # inheritance if config['slides']: myrules['blanksaroundtitle'] = 0 myrules['blanksaroundnumtitle'] = 0 else: myrules = rules_bank[config['target']].copy() # Populate return dictionary for key in allrules: ret[key] = 0 # reset all ret.update(myrules) # get rules return ret ############################################################################## def getRegexes(): "Returns all the regexes used to find the t2t marks" bank = { 'blockVerbOpen': re.compile(r'^```\s*$'), 'blockVerbClose': re.compile(r'^```\s*$'), 'blockRawOpen': re.compile(r'^"""\s*$'), 'blockRawClose': re.compile(r'^"""\s*$'), 'blockTaggedOpen': re.compile(r"^'''\s*$"), 'blockTaggedClose': re.compile(r"^'''\s*$"), 'blockCommentOpen': re.compile(r'^%%%\s*$'), 'blockCommentClose': re.compile(r'^%%%\s*$'), 'quote': re.compile(r'^\t+'), '1lineVerb': re.compile(r'^``` (?=.)'), '1lineRaw': re.compile(r'^""" (?=.)'), '1lineTagged': re.compile(r"^''' (?=.)"), # mono, raw, bold, italic, underline: # - marks must be glued with the contents, no boundary spaces # - they are greedy, so in ****bold****, turns to <b>**bold**</b> 'fontMono': re.compile( r'``([^\s](|.*?[^\s])`*)``'), 'raw': re.compile( r'""([^\s](|.*?[^\s])"*)""'), 'tagged': re.compile( r"''([^\s](|.*?[^\s])'*)''"), 'fontBold': re.compile(r'\*\*([^\s](|.*?[^\s])\**)\*\*'), 'fontItalic': re.compile( r'//([^\s](|.*?[^\s])/*)//'), 'fontUnderline': re.compile( r'__([^\s](|.*?[^\s])_*)__'), 'fontStrike': re.compile( r'--([^\s](|.*?[^\s])-*)--'), 'list': re.compile(r'^( *)(-) (?=[^ ])'), 'numlist': re.compile(r'^( *)(\+) (?=[^ ])'), 'deflist': re.compile(r'^( *)(:) (.*)$'), 'listclose': re.compile(r'^( *)([-+:])\s*$'), 'bar': re.compile(r'^(\s*)([_=-]{20,})\s*$'), 'table': re.compile(r'^ *\|\|? '), 'blankline': re.compile(r'^\s*$'), 'comment': re.compile(r'^%'), # Auxiliary tag regexes '_imgAlign' : re.compile(r'~A~', re.I), '_tableAlign' : re.compile(r'~A~', re.I), '_anchor' : re.compile(r'~A~', re.I), '_tableBorder' : re.compile(r'~B~', re.I), '_tableColAlign' : re.compile(r'~C~', re.I), '_tableCellColSpan': re.compile(r'~S~', re.I), '_tableCellAlign' : re.compile(r'~A~', re.I), } # Special char to place data on TAGs contents (\a == bell) bank['x'] = re.compile('\a') # %%macroname [ (formatting) ] bank['macros'] = re.compile(r'%%%%(?P<name>%s)\b(\((?P<fmt>.*?)\))?' % ( '|'.join(MACROS.keys())), re.I) # %%TOC special macro for TOC positioning bank['toc'] = re.compile(r'^ *%%toc\s*$', re.I) # Almost complicated title regexes ;) titskel = r'^ *(?P<id>%s)(?P<txt>%s)\1(\[(?P<label>[\w-]*)\])?\s*$' bank[ 'title'] = re.compile(titskel%('[=]{1,5}','[^=](|.*[^=])')) bank['numtitle'] = re.compile(titskel%('[+]{1,5}','[^+](|.*[^+])')) ### Complicated regexes begin here ;) # # Textual descriptions on --help's style: [...] is optional, | is OR ### First, some auxiliary variables # # [image.EXT] patt_img = r'\[([\w_,.+%$#@!?+~/-]+\.(png|jpe?g|gif|eps|bmp|svg))\]' # Link things # http://www.gbiv.com/protocols/uri/rfc/rfc3986.html # pchar: A-Za-z._~- / %FF / !$&'()*+,;= / :@ # Recomended order: scheme://user:pass@domain/path?query=foo#anchor # Also works : scheme://user:pass@domain/path#anchor?query=foo # TODO form: !'(): urlskel = { 'proto' : r'(https?|ftp|news|telnet|gopher|wais)://', 'guess' : r'(www[23]?|ftp)\.', # w/out proto, try to guess 'login' : r'A-Za-z0-9_.-', # for ftp://login@domain.com 'pass' : r'[^ @]*', # for ftp://login:pass@dom.com 'chars' : r'A-Za-z0-9%._/~:,=$@&+-', # %20(space), :80(port), D&D 'anchor': r'A-Za-z0-9%._-', # %nn(encoded) 'form' : r'A-Za-z0-9/%&=+:;.,$@*_-', # .,@*_-(as is) 'punct' : r'.,;:!?' } # username [ :password ] @ patt_url_login = r'([%s]+(:%s)?@)?'%(urlskel['login'],urlskel['pass']) # [ http:// ] [ username:password@ ] domain.com [ / ] # [ #anchor | ?form=data ] retxt_url = r'\b(%s%s|%s)[%s]+\b/*(\?[%s]+)?(#[%s]*)?'%( urlskel['proto'],patt_url_login, urlskel['guess'], urlskel['chars'],urlskel['form'],urlskel['anchor']) # filename | [ filename ] #anchor retxt_url_local = r'[%s]+|[%s]*(#[%s]*)'%( urlskel['chars'],urlskel['chars'],urlskel['anchor']) # user@domain [ ?form=data ] patt_email = r'\b[%s]+@([A-Za-z0-9_-]+\.)+[A-Za-z]{2,4}\b(\?[%s]+)?'%( urlskel['login'],urlskel['form']) # Saving for future use bank['_urlskel'] = urlskel ### And now the real regexes # bank['email'] = re.compile(patt_email,re.I) # email | url bank['link'] = re.compile(r'%s|%s'%(retxt_url,patt_email), re.I) # \[ label | imagetag url | email | filename \] bank['linkmark'] = re.compile( r'\[(?P<label>%s|[^]]+) (?P<link>%s|%s|%s)\]'%( patt_img, retxt_url, patt_email, retxt_url_local), re.I) # Image bank['img'] = re.compile(patt_img, re.I) # Special things bank['special'] = re.compile(r'^%!\s*') return bank ### END OF regex nightmares ################# functions for the ASCII Art backend ######################## def aa_line(char, length): return char * length def aa_box(txt, length): len_txt = len(txt) nspace = (length - len_txt - 4) / 2 line_box = " " * nspace + AA['corner'] + AA['border'] * (len_txt + 2) + AA['corner'] # <----- nspace " " -----> "+" <----- len_txt+2 "-" -----> "+" # +-------------------------------+ # | all theeeeeeeeeeeeeeeeee text | # <----- nspace " " -----> "| " <--------- txt ---------> " |" line_txt = " " * nspace + AA['side'] + ' ' + txt + ' ' + AA['side'] return [line_box, line_txt, line_box] def aa_header(header_data, length, n, end): header = [aa_line(AA['bar2'], length)] header.extend(['']*n) for h in 'HEADER1', 'HEADER2', 'HEADER3': if header_data[h]: header.extend(aa_box(header_data[h], length)) header.extend(['']*n) header.extend(['']*end) header.append(aa_line(AA['bar2'], length)) return header def aa_slide(title, length): res = [aa_line(AA['bar2'], length)] res.append('') res.append(title.center(length)) res.append('') res.append(aa_line(AA['bar2'], length)) return res def aa_table(table): data = [row[2:-2].split(' | ') for row in table] n = max([len(line) for line in data]) data = [line + (n - len(line)) * [''] for line in data] tab = [] for i in range(n): tab.append([line[i] for line in data]) length = [max([len(el) for el in line]) for line in tab] res = "+" for i in range(n): res = res + (length[i] + 2) * "-" + '+' ret = [] for line in data: aff = "|" ret.append(res) for j,el in enumerate(line): aff = aff + " " + el + (length[j] - len(el) + 1) * " " + "|" ret.append(aff) ret.append(res) return ret ############################################################################## class error(Exception): pass def echo(msg): # for quick debug print('\033[32;1m%s\033[m'%msg) def Quit(msg=''): if msg: print(msg) sys.exit(0) def Error(msg): msg = _("%s: Error: ")%my_name + msg raise error(msg) def getTraceback(): try: from traceback import format_exception etype, value, tb = sys.exc_info() return ''.join(format_exception(etype, value, tb)) except: pass def getUnknownErrorMessage(): msg = '%s\n%s (%s):\n\n%s'%( _('Sorry! Txt2tags aborted by an unknown error.'), _('Please send the following Error Traceback to the author'), my_email, getTraceback()) return msg def Message(msg,level): if level <= VERBOSE and not QUIET: prefix = '-'*5 print("%s %s"%(prefix*level, msg)) def Debug(msg,id_=0,linenr=None): "Show debug messages, categorized (colored or not)" if QUIET or not DEBUG: return if int(id_) not in range(8): id_ = 0 # 0:black 1:red 2:green 3:yellow 4:blue 5:pink 6:cyan 7:white ;1:light ids = ['INI','CFG','SRC','BLK','HLD','GUI','OUT','DET'] colors_bgdark = ['7;1','1;1','3;1','6;1','4;1','5;1','2;1','7;1'] colors_bglight = ['0' ,'1' ,'3' ,'6' ,'4' ,'5' ,'2' ,'0' ] if linenr is not None: msg = "LINE %04d: %s"%(linenr,msg) if COLOR_DEBUG: if BG_LIGHT: color = colors_bglight[id_] else : color = colors_bgdark[id_] msg = '\033[3%sm%s\033[m'%(color,msg) print("++ %s: %s"%(ids[id_],msg)) def Readfile(file_path, remove_linebreaks=0, ignore_error=0): data = [] if file_path == '-': try: data = sys.stdin.readlines() except: if not ignore_error: Error(_('You must feed me with data on STDIN!')) else: try: f = open(file_path) data = f.readlines() f.close() except: if not ignore_error: Error(_("Cannot read file:") + ' ' + file_path) if remove_linebreaks: data = [re.sub('[\n\r]+$', '', x) for x in data] Message(_("File read (%d lines): %s") % (len(data), file_path), 2) return data def Savefile(file_path, lines): try: with open(file_path, "w") as f: f.writelines(lines) except IOError: Error(_("Cannot open file for writing:") + ' ' + file_path) def showdic(dic): for k in dic.keys(): print("%15s : %s" % (k,dic[k])) def dotted_spaces(txt=''): return txt.replace(' ', '.') # TIP: win env vars http://www.winnetmag.com/Article/ArticleID/23873/23873.html def get_rc_path(): "Return the full path for the users' RC file" # Try to get the path from an env var. if yes, we're done user_defined = os.environ.get('T2TCONFIG') if user_defined: return user_defined # Env var not found, so perform automatic path composing # Set default filename according system platform rc_names = {'default':'.txt2tagsrc', 'win':'_t2trc'} rc_file = rc_names.get(sys.platform[:3]) or rc_names['default'] # The file must be on the user directory, but where is this dir? rc_dir_search = ['HOME', 'HOMEPATH'] for var in rc_dir_search: rc_dir = os.environ.get(var) if rc_dir: break # rc dir found, now we must join dir+file to compose the full path if rc_dir: # Compose path and return it if the file exists rc_path = os.path.join(rc_dir, rc_file) # On windows, prefix with the drive (%homedrive%: 2k/XP/NT) if sys.platform.startswith('win'): rc_drive = os.environ.get('HOMEDRIVE') rc_path = os.path.join(rc_drive,rc_path) return rc_path # Sorry, not found return '' ############################################################################## class CommandLine: """ Command Line class - Masters command line This class checks and extract data from the provided command line. The --long options and flags are taken from the global OPTIONS, FLAGS and ACTIONS dictionaries. The short options are registered here, and also their equivalence to the long ones. _compose_short_opts() -> str _compose_long_opts() -> list Compose the valid short and long options list, on the 'getopt' format. parse() -> (opts, args) Call getopt to check and parse the command line. It expects to receive the command line as a list, and without the program name (sys.argv[1:]). get_raw_config() -> [RAW config] Scans command line and convert the data to the RAW config format. See ConfigMaster class to the RAW format description. Optional 'ignore' and 'filter_' arguments are used to filter in or out specified keys. compose_cmdline(dict) -> [Command line] Compose a command line list from an already parsed config dictionary, generated from RAW by ConfigMaster(). Use this to compose an optimal command line for a group of options. The get_raw_config() calls parse(), so the typical use of this class is: raw = CommandLine().get_raw_config(sys.argv[1:]) """ def __init__(self): self.all_options = list(OPTIONS.keys()) self.all_flags = list(FLAGS.keys()) self.all_actions = list(ACTIONS.keys()) # short:long options equivalence self.short_long = { 'C':'config-file', 'h':'help', 'H':'no-headers', 'i':'infile', 'n':'enum-title', 'o':'outfile', 'q':'quiet', 't':'target', 'v':'verbose', 'V':'version', } # Compose valid short and long options data for getopt self.short_opts = self._compose_short_opts() self.long_opts = self._compose_long_opts() def _compose_short_opts(self): "Returns a string like 'hVt:o' with all short options/flags" ret = [] for opt in self.short_long.keys(): long_ = self.short_long[opt] if long_ in self.all_options: # is flag or option? opt = opt+':' # option: have param ret.append(opt) #Debug('Valid SHORT options: %s'%ret) return ''.join(ret) def _compose_long_opts(self): "Returns a list with all the valid long options/flags" ret = [x+'=' for x in self.all_options] # add = ret.extend(self.all_flags) # flag ON ret.extend(self.all_actions) # actions ret.extend(['no-'+x for x in self.all_flags]) # add no-* ret.extend(['no-style','no-encoding']) # turn OFF ret.extend(['no-outfile','no-infile']) # turn OFF ret.extend(['no-dump-config', 'no-dump-source']) # turn OFF ret.extend(['no-targets']) # turn OFF #Debug('Valid LONG options: %s'%ret) return ret def _tokenize(self, cmd_string=''): "Convert a command line string to a list" #TODO protect quotes contents -- Don't use it, pass cmdline as list return cmd_string.split() def parse(self, cmdline=[]): "Check/Parse a command line list TIP: no program name!" # Get the valid options short, long_ = self.short_opts, self.long_opts # Parse it! try: opts, args = getopt.getopt(cmdline, short, long_) except getopt.error as errmsg: Error(_("%s (try --help)")%errmsg) return (opts, args) def get_raw_config(self, cmdline=[], ignore=[], filter_=[], relative=0): "Returns the options/arguments found as RAW config" if not cmdline: return [] ret = [] # We need lists, not strings (such as from %!options) if isinstance(cmdline, str): cmdline = self._tokenize(cmdline) # Extract name/value pair of all configs, check for invalid names options, arguments = self.parse(cmdline[:]) # Some cleanup on the raw config for name, value in options: # Remove leading - and -- name = re.sub('^--?', '', name) # Fix old misspelled --suGGar, --no-suGGar name = name.replace('suggar', 'sugar') # Translate short option to long if len(name) == 1: name = self.short_long[name] # Outfile exception: path relative to PWD if name == 'outfile' and relative and value not in [STDOUT, MODULEOUT]: value = os.path.abspath(value) # -C, --config-file inclusion, path relative to PWD if name == 'config-file': ret.extend(ConfigLines().include_config_file(value)) continue # Save this config ret.append(['all', name, value]) # All configuration was read and saved # Get infile, if any while arguments: infile = arguments.pop(0) ret.append(['all', 'infile', infile]) # Apply 'ignore' and 'filter_' rules (filter_ is stronger) if (ignore or filter_): filtered = [] for target, name, value in ret: if (filter_ and name in filter_) or \ (ignore and name not in ignore): filtered.append([target, name, value]) ret = filtered[:] # Add the original command line string as 'realcmdline' ret.append( ['all', 'realcmdline', cmdline] ) return ret def compose_cmdline(self, conf={}, no_check=0): "compose a full (and diet) command line from CONF dict" if not conf: return [] args = [] dft_options = OPTIONS.copy() cfg = conf.copy() valid_opts = self.all_options + self.all_flags use_short = {'no-headers':'H', 'enum-title':'n'} # Remove useless options if not no_check and cfg.get('toc-only'): if 'no-headers' in cfg: del cfg['no-headers'] if 'outfile' in cfg: del cfg['outfile'] # defaults to STDOUT if cfg.get('target') == 'txt': del cfg['target'] # already default args.append('--toc-only') # must be the first del cfg['toc-only'] # Add target type if 'target' in cfg: args.append('-t '+cfg['target']) del cfg['target'] # Add other options for key in cfg.keys(): if key not in valid_opts: continue # may be a %!setting if key == 'outfile' or key == 'infile': continue # later val = cfg[key] if not val: continue # Default values are useless on cmdline if val == dft_options.get(key): continue # -short format if key in use_short.keys(): args.append('-'+use_short[key]) continue # --long format if key in self.all_flags: # add --option args.append('--'+key) else: # add --option=value args.append('--%s=%s'%(key,val)) # The outfile using -o if 'outfile' in cfg and \ cfg['outfile'] != dft_options.get('outfile'): args.append('-o '+cfg['outfile']) # Place input file(s) always at the end if 'infile' in cfg: args.append(' '.join(cfg['infile'])) # Return as a nice list Debug("Diet command line: %s"%' '.join(args), 1) return args ############################################################################## class SourceDocument: """ SourceDocument class - scan document structure, extract data It knows about full files. It reads a file and identify all the areas beginning (Head,Conf,Body). With this info it can extract each area contents. Note: the original line break is removed. DATA: self.arearef - Save Head, Conf, Body init line number self.areas - Store the area names which are not empty self.buffer - The full file contents (with NO \\r, \\n) METHODS: get() - Access the contents of an Area. Example: config = SourceDocument(file).get('conf') split() - Get all the document Areas at once. Example: head, conf, body = SourceDocument(file).split() RULES: * The document parts are sequential: Head, Conf and Body. * One ends when the next begins. * The Conf Area is optional, so a document can have just Head and Body Areas. These are the Areas limits: - Head Area: the first three lines - Body Area: from the first valid text line to the end - Conf Area: the comments between Head and Body Areas Exception: If the first line is blank, this means no header info, so the Head Area is just the first line. """ def __init__(self, filename='', contents=[]): self.areas = ['head','conf','body'] self.arearef = [] self.areas_fancy = '' self.filename = filename self.buffer = [] if filename: self.scan_file(filename) elif contents: self.scan(contents) def split(self): "Returns all document parts, splitted into lists." return self.get('head'), self.get('conf'), self.get('body') def get(self, areaname): "Returns head|conf|body contents from self.buffer" # Sanity if areaname not in self.areas: return [] if not self.buffer : return [] # Go get it bufini = 1 bufend = len(self.buffer) if areaname == 'head': ini = bufini end = self.arearef[1] or self.arearef[2] or bufend elif areaname == 'conf': ini = self.arearef[1] end = self.arearef[2] or bufend elif areaname == 'body': ini = self.arearef[2] end = bufend else: Error("Unknown Area name '%s'"%areaname) lines = self.buffer[ini:end] # Make sure head will always have 3 lines while areaname == 'head' and len(lines) < 3: lines.append('') return lines def scan_file(self, filename): Debug("source file: %s"%filename) Message(_("Loading source document"),1) buf = Readfile(filename, remove_linebreaks=1) self.scan(buf) def scan(self, lines): "Run through source file and identify head/conf/body areas" buf = lines if len(buf) == 0: Error(_('The input file is empty: %s')%self.filename) cfg_parser = ConfigLines().parse_line buf.insert(0, '') # text start at pos 1 ref = [1,4,0] if not buf[1].strip(): # no header ref[0] = 0 ; ref[1] = 2 rgx = getRegexes() on_comment_block = 0 for i in range(ref[1],len(buf)): # find body init: # Handle comment blocks inside config area if not on_comment_block \ and rgx['blockCommentOpen'].search(buf[i]): on_comment_block = 1 continue if on_comment_block \ and rgx['blockCommentOpen'].search(buf[i]): on_comment_block = 0 continue if on_comment_block: continue if buf[i].strip() and ( # ... not blank and buf[i][0] != '%' or # ... not comment or rgx['macros'].match(buf[i]) or # ... %%macro rgx['toc'].match(buf[i]) or # ... %%toc cfg_parser(buf[i],'include')[1] or # ... %!include cfg_parser(buf[i],'csv')[1] # ... %!csv ): ref[2] = i ; break if ref[1] == ref[2]: ref[1] = 0 # no conf area for i in 0,1,2: # del !existent if ref[i] >= len(buf): ref[i] = 0 # title-only if not ref[i]: self.areas[i] = '' Debug('Head,Conf,Body start line: %s'%ref) self.arearef = ref # save results self.buffer = buf # Fancyness sample: head conf body (1 4 8) self.areas_fancy = "%s (%s)"%( ' '.join(self.areas), ' '.join(map(str, [x or '' for x in ref]))) Message(_("Areas found: %s")%self.areas_fancy, 2) def get_raw_config(self): "Handy method to get the CONF area RAW config (if any)" if not self.areas.count('conf'): return [] Message(_("Scanning source document CONF area"),1) raw = ConfigLines( file_=self.filename, lines=self.get('conf'), first_line=self.arearef[1]).get_raw_config() Debug("document raw config: %s"%raw, 1) return raw ############################################################################## class ConfigMaster: """ ConfigMaster class - the configuration wizard This class is the configuration master. It knows how to handle the RAW and PARSED config format. It also performs the sanity checking for a given configuration. DATA: self.raw - Stores the config on the RAW format self.parsed - Stores the config on the PARSED format self.defaults - Stores the default values for all keys self.off - Stores the OFF values for all keys self.multi - List of keys which can have multiple values self.numeric - List of keys which value must be a number self.incremental - List of keys which are incremental RAW FORMAT: The RAW format is a list of lists, being each mother list item a full configuration entry. Any entry is a 3 item list, on the following format: [ TARGET, KEY, VALUE ] Being a list, the order is preserved, so it's easy to use different kinds of configs, as CONF area and command line, respecting the precedence. The special target 'all' is used when no specific target was defined on the original config. PARSED FORMAT: The PARSED format is a dictionary, with all the 'key : value' found by reading the RAW config. The self.target contents matters, so this dictionary only contains the target's config. The configs of other targets are ignored. The CommandLine and ConfigLines classes have the get_raw_config() method which convert the configuration found to the RAW format. Just feed it to parse() and get a brand-new ready-to-use config dictionary. Example: >>> raw = CommandLine().get_raw_config(['-n', '-H']) >>> print raw [['all', 'enum-title', ''], ['all', 'no-headers', '']] >>> parsed = ConfigMaster(raw).parse() >>> print parsed {'enum-title': 1, 'headers': 0} """ def __init__(self, raw=[], target=''): self.raw = raw self.target = target self.parsed = {} self.dft_options = OPTIONS.copy() self.dft_flags = FLAGS.copy() self.dft_actions = ACTIONS.copy() self.dft_settings = SETTINGS.copy() self.defaults = self._get_defaults() self.off = self._get_off() self.incremental = ['verbose'] self.numeric = ['toc-level', 'split', 'width', 'height'] self.multi = ['infile', 'preproc', 'postproc', 'options', 'style'] def _get_defaults(self): "Get the default values for all config/options/flags" empty = {} for kw in CONFIG_KEYWORDS: empty[kw] = '' empty.update(self.dft_options) empty.update(self.dft_flags) empty.update(self.dft_actions) empty.update(self.dft_settings) empty['realcmdline'] = '' # internal use only empty['sourcefile'] = '' # internal use only return empty def _get_off(self): "Turns OFF all the config/options/flags" off = {} for key in self.defaults.keys(): kind = type(self.defaults[key]) if kind == type(9): off[key] = 0 elif kind == type(''): off[key] = '' elif kind == type([]): off[key] = [] else: Error('ConfigMaster: %s: Unknown type' % key) return off def _check_target(self): "Checks if the target is already defined. If not, do it" if not self.target: self.target = self.find_value('target') def get_target_raw(self): "Returns the raw config for self.target or 'all'" ret = [] self._check_target() for entry in self.raw: if entry[0] == self.target or entry[0] == 'all': ret.append(entry) return ret def add(self, key, val): "Adds the key:value pair to the config dictionary (if needed)" # %!options if key == 'options': ignoreme = list(self.dft_actions.keys()) + ['target'] ignoreme.remove('dump-config') ignoreme.remove('dump-source') ignoreme.remove('targets') raw_opts = CommandLine().get_raw_config( val, ignore=ignoreme) for target, key, val in raw_opts: self.add(key, val) return # The no- prefix turns OFF this key if key.startswith('no-'): key = key[3:] # remove prefix val = self.off.get(key) # turn key OFF # Is this key valid? if key not in self.defaults.keys(): Debug('Bogus Config %s:%s'%(key,val),1) return # Is this value the default one? if val == self.defaults.get(key): # If default value, remove previous key:val if key in self.parsed: del self.parsed[key] # Nothing more to do return # Flags ON comes empty. we'll add the 1 value now if val == '' and ( key in self.dft_flags.keys() or key in self.dft_actions.keys()): val = 1 # Multi value or single? if key in self.multi: # First one? start new list if key not in self.parsed: self.parsed[key] = [] self.parsed[key].append(val) # Incremental value? so let's add it elif key in self.incremental: self.parsed[key] = (self.parsed.get(key) or 0) + val else: self.parsed[key] = val fancykey = dotted_spaces("%12s"%key) Message(_("Added config %s : %s")%(fancykey,val),3) def get_outfile_name(self, config={}): "Dirname is the same for {in,out}file" infile, outfile = config['sourcefile'], config['outfile'] if outfile and outfile not in (STDOUT, MODULEOUT) \ and not os.path.isabs(outfile): outfile = os.path.join(os.path.dirname(infile), outfile) if infile == STDIN and not outfile: outfile = STDOUT if infile == MODULEIN and not outfile: outfile = MODULEOUT if not outfile and (infile and config.get('target')): basename = re.sub('\.(txt|t2t)$','',infile) outfile = "%s.%s"%(basename, config['target']) Debug(" infile: '%s'"%infile , 1) Debug("outfile: '%s'"%outfile, 1) return outfile def sanity(self, config, gui=0): "Basic config sanity checking" global AA if not config: return {} target = config.get('target') # Some actions don't require target specification if not target: for action in NO_TARGET: if config.get(action): target = 'txt' break # On GUI, some checking are skipped if not gui: # We *need* a target if not target: Error(_('No target specified (try --help)') + '\n\n' + _('Please inform a target using the -t option or the %!target command.') + '\n' + _('Example:') + ' %s -t html %s' % (my_name, _('file.t2t')) + '\n\n' + _("Run 'txt2tags --targets' to see all the available targets.")) # And of course, an infile also # TODO#1: It seems that this checking is never reached if not config.get('infile'): Error(_('Missing input file (try --help)')) # Is the target valid? if not TARGETS.count(target): Error(_("Invalid target '%s'") % target + '\n\n' + _("Run 'txt2tags --targets' to see all the available targets.")) # Ensure all keys are present empty = self.defaults.copy() ; empty.update(config) config = empty.copy() # Check integers options for key in config.keys(): if key in self.numeric: try: config[key] = int(config[key]) except ValueError: Error(_('--%s value must be a number') % key) # Check split level value if config['split'] not in (0,1,2): Error(_('Option --split must be 0, 1 or 2')) # Slides needs width and height if config['slides'] and target == 'art': if not config['width']: config['width'] = DFT_SLIDE_WIDTH if not config['height']: config['height'] = DFT_SLIDE_HEIGHT # ASCII Art needs a width if target == 'art' and not config['width']: config['width'] = DFT_TEXT_WIDTH # Check/set user ASCII Art formatting characters if config['art-chars']: if len(config['art-chars']) != len(AA_VALUES): Error(_("--art-chars: Expected %i chars, got %i") % ( len(AA_VALUES), len(config['art-chars']))) else: AA = dict(zip(AA_KEYS, config['art-chars'])) # --toc-only is stronger than others if config['toc-only']: config['headers'] = 0 config['toc'] = 0 config['split'] = 0 config['gui'] = 0 config['outfile'] = config['outfile'] or STDOUT # Splitting is disable for now (future: HTML only, no STDOUT) config['split'] = 0 # Restore target config['target'] = target # Set output file name config['outfile'] = self.get_outfile_name(config) # Checking suicide if config['sourcefile'] == config['outfile'] and \ config['outfile'] not in [STDOUT,MODULEOUT] and not gui: Error(_("Input and Output files are the same: %s") % config['outfile']) return config def parse(self): "Returns the parsed config for the current target" raw = self.get_target_raw() for target, key, value in raw: self.add(key, value) Message(_("Added the following keys: %s") % ', '.join(self.parsed.keys()), 2) return self.parsed.copy() def find_value(self, key='', target=''): "Scans ALL raw config to find the desired key" ret = [] # Scan and save all values found for targ, k, val in self.raw: if k == key and (targ == target or targ == 'all'): ret.append(val) if not ret: return '' # If not multi value, return only the last found if key in self.multi: return ret else : return ret[-1] ######################################################################## class ConfigLines: """ ConfigLines class - the config file data extractor This class reads and parse the config lines on the %!key:val format, converting it to RAW config. It deals with user config file (RC file), source document CONF area and %!includeconf directives. Call it passing a file name or feed the desired config lines. Then just call the get_raw_config() method and wait to receive the full config data on the RAW format. This method also follows the possible %!includeconf directives found on the config lines. Example: raw = ConfigLines(file=".txt2tagsrc").get_raw_config() The parse_line() method is also useful to be used alone, to identify and tokenize a single config line. For example, to get the %!include command components, on the source document BODY: target, key, value = ConfigLines().parse_line(body_line) """ def __init__(self, file_='', lines=[], first_line=1): self.file = file_ or 'NOFILE' self.lines = lines self.first_line = first_line def load_lines(self): "Make sure we've loaded the file contents into buffer" if not self.lines and not self.file: Error("ConfigLines: No file or lines provided") if not self.lines: self.lines = self.read_config_file(self.file) def read_config_file(self, filename=''): "Read a Config File contents, aborting on invalid line" if not filename: return [] errormsg = _("Invalid CONFIG line on %s")+"\n%03d:%s" lines = Readfile(filename, remove_linebreaks=1) # Sanity: try to find invalid config lines for i in range(len(lines)): line = lines[i].rstrip() if not line: continue # empty if line[0] != '%': Error(errormsg%(filename,i+1,line)) return lines def include_config_file(self, file_=''): "Perform the %!includeconf action, returning RAW config" if not file_: return [] # Current dir relative to the current file (self.file) current_dir = os.path.dirname(self.file) file_ = os.path.join(current_dir, file_) # Read and parse included config file contents lines = self.read_config_file(file_) return ConfigLines(file_=file_, lines=lines).get_raw_config() def get_raw_config(self): "Scan buffer and extract all config as RAW (including includes)" ret = [] self.load_lines() first = self.first_line for i in range(len(self.lines)): line = self.lines[i] Message(_("Processing line %03d: %s")%(first+i,line),2) target, key, val = self.parse_line(line) if not key: continue # no config on this line if key == 'includeconf': err = _('A file cannot include itself (loop!)') if val == self.file: Error("%s: %%!includeconf: %s" % (err, self.file)) more_raw = self.include_config_file(val) ret.extend(more_raw) Message(_("Finished Config file inclusion: %s") % val, 2) else: ret.append([target, key, val]) Message(_("Added %s")%key,3) return ret def parse_line(self, line='', keyname='', target=''): "Detects %!key:val config lines and extract data from it" empty = ['', '', ''] if not line: return empty no_target = ['target', 'includeconf'] re_name = keyname or '[a-z]+' re_target = target or '[a-z]*' # XXX TODO <value>\S.+? requires TWO chars, breaks %!include:a cfgregex = re.compile(""" ^%%!\s* # leading id with opt spaces (?P<name>%s)\s* # config name (\((?P<target>%s)\))? # optional target spec inside () \s*:\s* # key:value delimiter with opt spaces (?P<value>\S.+?) # config value \s*$ # rstrip() spaces and hit EOL """%(re_name, re_target), re.I+re.VERBOSE) prepostregex = re.compile(""" # ---[ PATTERN ]--- ^( "([^"]*)" # "double quoted" or | '([^']*)' # 'single quoted' or | ([^\s]+) # single_word ) \s+ # separated by spaces # ---[ REPLACE ]--- ( "([^"]*)" # "double quoted" or | '([^']*)' # 'single quoted' or | (.*) # anything ) \s*$ """, re.VERBOSE) guicolors = re.compile("^([^\s]+\s+){3}[^\s]+") # 4 tokens # Give me a match or get out match = cfgregex.match(line) if not match: return empty # Save information about this config name = (match.group('name') or '').lower() target = (match.group('target') or 'all').lower() value = match.group('value') # %!keyword(target) not allowed for these if name in no_target and match.group('target'): Error( _("You can't use (target) with %s") % ('%!' + name) + "\n%s" % line) # Force no_target keywords to be valid for all targets if name in no_target: target = 'all' # Special config for GUI colors if name == 'guicolors': valmatch = guicolors.search(value) if not valmatch: return empty value = re.split('\s+', value) # Special config with two quoted values (%!preproc: "foo" 'bar') if name == 'preproc' or name == 'postproc': valmatch = prepostregex.search(value) if not valmatch: return empty getval = valmatch.group patt = getval(2) or getval(3) or getval(4) or '' repl = getval(6) or getval(7) or getval(8) or '' value = (patt, repl) return [target, name, value] ############################################################################## class MaskMaster: "(Un)Protect important structures from escaping and formatting" def __init__(self): self.linkmask = 'vvvLINKvvv' self.monomask = 'vvvMONOvvv' self.macromask = 'vvvMACROvvv' self.rawmask = 'vvvRAWvvv' self.taggedmask= 'vvvTAGGEDvvv' self.tocmask = 'vvvTOCvvv' self.macroman = MacroMaster() self.reset() def reset(self): self.linkbank = [] self.monobank = [] self.macrobank = [] self.rawbank = [] self.taggedbank = [] def mask(self, line=''): global AUTOTOC # The verbatim, raw and tagged inline marks are mutually exclusive. # This means that one can't appear inside the other. # If found, the inner marks must be ignored. # Example: ``foo ""bar"" ''baz''`` # In HTML: <code>foo ""bar"" ''baz''</code> # # The trick here is to protect the mark who appears first on the line. # The three regexes are tried and the one with the lowest index wins. # If none is found (else), we get out of the loop. # while True: try: t = regex['tagged'].search(line).start() except: t = -1 try: r = regex['raw'].search(line).start() except: r = -1 try: v = regex['fontMono'].search(line).start() except: v = -1 # Protect tagged text if t >= 0 and (r == -1 or t < r) and (v == -1 or t < v): txt = regex['tagged'].search(line).group(1) ## JS if TARGET == 'tex': txt = txt.replace('_', 'vvvUnderscoreInTaggedTextvvv') self.taggedbank.append(txt) line = regex['tagged'].sub(self.taggedmask,line,1) # Protect raw text elif r >= 0 and (t == -1 or r < t) and (v == -1 or r < v): txt = regex['raw'].search(line).group(1) txt = doEscape(TARGET,txt) ## JS if TARGET == 'tex': txt = txt.replace('_', 'vvvUnderscoreInRawTextvvv') self.rawbank.append(txt) line = regex['raw'].sub(self.rawmask,line,1) # Protect verbatim text elif v >= 0 and (t == -1 or v < t) and (r == -1 or v < r): txt = regex['fontMono'].search(line).group(1) txt = doEscape(TARGET,txt) self.monobank.append(txt) line = regex['fontMono'].sub(self.monomask,line,1) else: break # Protect macros while regex['macros'].search(line): txt = regex['macros'].search(line).group() self.macrobank.append(txt) line = regex['macros'].sub(self.macromask,line,1) # Protect TOC location while regex['toc'].search(line): line = regex['toc'].sub(self.tocmask,line) AUTOTOC = 0 # Protect URLs and emails while regex['linkmark'].search(line) or \ regex['link' ].search(line): # Try to match plain or named links match_link = regex['link'].search(line) match_named = regex['linkmark'].search(line) # Define the current match if match_link and match_named: # Both types found, which is the first? m = match_link if match_named.start() < match_link.start(): m = match_named else: # Just one type found, we're fine m = match_link or match_named # Extract link data and apply mask if m == match_link: # plain link link = m.group() label = '' link_re = regex['link'] else: # named link link = m.group('link') label = m.group('label').rstrip() link_re = regex['linkmark'] line = link_re.sub(self.linkmask,line,1) # Save link data to the link bank self.linkbank.append((label, link)) return line def undo(self, line): # url & email for label,url in self.linkbank: link = get_tagged_link(label, url) line = line.replace(self.linkmask, link, 1) # Expand macros for macro in self.macrobank: macro = self.macroman.expand(macro) line = line.replace(self.macromask, macro, 1) # Expand verb for mono in self.monobank: open_,close = TAGS['fontMonoOpen'],TAGS['fontMonoClose'] line = line.replace(self.monomask, open_+mono+close, 1) # Expand raw for raw in self.rawbank: line = line.replace(self.rawmask, raw, 1) # Expand tagged for tagged in self.taggedbank: line = line.replace(self.taggedmask, tagged, 1) return line ############################################################################## class TitleMaster: "Title things" def __init__(self): self.count = ['',0,0,0,0,0] self.toc = [] self.level = 0 self.kind = '' self.txt = '' self.label = '' self.tag = '' self.tag_hold = [] self.last_level = 0 self.count_id = '' self.user_labels = {} self.anchor_count = 0 self.anchor_prefix = 'toc' def _open_close_blocks(self): "Open new title blocks, closing the previous (if any)" if not rules['titleblocks']: return tag = '' last = self.last_level curr = self.level # Same level, just close the previous if curr == last: tag = TAGS.get('title%dClose'%last) if tag: self.tag_hold.append(tag) # Section -> subsection, more depth while curr > last: last += 1 # Open the new block of subsections tag = TAGS.get('blockTitle%dOpen'%last) if tag: self.tag_hold.append(tag) # Jump from title1 to title3 or more # Fill the gap with an empty section if curr - last > 0: tag = TAGS.get('title%dOpen'%last) tag = regex['x'].sub('', tag) # del \a if tag: self.tag_hold.append(tag) # Section <- subsection, less depth while curr < last: # Close the current opened subsection tag = TAGS.get('title%dClose'%last) if tag: self.tag_hold.append(tag) # Close the current opened block of subsections tag = TAGS.get('blockTitle%dClose'%last) if tag: self.tag_hold.append(tag) last -= 1 # Close the previous section of the same level # The subsections were under it if curr == last: tag = TAGS.get('title%dClose'%last) if tag: self.tag_hold.append(tag) def add(self, line): "Parses a new title line." if not line: return self._set_prop(line) self._open_close_blocks() self._set_count_id() self._set_label() self._save_toc_info() def close_all(self): "Closes all opened title blocks" ret = [] ret.extend(self.tag_hold) while self.level: tag = TAGS.get('title%dClose'%self.level) if tag: ret.append(tag) tag = TAGS.get('blockTitle%dClose'%self.level) if tag: ret.append(tag) self.level -= 1 return ret def _save_toc_info(self): "Save TOC info, used by self.dump_marked_toc()" self.toc.append((self.level, self.count_id, self.txt, self.label)) def _set_prop(self, line=''): "Extract info from original line and set data holders." # Detect title type (numbered or not) id_ = line.lstrip()[0] if id_ == '=': kind = 'title' elif id_ == '+': kind = 'numtitle' else: Error("Unknown Title ID '%s'"%id_) # Extract line info match = regex[kind].search(line) level = len(match.group('id')) txt = match.group('txt').strip() label = match.group('label') # Parse info & save if CONF['enum-title']: kind = 'numtitle' # force if rules['titleblocks']: self.tag = TAGS.get('%s%dOpen'%(kind,level)) or \ TAGS.get('title%dOpen'%level) else: self.tag = TAGS.get(kind+repr(level)) or \ TAGS.get('title'+repr(level)) self.last_level = self.level self.kind = kind self.level = level self.txt = txt self.label = label def _set_count_id(self): "Compose and save the title count identifier (if needed)." count_id = '' if self.kind == 'numtitle' and not rules['autonumbertitle']: # Manually increase title count self.count[self.level] += 1 # Reset sublevels count (if any) max_levels = len(self.count) if self.level < max_levels-1: for i in range(self.level+1, max_levels): self.count[i] = 0 # Compose count id from hierarchy for i in range(self.level): count_id= "%s%d."%(count_id, self.count[i+1]) self.count_id = count_id def _set_label(self): "Compose and save title label, used by anchors." # Remove invalid chars from label set by user self.label = re.sub('[^A-Za-z0-9_-]', '', self.label or '') # Generate name as 15 first :alnum: chars #TODO how to translate safely accented chars to plain? #self.label = re.sub('[^A-Za-z0-9]', '', self.txt)[:15] # 'tocN' label - sequential count, ignoring 'toc-level' #self.label = self.anchor_prefix + str(len(self.toc)+1) def _get_tagged_anchor(self): "Return anchor if user defined a label, or TOC is on." ret = '' label = self.label if CONF['toc'] and self.level <= CONF['toc-level']: # This count is needed bcos self.toc stores all # titles, regardless of the 'toc-level' setting, # so we can't use self.toc length to number anchors self.anchor_count += 1 # Autonumber label (if needed) label = label or '%s%s' % (self.anchor_prefix, self.anchor_count) if label and TAGS['anchor']: ret = regex['x'].sub(label,TAGS['anchor']) return ret def _get_full_title_text(self): "Returns the full title contents, already escaped." ret = self.txt # Insert count_id (if any) before text if self.count_id: ret = '%s %s'%(self.count_id, ret) # Escape specials ret = doEscape(TARGET, ret) # Same targets needs final escapes on title lines # It's here because there is a 'continue' after title if rules['finalescapetitle']: ret = doFinalEscape(TARGET, ret) return ret def get(self): "Returns the tagged title as a list." global AA_TITLE ret = [] # Maybe some anchoring before? anchor = self._get_tagged_anchor() self.tag = regex['_anchor'].sub(anchor, self.tag) ### Compose & escape title text (TOC uses unescaped) full_title = self._get_full_title_text() # Close previous section area ret.extend(self.tag_hold) self.tag_hold = [] tagged = regex['x'].sub(full_title, self.tag) # Adds "underline" on TXT target if TARGET == 'txt': if BLOCK.count > 1: ret.append('') # blank line before ret.append(tagged) # Get the right letter count for UTF if CONF['encoding'].lower() == 'utf-8': i = len(full_title.decode('utf-8')) else: i = len(full_title) ret.append(regex['x'].sub('='*i, self.tag)) elif TARGET == 'art' and self.level == 1: if CONF['slides'] : AA_TITLE = tagged else : if BLOCK.count > 1: ret.append('') # blank line before ret.extend(aa_box(tagged, CONF['width'])) elif TARGET == 'art': level = 'level'+str(self.level) if BLOCK.count > 1: ret.append('') # blank line before ret.append(tagged) ret.append(AA[level] * len(full_title)) else: ret.append(tagged) return ret def dump_marked_toc(self, max_level=99): "Dumps all toc itens as a valid t2t-marked list" ret = [] toc_count = 1 for level, count_id, txt, label in self.toc: if level > max_level: continue # ignore indent = ' '*level id_txt = ('%s %s'%(count_id, txt)).lstrip() label = label or self.anchor_prefix+repr(toc_count) toc_count += 1 # TOC will have crosslinks to anchors if TAGS['anchor']: if CONF['enum-title'] and level == 1: # 1. [Foo #anchor] is more readable than [1. Foo #anchor] in level 1. # This is a stoled idea from Windows .CHM help files. tocitem = '%s+ [""%s"" #%s]' % (indent, txt, label) else: tocitem = '%s- [""%s"" #%s]' % (indent, id_txt, label) # TOC will be plain text (no links) else: if TARGET in ['txt', 'man', 'art']: # For these, the list is not necessary, just dump the text tocitem = '%s""%s""' % (indent, id_txt) else: tocitem = '%s- ""%s""' % (indent, id_txt) ret.append(tocitem) return ret ############################################################################## #TODO check all this table mess # It uses parse_row properties for table lines # BLOCK.table() replaces the cells by the parsed content class TableMaster: def __init__(self, line=''): self.rows = [] self.border = 0 self.align = 'Left' self.cellalign = [] self.colalign = [] self.cellspan = [] if line: prop = self.parse_row(line) self.border = prop['border'] self.align = prop['align'] self.cellalign = prop['cellalign'] self.cellspan = prop['cellspan'] self.colalign = self._get_col_align() def _get_col_align(self): colalign = [] for cell in range(0,len(self.cellalign)): align = self.cellalign[cell] span = self.cellspan[cell] colalign.extend([align] * span) return colalign def _get_open_tag(self): topen = TAGS['tableOpen'] tborder = TAGS['_tableBorder'] talign = TAGS['_tableAlign'+self.align] calignsep = TAGS['tableColAlignSep'] calign = '' # The first line defines if table has border or not if not self.border: tborder = '' # Set the columns alignment if rules['tablecellaligntype'] == 'column': calign = [TAGS['_tableColAlign%s'%x] for x in self.colalign] calign = calignsep.join(calign) # Align full table, set border and Column align (if any) topen = regex['_tableAlign' ].sub(talign , topen) topen = regex['_tableBorder' ].sub(tborder, topen) topen = regex['_tableColAlign'].sub(calign , topen) # Tex table spec, border or not: {|l|c|r|} , {lcr} if calignsep and not self.border: # Remove cell align separator topen = topen.replace(calignsep, '') return topen def _get_cell_align(self, cells): ret = [] for cell in cells: align = 'Left' if cell.strip(): if cell[0] == ' ' and cell[-1] == ' ': align = 'Center' elif cell[0] == ' ': align = 'Right' ret.append(align) return ret def _get_cell_span(self, cells): ret = [] for cell in cells: span = 1 m = re.search('\a(\|+)$', cell) if m: span = len(m.group(1))+1 ret.append(span) return ret def _tag_cells(self, rowdata): row = [] cells = rowdata['cells'] open_ = TAGS['tableCellOpen'] close = TAGS['tableCellClose'] sep = TAGS['tableCellSep'] calign = [TAGS['_tableCellAlign'+x] for x in rowdata['cellalign']] calignsep = TAGS['tableColAlignSep'] ncolumns = len(self.colalign) # Populate the span and multicol open tags cspan = [] multicol = [] colindex = 0 for cellindex in range(0,len(rowdata['cellspan'])): span = rowdata['cellspan'][cellindex] align = rowdata['cellalign'][cellindex] if span > 1: cspan.append(regex['x'].sub( str(span), TAGS['_tableCellColSpan'])) mcopen = regex['x'].sub(str(span), TAGS['_tableCellMulticolOpen']) multicol.append(mcopen) else: cspan.append('') if colindex < ncolumns and align != self.colalign[colindex]: mcopen = regex['x'].sub('1', TAGS['_tableCellMulticolOpen']) multicol.append(mcopen) else: multicol.append('') if not self.border: multicol[-1] = multicol[-1].replace(calignsep, '') colindex += span # Maybe is it a title row? if rowdata['title']: open_ = TAGS['tableTitleCellOpen'] or open_ close = TAGS['tableTitleCellClose'] or close sep = TAGS['tableTitleCellSep'] or sep # Should we break the line on *each* table cell? if rules['breaktablecell']: close = close+'\n' # Cells pre processing if rules['tablecellstrip']: cells = [x.strip() for x in cells] if rowdata['title'] and rules['tabletitlerowinbold']: cells = [enclose_me('fontBold',x) for x in cells] # Add cell BEGIN/END tags for cell in cells: copen = open_ cclose = close # Make sure we will pop from some filled lists # Fixes empty line bug '| |' this_align = this_span = this_mcopen = '' if calign: this_align = calign.pop(0) if cspan : this_span = cspan.pop(0) if multicol: this_mcopen = multicol.pop(0) # Insert cell align into open tag (if cell is alignable) if rules['tablecellaligntype'] == 'cell': copen = regex['_tableCellAlign'].sub( this_align, copen) # Insert cell span into open tag (if cell is spannable) if rules['tablecellspannable']: copen = regex['_tableCellColSpan'].sub( this_span, copen) # Use multicol tags instead (if multicol supported, and if # cell has a span or is aligned differently to column) if rules['tablecellmulticol']: if this_mcopen: copen = regex['_tableColAlign'].sub(this_align, this_mcopen) cclose = TAGS['_tableCellMulticolClose'] row.append(copen + cell + cclose) # Maybe there are cell separators? return sep.join(row) def add_row(self, cells): self.rows.append(cells) def parse_row(self, line): # Default table properties ret = { 'border':0, 'title':0, 'align':'Left', 'cells':[], 'cellalign':[], 'cellspan':[] } # Detect table align (and remove spaces mark) if line[0] == ' ': ret['align'] = 'Center' line = line.lstrip() # Detect title mark if line[1] == '|': ret['title'] = 1 # Detect border mark and normalize the EOL m = re.search(' (\|+) *$', line) if m: line = line+' ' ; ret['border'] = 1 else: line = line+' | ' # Delete table mark line = regex['table'].sub('', line) # Detect colspan | foo | bar baz ||| line = re.sub(' (\|+)\| ', '\a\\1 | ', line) # Split cells (the last is fake) ret['cells'] = line.split(' | ')[:-1] # Find cells span ret['cellspan'] = self._get_cell_span(ret['cells']) # Remove span ID ret['cells'] = [re.sub('\a\|+$','',x) for x in ret['cells']] # Find cells align ret['cellalign'] = self._get_cell_align(ret['cells']) # Hooray! Debug('Table Prop: %s' % ret, 7) return ret def dump(self): open_ = self._get_open_tag() rows = self.rows close = TAGS['tableClose'] rowopen = TAGS['tableRowOpen'] rowclose = TAGS['tableRowClose'] rowsep = TAGS['tableRowSep'] titrowopen = TAGS['tableTitleRowOpen'] or rowopen titrowclose = TAGS['tableTitleRowClose'] or rowclose if rules['breaktablelineopen']: rowopen = rowopen + '\n' titrowopen = titrowopen + '\n' # Tex gotchas if TARGET == 'tex': if not self.border: rowopen = titrowopen = '' else: close = rowopen + close # Now we tag all the table cells on each row #tagged_cells = map(lambda x: self._tag_cells(x), rows) #!py15 tagged_cells = [] for cell in rows: tagged_cells.append(self._tag_cells(cell)) # Add row separator tags between lines tagged_rows = [] if rowsep: #!py15 #tagged_rows = map(lambda x:x+rowsep, tagged_cells) for cell in tagged_cells: tagged_rows.append(cell+rowsep) # Remove last rowsep, because the table is over tagged_rows[-1] = tagged_rows[-1].replace(rowsep, '') # Add row BEGIN/END tags for each line else: for rowdata in rows: if rowdata['title']: o,c = titrowopen, titrowclose else: o,c = rowopen, rowclose row = tagged_cells.pop(0) tagged_rows.append(o + row + c) # Join the pieces together fulltable = [] if open_: fulltable.append(open_) fulltable.extend(tagged_rows) if close: fulltable.append(close) return fulltable ############################################################################## class BlockMaster: "TIP: use blockin/out to add/del holders" def __init__(self): self.BLK = [] self.HLD = [] self.PRP = [] self.depth = 0 self.count = 0 self.last = '' self.tableparser = None self.contains = { 'para' :['comment','raw','tagged'], 'verb' :[], 'table' :['comment'], 'raw' :[], 'tagged' :[], 'comment' :[], 'quote' :['quote','comment','raw','tagged'], 'list' :['list','numlist','deflist','para','verb','comment','raw','tagged'], 'numlist' :['list','numlist','deflist','para','verb','comment','raw','tagged'], 'deflist' :['list','numlist','deflist','para','verb','comment','raw','tagged'], 'bar' :[], 'title' :[], 'numtitle':[], } self.allblocks = list(self.contains.keys()) # If one is found inside another, ignore the marks self.exclusive = ['comment','verb','raw','tagged'] # May we include bars inside quotes? if rules['barinsidequote']: self.contains['quote'].append('bar') def block(self): if not self.BLK: return '' return self.BLK[-1] def isblock(self, name=''): return self.block() == name def prop(self, key): if not self.PRP: return '' return self.PRP[-1].get(key) or '' def propset(self, key, val): self.PRP[-1][key] = val #Debug('BLOCK prop ++: %s->%s'%(key,repr(val)), 1) #Debug('BLOCK props: %s'%(repr(self.PRP)), 1) def hold(self): if not self.HLD: return [] return self.HLD[-1] def holdadd(self, line): if self.block().endswith('list'): line = [line] self.HLD[-1].append(line) Debug('HOLD add: %s'%repr(line), 4) Debug('FULL HOLD: %s'%self.HLD, 4) def holdaddsub(self, line): self.HLD[-1][-1].append(line) Debug('HOLD addsub: %s'%repr(line), 4) Debug('FULL HOLD: %s'%self.HLD, 4) def holdextend(self, lines): if self.block().endswith('list'): lines = [lines] self.HLD[-1].extend(lines) Debug('HOLD extend: %s'%repr(lines), 4) Debug('FULL HOLD: %s'%self.HLD, 4) def blockin(self, block): ret = [] if block not in self.allblocks: Error("Invalid block '%s'"%block) # First, let's close other possible open blocks while self.block() and block not in self.contains[self.block()]: ret.extend(self.blockout()) # Now we can gladly add this new one self.BLK.append(block) self.HLD.append([]) self.PRP.append({}) self.count += 1 if block == 'table': self.tableparser = TableMaster() # Deeper and deeper self.depth = len(self.BLK) Debug('block ++ (%s): %s' % (block,self.BLK), 3) return ret def blockout(self): global AA_COUNT if not self.BLK: Error('No block to pop') blockname = self.BLK.pop() result = getattr(self, blockname)() parsed = self.HLD.pop() self.PRP.pop() self.depth = len(self.BLK) if blockname == 'table': del self.tableparser # Inserting a nested block into mother if self.block(): if blockname != 'comment': # ignore comment blocks if self.block().endswith('list'): self.HLD[-1][-1].append(result) else: self.HLD[-1].append(result) # Reset now. Mother block will have it all result = [] Debug('block -- (%s): %s' % (blockname,self.BLK), 3) Debug('RELEASED (%s): %s' % (blockname,parsed), 3) # Save this top level block name (produced output) # The next block will use it if result: self.last = blockname Debug('BLOCK: %s'%result, 6) # ASCII Art processing if TARGET == 'art' and CONF['slides'] and not CONF['toc-only'] and not CONF.get('art-no-title'): n = (CONF['height'] - 1) - (AA_COUNT % (CONF['height'] - 1) + 1) if n < len(result) and not (TITLE.level == 1 and blockname in ["title", "numtitle"]): result = ([''] * n) + [aa_line(AA['bar1'], CONF['width'])] + aa_slide(AA_TITLE, CONF['width']) + [''] + result if blockname in ["title", "numtitle"] and TITLE.level == 1: aa_title = aa_slide(AA_TITLE, CONF['width']) + [''] if AA_COUNT: aa_title = ([''] * n) + [aa_line(AA['bar2'], CONF['width'])] + aa_title result = aa_title + result AA_COUNT += len(result) return result def _last_escapes(self, line): return doFinalEscape(TARGET, line) def _get_escaped_hold(self): ret = [] for line in self.hold(): if isinstance(line, list): ret.extend(line) else: ret.append(self._last_escapes(line)) return ret def _remove_twoblanks(self, lastitem): if len(lastitem) > 1 and lastitem[-2:] == ['','']: return lastitem[:-2] return lastitem def _should_add_blank_line(self, where, blockname): "Validates the blanksaround* rules" # Nestable blocks: only mother blocks (level 1) are spaced if blockname.endswith('list') and self.depth > 1: return False # The blank line after the block is always added if where == 'after' \ and rules['blanksaround'+blockname]: return True # # No blank before if it's the first block of the body # elif where == 'before' \ # and BLOCK.count == 1: # return False # # No blank before if it's the first block of this level (nested) # elif where == 'before' \ # and self.count == 1: # return False # The blank line before the block is only added if # the previous block haven't added a blank line # (to avoid consecutive blanks) elif where == 'before' \ and rules['blanksaround'+blockname] \ and not rules.get('blanksaround'+self.last): return True # Nested quotes are handled here, # because the mother quote isn't closed yet elif where == 'before' \ and blockname == 'quote' \ and rules['blanksaround'+blockname] \ and self.depth > 1: return True return False def comment(self): return '' def raw(self): lines = self.hold() return [doEscape(TARGET, x) for x in lines] def tagged(self): return self.hold() def para(self): result = [] open_ = TAGS['paragraphOpen'] close = TAGS['paragraphClose'] lines = self._get_escaped_hold() # Blank line before? if self._should_add_blank_line('before', 'para'): result.append('') # Open tag if open_: result.append(open_) # Pagemaker likes a paragraph as a single long line if rules['onelinepara']: result.append(' '.join(lines)) # Others are normal :) else: result.extend(lines) # Close tag if close: result.append(close) # Blank line after? if self._should_add_blank_line('after', 'para'): result.append('') # Very very very very very very very very very UGLY fix # Needed because <center> can't appear inside <p> try: if len(lines) == 1 and \ TARGET in ('html', 'xhtml') and \ re.match('^\s*<center>.*</center>\s*$', lines[0]): result = [lines[0]] except: pass return result def verb(self): "Verbatim lines are not masked, so there's no need to unmask" result = [] open_ = TAGS['blockVerbOpen'] close = TAGS['blockVerbClose'] # Blank line before? if self._should_add_blank_line('before', 'verb'): result.append('') # Open tag if open_: result.append(open_) # Get contents for line in self.hold(): if self.prop('mapped') == 'table': line = MacroMaster().expand(line) if not rules['verbblocknotescaped']: line = doEscape(TARGET,line) if rules['indentverbblock']: line = ' '+line if rules['verbblockfinalescape']: line = doFinalEscape(TARGET, line) result.append(line) # Close tag if close: result.append(close) # Blank line after? if self._should_add_blank_line('after', 'verb'): result.append('') return result def numtitle(self): return self.title('numtitle') def title(self, name='title'): result = [] # Blank line before? if self._should_add_blank_line('before', name): result.append('') # Get contents result.extend(TITLE.get()) # Blank line after? if self._should_add_blank_line('after', name): result.append('') return result def table(self): result = [] # Blank line before? if self._should_add_blank_line('before', 'table'): result.append('') # Rewrite all table cells by the unmasked and escaped data lines = self._get_escaped_hold() for i in range(len(lines)): cells = lines[i].split(SEPARATOR) self.tableparser.rows[i]['cells'] = cells result.extend(self.tableparser.dump()) # Blank line after? if self._should_add_blank_line('after', 'table'): result.append('') return result def quote(self): result = [] open_ = TAGS['blockQuoteOpen'] # block based close = TAGS['blockQuoteClose'] qline = TAGS['blockQuoteLine'] # line based indent = tagindent = '\t'*self.depth # Apply rules if rules['tagnotindentable']: tagindent = '' if not rules['keepquoteindent']: indent = '' # Blank line before? if self._should_add_blank_line('before', 'quote'): result.append('') # Open tag if open_: result.append(tagindent+open_) # Get contents for item in self.hold(): if type(item) == type([]): result.extend(item) # subquotes else: item = regex['quote'].sub('', item) # del TABs item = self._last_escapes(item) item = qline*self.depth + item result.append(indent+item) # quote line # Close tag if close: result.append(tagindent+close) # Blank line after? if self._should_add_blank_line('after', 'quote'): result.append('') return result def bar(self): result = [] bar_tag = '' # Blank line before? if self._should_add_blank_line('before', 'bar'): result.append('') # Get the original bar chars bar_chars = self.hold()[0].strip() # Set bar type if bar_chars.startswith('='): bar_tag = TAGS['bar2'] else : bar_tag = TAGS['bar1'] # To avoid comment tag confusion like <!-- ------ --> (sgml) if TAGS['comment'].count('--'): bar_chars = bar_chars.replace('--', '__') # Get the bar tag (may contain \a) result.append(regex['x'].sub(bar_chars, bar_tag)) # Blank line after? if self._should_add_blank_line('after', 'bar'): result.append('') return result def deflist(self): return self.list('deflist') def numlist(self): return self.list('numlist') def list(self, name='list'): result = [] items = self.hold() indent = self.prop('indent') tagindent = indent listline = TAGS.get(name+'ItemLine') itemcount = 0 if name == 'deflist': itemopen = TAGS[name+'Item1Open'] itemclose = TAGS[name+'Item2Close'] itemsep = TAGS[name+'Item1Close']+\ TAGS[name+'Item2Open'] else: itemopen = TAGS[name+'ItemOpen'] itemclose = TAGS[name+'ItemClose'] itemsep = '' # Apply rules if rules['tagnotindentable']: tagindent = '' if not rules['keeplistindent']: indent = tagindent = '' # ItemLine: number of leading chars identifies list depth if listline: itemopen = listline*self.depth + itemopen # Adds trailing space on opening tags if (name == 'list' and rules['spacedlistitemopen']) or \ (name == 'numlist' and rules['spacednumlistitemopen']): itemopen = itemopen + ' ' # Remove two-blanks from list ending mark, to avoid <p> items[-1] = self._remove_twoblanks(items[-1]) # Blank line before? if self._should_add_blank_line('before', name): result.append('') # Tag each list item (multiline items), store in listbody itemopenorig = itemopen listbody = [] widelist = 0 for item in items: # Add "manual" item count for noautonum targets itemcount += 1 if name == 'numlist' and not rules['autonumberlist']: n = str(itemcount) itemopen = regex['x'].sub(n, itemopenorig) del n # Tag it item[0] = self._last_escapes(item[0]) if name == 'deflist': z,term,rest = item[0].split(SEPARATOR, 2) item[0] = rest if not item[0]: del item[0] # to avoid <p> listbody.append(tagindent+itemopen+term+itemsep) else: fullitem = tagindent+itemopen listbody.append(item[0].replace(SEPARATOR, fullitem)) del item[0] # Process next lines for this item (if any) for line in item: if type(line) == type([]): # sublist inside listbody.extend(line) else: line = self._last_escapes(line) # Blank lines turns to <p> if not line and rules['parainsidelist']: line = indent + TAGS['paragraphOpen'] + TAGS['paragraphClose'] line = line.rstrip() widelist = 1 # Some targets don't like identation here (wiki) if not rules['keeplistindent'] or (name == 'deflist' and rules['deflisttextstrip']): line = line.lstrip() # Maybe we have a line prefix to add? (wiki) if name == 'deflist' and TAGS['deflistItem2LinePrefix']: line = TAGS['deflistItem2LinePrefix'] + line listbody.append(line) # Close item (if needed) if itemclose: listbody.append(tagindent+itemclose) if not widelist and rules['compactlist']: listopen = TAGS.get(name+'OpenCompact') listclose = TAGS.get(name+'CloseCompact') else: listopen = TAGS.get(name+'Open') listclose = TAGS.get(name+'Close') # Open list (not nestable lists are only opened at mother) if listopen and not \ (rules['listnotnested'] and BLOCK.depth != 1): result.append(tagindent+listopen) result.extend(listbody) # Close list (not nestable lists are only closed at mother) if listclose and not \ (rules['listnotnested'] and self.depth != 1): result.append(tagindent+listclose) # Blank line after? if self._should_add_blank_line('after', name): result.append('') return result ############################################################################## class MacroMaster: def __init__(self, config={}): self.name = '' self.config = config or CONF self.infile = self.config['sourcefile'] self.outfile = self.config['outfile'] self.currdate = time.localtime(time.time()) self.rgx = regex.get('macros') or getRegexes()['macros'] self.fileinfo = { 'infile': None, 'outfile': None } self.dft_fmt = MACROS def walk_file_format(self, fmt): "Walks the %%{in/out}file format string, expanding the % flags" i = 0; ret = '' # counter/hold while i < len(fmt): # char by char c = fmt[i]; i += 1 if c == '%': # hot char! if i == len(fmt): # % at the end ret = ret + c break c = fmt[i]; i += 1 # read next ret = ret + self.expand_file_flag(c) else: ret = ret +c # common char return ret def expand_file_flag(self, flag): "%f: filename %F: filename (w/o extension)" "%d: dirname %D: dirname (only parent dir)" "%p: file path %e: extension" info = self.fileinfo[self.name] # get dict if flag == '%': x = '%' # %% -> % elif flag == 'f': x = info['name'] elif flag == 'F': x = re.sub('\.[^.]*$','',info['name']) elif flag == 'd': x = info['dir'] elif flag == 'D': x = os.path.split(info['dir'])[-1] elif flag == 'p': x = info['path'] elif flag == 'e': x = re.search('.(\.([^.]+))?$', info['name']).group(2) or '' #TODO simpler way for %e ? else : x = '%'+flag # false alarm return x def set_file_info(self, macroname): if self.fileinfo.get(macroname): return # already done file_ = getattr(self, self.name) # self.infile if file_ == STDOUT or file_ == MODULEOUT: dir_ = '' path = name = file_ else: path = os.path.abspath(file_) dir_ = os.path.dirname(path) name = os.path.basename(path) self.fileinfo[macroname] = {'path':path,'dir':dir_,'name':name} def expand(self, line=''): "Expand all macros found on the line" while self.rgx.search(line): m = self.rgx.search(line) name = self.name = m.group('name').lower() fmt = m.group('fmt') or self.dft_fmt.get(name) if name == 'date': txt = time.strftime(fmt,self.currdate) elif name == 'mtime': if self.infile in (STDIN, MODULEIN): fdate = self.currdate else: mtime = os.path.getmtime(self.infile) fdate = time.localtime(mtime) txt = time.strftime(fmt,fdate) elif name == 'infile' or name == 'outfile': self.set_file_info(name) txt = self.walk_file_format(fmt) else: Error("Unknown macro name '%s'"%name) line = self.rgx.sub(txt,line,1) return line ############################################################################## def listTargets(): """list all available targets""" targets = TARGETS targets.sort() for target in targets: print("%s\t%s" % (target, TARGET_NAMES.get(target))) def dumpConfig(source_raw, parsed_config): onoff = {1:_('ON'), 0:_('OFF')} data = [ (_('RC file') , RC_RAW ), (_('source document'), source_raw ), (_('command line') , CMDLINE_RAW) ] # First show all RAW data found for label, cfg in data: print(_('RAW config for %s')%label) for target,key,val in cfg: target = '(%s)'%target key = dotted_spaces("%-14s"%key) val = val or _('ON') print(' %-8s %s: %s'%(target,key,val)) print() # Then the parsed results of all of them print(_('Full PARSED config')) keys = list(parsed_config.keys()) ; keys.sort() # sorted for key in keys: val = parsed_config[key] # Filters are the last if key == 'preproc' or key == 'postproc': continue # Flag beautifier if key in list(FLAGS.keys()) or key in list(ACTIONS.keys()): val = onoff.get(val) or val # List beautifier if type(val) == type([]): if key == 'options': sep = ' ' else : sep = ', ' val = sep.join(val) print("%25s: %s"%(dotted_spaces("%-14s"%key),val)) print() print(_('Active filters')) for filter_ in ['preproc', 'postproc']: for rule in parsed_config.get(filter_) or []: print("%25s: %s -> %s" % ( dotted_spaces("%-14s"%filter_), rule[0], rule[1])) def get_file_body(file_): "Returns all the document BODY lines" return process_source_file(file_, noconf=1)[1][2] def finish_him(outlist, config): "Writing output to screen or file" outfile = config['outfile'] outlist = unmaskEscapeChar(outlist) outlist = expandLineBreaks(outlist) # Apply PostProc filters if config['postproc']: filters = compile_filters(config['postproc'], _('Invalid PostProc filter regex')) postoutlist = [] errmsg = _('Invalid PostProc filter replacement') for line in outlist: for rgx,repl in filters: try: line = rgx.sub(repl, line) except: Error("%s: '%s'"%(errmsg, repl)) postoutlist.append(line) outlist = postoutlist[:] if outfile == MODULEOUT: return outlist elif outfile == STDOUT: if GUI: return outlist, config else: for line in outlist: print(line) else: Savefile(outfile, addLineBreaks(outlist)) if not GUI and not QUIET: print(_('%s wrote %s')%(my_name,outfile)) if config['split']: if not QUIET: print("--- html...") sgml2html = 'sgml2html -s %s -l %s %s' % ( config['split'], config['lang'] or lang, outfile) if not QUIET: print("Running system command:", sgml2html) os.system(sgml2html) def toc_inside_body(body, toc, config): ret = [] if AUTOTOC: return body # nothing to expand toc_mark = MaskMaster().tocmask # Expand toc mark with TOC contents for line in body: if line.count(toc_mark): # toc mark found if config['toc']: ret.extend(toc) # include if --toc else: pass # or remove %%toc line else: ret.append(line) # common line return ret def toc_tagger(toc, config): "Returns the tagged TOC, as a single tag or a tagged list" ret = [] # Convert the TOC list (t2t-marked) to the target's list format if config['toc-only'] or (config['toc'] and not TAGS['TOC']): fakeconf = config.copy() fakeconf['headers'] = 0 fakeconf['toc-only'] = 0 fakeconf['mask-email'] = 0 fakeconf['preproc'] = [] fakeconf['postproc'] = [] fakeconf['css-sugar'] = 0 fakeconf['art-no-title'] = 1 # needed for --toc and --slides together, avoids slide title before TOC ret,foo = convert(toc, fakeconf) set_global_config(config) # restore config # Our TOC list is not needed, the target already knows how to do a TOC elif config['toc'] and TAGS['TOC']: ret = [TAGS['TOC']] return ret def toc_formatter(toc, config): "Formats TOC for automatic placement between headers and body" if config['toc-only']: return toc # no formatting needed if not config['toc'] : return [] # TOC disabled ret = toc # Art: An automatic "Table of Contents" header is added to the TOC slide if config['target'] == 'art' and config['slides']: n = (config['height'] - 1) - (len(toc) + 6) % (config['height'] - 1) toc = aa_slide(_("Table of Contents"), config['width']) + toc + ([''] * n) toc.append(aa_line(AA['bar2'], config['width'])) return toc # TOC open/close tags (if any) if TAGS['tocOpen' ]: ret.insert(0, TAGS['tocOpen']) if TAGS['tocClose']: ret.append(TAGS['tocClose']) # Autotoc specific formatting if AUTOTOC: if rules['autotocwithbars']: # TOC between bars para = TAGS['paragraphOpen']+TAGS['paragraphClose'] bar = regex['x'].sub('-' * DFT_TEXT_WIDTH, TAGS['bar1']) tocbar = [para, bar, para] if config['target'] == 'art' and config['headers']: # exception: header already printed a bar ret = [para] + ret + tocbar else: ret = tocbar + ret + tocbar if rules['blankendautotoc']: # blank line after TOC ret.append('') if rules['autotocnewpagebefore']: # page break before TOC ret.insert(0,TAGS['pageBreak']) if rules['autotocnewpageafter']: # page break after TOC ret.append(TAGS['pageBreak']) return ret def doHeader(headers, config): if not config['headers']: return [] if not headers: headers = ['','',''] target = config['target'] if target not in HEADER_TEMPLATE: Error("doHeader: Unknown target '%s'"%target) if target in ('html','xhtml') and config.get('css-sugar'): template = HEADER_TEMPLATE[target+'css'].split('\n') else: template = HEADER_TEMPLATE[target].split('\n') head_data = {'STYLE':[], 'ENCODING':''} for key in head_data.keys(): val = config.get(key.lower()) # Remove .sty extension from each style filename (freaking tex) # XXX Can't handle --style foo.sty,bar.sty if target == 'tex' and key == 'STYLE': val = [re.sub('(?i)\.sty$','',x) for x in val] if key == 'ENCODING': val = get_encoding_string(val, target) head_data[key] = val # Parse header contents for i in 0,1,2: # Expand macros contents = MacroMaster(config=config).expand(headers[i]) # Escapes - on tex, just do it if any \tag{} present if target != 'tex' or \ (target == 'tex' and re.search(r'\\\w+{', contents)): contents = doEscape(target, contents) if target == 'lout': contents = doFinalEscape(target, contents) head_data['HEADER%d'%(i+1)] = contents # css-inside removes STYLE line #XXX In tex, this also removes the modules call (%!style:amsfonts) if target in ('html','xhtml') and config.get('css-inside') and \ config.get('style'): head_data['STYLE'] = [] Debug("Header Data: %s"%head_data, 1) # ASCII Art does not use a header template, aa_header() formats the header if target == 'art': n_h = len([v for v in head_data if v.startswith("HEADER") and head_data[v]]) if not n_h : return [] if config['slides']: x = config['height'] - 3 - (n_h * 3) n = x / (n_h + 1) end = x % (n_h + 1) template = aa_header(head_data, config['width'], n, end) else: template = [''] + aa_header(head_data, config['width'], 2, 0) # Header done, let's get out return template # Scan for empty dictionary keys # If found, scan template lines for that key reference # If found, remove the reference # If there isn't any other key reference on the same line, remove it #TODO loop by template line > key for key in head_data.keys(): if head_data.get(key): continue for line in template: if line.count('%%(%s)s'%key): sline = line.replace('%%(%s)s'%key, '') if not re.search(r'%\([A-Z0-9]+\)s', sline): template.remove(line) # Style is a multiple tag. # - If none or just one, use default template # - If two or more, insert extra lines in a loop (and remove original) styles = head_data['STYLE'] if len(styles) == 1: head_data['STYLE'] = styles[0] elif len(styles) > 1: style_mark = '%(STYLE)s' for i in range(len(template)): if template[i].count(style_mark): while styles: template.insert(i+1, template[i].replace(style_mark, styles.pop())) del template[i] break # Populate template with data (dict expansion) template = '\n'.join(template) % head_data # Adding CSS contents into template (for --css-inside) # This code sux. Dirty++ if target in ('html','xhtml') and config.get('css-inside') and \ config.get('style'): set_global_config(config) # usually on convert(), needed here for i in range(len(config['style'])): cssfile = config['style'][i] if not os.path.isabs(cssfile): infile = config.get('sourcefile') cssfile = os.path.join( os.path.dirname(infile), cssfile) try: contents = Readfile(cssfile, 1) css = "\n%s\n%s\n%s\n%s\n" % ( doCommentLine("Included %s" % cssfile), TAGS['cssOpen'], '\n'.join(contents), TAGS['cssClose']) # Style now is content, needs escaping (tex) #css = maskEscapeChar(css) except: errmsg = "CSS include failed for %s" % cssfile css = "\n%s\n" % (doCommentLine(errmsg)) # Insert this CSS file contents on the template template = re.sub('(?i)(</HEAD>)', css+r'\1', template) # template = re.sub(r'(?i)(\\begin{document})', # css+'\n'+r'\1', template) # tex # The last blank line to keep everything separated template = re.sub('(?i)(</HEAD>)', '\n'+r'\1', template) return template.split('\n') def doCommentLine(txt): # The -- string ends a (h|sg|xht)ml comment :( txt = maskEscapeChar(txt) if TAGS['comment'].count('--') and txt.count('--'): txt = re.sub('-(?=-)', r'-\\', txt) if TAGS['comment']: return regex['x'].sub(txt, TAGS['comment']) return '' def doFooter(config): ret = [] # No footer. The --no-headers option hides header AND footer if not config['headers']: return [] # Only add blank line before footer if last block doesn't added by itself if not rules.get('blanksaround'+BLOCK.last): ret.append('') # Add txt2tags info at footer, if target supports comments if TAGS['comment']: # Not using TARGET_NAMES because it's i18n'ed. # It's best to always present this info in english. target = config['target'] if config['target'] == 'tex': target = 'LaTeX2e' t2t_version = '%s code generated by %s %s (%s)' % (target, my_name, my_version, my_url) cmdline = 'cmdline: %s %s' % (my_name, ' '.join(config['realcmdline'])) ret.append(doCommentLine(t2t_version)) ret.append(doCommentLine(cmdline)) # Maybe we have a specific tag to close the document? if TAGS['EOD']: ret.append(TAGS['EOD']) return ret def doEscape(target,txt): "Target-specific special escapes. Apply *before* insert any tag." tmpmask = 'vvvvThisEscapingSuxvvvv' if target in ('html','sgml','xhtml','dbk'): txt = re.sub('&','&amp;',txt) txt = re.sub('<','&lt;',txt) txt = re.sub('>','&gt;',txt) if target == 'sgml': txt = re.sub('\xff','&yuml;',txt) # "+y elif target == 'pm6': txt = re.sub('<','<\#60>',txt) elif target == 'mgp': txt = re.sub('^%',' %',txt) # add leading blank to avoid parse elif target == 'man': txt = re.sub("^([.'])", '\\&\\1',txt) # command ID txt = txt.replace(ESCCHAR, ESCCHAR+'e') # \e elif target == 'lout': # TIP: / moved to FinalEscape to avoid //italic// # TIP: these are also converted by lout: ... --- -- txt = txt.replace(ESCCHAR, tmpmask) # \ txt = txt.replace('"', '"%s""'%ESCCHAR) # "\"" txt = re.sub('([|&{}@#^~])', '"\\1"', txt) # "@" txt = txt.replace(tmpmask, '"%s"'%(ESCCHAR*2)) # "\\" elif target == 'tex': # Mark literal \ to be changed to $\backslash$ later txt = txt.replace(ESCCHAR, tmpmask) txt = re.sub('([#$&%{}])', ESCCHAR+r'\1' , txt) # \% txt = re.sub('([~^])' , ESCCHAR+r'\1{}', txt) # \~{} txt = re.sub('([<|>])' , r'$\1$', txt) # $>$ txt = txt.replace(tmpmask, maskEscapeChar(r'$\backslash$')) # TIP the _ is escaped at the end return txt # TODO man: where - really needs to be escaped? def doFinalEscape(target, txt): "Last escapes of each line" if target == 'pm6' : txt = txt.replace(ESCCHAR+'<', r'<\#92><') elif target == 'man' : txt = txt.replace('-', r'\-') elif target == 'sgml': txt = txt.replace('[', '&lsqb;') elif target == 'lout': txt = txt.replace('/', '"/"') elif target == 'tex' : txt = txt.replace('_', r'\_') txt = txt.replace('vvvvTexUndervvvv', '_') # shame! ## JS txt = txt.replace('vvvUnderscoreInRawTextvvv', '_') txt = txt.replace('vvvUnderscoreInTaggedTextvvv', '_') return txt def EscapeCharHandler(action, data): "Mask/Unmask the Escape Char on the given string" if not data.strip(): return data if action not in ('mask','unmask'): Error("EscapeCharHandler: Invalid action '%s'"%action) if action == 'mask': return data.replace('\\', ESCCHAR) else: return data.replace(ESCCHAR, '\\') def maskEscapeChar(data): "Replace any Escape Char \ with a text mask (Input: str or list)" if type(data) == type([]): return [EscapeCharHandler('mask', x) for x in data] return EscapeCharHandler('mask',data) def unmaskEscapeChar(data): "Undo the Escape char \ masking (Input: str or list)" if type(data) == type([]): return [EscapeCharHandler('unmask', x) for x in data] return EscapeCharHandler('unmask',data) def addLineBreaks(mylist): "use LB to respect sys.platform" ret = [] for line in mylist: line = line.replace('\n', LB) # embedded \n's ret.append(line+LB) # add final line break return ret # Convert ['foo\nbar'] to ['foo', 'bar'] def expandLineBreaks(mylist): ret = [] for line in mylist: ret.extend(line.split('\n')) return ret def compile_filters(filters, errmsg='Filter'): if filters: for i in range(len(filters)): patt,repl = filters[i] try: rgx = re.compile(patt) except: Error("%s: '%s'"%(errmsg, patt)) filters[i] = (rgx,repl) return filters def enclose_me(tagname, txt): return TAGS.get(tagname+'Open') + txt + TAGS.get(tagname+'Close') def beautify_me(name, font, line): "where name is: bold, italic, underline or strike" # Exception: Doesn't parse an horizontal bar as strike if name == 'strike' and regex['bar'].search(line): return line open_ = TAGS['%sOpen' % font] close = TAGS['%sClose' % font] txt = r'%s\1%s'%(open_, close) line = regex[font].sub(txt, line) return line def get_tagged_link(label, url): ret = '' target = CONF['target'] image_re = regex['img'] # Set link type if regex['email'].match(url): linktype = 'email' else: linktype = 'url'; # Escape specials from TEXT parts label = doEscape(target,label) # Escape specials from link URL if not rules['linkable'] or rules['escapeurl']: url = doEscape(target, url) # Adding protocol to guessed link guessurl = '' if linktype == 'url' and \ re.match('(?i)'+regex['_urlskel']['guess'], url): if url[0] in 'Ww': guessurl = 'http://' +url else : guessurl = 'ftp://' +url # Not link aware targets -> protocol is useless if not rules['linkable']: guessurl = '' # Simple link (not guessed) if not label and not guessurl: if CONF['mask-email'] and linktype == 'email': # Do the email mask feature (no TAGs, just text) url = url.replace('@', ' (a) ') url = url.replace('.', ' ') url = "<%s>" % url if rules['linkable']: url = doEscape(target, url) ret = url else: # Just add link data to tag tag = TAGS[linktype] ret = regex['x'].sub(url,tag) # Named link or guessed simple link else: # Adjusts for guessed link if not label: label = url # no protocol if guessurl : url = guessurl # with protocol # Image inside link! if image_re.match(label): if rules['imglinkable']: # get image tag label = parse_images(label) else: # img@link !supported label = "(%s)"%image_re.match(label).group(1) # Putting data on the right appearance order if rules['labelbeforelink'] or not rules['linkable']: urlorder = [label, url] # label before link else: urlorder = [url, label] # link before label # Add link data to tag (replace \a's) ret = TAGS["%sMark"%linktype] for data in urlorder: ret = regex['x'].sub(data,ret,1) return ret def parse_deflist_term(line): "Extract and parse definition list term contents" img_re = regex['img'] term = regex['deflist'].search(line).group(3) # Mask image inside term as (image.jpg), where not supported if not rules['imgasdefterm'] and img_re.search(term): while img_re.search(term): imgfile = img_re.search(term).group(1) term = img_re.sub('(%s)'%imgfile, term, 1) #TODO tex: escape ] on term. \], \rbrack{} and \verb!]! don't work :( return term def get_image_align(line): "Return the image (first found) align for the given line" # First clear marks that can mess align detection line = re.sub(SEPARATOR+'$', '', line) # remove deflist sep line = re.sub('^'+SEPARATOR, '', line) # remove list sep line = re.sub('^[\t]+' , '', line) # remove quote mark # Get image position on the line m = regex['img'].search(line) ini = m.start() ; head = 0 end = m.end() ; tail = len(line) # The align detection algorithm if ini == head and end != tail: align = 'left' # ^img + text$ elif ini != head and end == tail: align = 'right' # ^text + img$ else : align = 'center' # default align # Some special cases if BLOCK.isblock('table'): align = 'center' # ignore when table # if TARGET == 'mgp' and align == 'center': align = 'center' return align # Reference: http://www.iana.org/assignments/character-sets # http://www.drclue.net/F1.cgi/HTML/META/META.html def get_encoding_string(enc, target): if not enc: return '' # Target specific translation table translate = { 'tex': { # missing: ansinew , applemac , cp437 , cp437de , cp865 'utf-8' : 'utf8', 'us-ascii' : 'ascii', 'windows-1250': 'cp1250', 'windows-1252': 'cp1252', 'ibm850' : 'cp850', 'ibm852' : 'cp852', 'iso-8859-1' : 'latin1', 'iso-8859-2' : 'latin2', 'iso-8859-3' : 'latin3', 'iso-8859-4' : 'latin4', 'iso-8859-5' : 'latin5', 'iso-8859-9' : 'latin9', 'koi8-r' : 'koi8-r' } } # Normalization enc = re.sub('(?i)(us[-_]?)?ascii|us|ibm367','us-ascii' , enc) enc = re.sub('(?i)(ibm|cp)?85([02])' ,'ibm85\\2' , enc) enc = re.sub('(?i)(iso[_-]?)?8859[_-]?' ,'iso-8859-' , enc) enc = re.sub('iso-8859-($|[^1-9]).*' ,'iso-8859-1', enc) # Apply translation table try: enc = translate[target][enc.lower()] except: pass return enc ############################################################################## ##MerryChristmas,IdontwanttofighttonightwithyouImissyourbodyandIneedyourlove## ############################################################################## def process_source_file(file_='', noconf=0, contents=[]): """ Find and Join all the configuration available for a source file. No sanity checking is done on this step. It also extracts the source document parts into separate holders. The config scan order is: 1. The user configuration file (i.e. $HOME/.txt2tagsrc) 2. The source document's CONF area 3. The command line options The return data is a tuple of two items: 1. The parsed config dictionary 2. The document's parts, as a (head, conf, body) tuple All the conversion process will be based on the data and configuration returned by this function. The source files is read on this step only. """ if contents: source = SourceDocument(contents=contents) else: source = SourceDocument(file_) head, conf, body = source.split() Message(_("Source document contents stored"),2) if not noconf: # Read document config source_raw = source.get_raw_config() # Join all the config directives found, then parse it full_raw = RC_RAW + source_raw + CMDLINE_RAW Message(_("Parsing and saving all config found (%03d items)") % (len(full_raw)), 1) full_parsed = ConfigMaster(full_raw).parse() # Add manually the filename to the conf dic if contents: full_parsed['sourcefile'] = MODULEIN full_parsed['infile'] = MODULEIN full_parsed['outfile'] = MODULEOUT else: full_parsed['sourcefile'] = file_ # Maybe should we dump the config found? if full_parsed.get('dump-config'): dumpConfig(source_raw, full_parsed) Quit() # The user just want to know a single config value (hidden feature) #TODO pick a better name than --show-config-value elif full_parsed.get('show-config-value'): config_value = full_parsed.get(full_parsed['show-config-value']) if config_value: if type(config_value) == type([]): print('\n'.join(config_value)) else: print(config_value) Quit() # Okay, all done Debug("FULL config for this file: %s"%full_parsed, 1) else: full_parsed = {} return full_parsed, (head,conf,body) def get_infiles_config(infiles): """ Find and Join into a single list, all configuration available for each input file. This function is supposed to be the very first one to be called, before any processing. """ return list(map(process_source_file, infiles)) def convert_this_files(configs): global CONF for myconf,doc in configs: # multifile support target_head = [] target_toc = [] target_body = [] target_foot = [] source_head, source_conf, source_body = doc myconf = ConfigMaster().sanity(myconf) # Compose the target file Headers #TODO escape line before? #TODO see exceptions by tex and mgp Message(_("Composing target Headers"),1) target_head = doHeader(source_head, myconf) # Parse the full marked body into tagged target first_body_line = (len(source_head) or 1)+ len(source_conf) + 1 Message(_("Composing target Body"),1) target_body, marked_toc = convert(source_body, myconf, firstlinenr=first_body_line) # If dump-source, we're done if myconf['dump-source']: for line in source_head+source_conf+target_body: print(line) return # Close the last slide if myconf['slides'] and not myconf['toc-only'] and myconf['target'] == 'art': n = (myconf['height'] - 1) - (AA_COUNT % (myconf['height'] - 1) + 1) target_body = target_body + ([''] * n) + [aa_line(AA['bar2'], myconf['width'])] # Compose the target file Footer Message(_("Composing target Footer"),1) target_foot = doFooter(myconf) # Make TOC (if needed) Message(_("Composing target TOC"),1) tagged_toc = toc_tagger(marked_toc, myconf) target_toc = toc_formatter(tagged_toc, myconf) target_body = toc_inside_body(target_body, target_toc, myconf) if not AUTOTOC and not myconf['toc-only']: target_toc = [] # Finally, we have our document outlist = target_head + target_toc + target_body + target_foot # If on GUI, abort before finish_him # If module, return finish_him as list # Else, write results to file or STDOUT if GUI: return outlist, myconf elif myconf.get('outfile') == MODULEOUT: return finish_him(outlist, myconf), myconf else: Message(_("Saving results to the output file"),1) finish_him(outlist, myconf) def parse_images(line): "Tag all images found" while regex['img'].search(line) and TAGS['img'] != '[\a]': txt = regex['img'].search(line).group(1) tag = TAGS['img'] # If target supports image alignment, here we go if rules['imgalignable']: align = get_image_align(line) # right align_name = align.capitalize() # Right # The align is a full tag, or part of the image tag (~A~) if TAGS['imgAlign'+align_name]: tag = TAGS['imgAlign'+align_name] else: align_tag = TAGS['_imgAlign'+align_name] tag = regex['_imgAlign'].sub(align_tag, tag, 1) # Dirty fix to allow centered solo images if align == 'center' and TARGET in ('html','xhtml'): rest = regex['img'].sub('',line,1) if re.match('^\s+$', rest): tag = "<center>%s</center>" %tag if TARGET == 'tex': tag = re.sub(r'\\b',r'\\\\b',tag) txt = txt.replace('_', 'vvvvTexUndervvvv') # Ugly hack to avoid infinite loop when target's image tag contains [] tag = tag.replace('[', 'vvvvEscapeSquareBracketvvvv') line = regex['img'].sub(tag,line,1) line = regex['x'].sub(txt,line,1) return line.replace('vvvvEscapeSquareBracketvvvv','[') def add_inline_tags(line): # Beautifiers for beauti, font in [ ('bold', 'fontBold'), ('italic', 'fontItalic'), ('underline', 'fontUnderline'), ('strike', 'fontStrike')]: if regex[font].search(line): line = beautify_me(beauti, font, line) line = parse_images(line) return line def get_include_contents(file_, path=''): "Parses %!include: value and extract file contents" ids = {'`':'verb', '"':'raw', "'":'tagged' } id_ = 't2t' # Set include type and remove identifier marks mark = file_[0] if mark in ids.keys(): if file_[:2] == file_[-2:] == mark*2: id_ = ids[mark] # set type file_ = file_[2:-2] # remove marks # Handle remote dir execution filepath = os.path.join(path, file_) # Read included file contents lines = Readfile(filepath, remove_linebreaks=1) # Default txt2tags marked text, just BODY matters if id_ == 't2t': lines = get_file_body(filepath) #TODO fix images relative path if file has a path, ie.: chapter1/index.t2t (wait until tree parsing) #TODO for the images path fix, also respect outfile path, if different from infile (wait until tree parsing) lines.insert(0, '%%INCLUDED(%s) starts here: %s'%(id_,file_)) # This appears when included hit EOF with verbatim area open #lines.append('%%INCLUDED(%s) ends here: %s'%(id_,file_)) return id_, lines def set_global_config(config): global CONF, TAGS, regex, rules, TARGET CONF = config rules = getRules(CONF) TAGS = getTags(CONF) regex = getRegexes() TARGET = config['target'] # save for buggy functions that need global def convert(bodylines, config, firstlinenr=1): global BLOCK, TITLE set_global_config(config) target = config['target'] BLOCK = BlockMaster() MASK = MaskMaster() TITLE = TitleMaster() ret = [] dump_source = [] f_lastwasblank = 0 # Compiling all PreProc regexes pre_filter = compile_filters( CONF['preproc'], _('Invalid PreProc filter regex')) # Let's mark it up! linenr = firstlinenr-1 lineref = 0 while lineref < len(bodylines): # Defaults MASK.reset() results_box = '' untouchedline = bodylines[lineref] dump_source.append(untouchedline) line = re.sub('[\n\r]+$','',untouchedline) # del line break # Apply PreProc filters if pre_filter: errmsg = _('Invalid PreProc filter replacement') for rgx,repl in pre_filter: try: line = rgx.sub(repl, line) except: Error("%s: '%s'"%(errmsg, repl)) line = maskEscapeChar(line) # protect \ char linenr += 1 lineref += 1 Debug(repr(line), 2, linenr) # heavy debug: show each line #------------------[ Comment Block ]------------------------ # We're already on a comment block if BLOCK.block() == 'comment': # Closing comment if regex['blockCommentClose'].search(line): ret.extend(BLOCK.blockout() or []) continue # Normal comment-inside line. Ignore it. continue # Detecting comment block init if regex['blockCommentOpen'].search(line) \ and BLOCK.block() not in BLOCK.exclusive: ret.extend(BLOCK.blockin('comment')) continue #-------------------------[ Tagged Text ]---------------------- # We're already on a tagged block if BLOCK.block() == 'tagged': # Closing tagged if regex['blockTaggedClose'].search(line): ret.extend(BLOCK.blockout()) continue # Normal tagged-inside line BLOCK.holdadd(line) continue # Detecting tagged block init if regex['blockTaggedOpen'].search(line) \ and BLOCK.block() not in BLOCK.exclusive: ret.extend(BLOCK.blockin('tagged')) continue # One line tagged text if regex['1lineTagged'].search(line) \ and BLOCK.block() not in BLOCK.exclusive: ret.extend(BLOCK.blockin('tagged')) line = regex['1lineTagged'].sub('',line) BLOCK.holdadd(line) ret.extend(BLOCK.blockout()) continue #-------------------------[ Raw Text ]---------------------- # We're already on a raw block if BLOCK.block() == 'raw': # Closing raw if regex['blockRawClose'].search(line): ret.extend(BLOCK.blockout()) continue # Normal raw-inside line BLOCK.holdadd(line) continue # Detecting raw block init if regex['blockRawOpen'].search(line) \ and BLOCK.block() not in BLOCK.exclusive: ret.extend(BLOCK.blockin('raw')) continue # One line raw text if regex['1lineRaw'].search(line) \ and BLOCK.block() not in BLOCK.exclusive: ret.extend(BLOCK.blockin('raw')) line = regex['1lineRaw'].sub('',line) BLOCK.holdadd(line) ret.extend(BLOCK.blockout()) continue #------------------------[ Verbatim ]---------------------- #TIP We'll never support beautifiers inside verbatim # Closing table mapped to verb if BLOCK.block() == 'verb' \ and BLOCK.prop('mapped') == 'table' \ and not regex['table'].search(line): ret.extend(BLOCK.blockout()) # We're already on a verb block if BLOCK.block() == 'verb': # Closing verb if regex['blockVerbClose'].search(line): ret.extend(BLOCK.blockout()) continue # Normal verb-inside line BLOCK.holdadd(line) continue # Detecting verb block init if regex['blockVerbOpen'].search(line) \ and BLOCK.block() not in BLOCK.exclusive: ret.extend(BLOCK.blockin('verb')) f_lastwasblank = 0 continue # One line verb-formatted text if regex['1lineVerb'].search(line) \ and BLOCK.block() not in BLOCK.exclusive: ret.extend(BLOCK.blockin('verb')) line = regex['1lineVerb'].sub('',line) BLOCK.holdadd(line) ret.extend(BLOCK.blockout()) f_lastwasblank = 0 continue # Tables are mapped to verb when target is not table-aware if not rules['tableable'] and regex['table'].search(line): if not BLOCK.isblock('verb'): ret.extend(BLOCK.blockin('verb')) BLOCK.propset('mapped', 'table') BLOCK.holdadd(line) continue #---------------------[ blank lines ]----------------------- if regex['blankline'].search(line): # Close open paragraph if BLOCK.isblock('para'): ret.extend(BLOCK.blockout()) f_lastwasblank = 1 continue # Close all open tables if BLOCK.isblock('table'): ret.extend(BLOCK.blockout()) f_lastwasblank = 1 continue # Close all open quotes while BLOCK.isblock('quote'): ret.extend(BLOCK.blockout()) # Closing all open lists if f_lastwasblank: # 2nd consecutive blank if BLOCK.block().endswith('list'): BLOCK.holdaddsub('') # helps parser while BLOCK.depth: # closes list (if any) ret.extend(BLOCK.blockout()) continue # ignore consecutive blanks # Paragraph (if any) is wanted inside lists also if BLOCK.block().endswith('list'): BLOCK.holdaddsub('') f_lastwasblank = 1 continue #---------------------[ special ]--------------------------- if regex['special'].search(line): targ, key, val = ConfigLines().parse_line(line, None, target) if key: Debug("Found config '%s', value '%s'" % (key, val), 1, linenr) else: Debug('Bogus Special Line', 1, linenr) # %!include command if key == 'include': incpath = os.path.dirname(CONF['sourcefile']) incfile = val err = _('A file cannot include itself (loop!)') if CONF['sourcefile'] == incfile: Error("%s: %s"%(err,incfile)) inctype, inclines = get_include_contents(incfile, incpath) # Verb, raw and tagged are easy if inctype != 't2t': ret.extend(BLOCK.blockin(inctype)) BLOCK.holdextend(inclines) ret.extend(BLOCK.blockout()) else: # Insert include lines into body #TODO include maxdepth limit bodylines = bodylines[:lineref] + inclines + bodylines[lineref:] #TODO fix path if include@include # Remove %!include call if CONF['dump-source']: dump_source.pop() # This line is done, go to next continue # %!csv command elif key == 'csv': if not csv: Error("Python module 'csv' not found, but needed for %!csv") table = [] filename = val reader = csv.reader(Readfile(filename)) # Convert each CSV line to a txt2tags' table line # foo,bar,baz -> | foo | bar | baz | try: for row in reader: table.append('| %s |' % ' | '.join(row)) except csv.Error as e: Error('CSV: file %s: %s' % (filename, e)) # Parse and convert the new table # Note: cell contents is raw, no t2t marks are parsed if rules['tableable']: ret.extend(BLOCK.blockin('table')) if table: BLOCK.tableparser.__init__(table[0]) for row in table: tablerow = TableMaster().parse_row(row) BLOCK.tableparser.add_row(tablerow) # Very ugly, but necessary for escapes line = SEPARATOR.join(tablerow['cells']) BLOCK.holdadd(doEscape(target, line)) ret.extend(BLOCK.blockout()) # Tables are mapped to verb when target is not table-aware else: if target == 'art' and table: table = aa_table(table) ret.extend(BLOCK.blockin('verb')) BLOCK.propset('mapped', 'table') for row in table: BLOCK.holdadd(row) ret.extend(BLOCK.blockout()) # This line is done, go to next continue #---------------------[ dump-source ]----------------------- # We don't need to go any further if CONF['dump-source']: continue #---------------------[ Comments ]-------------------------- # Just skip them (if not macro) if regex['comment'].search(line) and not \ regex['macros'].match(line) and not \ regex['toc'].match(line): continue #---------------------[ Triggers ]-------------------------- # Valid line, reset blank status f_lastwasblank = 0 # Any NOT quote line closes all open quotes if BLOCK.isblock('quote') and not regex['quote'].search(line): while BLOCK.isblock('quote'): ret.extend(BLOCK.blockout()) # Any NOT table line closes an open table if BLOCK.isblock('table') and not regex['table'].search(line): ret.extend(BLOCK.blockout()) #---------------------[ Horizontal Bar ]-------------------- if regex['bar'].search(line): # Bars inside quotes are handled on the Quote processing # Otherwise we parse the bars right here # if not (BLOCK.isblock('quote') or regex['quote'].search(line)) \ or (BLOCK.isblock('quote') and not rules['barinsidequote']): # Close all the opened blocks ret.extend(BLOCK.blockin('bar')) # Extract the bar chars (- or =) m = regex['bar'].search(line) bar_chars = m.group(2) # Process and dump the tagged bar BLOCK.holdadd(bar_chars) ret.extend(BLOCK.blockout()) Debug("BAR: %s"%line, 6) # We're done, nothing more to process continue #---------------------[ Title ]----------------------------- if (regex['title'].search(line) or regex['numtitle'].search(line)) \ and not BLOCK.block().endswith('list'): if regex['title'].search(line): name = 'title' else: name = 'numtitle' # Close all the opened blocks ret.extend(BLOCK.blockin(name)) # Process title TITLE.add(line) ret.extend(BLOCK.blockout()) # We're done, nothing more to process continue #---------------------[ %%toc ]----------------------- # %%toc line closes paragraph if BLOCK.block() == 'para' and regex['toc'].search(line): ret.extend(BLOCK.blockout()) #---------------------[ apply masks ]----------------------- line = MASK.mask(line) #XXX from here, only block-inside lines will pass #---------------------[ Quote ]----------------------------- if regex['quote'].search(line): # Store number of leading TABS quotedepth = len(regex['quote'].search(line).group(0)) # SGML doesn't support nested quotes if rules['quotenotnested']: quotedepth = 1 # Don't cross depth limit maxdepth = rules['quotemaxdepth'] if maxdepth and quotedepth > maxdepth: quotedepth = maxdepth # New quote if not BLOCK.isblock('quote'): ret.extend(BLOCK.blockin('quote')) # New subquotes while BLOCK.depth < quotedepth: BLOCK.blockin('quote') # Closing quotes while quotedepth < BLOCK.depth: ret.extend(BLOCK.blockout()) # Bar inside quote if regex['bar'].search(line) and rules['barinsidequote']: tempBlock = BlockMaster() tagged_bar = [] tagged_bar.extend(tempBlock.blockin('bar')) tempBlock.holdadd(line) tagged_bar.extend(tempBlock.blockout()) BLOCK.holdextend(tagged_bar) continue #---------------------[ Lists ]----------------------------- # An empty item also closes the current list if BLOCK.block().endswith('list'): m = regex['listclose'].match(line) if m: listindent = m.group(1) listtype = m.group(2) currlisttype = BLOCK.prop('type') currlistindent = BLOCK.prop('indent') if listindent == currlistindent and \ listtype == currlisttype: ret.extend(BLOCK.blockout()) continue if regex['list'].search(line) or \ regex['numlist'].search(line) or \ regex['deflist'].search(line): listindent = BLOCK.prop('indent') listids = ''.join(LISTNAMES.keys()) m = re.match('^( *)([%s]) ' % re.escape(listids), line) listitemindent = m.group(1) listtype = m.group(2) listname = LISTNAMES[listtype] results_box = BLOCK.holdadd # Del list ID (and separate term from definition) if listname == 'deflist': term = parse_deflist_term(line) line = regex['deflist'].sub( SEPARATOR+term+SEPARATOR,line) else: line = regex[listname].sub(SEPARATOR,line) # Don't cross depth limit maxdepth = rules['listmaxdepth'] if maxdepth and BLOCK.depth == maxdepth: if len(listitemindent) > len(listindent): listitemindent = listindent # List bumping (same indent, diff mark) # Close the currently open list to clear the mess if BLOCK.block().endswith('list') \ and listname != BLOCK.block() \ and len(listitemindent) == len(listindent): ret.extend(BLOCK.blockout()) listindent = BLOCK.prop('indent') # Open mother list or sublist if not BLOCK.block().endswith('list') or \ len(listitemindent) > len(listindent): ret.extend(BLOCK.blockin(listname)) BLOCK.propset('indent',listitemindent) BLOCK.propset('type',listtype) # Closing sublists while len(listitemindent) < len(BLOCK.prop('indent')): ret.extend(BLOCK.blockout()) # O-oh, sublist before list ("\n\n - foo\n- foo") # Fix: close sublist (as mother), open another list if not BLOCK.block().endswith('list'): ret.extend(BLOCK.blockin(listname)) BLOCK.propset('indent',listitemindent) BLOCK.propset('type',listtype) #---------------------[ Table ]----------------------------- #TODO escape undesired format inside table #TODO add pm6 target if regex['table'].search(line): if not BLOCK.isblock('table'): # first table line! ret.extend(BLOCK.blockin('table')) BLOCK.tableparser.__init__(line) tablerow = TableMaster().parse_row(line) BLOCK.tableparser.add_row(tablerow) # save config # Maintain line to unmask and inlines # XXX Bug: | **bo | ld** | turns **bo\x01ld** and gets converted :( # TODO isolate unmask+inlines parsing to use here line = SEPARATOR.join(tablerow['cells']) #---------------------[ Paragraph ]------------------------- if not BLOCK.block() and \ not line.count(MASK.tocmask): # new para! ret.extend(BLOCK.blockin('para')) ############################################################ ############################################################ ############################################################ #---------------------[ Final Parses ]---------------------- # The target-specific special char escapes for body lines line = doEscape(target,line) line = add_inline_tags(line) line = MASK.undo(line) #---------------------[ Hold or Return? ]------------------- ### Now we must choose where to put the parsed line # if not results_box: # List item extra lines if BLOCK.block().endswith('list'): results_box = BLOCK.holdaddsub # Other blocks elif BLOCK.block(): results_box = BLOCK.holdadd # No blocks else: line = doFinalEscape(target, line) results_box = ret.append results_box(line) # EOF: close any open para/verb/lists/table/quotes Debug('EOF',7) while BLOCK.block(): ret.extend(BLOCK.blockout()) # Maybe close some opened title area? if rules['titleblocks']: ret.extend(TITLE.close_all()) # Maybe a major tag to enclose body? (like DIV for CSS) if TAGS['bodyOpen' ]: ret.insert(0, TAGS['bodyOpen']) if TAGS['bodyClose']: ret.append(TAGS['bodyClose']) if CONF['toc-only']: ret = [] marked_toc = TITLE.dump_marked_toc(CONF['toc-level']) # If dump-source, all parsing is ignored if CONF['dump-source']: ret = dump_source[:] return ret, marked_toc ############################################################################## ################################### GUI ###################################### ############################################################################## # # Tk help: http://python.org/topics/tkinter/ # Tuto: http://ibiblio.org/obp/py4fun/gui/tkPhone.html # /usr/lib/python*/lib-tk/Tkinter.py # # grid table : row=0, column=0, columnspan=2, rowspan=2 # grid align : sticky='n,s,e,w' (North, South, East, West) # pack place : side='top,bottom,right,left' # pack fill : fill='x,y,both,none', expand=1 # pack align : anchor='n,s,e,w' (North, South, East, West) # padding : padx=10, pady=10, ipadx=10, ipady=10 (internal) # checkbox : offvalue is return if the _user_ deselected the box # label align: justify=left,right,center def load_GUI_resources(): "Load all extra modules and methods used by GUI" global askopenfilename, showinfo, showwarning, showerror, Tkinter from tkinter.filedialog import askopenfilename from tkinter.messagebox import showinfo,showwarning,showerror import tkinter class Gui: "Graphical Tk Interface" def __init__(self, conf={}): self.root = tkinter.Tk() # mother window, come to butthead self.root.title(my_name) # window title bar text self.window = self.root # variable "focus" for inclusion self.row = 0 # row count for grid() self.action_length = 150 # left column length (pixel) self.frame_margin = 10 # frame margin size (pixel) self.frame_border = 6 # frame border size (pixel) # The default Gui colors, can be changed by %!guicolors self.dft_gui_colors = ['#6c6','white','#cf9','#030'] self.gui_colors = [] self.bg1 = self.fg1 = self.bg2 = self.fg2 = '' # On Tk, vars need to be set/get using setvar()/get() self.infile = self.setvar('') self.target = self.setvar('') self.target_name = self.setvar('') # The checks appearance order self.checks = [ 'headers', 'enum-title', 'toc', 'mask-email', 'toc-only', 'stdout' ] # Creating variables for all checks for check in self.checks: setattr(self, 'f_'+check, self.setvar('')) # Load RC config self.conf = {} if conf: self.load_config(conf) def load_config(self, conf): self.conf = conf self.gui_colors = conf.get('guicolors') or self.dft_gui_colors self.bg1, self.fg1, self.bg2, self.fg2 = self.gui_colors self.root.config(bd=15,bg=self.bg1) ### Config as dic for python 1.5 compat (**opts don't work :( ) def entry(self, **opts): return tkinter.Entry(self.window, opts) def label(self, txt='', bg=None, **opts): opts.update({'text':txt,'bg':bg or self.bg1}) return tkinter.Label(self.window, opts) def button(self,name,cmd,**opts): opts.update({'text':name,'command':cmd}) return tkinter.Button(self.window, opts) def check(self,name,checked=0,**opts): bg, fg = self.bg2, self.fg2 opts.update({ 'text':name, 'onvalue':1, 'offvalue':0, 'activeforeground':fg, 'activebackground':bg, 'highlightbackground':bg, 'fg':fg, 'bg':bg, 'anchor':'w' }) chk = tkinter.Checkbutton(self.window, opts) if checked: chk.select() chk.grid(columnspan=2, sticky='w', padx=0) def menu(self,sel,items): return tkinter.OptionMenu(*(self.window,sel)+tuple(items)) # Handy auxiliary functions def action(self, txt): self.label( txt, fg=self.fg1, bg=self.bg1, wraplength=self.action_length).grid(column=0,row=self.row) def frame_open(self): self.window = tkinter.Frame( self.root, bg=self.bg2, borderwidth=self.frame_border) def frame_close(self): self.window.grid( column=1, row=self.row, sticky='w', padx=self.frame_margin) self.window = self.root self.label('').grid() self.row += 2 # update row count def target_name2key(self): name = self.target_name.get() target = [x for x in TARGETS if TARGET_NAMES[x] == name] try : key = target[0] except: key = '' self.target = self.setvar(key) def target_key2name(self): key = self.target.get() name = TARGET_NAMES.get(key) or key self.target_name = self.setvar(name) def exit(self): self.root.destroy() def setvar(self, val): z = tkinter.StringVar() ; z.set(val) ; return z def askfile(self): ftypes= [(_('txt2tags files'), ('*.t2t','*.txt')), (_('All files'),'*')] newfile = askopenfilename(filetypes=ftypes) if newfile: self.infile.set(newfile) newconf = process_source_file(newfile)[0] newconf = ConfigMaster().sanity(newconf, gui=1) # Restate all checkboxes after file selection #TODO how to make a refresh without killing it? self.root.destroy() self.__init__(newconf) self.mainwindow() def scrollwindow(self, txt='no text!', title=''): # Create components win = tkinter.Toplevel() ; win.title(title) frame = tkinter.Frame(win) scroll = tkinter.Scrollbar(frame) text = tkinter.Text(frame,yscrollcommand=scroll.set) button = tkinter.Button(win) # Config text.insert(tkinter.END, '\n'.join(txt)) scroll.config(command=text.yview) button.config(text=_('Close'), command=win.destroy) button.focus_set() # Packing text.pack(side='left', fill='both', expand=1) scroll.pack(side='right', fill='y') frame.pack(fill='both', expand=1) button.pack(ipadx=30) def runprogram(self): global CMDLINE_RAW # Prepare self.target_name2key() infile, target = self.infile.get(), self.target.get() # Sanity if not target: showwarning(my_name,_("You must select a target type!")) return if not infile: showwarning(my_name,_("You must provide the source file location!")) return # Compose cmdline guiflags = [] real_cmdline_conf = ConfigMaster(CMDLINE_RAW).parse() if 'infile' in real_cmdline_conf: del real_cmdline_conf['infile'] if 'target' in real_cmdline_conf: del real_cmdline_conf['target'] real_cmdline = CommandLine().compose_cmdline(real_cmdline_conf) default_outfile = ConfigMaster().get_outfile_name( {'sourcefile':infile, 'outfile':'', 'target':target}) for opt in self.checks: val = int(getattr(self, 'f_%s'%opt).get() or "0") if opt == 'stdout': opt = 'outfile' on_config = self.conf.get(opt) or 0 on_cmdline = real_cmdline_conf.get(opt) or 0 if opt == 'outfile': if on_config == STDOUT: on_config = 1 else: on_config = 0 if on_cmdline == STDOUT: on_cmdline = 1 else: on_cmdline = 0 if val != on_config or ( val == on_config == on_cmdline and opt in real_cmdline_conf): if val: # Was not set, but user selected on GUI Debug("user turned ON: %s"%opt) if opt == 'outfile': opt = '-o-' else: opt = '--%s'%opt else: # Was set, but user deselected on GUI Debug("user turned OFF: %s"%opt) if opt == 'outfile': opt = "-o%s"%default_outfile else: opt = '--no-%s'%opt guiflags.append(opt) cmdline = [my_name, '-t', target] + real_cmdline + guiflags + [infile] Debug('Gui/Tk cmdline: %s' % cmdline, 5) # Run! cmdline_raw_orig = CMDLINE_RAW try: # Fake the GUI cmdline as the real one, and parse file CMDLINE_RAW = CommandLine().get_raw_config(cmdline[1:]) data = process_source_file(infile) # On GUI, convert_* returns the data, not finish_him() outlist, config = convert_this_files([data]) # On GUI and STDOUT, finish_him() returns the data result = finish_him(outlist, config) # Show outlist in s a nice new window if result: outlist, config = result title = _('%s: %s converted to %s') % ( my_name, os.path.basename(infile), config['target'].upper()) self.scrollwindow(outlist, title) # Show the "file saved" message else: msg = "%s\n\n %s\n%s\n\n %s\n%s"%( _('Conversion done!'), _('FROM:'), infile, _('TO:'), config['outfile']) showinfo(my_name, msg) except error: # common error (windowed), not quit pass except: # fatal error (windowed and printed) errormsg = getUnknownErrorMessage() print(errormsg) showerror(_('%s FATAL ERROR!')%my_name,errormsg) self.exit() CMDLINE_RAW = cmdline_raw_orig def mainwindow(self): self.infile.set(self.conf.get('sourcefile') or '') self.target.set(self.conf.get('target') or _('-- select one --')) outfile = self.conf.get('outfile') if outfile == STDOUT: # map -o- self.conf['stdout'] = 1 if self.conf.get('headers') == None: self.conf['headers'] = 1 # map default action1 = _("Enter the source file location:") action2 = _("Choose the target document type:") action3 = _("Some options you may check:") action4 = _("Some extra options:") checks_txt = { 'headers' : _("Include headers on output"), 'enum-title': _("Number titles (1, 1.1, 1.1.1, etc)"), 'toc' : _("Do TOC also (Table of Contents)"), 'mask-email': _("Hide e-mails from SPAM robots"), 'toc-only' : _("Just do TOC, nothing more"), 'stdout' : _("Dump to screen (Don't save target file)") } targets_menu = [TARGET_NAMES[x] for x in TARGETS] # Header self.label("%s %s"%(my_name.upper(), my_version), bg=self.bg2, fg=self.fg2).grid(columnspan=2, ipadx=10) self.label(_("ONE source, MULTI targets")+'\n%s\n'%my_url, bg=self.bg1, fg=self.fg1).grid(columnspan=2) self.row = 2 # Choose input file self.action(action1) ; self.frame_open() e_infile = self.entry(textvariable=self.infile,width=25) e_infile.grid(row=self.row, column=0, sticky='e') if not self.infile.get(): e_infile.focus_set() self.button(_("Browse"), self.askfile).grid( row=self.row, column=1, sticky='w', padx=10) # Show outfile name, style and encoding (if any) txt = '' if outfile: txt = outfile if outfile == STDOUT: txt = _('<screen>') l_output = self.label(_('Output: ')+txt, fg=self.fg2, bg=self.bg2) l_output.grid(columnspan=2, sticky='w') for setting in ['style','encoding']: if self.conf.get(setting): name = setting.capitalize() val = self.conf[setting] self.label('%s: %s'%(name, val), fg=self.fg2, bg=self.bg2).grid( columnspan=2, sticky='w') # Choose target self.frame_close() ; self.action(action2) self.frame_open() self.target_key2name() self.menu(self.target_name, targets_menu).grid( columnspan=2, sticky='w') # Options checkboxes label self.frame_close() ; self.action(action3) self.frame_open() # Compose options check boxes, example: # self.check(checks_txt['toc'],1,variable=self.f_toc) for check in self.checks: # Extra options label if check == 'toc-only': self.frame_close() ; self.action(action4) self.frame_open() txt = checks_txt[check] var = getattr(self, 'f_'+check) checked = self.conf.get(check) self.check(txt,checked,variable=var) self.frame_close() # Spacer and buttons self.label('').grid() ; self.row += 1 b_quit = self.button(_("Quit"), self.exit) b_quit.grid(row=self.row, column=0, sticky='w', padx=30) b_conv = self.button(_("Convert!"), self.runprogram) b_conv.grid(row=self.row, column=1, sticky='e', padx=30) if self.target.get() and self.infile.get(): b_conv.focus_set() # As documentation told me if sys.platform.startswith('win'): self.root.iconify() self.root.update() self.root.deiconify() self.root.mainloop() ############################################################################## ############################################################################## def exec_command_line(user_cmdline=[]): global CMDLINE_RAW, RC_RAW, DEBUG, VERBOSE, QUIET, GUI, Error # Extract command line data cmdline_data = user_cmdline or sys.argv[1:] CMDLINE_RAW = CommandLine().get_raw_config(cmdline_data, relative=1) cmdline_parsed = ConfigMaster(CMDLINE_RAW).parse() DEBUG = cmdline_parsed.get('debug' ) or 0 VERBOSE = cmdline_parsed.get('verbose') or 0 QUIET = cmdline_parsed.get('quiet' ) or 0 GUI = cmdline_parsed.get('gui' ) or 0 infiles = cmdline_parsed.get('infile' ) or [] Message(_("Txt2tags %s processing begins")%my_version,1) # The easy ones if cmdline_parsed.get('help' ): Quit(USAGE) if cmdline_parsed.get('version'): Quit(VERSIONSTR) if cmdline_parsed.get('targets'): listTargets() Quit() # Multifile haters if len(infiles) > 1: errmsg=_("Option --%s can't be used with multiple input files") for option in NO_MULTI_INPUT: if cmdline_parsed.get(option): Error(errmsg%option) Debug("system platform: %s"%sys.platform) Debug("python version: %s"%(sys.version.split('(')[0])) Debug("line break char: %s"%repr(LB)) Debug("command line: %s"%sys.argv) Debug("command line raw config: %s"%CMDLINE_RAW,1) # Extract RC file config if cmdline_parsed.get('rc') == 0: Message(_("Ignoring user configuration file"),1) else: rc_file = get_rc_path() if os.path.isfile(rc_file): Message(_("Loading user configuration file"),1) RC_RAW = ConfigLines(file_=rc_file).get_raw_config() Debug("rc file: %s"%rc_file) Debug("rc file raw config: %s"%RC_RAW,1) # Get all infiles config (if any) infiles_config = get_infiles_config(infiles) # Is GUI available? # Try to load and start GUI interface for --gui if GUI: try: load_GUI_resources() Debug("GUI resources OK (Tk module is installed)") winbox = Gui() Debug("GUI display OK") GUI = 1 except: Debug("GUI Error: no Tk module or no DISPLAY") GUI = 0 # User forced --gui, but it's not available if cmdline_parsed.get('gui') and not GUI: print(getTraceback()); print() Error( "Sorry, I can't run my Graphical Interface - GUI\n" "- Check if Python Tcl/Tk module is installed (Tkinter)\n" "- Make sure you are in a graphical environment (like X)") # Okay, we will use GUI if GUI: Message(_("We are on GUI interface"),1) # Redefine Error function to raise exception instead sys.exit() def Error(msg): showerror(_('txt2tags ERROR!'), msg) raise error # If no input file, get RC+cmdline config, else full config if not infiles: gui_conf = ConfigMaster(RC_RAW+CMDLINE_RAW).parse() else: try : gui_conf = infiles_config[0][0] except: gui_conf = {} # Sanity is needed to set outfile and other things gui_conf = ConfigMaster().sanity(gui_conf, gui=1) Debug("GUI config: %s"%gui_conf,5) # Insert config and populate the nice window! winbox.load_config(gui_conf) winbox.mainwindow() # Console mode rocks forever! else: Message(_("We are on Command Line interface"),1) # Called with no arguments, show error # TODO#1: this checking should be only in ConfigMaster.sanity() if not infiles: Error(_('Missing input file (try --help)') + '\n\n' + _('Please inform an input file (.t2t) at the end of the command.') + '\n' + _('Example:') + ' %s -t html %s' % (my_name, _('file.t2t'))) convert_this_files(infiles_config) Message(_("Txt2tags finished successfully"),1) if __name__ == '__main__': try: exec_command_line() except error as msg: sys.stderr.write("%s\n"%msg) sys.stderr.flush() sys.exit(1) except SystemExit: pass except: sys.stderr.write(getUnknownErrorMessage()) sys.stderr.flush() sys.exit(1) Quit() # The End.
236,923
Python
38.4676
126
0.476543
makolon/hsr_isaac_tamp/hsr_tamp/downward/misc/style/check-include-guard-convention.py
#! /usr/bin/env python3 import glob import os.path import sys DIR = os.path.dirname(os.path.abspath(__file__)) REPO = os.path.dirname(os.path.dirname(DIR)) SRC_DIR = os.path.join(REPO, "src") def check_header_files(component): component_dir = os.path.join(SRC_DIR, component) header_files = (glob.glob(os.path.join(component_dir, "*.h")) + glob.glob(os.path.join(component_dir, "*", "*.h"))) assert header_files errors = [] for filename in header_files: assert filename.endswith(".h"), filename rel_filename = os.path.relpath(filename, start=component_dir) guard = rel_filename.replace(".", "_").replace("/", "_").replace("-", "_").upper() expected = "#ifndef " + guard for line in open(filename): line = line.rstrip("\n") if line.startswith("#ifndef"): if line != expected: errors.append('%s uses guard "%s" but should use "%s"' % (filename, line, expected)) break return errors def main(): errors = [] errors.extend(check_header_files("search")) for error in errors: print(error) if errors: sys.exit(1) if __name__ == "__main__": main()
1,278
Python
27.422222
90
0.555556
makolon/hsr_isaac_tamp/hsr_tamp/downward/misc/style/check-cc-file.py
#! /usr/bin/env python3 import argparse import re import subprocess import sys STD_REGEX = r"(^|\s|\W)std::" def parse_args(): parser = argparse.ArgumentParser() parser.add_argument("cc_file", nargs="+") return parser.parse_args() def check_std(cc_file): source_without_comments = subprocess.check_output( ["gcc", "-fpreprocessed", "-dD", "-E", cc_file]).decode("utf-8") errors = [] for line in source_without_comments.splitlines(): if re.search(STD_REGEX, line): errors.append("Remove std:: from {}: {}".format( cc_file, line.strip())) return errors def main(): args = parse_args() errors = [] for cc_file in args.cc_file: errors.extend(check_std(cc_file)) for error in errors: print(error) if errors: sys.exit(1) if __name__ == "__main__": main()
881
Python
19.511627
72
0.584563
makolon/hsr_isaac_tamp/hsr_tamp/downward/misc/style/utils.py
import os import os.path def get_src_files(path, extensions, ignore_dirs=None): ignore_dirs = ignore_dirs or [] src_files = [] for root, dirs, files in os.walk(path): for ignore_dir in ignore_dirs: if ignore_dir in dirs: dirs.remove(ignore_dir) src_files.extend([ os.path.join(root, file) for file in files if file.endswith(extensions)]) return src_files
441
Python
26.624998
60
0.598639
makolon/hsr_isaac_tamp/hsr_tamp/downward/misc/style/run-clang-tidy.py
#! /usr/bin/env python3 import json import os import pipes import re import subprocess import sys DIR = os.path.dirname(os.path.abspath(__file__)) REPO = os.path.dirname(os.path.dirname(DIR)) SRC_DIR = os.path.join(REPO, "src") import utils def check_search_code_with_clang_tidy(): # clang-tidy needs the CMake files. build_dir = os.path.join(REPO, "builds", "clang-tidy") if not os.path.exists(build_dir): os.makedirs(build_dir) with open(os.devnull, 'w') as devnull: subprocess.check_call(["cmake", "../../src"], cwd=build_dir, stdout=devnull) # Create custom compilation database file. CMake outputs part of this information # when passing -DCMAKE_EXPORT_COMPILE_COMMANDS=ON, but the resulting file # contains no header files. search_dir = os.path.join(REPO, "src/search") src_files = utils.get_src_files(search_dir, (".h", ".cc")) compile_commands = [{ "directory": os.path.join(build_dir, "search"), "command": "g++ -I{}/ext -std=c++11 -c {}".format(search_dir, src_file), "file": src_file} for src_file in src_files ] with open(os.path.join(build_dir, "compile_commands.json"), "w") as f: json.dump(compile_commands, f, indent=2) # See https://clang.llvm.org/extra/clang-tidy/checks/list.html for # an explanation of the checks. We comment out inactive checks of some # categories instead of deleting them to see which additional checks # we could activate. checks = [ # Enable with CheckTriviallyCopyableMove=0 when we require # clang-tidy >= 6.0 (see issue856). # "misc-move-const-arg", "misc-move-constructor-init", "misc-use-after-move", "performance-for-range-copy", "performance-implicit-cast-in-loop", "performance-inefficient-vector-operation", "readability-avoid-const-params-in-decls", # "readability-braces-around-statements", "readability-container-size-empty", "readability-delete-null-pointer", "readability-deleted-default", # "readability-else-after-return", # "readability-function-size", # "readability-identifier-naming", # "readability-implicit-bool-cast", # Disabled since we prefer a clean interface over consistent names. # "readability-inconsistent-declaration-parameter-name", "readability-misleading-indentation", "readability-misplaced-array-index", # "readability-named-parameter", # "readability-non-const-parameter", "readability-redundant-control-flow", "readability-redundant-declaration", "readability-redundant-function-ptr-dereference", "readability-redundant-member-init", "readability-redundant-smartptr-get", "readability-redundant-string-cstr", "readability-redundant-string-init", "readability-simplify-boolean-expr", "readability-static-definition-in-anonymous-namespace", "readability-uniqueptr-delete-release", ] cmd = [ "run-clang-tidy-8", "-quiet", "-p", build_dir, "-clang-tidy-binary=clang-tidy-8", # Include all non-system headers (.*) except the ones from search/ext/. "-header-filter=.*,-tree.hh,-tree_util.hh", "-checks=-*," + ",".join(checks)] print("Running clang-tidy: " + " ".join(pipes.quote(x) for x in cmd)) print() try: output = subprocess.check_output(cmd, cwd=DIR, stderr=subprocess.STDOUT).decode("utf-8") except subprocess.CalledProcessError as err: print("Failed to run clang-tidy-8. Is it on the PATH?") print("Output:", err.stdout) return False errors = re.findall(r"^(.*:\d+:\d+: (?:warning|error): .*)$", output, flags=re.M) for error in errors: print(error) if errors: fix_cmd = cmd + [ "-clang-apply-replacements-binary=clang-apply-replacements-8", "-fix"] print() print("You may be able to fix these issues with the following command: " + " ".join(pipes.quote(x) for x in fix_cmd)) sys.exit(1) check_search_code_with_clang_tidy()
4,198
Python
37.522935
96
0.633873
makolon/hsr_isaac_tamp/hsr_tamp/downward/misc/style/run-uncrustify.py
#! /usr/bin/env python3 """ Run uncrustify on all C++ files in the repository. """ import argparse import os.path import subprocess import sys import utils DIR = os.path.dirname(os.path.abspath(__file__)) REPO = os.path.dirname(os.path.dirname(DIR)) SEARCH_DIR = os.path.join(REPO, "src", "search") def parse_args(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument( "-m", "--modify", action="store_true", help="modify the files that need to be uncrustified") parser.add_argument( "-f", "--force", action="store_true", help="modify files even if there are uncommited changes") return parser.parse_args() def search_files_are_dirty(): if os.path.exists(os.path.join(REPO, ".git")): cmd = ["git", "status", "--porcelain", SEARCH_DIR] elif os.path.exists(os.path.join(REPO, ".hg")): cmd = ["hg", "status", SEARCH_DIR] else: sys.exit("Error: repo must contain a .git or .hg directory.") return bool(subprocess.check_output(cmd, cwd=REPO)) def main(): args = parse_args() if not args.force and args.modify and search_files_are_dirty(): sys.exit(f"Error: {SEARCH_DIR} has uncommited changes.") src_files = utils.get_src_files(SEARCH_DIR, (".h", ".cc")) print(f"Checking {len(src_files)} files with uncrustify.") config_file = os.path.join(REPO, ".uncrustify.cfg") executable = "uncrustify" cmd = [executable, "-q", "-c", config_file] + src_files if args.modify: cmd.append("--no-backup") else: cmd.append("--check") try: # Hide clean files printed on stdout. returncode = subprocess.call(cmd, stdout=subprocess.PIPE) except FileNotFoundError: sys.exit(f"Error: {executable} not found. Is it on the PATH?") if not args.modify and returncode != 0: print('Run "tox -e fix-style" in the misc/ directory to fix the C++ style.') return returncode if __name__ == "__main__": sys.exit(main())
2,016
Python
30.030769
84
0.630456
makolon/hsr_isaac_tamp/hsr_tamp/downward/misc/style/run-all-style-checks.py
#! /usr/bin/env python3 """ Run syntax checks on Python and C++ files. Exit with 0 if all tests pass and with 1 otherwise. """ import errno import os import subprocess import sys DIR = os.path.dirname(os.path.abspath(__file__)) REPO = os.path.dirname(os.path.dirname(DIR)) SRC_DIR = os.path.join(REPO, "src") import utils def check_python_style(): try: subprocess.check_call([ "flake8", # https://flake8.pycqa.org/en/latest/user/error-codes.html "--extend-ignore", "E128,E129,E131,E261,E266,E301,E302,E305,E306,E402,E501,E741,F401", "--exclude", "run-clang-tidy.py,txt2tags.py,.tox", "src/translate/", "driver/", "misc/", "build.py", "build_configs.py", "fast-downward.py"], cwd=REPO) except FileNotFoundError: sys.exit('Error: flake8 not found. Try "tox -e style".') except subprocess.CalledProcessError: return False else: return True def check_include_guard_convention(): return subprocess.call("./check-include-guard-convention.py", cwd=DIR) == 0 def check_cc_files(): """ Currently, we only check that there is no "std::" in .cc files. """ search_dir = os.path.join(SRC_DIR, "search") cc_files = utils.get_src_files(search_dir, (".cc",)) print("Checking style of {} *.cc files".format(len(cc_files))) return subprocess.call(["./check-cc-file.py"] + cc_files, cwd=DIR) == 0 def check_cplusplus_style(): return subprocess.call(["./run-uncrustify.py"], cwd=DIR) == 0 def main(): results = [] for test_name, test in sorted(globals().items()): if test_name.startswith("check_"): print("Running {}".format(test_name)) results.append(test()) if all(results): print("All style checks passed") else: sys.exit("Style checks failed") if __name__ == "__main__": main()
1,904
Python
25.830986
98
0.61292
makolon/hsr_isaac_tamp/hsr_tamp/downward/misc/tests/test-memory-leaks.py
import errno import os import pipes import re import subprocess import sys import pytest import configs DIR = os.path.dirname(os.path.abspath(__file__)) REPO = os.path.dirname(os.path.dirname(DIR)) BENCHMARKS_DIR = os.path.join(REPO, "misc", "tests", "benchmarks") FAST_DOWNWARD = os.path.join(REPO, "fast-downward.py") BUILD_DIR = os.path.join(REPO, "builds", "release") DOWNWARD_BIN = os.path.join(BUILD_DIR, "bin", "downward") SAS_FILE = os.path.join(REPO, "test.sas") PLAN_FILE = os.path.join(REPO, "test.plan") VALGRIND_GCC5_SUPPRESSION_FILE = os.path.join( REPO, "misc", "tests", "valgrind", "gcc5.supp") DLOPEN_SUPPRESSION_FILE = os.path.join( REPO, "misc", "tests", "valgrind", "dlopen.supp") DL_CATCH_ERROR_SUPPRESSION_FILE = os.path.join( REPO, "misc", "tests", "valgrind", "dl_catch_error.supp") VALGRIND_ERROR_EXITCODE = 99 TASK = os.path.join(BENCHMARKS_DIR, "miconic/s1-0.pddl") CONFIGS = {} CONFIGS.update(configs.default_configs_optimal(core=True, extended=True)) CONFIGS.update(configs.default_configs_satisficing(core=True, extended=True)) def escape_list(l): return " ".join(pipes.quote(x) for x in l) def get_compiler_and_version(): output = subprocess.check_output( ["cmake", "-LA", "-N", "../../src/"], cwd=BUILD_DIR).decode("utf-8") compiler = re.search( "^DOWNWARD_CXX_COMPILER_ID:STRING=(.+)$", output, re.M).group(1) version = re.search( "^DOWNWARD_CXX_COMPILER_VERSION:STRING=(.+)$", output, re.M).group(1) return compiler, version COMPILER, COMPILER_VERSION = get_compiler_and_version() SUPPRESSION_FILES = [ DLOPEN_SUPPRESSION_FILE, DL_CATCH_ERROR_SUPPRESSION_FILE, ] if COMPILER == "GNU" and COMPILER_VERSION.split(".")[0] == "5": print("Using leak suppression file for GCC 5 " "(see http://issues.fast-downward.org/issue703).") SUPPRESSION_FILES.append(VALGRIND_GCC5_SUPPRESSION_FILE) def run_plan_script(task, config): assert "--alias" not in config, config cmd = [ "valgrind", "--leak-check=full", "--error-exitcode={}".format(VALGRIND_ERROR_EXITCODE), "--show-leak-kinds=all", "--errors-for-leak-kinds=all", "--track-origins=yes"] for suppression_file in SUPPRESSION_FILES: cmd.append("--suppressions={}".format(suppression_file)) cmd.extend([DOWNWARD_BIN] + config + ["--internal-plan-file", PLAN_FILE]) print("\nRun: {}".format(escape_list(cmd))) sys.stdout.flush() try: subprocess.check_call(cmd, stdin=open(SAS_FILE), cwd=REPO) except OSError as err: if err.errno == errno.ENOENT: pytest.fail( "Could not find valgrind. Please install it " "with \"sudo apt install valgrind\".") except subprocess.CalledProcessError as err: # Valgrind exits with # - the exit code of the binary if it does not find leaks # - VALGRIND_ERROR_EXITCODE if it finds leaks # - 1 in case of usage errors # Fortunately, we only use exit code 1 for portfolios. if err.returncode == 1: pytest.fail("failed to run valgrind") elif err.returncode == VALGRIND_ERROR_EXITCODE: pytest.fail("{config} leaks memory for {task}".format(**locals())) def translate(task): subprocess.check_call( [sys.executable, FAST_DOWNWARD, "--sas-file", SAS_FILE, "--translate", task], cwd=REPO) def setup_module(_module): translate(TASK) @pytest.mark.parametrize("config", sorted(CONFIGS.values())) def test_configs(config): run_plan_script(SAS_FILE, config) def teardown_module(_module): os.remove(SAS_FILE) os.remove(PLAN_FILE)
3,694
Python
32.288288
85
0.649702
makolon/hsr_isaac_tamp/hsr_tamp/downward/misc/tests/test-dependencies.py
#! /usr/bin/env python3 import os import shutil import subprocess import sys DIR = os.path.dirname(os.path.abspath(__file__)) REPO = os.path.dirname(os.path.dirname(DIR)) DOWNWARD_FILES = os.path.join(REPO, "src", "search", "DownwardFiles.cmake") TEST_BUILD_CONFIGS = os.path.join(REPO, "test_build_configs.py") BUILD = os.path.join(REPO, "build.py") BUILDS = os.path.join(REPO, "builds") paths_to_clean = [TEST_BUILD_CONFIGS] def clean_up(paths_to_clean): print("\nCleaning up") for path in paths_to_clean: print("Removing {path}".format(**locals())) if os.path.isfile(path): os.remove(path) if os.path.isdir(path): shutil.rmtree(path) print("Done cleaning") with open(DOWNWARD_FILES) as d: content = d.readlines() content = [line for line in content if '#' not in line] content = [line for line in content if 'NAME' in line or 'CORE_PLUGIN' in line or 'DEPENDENCY_ONLY' in line] plugins_to_be_tested = [] for line in content: if 'NAME' in line: plugins_to_be_tested.append(line.replace("NAME", "").strip()) if 'CORE_PLUGIN' in line or 'DEPENDENCY_ONLY' in line: plugins_to_be_tested.pop() with open(TEST_BUILD_CONFIGS, "w") as f: for plugin in plugins_to_be_tested: lowercase = plugin.lower() line = "{lowercase} = [\"-DCMAKE_BUILD_TYPE=Debug\", \"-DDISABLE_PLUGINS_BY_DEFAULT=YES\"," \ " \"-DPLUGIN_{plugin}_ENABLED=True\"]\n".format(**locals()) f.write(line) paths_to_clean.append(os.path.join(BUILDS, lowercase)) plugins_failed_test = [] for plugin in plugins_to_be_tested: try: subprocess.check_call([BUILD, plugin.lower()]) except subprocess.CalledProcessError: plugins_failed_test.append(plugin) if plugins_failed_test: print("\nFailure:") for plugin in plugins_failed_test: print("{plugin} failed dependencies test".format(**locals())) sys.exit(1) else: print("\nAll plugins have passed dependencies test") clean_up(paths_to_clean)
2,043
Python
30.9375
108
0.652472
makolon/hsr_isaac_tamp/hsr_tamp/downward/misc/tests/test-standard-configs.py
import os import pipes import subprocess import sys import pytest import configs DIR = os.path.dirname(os.path.abspath(__file__)) REPO = os.path.dirname(os.path.dirname(DIR)) BENCHMARKS_DIR = os.path.join(REPO, "misc", "tests", "benchmarks") FAST_DOWNWARD = os.path.join(REPO, "fast-downward.py") SAS_FILE = os.path.join(REPO, "test.sas") PLAN_FILE = os.path.join(REPO, "test.plan") TASK = os.path.join(BENCHMARKS_DIR, "miconic/s1-0.pddl") CONFIGS_NOLP = {} CONFIGS_NOLP.update(configs.default_configs_optimal(core=True, extended=True)) CONFIGS_NOLP.update(configs.default_configs_satisficing(core=True, extended=True)) def escape_list(l): return " ".join(pipes.quote(x) for x in l) def run_plan_script(task, config, debug): cmd = [sys.executable, FAST_DOWNWARD, "--plan-file", PLAN_FILE] if debug: cmd.append("--debug") if "--alias" in config: assert len(config) == 2, config cmd += config + [task] else: cmd += [task] + config print("\nRun: {}:".format(escape_list(cmd))) sys.stdout.flush() subprocess.check_call(cmd, cwd=REPO) def translate(task): subprocess.check_call([ sys.executable, FAST_DOWNWARD, "--sas-file", SAS_FILE, "--translate", task], cwd=REPO) def cleanup(): os.remove(SAS_FILE) os.remove(PLAN_FILE) def setup_module(module): translate(TASK) @pytest.mark.parametrize("config", sorted(CONFIGS_NOLP.values())) @pytest.mark.parametrize("debug", [False, True]) def test_configs_nolp(config, debug): run_plan_script(SAS_FILE, config, debug) @pytest.mark.parametrize("config", sorted(configs.configs_optimal_lp(lp_solver="CPLEX").values())) @pytest.mark.parametrize("debug", [False, True]) def test_configs_cplex(config, debug): run_plan_script(SAS_FILE, config, debug) @pytest.mark.parametrize("config", sorted(configs.configs_optimal_lp(lp_solver="SOPLEX").values())) @pytest.mark.parametrize("debug", [False, True]) def test_configs_soplex(config, debug): run_plan_script(SAS_FILE, config, debug) def teardown_module(module): cleanup()
2,077
Python
26.706666
99
0.68753
makolon/hsr_isaac_tamp/hsr_tamp/downward/misc/tests/test-translator.py
#! /usr/bin/env python3 HELP = """\ Check that translator is deterministic. Run the translator multiple times to test that the log and the output file are the same for every run. Obviously, there might be false negatives, i.e., different runs might lead to the same nondeterministic results. """ import argparse from collections import defaultdict import itertools import os from pathlib import Path import re import subprocess import sys DIR = Path(__file__).resolve().parent REPO = DIR.parents[1] DRIVER = REPO / "fast-downward.py" def parse_args(): parser = argparse.ArgumentParser(description=HELP) parser.add_argument( "benchmarks_dir", help="path to benchmark directory") parser.add_argument( "suite", nargs="*", default=["first"], help='Use "all" to test all benchmarks, ' '"first" to test the first task of each domain (default), ' 'or "<domain>:<problem>" to test individual tasks') parser.add_argument( "--runs-per-task", help="translate each task this many times and compare the outputs", type=int, default=3) args = parser.parse_args() args.benchmarks_dir = Path(args.benchmarks_dir).resolve() return args def get_task_name(path): return "-".join(str(path).split("/")[-2:]) def translate_task(task_file): print(f"Translate {get_task_name(task_file)}", flush=True) sys.stdout.flush() cmd = [sys.executable, str(DRIVER), "--translate", str(task_file)] try: output = subprocess.check_output(cmd, encoding=sys.getfilesystemencoding()) except OSError as err: sys.exit(f"Call failed: {' '.join(cmd)}\n{err}") # Remove information that may differ between calls. for pattern in [ r"\[.+s CPU, .+s wall-clock\]", r"\d+ KB"]: output = re.sub(pattern, "", output) return output def _get_all_tasks_by_domain(benchmarks_dir): # Ignore domains where translating the first task takes too much time or memory. # We also ignore citycar, which indeed reveals some nondeterminism in the # invariant synthesis. Fixing it would require to sort the actions which # seems to be detrimental on some other domains. blacklisted_domains = [ "agricola-sat18-strips", "citycar-opt14-adl", # cf. issue879 "citycar-sat14-adl", # cf. issue879 "organic-synthesis-sat18-strips", "organic-synthesis-split-opt18-strips", "organic-synthesis-split-sat18-strips"] benchmarks_dir = Path(benchmarks_dir) tasks = defaultdict(list) domains = [ domain_dir for domain_dir in benchmarks_dir.iterdir() if domain_dir.is_dir() and not str(domain_dir.name).startswith((".", "_", "unofficial")) and str(domain_dir.name) not in blacklisted_domains] for domain in domains: path = benchmarks_dir / domain tasks[domain] = [ benchmarks_dir / domain / f for f in sorted(path.iterdir()) if "domain" not in str(f)] return sorted(tasks.values()) def get_tasks(args): suite = [] for task in args.suite: if task == "first": # Add the first task of each domain. suite.extend([tasks[0] for tasks in _get_all_tasks_by_domain(args.benchmarks_dir)]) elif task == "all": # Add the whole benchmark suite. suite.extend(itertools.chain.from_iterable( tasks for tasks in _get_all_tasks_by_domain(args.benchmarks_dir))) else: # Add task from command line. task = task.replace(":", "/") suite.append(args.benchmarks_dir / task) return sorted(set(suite)) def cleanup(): for f in Path(".").glob("translator-output-*.txt"): f.unlink() def write_combined_output(output_file, task): log = translate_task(task) with open(output_file, "w") as combined_output: combined_output.write(log) with open("output.sas") as output_sas: combined_output.write(output_sas.read()) def main(): args = parse_args() os.chdir(DIR) cleanup() for task in get_tasks(args): base_file = "translator-output-0.txt" write_combined_output(base_file, task) for i in range(1, args.runs_per_task): compared_file = f"translator-output-{i}.txt" write_combined_output(compared_file, task) files = [base_file, compared_file] try: subprocess.check_call(["diff", "-q"] + files) except subprocess.CalledProcessError: sys.exit(f"Error: Translator is nondeterministic for {task}.") print("Outputs match\n", flush=True) cleanup() if __name__ == "__main__": main()
4,774
Python
32.391608
95
0.624005
makolon/hsr_isaac_tamp/hsr_tamp/downward/misc/tests/test-exitcodes.py
from collections import defaultdict import os import subprocess import sys import pytest DIR = os.path.dirname(os.path.abspath(__file__)) REPO_BASE = os.path.dirname(os.path.dirname(DIR)) sys.path.insert(0, REPO_BASE) from driver import returncodes BENCHMARKS_DIR = os.path.join(REPO_BASE, "misc", "tests", "benchmarks") DRIVER = os.path.join(REPO_BASE, "fast-downward.py") TRANSLATE_TASKS = { "small": "gripper/prob01.pddl", "large": "satellite/p25-HC-pfile5.pddl", } TRANSLATE_TESTS = [ ("small", [], [], defaultdict(lambda: returncodes.SUCCESS)), # We cannot set time limits on Windows and thus expect DRIVER_UNSUPPORTED # as exit code in this case. ("large", ["--translate-time-limit", "1s"], [], defaultdict( lambda: returncodes.TRANSLATE_OUT_OF_TIME, win32=returncodes.DRIVER_UNSUPPORTED)), # We cannot set/enforce memory limits on Windows/macOS and thus expect # DRIVER_UNSUPPORTED as exit code in those cases. ("large", ["--translate-memory-limit", "75M"], [], defaultdict( lambda: returncodes.TRANSLATE_OUT_OF_MEMORY, darwin=returncodes.DRIVER_UNSUPPORTED, win32=returncodes.DRIVER_UNSUPPORTED)), ] SEARCH_TASKS = { "strips": "miconic/s1-0.pddl", "axioms": "philosophers/p01-phil2.pddl", "cond-eff": "miconic-simpleadl/s1-0.pddl", "large": "satellite/p25-HC-pfile5.pddl", } MERGE_AND_SHRINK = ('astar(merge_and_shrink(' 'merge_strategy=merge_stateless(merge_selector=' 'score_based_filtering(scoring_functions=[goal_relevance,' 'dfp,total_order(atomic_ts_order=reverse_level,' 'product_ts_order=new_to_old,atomic_before_product=false)])),' 'shrink_strategy=shrink_bisimulation(greedy=false),' 'label_reduction=exact(' 'before_shrinking=true,' 'before_merging=false),' 'max_states=50000,threshold_before_merge=1,verbosity=silent))') SEARCH_TESTS = [ ("strips", [], "astar(add())", defaultdict(lambda: returncodes.SUCCESS)), ("strips", [], "astar(hm())", defaultdict(lambda: returncodes.SUCCESS)), ("strips", [], "ehc(hm())", defaultdict(lambda: returncodes.SUCCESS)), ("strips", [], "astar(ipdb())", defaultdict(lambda: returncodes.SUCCESS)), ("strips", [], "astar(lmcut())", defaultdict(lambda: returncodes.SUCCESS)), ("strips", [], "astar(lmcount(lm_rhw(), admissible=false))", defaultdict(lambda: returncodes.SUCCESS)), ("strips", [], "astar(lmcount(lm_rhw(), admissible=true))", defaultdict(lambda: returncodes.SUCCESS)), ("strips", [], "astar(lmcount(lm_hm(), admissible=false))", defaultdict(lambda: returncodes.SUCCESS)), ("strips", [], "astar(lmcount(lm_hm(), admissible=true))", defaultdict(lambda: returncodes.SUCCESS)), ("strips", [], MERGE_AND_SHRINK, defaultdict(lambda: returncodes.SUCCESS)), ("axioms", [], "astar(add())", defaultdict(lambda: returncodes.SUCCESS)), ("axioms", [], "astar(hm())", defaultdict(lambda: returncodes.SEARCH_UNSOLVED_INCOMPLETE)), ("axioms", [], "ehc(hm())", defaultdict(lambda: returncodes.SEARCH_UNSOLVED_INCOMPLETE)), ("axioms", [], "astar(ipdb())", defaultdict(lambda: returncodes.SEARCH_UNSUPPORTED)), ("axioms", [], "astar(lmcut())", defaultdict(lambda: returncodes.SEARCH_UNSUPPORTED)), ("axioms", [], "astar(lmcount(lm_rhw(), admissible=false))", defaultdict(lambda: returncodes.SUCCESS)), ("axioms", [], "astar(lmcount(lm_rhw(), admissible=true))", defaultdict(lambda: returncodes.SEARCH_UNSUPPORTED)), ("axioms", [], "astar(lmcount(lm_zg(), admissible=false))", defaultdict(lambda: returncodes.SUCCESS)), ("axioms", [], "astar(lmcount(lm_zg(), admissible=true))", defaultdict(lambda: returncodes.SEARCH_UNSUPPORTED)), # h^m landmark factory explicitly forbids axioms. ("axioms", [], "astar(lmcount(lm_hm(), admissible=false))", defaultdict(lambda: returncodes.SEARCH_UNSUPPORTED)), ("axioms", [], "astar(lmcount(lm_hm(), admissible=true))", defaultdict(lambda: returncodes.SEARCH_UNSUPPORTED)), ("axioms", [], "astar(lmcount(lm_exhaust(), admissible=false))", defaultdict(lambda: returncodes.SUCCESS)), ("axioms", [], "astar(lmcount(lm_exhaust(), admissible=true))", defaultdict(lambda: returncodes.SEARCH_UNSUPPORTED)), ("axioms", [], MERGE_AND_SHRINK, defaultdict(lambda: returncodes.SEARCH_UNSUPPORTED)), ("cond-eff", [], "astar(add())", defaultdict(lambda: returncodes.SUCCESS)), ("cond-eff", [], "astar(hm())", defaultdict(lambda: returncodes.SUCCESS)), ("cond-eff", [], "astar(ipdb())", defaultdict(lambda: returncodes.SEARCH_UNSUPPORTED)), ("cond-eff", [], "astar(lmcut())", defaultdict(lambda: returncodes.SEARCH_UNSUPPORTED)), ("cond-eff", [], "astar(lmcount(lm_rhw(), admissible=false))", defaultdict(lambda: returncodes.SUCCESS)), ("cond-eff", [], "astar(lmcount(lm_rhw(), admissible=true))", defaultdict(lambda: returncodes.SUCCESS)), ("cond-eff", [], "astar(lmcount(lm_zg(), admissible=false))", defaultdict(lambda: returncodes.SUCCESS)), ("cond-eff", [], "astar(lmcount(lm_zg(), admissible=true))", defaultdict(lambda: returncodes.SUCCESS)), ("cond-eff", [], "astar(lmcount(lm_hm(), admissible=false))", defaultdict(lambda: returncodes.SUCCESS)), ("cond-eff", [], "astar(lmcount(lm_hm(), admissible=true))", defaultdict(lambda: returncodes.SEARCH_UNSUPPORTED)), ("cond-eff", [], "astar(lmcount(lm_exhaust(), admissible=false))", defaultdict(lambda: returncodes.SUCCESS)), ("cond-eff", [], "astar(lmcount(lm_exhaust(), admissible=true))", defaultdict(lambda: returncodes.SEARCH_UNSUPPORTED)), ("cond-eff", [], MERGE_AND_SHRINK, defaultdict(lambda: returncodes.SUCCESS)), # We cannot set/enforce memory limits on Windows/macOS and thus expect # DRIVER_UNSUPPORTED as exit code in those cases. ("large", ["--search-memory-limit", "100M"], MERGE_AND_SHRINK, defaultdict(lambda: returncodes.SEARCH_OUT_OF_MEMORY, darwin=returncodes.DRIVER_UNSUPPORTED, win32=returncodes.DRIVER_UNSUPPORTED)), # We cannot set time limits on Windows and thus expect DRIVER_UNSUPPORTED # as exit code in this case. ("large", ["--search-time-limit", "1s"], MERGE_AND_SHRINK, defaultdict(lambda: returncodes.SEARCH_OUT_OF_TIME, win32=returncodes.DRIVER_UNSUPPORTED)), ] def translate(pddl_file, sas_file): subprocess.check_call([ sys.executable, DRIVER, "--sas-file", sas_file, "--translate", pddl_file]) def cleanup(): subprocess.check_call([sys.executable, DRIVER, "--cleanup"]) def get_sas_file_name(task_type): return "{}.sas".format(task_type) def setup_module(_module): for task_type, relpath in SEARCH_TASKS.items(): pddl_file = os.path.join(BENCHMARKS_DIR, relpath) sas_file = get_sas_file_name(task_type) translate(pddl_file, sas_file) @pytest.mark.parametrize( "task_type, driver_options, translate_options, expected", TRANSLATE_TESTS) def test_translator_exit_codes(task_type, driver_options, translate_options, expected): relpath = TRANSLATE_TASKS[task_type] problem = os.path.join(BENCHMARKS_DIR, relpath) cmd = ([sys.executable, DRIVER] + driver_options + ["--translate"] + translate_options + [problem]) print("\nRun {cmd}:".format(**locals())) sys.stdout.flush() exitcode = subprocess.call(cmd) assert exitcode == expected[sys.platform] cleanup() @pytest.mark.parametrize( "task_type, driver_options, search_options, expected", SEARCH_TESTS) def test_search_exit_codes(task_type, driver_options, search_options, expected): sas_file = get_sas_file_name(task_type) cmd = ([sys.executable, DRIVER] + driver_options + [sas_file, "--search", search_options]) print("\nRun {cmd}:".format(**locals())) sys.stdout.flush() exitcode = subprocess.call(cmd) assert exitcode == expected[sys.platform] cleanup() def teardown_module(_module): for task_type in SEARCH_TASKS: os.remove(get_sas_file_name(task_type))
8,269
Python
42.989361
87
0.653767
makolon/hsr_isaac_tamp/hsr_tamp/downward/misc/tests/configs.py
def configs_optimal_core(): return { # A* "astar_blind": [ "--search", "astar(blind)"], "astar_h2": [ "--search", "astar(hm(2))"], "astar_ipdb": [ "--search", "astar(ipdb)"], "bjolp": [ "--evaluator", "lmc=lmcount(lm_merged([lm_rhw(),lm_hm(m=1)]),admissible=true)", "--search", "astar(lmc,lazy_evaluator=lmc)"], "astar_lmcut": [ "--search", "astar(lmcut)"], "astar_hmax": [ "--search", "astar(hmax)"], "astar_merge_and_shrink_rl_fh": [ "--search", "astar(merge_and_shrink(" "merge_strategy=merge_strategy=merge_precomputed(" "merge_tree=linear(variable_order=reverse_level))," "shrink_strategy=shrink_fh()," "label_reduction=exact(before_shrinking=false," "before_merging=true),max_states=50000,verbosity=silent))"], "astar_merge_and_shrink_dfp_bisim": [ "--search", "astar(merge_and_shrink(merge_strategy=merge_stateless(" "merge_selector=score_based_filtering(scoring_functions=[" "goal_relevance,dfp,total_order(" "atomic_ts_order=reverse_level,product_ts_order=new_to_old," "atomic_before_product=false)]))," "shrink_strategy=shrink_bisimulation(greedy=false)," "label_reduction=exact(before_shrinking=true," "before_merging=false),max_states=50000," "threshold_before_merge=1,verbosity=silent))"], "astar_merge_and_shrink_dfp_greedy_bisim": [ "--search", "astar(merge_and_shrink(merge_strategy=merge_stateless(" "merge_selector=score_based_filtering(scoring_functions=[" "goal_relevance,dfp,total_order(" "atomic_ts_order=reverse_level,product_ts_order=new_to_old," "atomic_before_product=false)]))," "shrink_strategy=shrink_bisimulation(" "greedy=true)," "label_reduction=exact(before_shrinking=true," "before_merging=false),max_states=infinity," "threshold_before_merge=1,verbosity=silent))"], "blind-sss-simple": [ "--search", "astar(blind(), pruning=stubborn_sets_simple())"], "blind-sss-ec": [ "--search", "astar(blind(), pruning=stubborn_sets_ec())"], "blind-atom-centric-sss": [ "--search", "astar(blind(), pruning=atom_centric_stubborn_sets())"], } def configs_satisficing_core(): return { # A* "astar_goalcount": [ "--search", "astar(goalcount)"], # eager greedy "eager_greedy_ff": [ "--evaluator", "h=ff()", "--search", "eager_greedy([h],preferred=[h])"], "eager_greedy_add": [ "--evaluator", "h=add()", "--search", "eager_greedy([h],preferred=[h])"], "eager_greedy_cg": [ "--evaluator", "h=cg()", "--search", "eager_greedy([h],preferred=[h])"], "eager_greedy_cea": [ "--evaluator", "h=cea()", "--search", "eager_greedy([h],preferred=[h])"], # lazy greedy "lazy_greedy_ff": [ "--evaluator", "h=ff()", "--search", "lazy_greedy([h],preferred=[h])"], "lazy_greedy_add": [ "--evaluator", "h=add()", "--search", "lazy_greedy([h],preferred=[h])"], "lazy_greedy_cg": [ "--evaluator", "h=cg()", "--search", "lazy_greedy([h],preferred=[h])"], # LAMA first "lama-first": [ "--evaluator", "hlm=lmcount(lm_factory=lm_reasonable_orders_hps(lm_rhw()),transform=adapt_costs(one),pref=false)", "--evaluator", "hff=ff(transform=adapt_costs(one))", "--search", """lazy_greedy([hff,hlm],preferred=[hff,hlm], cost_type=one,reopen_closed=false)"""], "lama-first-typed": [ "--evaluator", "hlm=lmcount(lm_factory=lm_reasonable_orders_hps(lm_rhw()),transform=adapt_costs(one),pref=false)", "--evaluator", "hff=ff(transform=adapt_costs(one))", "--search", "lazy(alt([single(hff), single(hff, pref_only=true)," "single(hlm), single(hlm, pref_only=true), type_based([hff, g()])], boost=1000)," "preferred=[hff,hlm], cost_type=one, reopen_closed=false, randomize_successors=true," "preferred_successors_first=false)"], } def configs_optimal_extended(): return { "astar_cegar": [ "--search", "astar(cegar())"], "pdb": [ "--search", "astar(pdb())"], } def configs_satisficing_extended(): return { # eager greedy "eager_greedy_alt_ff_cg": [ "--evaluator", "hff=ff()", "--evaluator", "hcg=cg()", "--search", "eager_greedy([hff,hcg],preferred=[hff,hcg])"], "eager_greedy_ff_no_pref": [ "--search", "eager_greedy([ff()])"], # lazy greedy "lazy_greedy_alt_cea_cg": [ "--evaluator", "hcea=cea()", "--evaluator", "hcg=cg()", "--search", "lazy_greedy([hcea,hcg],preferred=[hcea,hcg])"], "lazy_greedy_ff_no_pref": [ "--search", "lazy_greedy([ff()])"], "lazy_greedy_cea": [ "--evaluator", "h=cea()", "--search", "lazy_greedy([h],preferred=[h])"], # lazy wA* "lazy_wa3_ff": [ "--evaluator", "h=ff()", "--search", "lazy_wastar([h],w=3,preferred=[h])"], # eager wA* "eager_wa3_cg": [ "--evaluator", "h=cg()", "--search", "eager(single(sum([g(),weight(h,3)])),preferred=[h])"], # ehc "ehc_ff": [ "--search", "ehc(ff())"], # iterated "iterated_wa_ff": [ "--evaluator", "h=ff()", "--search", "iterated([lazy_wastar([h],w=10), lazy_wastar([h],w=5), lazy_wastar([h],w=3)," "lazy_wastar([h],w=2), lazy_wastar([h],w=1)])"], # pareto open list "pareto_ff": [ "--evaluator", "h=ff()", "--search", "eager(pareto([sum([g(), h]), h]), reopen_closed=true," "f_eval=sum([g(), h]))"], } def configs_optimal_lp(lp_solver="CPLEX"): return { "divpot": ["--search", f"astar(diverse_potentials(lpsolver={lp_solver}))"], "seq+lmcut": ["--search", f"astar(operatorcounting([state_equation_constraints(), lmcut_constraints()], lpsolver={lp_solver}))"], } def default_configs_optimal(core=True, extended=True): configs = {} if core: configs.update(configs_optimal_core()) if extended: configs.update(configs_optimal_extended()) return configs def default_configs_satisficing(core=True, extended=True): configs = {} if core: configs.update(configs_satisficing_core()) if extended: configs.update(configs_satisficing_extended()) return configs
7,629
Python
33.215246
137
0.476078
makolon/hsr_isaac_tamp/hsr_tamp/downward/src/translate/invariant_finder.py
#! /usr/bin/env python3 from __future__ import print_function from collections import deque, defaultdict import itertools import time import invariants import options import pddl import timers class BalanceChecker: def __init__(self, task, reachable_action_params): self.predicates_to_add_actions = defaultdict(set) self.action_to_heavy_action = {} for act in task.actions: action = self.add_inequality_preconds(act, reachable_action_params) too_heavy_effects = [] create_heavy_act = False heavy_act = action for eff in action.effects: too_heavy_effects.append(eff) if eff.parameters: # universal effect create_heavy_act = True too_heavy_effects.append(eff.copy()) if not eff.literal.negated: predicate = eff.literal.predicate self.predicates_to_add_actions[predicate].add(action) if create_heavy_act: heavy_act = pddl.Action(action.name, action.parameters, action.num_external_parameters, action.precondition, too_heavy_effects, action.cost) # heavy_act: duplicated universal effects and assigned unique names # to all quantified variables (implicitly in constructor) self.action_to_heavy_action[action] = heavy_act def get_threats(self, predicate): return self.predicates_to_add_actions.get(predicate, set()) def get_heavy_action(self, action): return self.action_to_heavy_action[action] def add_inequality_preconds(self, action, reachable_action_params): if reachable_action_params is None or len(action.parameters) < 2: return action inequal_params = [] combs = itertools.combinations(range(len(action.parameters)), 2) for pos1, pos2 in combs: for params in reachable_action_params[action]: if params[pos1] == params[pos2]: break else: inequal_params.append((pos1, pos2)) if inequal_params: precond_parts = [action.precondition] for pos1, pos2 in inequal_params: param1 = action.parameters[pos1].name param2 = action.parameters[pos2].name new_cond = pddl.NegatedAtom("=", (param1, param2)) precond_parts.append(new_cond) precond = pddl.Conjunction(precond_parts).simplified() return pddl.Action( action.name, action.parameters, action.num_external_parameters, precond, action.effects, action.cost) else: return action def get_fluents(task): fluent_names = set() for action in task.actions: for eff in action.effects: fluent_names.add(eff.literal.predicate) return [pred for pred in task.predicates if pred.name in fluent_names] def get_initial_invariants(task): for predicate in get_fluents(task): all_args = list(range(len(predicate.arguments))) for omitted_arg in [-1] + all_args: order = [i for i in all_args if i != omitted_arg] part = invariants.InvariantPart(predicate.name, order, omitted_arg) yield invariants.Invariant((part,)) def find_invariants(task, reachable_action_params): limit = options.invariant_generation_max_candidates candidates = deque(itertools.islice(get_initial_invariants(task), 0, limit)) print(len(candidates), "initial candidates") seen_candidates = set(candidates) balance_checker = BalanceChecker(task, reachable_action_params) def enqueue_func(invariant): if len(seen_candidates) < limit and invariant not in seen_candidates: candidates.append(invariant) seen_candidates.add(invariant) start_time = time.time() while candidates: candidate = candidates.popleft() if time.time() - start_time > options.invariant_generation_max_time: print("Time limit reached, aborting invariant generation") return if candidate.check_balance(balance_checker, enqueue_func): yield candidate def useful_groups(invariants, initial_facts): predicate_to_invariants = defaultdict(list) for invariant in invariants: for predicate in invariant.predicates: predicate_to_invariants[predicate].append(invariant) nonempty_groups = set() overcrowded_groups = set() for atom in initial_facts: if isinstance(atom, pddl.Assign): continue for invariant in predicate_to_invariants.get(atom.predicate, ()): group_key = (invariant, tuple(invariant.get_parameters(atom))) if group_key not in nonempty_groups: nonempty_groups.add(group_key) else: overcrowded_groups.add(group_key) useful_groups = nonempty_groups - overcrowded_groups for (invariant, parameters) in useful_groups: yield [part.instantiate(parameters) for part in sorted(invariant.parts)] def get_groups(task, reachable_action_params=None): with timers.timing("Finding invariants", block=True): invariants = sorted(find_invariants(task, reachable_action_params)) with timers.timing("Checking invariant weight"): result = list(useful_groups(invariants, task.init)) return result if __name__ == "__main__": import normalize import pddl_parser print("Parsing...") task = pddl_parser.open() print("Normalizing...") normalize.normalize(task) print("Finding invariants...") print("NOTE: not passing in reachable_action_params.") print("This means fewer invariants might be found.") for invariant in find_invariants(task, None): print(invariant) print("Finding fact groups...") groups = get_groups(task) for group in groups: print("[%s]" % ", ".join(map(str, group)))
6,122
Python
38.75974
80
0.626103
makolon/hsr_isaac_tamp/hsr_tamp/downward/src/translate/pddl_to_prolog.py
#! /usr/bin/env python3 from __future__ import print_function import itertools import normalize import pddl import timers REDUCE_CONDITIONS = True # caelan: speeds up instantiation class PrologProgram: def __init__(self): self.facts = [] self.rules = [] self.objects = set() def predicate_name_generator(): for count in itertools.count(): yield "p$%d" % count self.new_name = predicate_name_generator() def add_fact(self, atom): self.facts.append(Fact(atom)) self.objects |= set(atom.args) def add_rule(self, rule): self.rules.append(rule) def dump(self, file=None): for fact in self.facts: print(fact, file=file) for rule in self.rules: print(getattr(rule, "type", "none"), rule, file=file) def normalize(self): # Normalized prolog programs have the following properties: # 1. Each variable that occurs in the effect of a rule also occurs in its # condition. # 2. The variables that appear in each effect or condition are distinct. # 3. There are no rules with empty condition. self.remove_free_effect_variables() self.split_duplicate_arguments() self.convert_trivial_rules() def split_rules(self): import split_rules # Splits rules whose conditions can be partitioned in such a way that # the parts have disjoint variable sets, then split n-ary joins into # a number of binary joins, introducing new pseudo-predicates for the # intermediate values. new_rules = [] for rule in self.rules: new_rules += split_rules.split_rule(rule, self.new_name) self.rules = new_rules def remove_free_effect_variables(self): """Remove free effect variables like the variable Y in the rule p(X, Y) :- q(X). This is done by introducing a new predicate @object, setting it true for all objects, and translating the above rule to p(X, Y) :- q(X), @object(Y). After calling this, no new objects should be introduced!""" # Note: This should never be necessary for typed domains. # Leaving it in at the moment regardless. must_add_predicate = False for rule in self.rules: eff_vars = get_variables([rule.effect]) cond_vars = get_variables(rule.conditions) if not eff_vars.issubset(cond_vars): must_add_predicate = True eff_vars -= cond_vars for var in sorted(eff_vars): rule.add_condition(pddl.Atom("@object", [var])) if must_add_predicate: print("Unbound effect variables: Adding @object predicate.") self.facts += [Fact(pddl.Atom("@object", [obj])) for obj in self.objects] def split_duplicate_arguments(self): """Make sure that no variable occurs twice within the same symbolic fact, like the variable X does in p(X, Y, X). This is done by renaming the second and following occurrences of the variable and adding equality conditions. For example p(X, Y, X) is translated to p(X, Y, X@0) with the additional condition =(X, X@0); the equality predicate must be appropriately instantiated somewhere else.""" printed_message = False for rule in self.rules: if rule.rename_duplicate_variables() and not printed_message: print("Duplicate arguments: Adding equality conditions.") printed_message = True def convert_trivial_rules(self): """Convert rules with an empty condition into facts. This must be called after bounding rule effects, so that rules with an empty condition must necessarily have a variable-free effect. Variable-free effects are the only ones for which a distinction between ground and symbolic atoms is not necessary.""" must_delete_rules = [] for i, rule in enumerate(self.rules): if not rule.conditions: assert not get_variables([rule.effect]) self.add_fact(pddl.Atom(rule.effect.predicate, rule.effect.args)) must_delete_rules.append(i) if must_delete_rules: print("Trivial rules: Converted to facts.") for rule_no in must_delete_rules[::-1]: del self.rules[rule_no] def get_variables(symbolic_atoms): variables = set() for sym_atom in symbolic_atoms: variables |= {arg for arg in sym_atom.args if arg[0] == "?"} return variables class Fact: def __init__(self, atom): self.atom = atom def __str__(self): return "%s." % self.atom class Rule: def __init__(self, conditions, effect): self.conditions = conditions self.effect = effect def add_condition(self, condition): self.conditions.append(condition) def get_variables(self): return get_variables(self.conditions + [self.effect]) def _rename_duplicate_variables(self, atom, new_conditions): used_variables = set() for i, var_name in enumerate(atom.args): if var_name[0] == "?": if var_name in used_variables: new_var_name = "%s@%d" % (var_name, len(new_conditions)) atom = atom.replace_argument(i, new_var_name) new_conditions.append(pddl.Atom("=", [var_name, new_var_name])) else: used_variables.add(var_name) return atom def rename_duplicate_variables(self): extra_conditions = [] self.effect = self._rename_duplicate_variables( self.effect, extra_conditions) old_conditions = self.conditions self.conditions = [] for condition in old_conditions: self.conditions.append(self._rename_duplicate_variables( condition, extra_conditions)) self.conditions += extra_conditions return bool(extra_conditions) def __str__(self): cond_str = ", ".join(map(str, self.conditions)) return "%s :- %s." % (self.effect, cond_str) def translate_typed_object(prog, obj, type_dict): supertypes = type_dict[obj.type_name].supertype_names for type_name in [obj.type_name] + supertypes: prog.add_fact(pddl.TypedObject(obj.name, type_name).get_atom()) def translate_facts(prog, task): type_dict = {type.name: type for type in task.types} for obj in task.objects: translate_typed_object(prog, obj, type_dict) for fact in task.init: assert isinstance(fact, pddl.Atom) or isinstance(fact, pddl.Assign) if isinstance(fact, pddl.Atom): prog.add_fact(fact) def translate(task): # Note: The function requires that the task has been normalized. from invariant_finder import get_fluents with timers.timing("Generating Datalog program"): prog = PrologProgram() translate_facts(prog, task) fluents = get_fluents(task) # TODO: identify implied conditions and filter automatically for conditions, effect in normalize.build_exploration_rules(task): if REDUCE_CONDITIONS: # TODO: could possibly remove rules with effects that don't achieve conditions #conditions = [condition for condition in conditions if condition.predicate not in fluents] conditions = sorted(conditions, key=lambda c: (len(c.args), c.predicate not in fluents), reverse=True) covered_args = set() reduced_conditions = [] for condition in conditions: # isinstance(condition.predicate, pddl.Action) or isinstance(condition.predicate, pddl.Axiom) if not reduced_conditions or not (set(condition.args) <= covered_args): covered_args.update(condition.args) reduced_conditions.append(condition) conditions = reduced_conditions prog.add_rule(Rule(conditions, effect)) with timers.timing("Normalizing Datalog program", block=True): # Using block=True because normalization can output some messages # in rare cases. prog.normalize() prog.split_rules() return prog if __name__ == "__main__": import pddl_parser task = pddl_parser.open() normalize.normalize(task) prog = translate(task) prog.dump()
8,530
Python
42.304568
118
0.619109
makolon/hsr_isaac_tamp/hsr_tamp/downward/src/translate/split_rules.py
# split_rules: Split rules whose conditions fall into different "connected # components" (where to conditions are related if they share a variabe) into # several rules, one for each connected component and one high-level rule. from pddl_to_prolog import Rule, get_variables import graph import greedy_join import pddl def get_connected_conditions(conditions): agraph = graph.Graph(conditions) var_to_conditions = {var: [] for var in get_variables(conditions)} for cond in conditions: for var in cond.args: if var[0] == "?": var_to_conditions[var].append(cond) # Connect conditions with a common variable for var, conds in var_to_conditions.items(): for cond in conds[1:]: agraph.connect(conds[0], cond) return sorted(map(sorted, agraph.connected_components())) def project_rule(rule, conditions, name_generator): predicate = next(name_generator) effect_variables = set(rule.effect.args) & get_variables(conditions) effect = pddl.Atom(predicate, sorted(effect_variables)) projected_rule = Rule(conditions, effect) return projected_rule def split_rule(rule, name_generator): important_conditions, trivial_conditions = [], [] for cond in rule.conditions: for arg in cond.args: if arg[0] == "?": important_conditions.append(cond) break else: trivial_conditions.append(cond) # important_conditions = [cond for cond in rule.conditions if cond.args] # trivial_conditions = [cond for cond in rule.conditions if not cond.args] components = get_connected_conditions(important_conditions) if len(components) == 1 and not trivial_conditions: return split_into_binary_rules(rule, name_generator) projected_rules = [project_rule(rule, conditions, name_generator) for conditions in components] result = [] for proj_rule in projected_rules: result += split_into_binary_rules(proj_rule, name_generator) conditions = ([proj_rule.effect for proj_rule in projected_rules] + trivial_conditions) combining_rule = Rule(conditions, rule.effect) if len(conditions) >= 2: combining_rule.type = "product" else: combining_rule.type = "project" result.append(combining_rule) return result def split_into_binary_rules(rule, name_generator): if len(rule.conditions) <= 1: rule.type = "project" return [rule] return greedy_join.greedy_join(rule, name_generator)
2,569
Python
36.246376
78
0.669132
makolon/hsr_isaac_tamp/hsr_tamp/downward/src/translate/build_model.py
#! /usr/bin/env python3 from __future__ import print_function import sys import itertools import pddl import timers from functools import reduce def convert_rules(prog): RULE_TYPES = { "join": JoinRule, "product": ProductRule, "project": ProjectRule, } result = [] for rule in prog.rules: RuleType = RULE_TYPES[rule.type] new_effect, new_conditions = variables_to_numbers( rule.effect, rule.conditions) rule = RuleType(new_effect, new_conditions) rule.validate() result.append(rule) return result def variables_to_numbers(effect, conditions): new_effect_args = list(effect.args) rename_map = {} for i, arg in enumerate(effect.args): if arg[0] == "?": rename_map[arg] = i new_effect_args[i] = i new_effect = pddl.Atom(effect.predicate, new_effect_args) # There are three possibilities for arguments in conditions: # 1. They are variables that occur in the effect. In that case, # they are replaced by the corresponding position in the # effect, as indicated by the rename_map. # 2. They are constants. In that case, the unifier must guarantee # that they are matched appropriately. In that case, they are # not modified (remain strings denoting objects). # 3. They are variables that don't occur in the effect (are # projected away). This is only allowed in projection rules. # Such arguments are also not modified (remain "?x" strings). new_conditions = [] for cond in conditions: new_cond_args = [rename_map.get(arg, arg) for arg in cond.args] new_conditions.append(pddl.Atom(cond.predicate, new_cond_args)) return new_effect, new_conditions class BuildRule: def prepare_effect(self, new_atom, cond_index): effect_args = list(self.effect.args) cond = self.conditions[cond_index] for var_no, obj in zip(cond.args, new_atom.args): if isinstance(var_no, int): effect_args[var_no] = obj return effect_args def __str__(self): return "%s :- %s" % (self.effect, ", ".join(map(str, self.conditions))) def __repr__(self): return "<%s %s>" % (self.__class__.__name__, self) class JoinRule(BuildRule): def __init__(self, effect, conditions): self.effect = effect self.conditions = conditions left_args = conditions[0].args right_args = conditions[1].args left_vars = {var for var in left_args if isinstance(var, int)} right_vars = {var for var in right_args if isinstance(var, int)} common_vars = sorted(left_vars & right_vars) self.common_var_positions = [ [args.index(var) for var in common_vars] for args in (list(left_args), list(right_args))] self.atoms_by_key = ({}, {}) def validate(self): assert len(self.conditions) == 2, self left_args = self.conditions[0].args right_args = self.conditions[1].args eff_args = self.effect.args left_vars = {v for v in left_args if isinstance(v, int) or v[0] == "?"} right_vars = {v for v in right_args if isinstance(v, int) or v[0] == "?"} eff_vars = {v for v in eff_args if isinstance(v, int) or v[0] == "?"} assert left_vars & right_vars, self assert (left_vars | right_vars) == (left_vars & right_vars) | eff_vars, self def update_index(self, new_atom, cond_index): ordered_common_args = [ new_atom.args[position] for position in self.common_var_positions[cond_index]] key = tuple(ordered_common_args) self.atoms_by_key[cond_index].setdefault(key, []).append(new_atom) def fire(self, new_atom, cond_index, enqueue_func): effect_args = self.prepare_effect(new_atom, cond_index) ordered_common_args = [ new_atom.args[position] for position in self.common_var_positions[cond_index]] key = tuple(ordered_common_args) other_cond_index = 1 - cond_index other_cond = self.conditions[other_cond_index] for atom in self.atoms_by_key[other_cond_index].get(key, []): for var_no, obj in zip(other_cond.args, atom.args): if isinstance(var_no, int): effect_args[var_no] = obj enqueue_func(self.effect.predicate, effect_args) class ProductRule(BuildRule): def __init__(self, effect, conditions): self.effect = effect self.conditions = conditions self.atoms_by_index = [[] for c in self.conditions] self.empty_atom_list_no = len(self.conditions) def validate(self): assert len(self.conditions) >= 2, self cond_vars = [{v for v in cond.args if isinstance(v, int) or v[0] == "?"} for cond in self.conditions] all_cond_vars = reduce(set.union, cond_vars) eff_vars = {v for v in self.effect.args if isinstance(v, int) or v[0] == "?"} assert len(all_cond_vars) == len(eff_vars), self assert len(all_cond_vars) == sum([len(c) for c in cond_vars]) def update_index(self, new_atom, cond_index): atom_list = self.atoms_by_index[cond_index] if not atom_list: self.empty_atom_list_no -= 1 atom_list.append(new_atom) def _get_bindings(self, atom, cond): return [(var_no, obj) for var_no, obj in zip(cond.args, atom.args) if isinstance(var_no, int)] def fire(self, new_atom, cond_index, enqueue_func): if self.empty_atom_list_no: return # Binding: a (var_no, object) pair # Bindings: List-of(Binding) # BindingsFactor: List-of(Bindings) # BindingsFactors: List-of(BindingsFactor) bindings_factors = [] for pos, cond in enumerate(self.conditions): if pos == cond_index: continue atoms = self.atoms_by_index[pos] assert atoms, "if we have no atoms, this should never be called" factor = [self._get_bindings(atom, cond) for atom in atoms] bindings_factors.append(factor) eff_args = self.prepare_effect(new_atom, cond_index) for bindings_list in itertools.product(*bindings_factors): bindings = itertools.chain(*bindings_list) for var_no, obj in bindings: eff_args[var_no] = obj enqueue_func(self.effect.predicate, eff_args) class ProjectRule(BuildRule): def __init__(self, effect, conditions): self.effect = effect self.conditions = conditions def validate(self): assert len(self.conditions) == 1 def update_index(self, new_atom, cond_index): pass def fire(self, new_atom, cond_index, enqueue_func): effect_args = self.prepare_effect(new_atom, cond_index) enqueue_func(self.effect.predicate, effect_args) class Unifier: def __init__(self, rules): self.predicate_to_rule_generator = {} for rule in rules: for i, cond in enumerate(rule.conditions): self._insert_condition(rule, i) def unify(self, atom): result = [] generator = self.predicate_to_rule_generator.get(atom.predicate) if generator: generator.generate(atom, result) return result def _insert_condition(self, rule, cond_index): condition = rule.conditions[cond_index] root = self.predicate_to_rule_generator.get(condition.predicate) if not root: root = LeafGenerator() constant_arguments = [ (arg_index, arg) for (arg_index, arg) in enumerate(condition.args) if not isinstance(arg, int) and arg[0] != "?"] newroot = root._insert(constant_arguments, (rule, cond_index)) self.predicate_to_rule_generator[condition.predicate] = newroot def dump(self): predicates = sorted(self.predicate_to_rule_generator) print("Unifier:") for pred in predicates: print(" %s:" % pred) rule_gen = self.predicate_to_rule_generator[pred] rule_gen.dump(" " * 2) class LeafGenerator: index = sys.maxsize def __init__(self): self.matches = [] def empty(self): return not self.matches def generate(self, atom, result): result += self.matches def _insert(self, args, value): if not args: self.matches.append(value) return self else: root = LeafGenerator() root.matches.append(value) for arg_index, arg in args[::-1]: new_root = MatchGenerator(arg_index, LeafGenerator()) new_root.match_generator[arg] = root root = new_root root.matches = self.matches # can be swapped in C++ return root def dump(self, indent): for match in self.matches: print("%s%s" % (indent, match)) class MatchGenerator: def __init__(self, index, next): self.index = index self.matches = [] self.match_generator = {} self.next = next def empty(self): return False def generate(self, atom, result): result += self.matches generator = self.match_generator.get(atom.args[self.index]) if generator: generator.generate(atom, result) self.next.generate(atom, result) def _insert(self, args, value): if not args: self.matches.append(value) return self else: arg_index, arg = args[0] if self.index < arg_index: self.next = self.next._insert(args, value) return self elif self.index > arg_index: new_parent = MatchGenerator(arg_index, self) new_branch = LeafGenerator()._insert(args[1:], value) new_parent.match_generator[arg] = new_branch return new_parent else: branch_generator = self.match_generator.get(arg) if not branch_generator: branch_generator = LeafGenerator() self.match_generator[arg] = branch_generator._insert( args[1:], value) return self def dump(self, indent): for match in self.matches: print("%s%s" % (indent, match)) for key in sorted(self.match_generator.keys()): print("%sargs[%s] == %s:" % (indent, self.index, key)) self.match_generator[key].dump(indent + " ") if not self.next.empty(): assert isinstance(self.next, MatchGenerator) print("%s[*]" % indent) self.next.dump(indent + " ") class Queue: def __init__(self, atoms): self.queue = atoms self.queue_pos = 0 self.enqueued = {(atom.predicate,) + tuple(atom.args) for atom in self.queue} self.num_pushes = len(atoms) def __bool__(self): return self.queue_pos < len(self.queue) __nonzero__ = __bool__ def push(self, predicate, args): self.num_pushes += 1 eff_tuple = (predicate,) + tuple(args) if eff_tuple not in self.enqueued: self.enqueued.add(eff_tuple) self.queue.append(pddl.Atom(predicate, list(args))) def pop(self): result = self.queue[self.queue_pos] self.queue_pos += 1 return result def compute_model(prog): with timers.timing("Preparing model"): rules = convert_rules(prog) unifier = Unifier(rules) # unifier.dump() fact_atoms = sorted(fact.atom for fact in prog.facts) queue = Queue(fact_atoms) print("Generated %d rules." % len(rules)) with timers.timing("Computing model"): relevant_atoms = 0 auxiliary_atoms = 0 while queue: next_atom = queue.pop() pred = next_atom.predicate if isinstance(pred, str) and "$" in pred: auxiliary_atoms += 1 else: relevant_atoms += 1 matches = unifier.unify(next_atom) for rule, cond_index in matches: rule.update_index(next_atom, cond_index) rule.fire(next_atom, cond_index, queue.push) print("%d relevant atoms" % relevant_atoms) print("%d auxiliary atoms" % auxiliary_atoms) print("%d final queue length" % len(queue.queue)) print("%d total queue pushes" % queue.num_pushes) return queue.queue if __name__ == "__main__": import pddl_parser import normalize import pddl_to_prolog print("Parsing...") task = pddl_parser.open() print("Normalizing...") normalize.normalize(task) print("Writing rules...") prog = pddl_to_prolog.translate(task) model = compute_model(prog) for atom in model: print(atom) print("%d atoms" % len(model))
13,152
Python
37.124638
84
0.579836
makolon/hsr_isaac_tamp/hsr_tamp/downward/src/translate/sccs.py
"""Tarjan's algorithm for maximal strongly connected components. We provide two versions of the algorithm for different graph representations. Since the original recursive version exceeds python's maximal recursion depth on some planning instances, this is an iterative version with an explicit recursion stack (iter_stack). Note that the derived graph where each SCC is a single "supernode" is necessarily acyclic. The SCCs returned by the algorithm are in a topological sort order with respect to this derived DAG. """ from collections import defaultdict __all__ = ["get_sccs_adjacency_list", "get_sccs_adjacency_dict"] def get_sccs_adjacency_list(adjacency_list): """Compute SCCs for a graph represented as an adjacency list. `adjacency_list` is a list (or similar data structure) whose indices correspond to the graph nodes. For example, if `len(adjacency_list)` is N, the graph nodes are {0, ..., N-1}. For every node `u`, `adjacency_list[u]` is the list (or similar data structure) of successors of `u`. Returns a list of lists that defines a partition of {0, ..., N-1}, where each block in the partition is an SCC of the graph, and the partition is given in a topologically sort order.""" return StronglyConnectedComponentComputation(adjacency_list).get_result() def get_sccs_adjacency_dict(adjacency_dict): """Compute SCCs for a graph represented as an adjacency dict. `adjacency_dict` is a dictionary whose keys are the vertices of the graph. For every node `u`, adjacency_dict[u]` is the list (or similar data structure) of successors of `u`. Returns a list of lists that defines a partition of the graph nodes, where each block in the partition is an SCC of the graph, and the partition is given in a topologically sort order.""" node_to_index = {} index_to_node = [] for index, node in enumerate(adjacency_dict): node_to_index[node] = index index_to_node.append(node) adjacency_list = [] for index, node in enumerate(index_to_node): successors = adjacency_dict[node] successor_indices = [node_to_index[v] for v in successors] adjacency_list.append(successor_indices) result_indices = get_sccs_adjacency_list(adjacency_list) result = [] for block_indices in result_indices: block = [index_to_node[index] for index in block_indices] result.append(block) return result class StronglyConnectedComponentComputation: def __init__(self, unweighted_graph): self.graph = unweighted_graph self.BEGIN, self.CONTINUE, self.RETURN = 0, 1, 2 # "recursion" handling def get_result(self): self.indices = dict() self.lowlinks = defaultdict(lambda: -1) self.stack_indices = dict() self.current_index = 0 self.stack = [] self.sccs = [] for i in range(len(self.graph)): if i not in self.indices: self.visit(i) self.sccs.reverse() return self.sccs def visit(self, vertex): iter_stack = [(vertex, None, None, self.BEGIN)] while iter_stack: v, w, succ_index, state = iter_stack.pop() if state == self.BEGIN: self.current_index += 1 self.indices[v] = self.current_index self.lowlinks[v] = self.current_index self.stack_indices[v] = len(self.stack) self.stack.append(v) iter_stack.append((v, None, 0, self.CONTINUE)) elif state == self.CONTINUE: successors = self.graph[v] if succ_index == len(successors): if self.lowlinks[v] == self.indices[v]: stack_index = self.stack_indices[v] scc = self.stack[stack_index:] del self.stack[stack_index:] for n in scc: del self.stack_indices[n] self.sccs.append(scc) else: w = successors[succ_index] if w not in self.indices: iter_stack.append((v, w, succ_index, self.RETURN)) iter_stack.append((w, None, None, self.BEGIN)) else: if w in self.stack_indices: self.lowlinks[v] = min(self.lowlinks[v], self.indices[w]) iter_stack.append( (v, None, succ_index + 1, self.CONTINUE)) elif state == self.RETURN: self.lowlinks[v] = min(self.lowlinks[v], self.lowlinks[w]) iter_stack.append((v, None, succ_index + 1, self.CONTINUE))
4,835
Python
38
79
0.597311
makolon/hsr_isaac_tamp/hsr_tamp/downward/src/translate/tools.py
def cartesian_product(sequences): # TODO: Rename this. It's not good that we have two functions # called "product" and "cartesian_product", of which "product" # computes cartesian products, while "cartesian_product" does not. # This isn't actually a proper cartesian product because we # concatenate lists, rather than forming sequences of atomic elements. # We could probably also use something like # map(itertools.chain, product(*sequences)) # but that does not produce the same results if not sequences: yield [] else: temp = list(cartesian_product(sequences[1:])) for item in sequences[0]: for sequence in temp: yield item + sequence def get_peak_memory_in_kb(): try: # This will only work on Linux systems. with open("/proc/self/status") as status_file: for line in status_file: parts = line.split() if parts[0] == "VmPeak:": return int(parts[1]) except (OSError, IOError): pass raise Warning("warning: could not determine peak memory")
1,138
Python
35.741934
74
0.62478
makolon/hsr_isaac_tamp/hsr_tamp/downward/src/translate/axiom_rules.py
import options import pddl import sccs import timers from collections import defaultdict from itertools import chain NEGATIVE_SUFFIX = '-negative' DEBUG = False class AxiomDependencies(object): def __init__(self, axioms): if DEBUG: assert all(isinstance(axiom.effect, pddl.Atom) for axiom in axioms) self.derived_variables = {axiom.effect for axiom in axioms} self.positive_dependencies = defaultdict(set) self.negative_dependencies = defaultdict(set) for axiom in axioms: head = axiom.effect for body_literal in axiom.condition: body_atom = body_literal.positive() if body_atom in self.derived_variables: if body_literal.negated: self.negative_dependencies[head].add(body_atom) else: self.positive_dependencies[head].add(body_atom) # Remove all information for variables whose literals are not necessary. # We do not need to remove single entries from the dicts because if the key # (= head of an axiom) is relevant, then all its values (= body of axiom) # must be relevant by definition. def remove_unnecessary_variables(self, necessary_literals): for var in self.derived_variables.copy(): if var not in necessary_literals and var.negate() not in necessary_literals: self.derived_variables.remove(var) self.positive_dependencies.pop(var, None) self.negative_dependencies.pop(var, None) class AxiomCluster(object): def __init__(self, derived_variables): self.variables = derived_variables self.axioms = dict((v, []) for v in derived_variables) # Positive children will be populated with clusters that contain an # atom that occurs in the body of an axiom whose head is from this # cluster. Negative children analogous for atoms that occur negated # in the body. self.positive_children = set() self.negative_children = set() self.needed_negatively = False self.layer = 0 def handle_axioms(operators, axioms, goals, layer_strategy): clusters = compute_clusters(axioms, goals, operators) axiom_layers = compute_axiom_layers(clusters, layer_strategy) #if options.negative_axioms: # # Caelan: pretends all literals are positive # #axiom_literals = {l.positive() for l in axiom_literals} # axiom_literals = {l.positive() if l.predicate.endswith(NEGATIVE_SUFFIX) else l for l in axiom_literals} # TODO: It would be cleaner if these negated rules were an implementation # detail of the heuristics in the search component that make use of them # rather than part of the translation process. They should be removed in # the future. Similarly, it would be a good idea to remove the notion of # axiom layers and derived variable default values from the output. # (All derived variables should be binary and default to false.) with timers.timing("Computing negative axioms"): compute_negative_axioms(clusters) axioms = get_axioms(clusters) if DEBUG: verify_layering_condition(axioms, axiom_layers) return axioms, axiom_layers def compute_necessary_literals(dependencies, goals, operators): necessary_literals = set() for g in goals: if g.positive() in dependencies.derived_variables: necessary_literals.add(g) for op in operators: derived_preconditions = (l for l in op.precondition if l.positive() in dependencies.derived_variables) necessary_literals.update(derived_preconditions) for condition, effect in chain(op.add_effects, op.del_effects): for c in condition: if c.positive() in dependencies.derived_variables: necessary_literals.add(c) necessary_literals.add(c.negate()) literals_to_process = list(necessary_literals) while literals_to_process: l = literals_to_process.pop() atom = l.positive() for body_atom in dependencies.positive_dependencies[atom]: l2 = body_atom.negate() if l.negated else body_atom if l2 not in necessary_literals: literals_to_process.append(l2) necessary_literals.add(l2) for body_atom in dependencies.negative_dependencies[atom]: l2 = body_atom if l.negated else body_atom.negate() if l2 not in necessary_literals: literals_to_process.append(l2) necessary_literals.add(l2) return necessary_literals # Compute strongly connected components of the dependency graph. # In order to receive a deterministic result, we first sort the variables. # We then build adjacency lists over the variable indices based on dependencies. def get_strongly_connected_components(dependencies): sorted_vars = sorted(dependencies.derived_variables) variable_to_index = {var: index for index, var in enumerate(sorted_vars)} adjacency_list = [] for derived_var in sorted_vars: pos = dependencies.positive_dependencies[derived_var] neg = dependencies.negative_dependencies[derived_var] indices = [variable_to_index[atom] for atom in sorted(pos.union(neg))] adjacency_list.append(indices) index_groups = sccs.get_sccs_adjacency_list(adjacency_list) groups = [[sorted_vars[i] for i in g] for g in index_groups] return groups # Expects a list of axioms *with the same head* and returns a subset consisting # of all non-dominated axioms whose conditions have been cleaned up # (duplicate elimination). def compute_simplified_axioms(axioms): """Remove duplicate axioms, duplicates within axioms, and dominated axioms.""" if DEBUG: assert len(set(axiom.effect for axiom in axioms)) == 1 # Remove duplicates from axiom conditions. for axiom in axioms: axiom.condition = sorted(set(axiom.condition)) # Remove dominated axioms. axioms_to_skip = set() axioms_by_literal = defaultdict(set) for axiom in axioms: if axiom.effect in axiom.condition: axioms_to_skip.add(id(axiom)) else: for literal in axiom.condition: axioms_by_literal[literal].add(id(axiom)) for axiom in axioms: if id(axiom) in axioms_to_skip: continue # Required to keep one of multiple identical axioms. if not axiom.condition: # empty condition: dominates everything return [axiom] literals = iter(axiom.condition) dominated_axioms = axioms_by_literal[next(literals)].copy() for literal in literals: dominated_axioms &= axioms_by_literal[literal] for dominated_axiom in dominated_axioms: if dominated_axiom != id(axiom): axioms_to_skip.add(dominated_axiom) return [axiom for axiom in axioms if id(axiom) not in axioms_to_skip] def compute_clusters(axioms, goals, operators): dependencies = AxiomDependencies(axioms) # Compute necessary literals and prune unnecessary vars from dependencies. necessary_literals = compute_necessary_literals(dependencies, goals, operators) dependencies.remove_unnecessary_variables(necessary_literals) groups = get_strongly_connected_components(dependencies) clusters = [AxiomCluster(group) for group in groups] # Compute mapping from variables to their clusters and set needed_negatively. variable_to_cluster = {} for cluster in clusters: for variable in cluster.variables: variable_to_cluster[variable] = cluster if variable.negate() in necessary_literals: cluster.needed_negatively = True # Assign axioms to their clusters. for axiom in axioms: # axiom.effect is derived but might have been pruned if axiom.effect in dependencies.derived_variables: variable_to_cluster[axiom.effect].axioms[axiom.effect].append(axiom) removed = 0 with timers.timing("Simplifying axioms"): for cluster in clusters: for variable in cluster.variables: old_size = len(cluster.axioms[variable]) cluster.axioms[variable] = compute_simplified_axioms(cluster.axioms[variable]) removed += old_size - len(cluster.axioms[variable]) print("Translator axioms removed by simplifying: %d" % removed) # Create links between clusters (positive dependencies). for from_variable, depends_on in dependencies.positive_dependencies.items(): from_cluster = variable_to_cluster[from_variable] for to_variable in depends_on: to_cluster = variable_to_cluster[to_variable] if from_cluster is not to_cluster: from_cluster.positive_children.add(to_cluster) # Create links between clusters (negative dependencies). for from_variable, depends_on in dependencies.negative_dependencies.items(): from_cluster = variable_to_cluster[from_variable] for to_variable in depends_on: to_cluster = variable_to_cluster[to_variable] if from_cluster is to_cluster: raise ValueError("axioms are not stratifiable") from_cluster.negative_children.add(to_cluster) return clusters # Assign every cluster the smallest possible layer. def compute_single_cluster_layer(cluster): layer = 0 for pos_child in cluster.positive_children: layer = max(pos_child.layer, layer) for neg_child in cluster.negative_children: layer = max(neg_child.layer + 1, layer) return layer # Clusters must be ordered topologically based on AxiomDependencies. # Since we need to visit clusters containing variables that occur in the body # of an atom before we visit the cluster containing the head, we need to # traverse the clusters in reverse order. def compute_axiom_layers(clusters, strategy): if strategy == "max": layer = 0 for cluster in reversed(clusters): cluster.layer = layer layer += 1 elif strategy == "min": for cluster in reversed(clusters): cluster.layer = compute_single_cluster_layer(cluster) layers = dict() for cluster in clusters: for variable in cluster.variables: layers[variable] = cluster.layer return layers def compute_negative_axioms(clusters): for cluster in clusters: if cluster.needed_negatively: if len(cluster.variables) > 1: # If the cluster contains multiple variables, they have a cyclic # positive dependency. In this case, the "obvious" way of # negating the formula defining the derived variable is # semantically wrong. For details, see issue453. # # Therefore, in this case we perform a naive overapproximation # instead, which assumes that derived variables occurring in # such clusters can be false unconditionally. This is good # enough for correctness of the code that uses these negated # axioms (within heuristics of the search component), but loses # accuracy. Negating the rules in an exact # (non-overapproximating) way is possible but more expensive. # Again, see issue453 for details. for variable in cluster.variables: axioms = cluster.axioms[variable] negated_axiom = pddl.PropositionalAxiom(axioms[0].name, [], variable.negate(), axioms[0].axiom, axioms[0].var_mapping) cluster.axioms[variable].append(negated_axiom) else: variable = next(iter(cluster.variables)) negated_axioms = negate(cluster.axioms[variable]) cluster.axioms[variable] += negated_axioms def negate(axioms): assert axioms result = [pddl.PropositionalAxiom(axioms[0].name, [], axioms[0].effect.negate(), axioms[0].axiom, axioms[0].var_mapping)] for axiom in axioms: condition = axiom.condition if len(condition) == 0: # The derived fact we want to negate is triggered with an # empty condition, so it is always true and its negation # is always false. return [] elif len(condition) == 1: # Handle easy special case quickly. new_literal = condition[0].negate() for result_axiom in result: result_axiom.condition.append(new_literal) else: new_result = [] for literal in condition: literal = literal.negate() for result_axiom in result: new_axiom = result_axiom.clone() new_axiom.condition.append(literal) new_result.append(new_axiom) result = new_result result = compute_simplified_axioms(result) return result def get_axioms(clusters): axioms = [] for cluster in clusters: for v in cluster.variables: axioms += cluster.axioms[v] return axioms def verify_layering_condition(axioms, axiom_layers): # This function is only used for debugging. variables_in_heads = set() literals_in_heads = set() variables_with_layers = set() for axiom in axioms: head = axiom.effect variables_in_heads.add(head.positive()) literals_in_heads.add(head) variables_with_layers = set(axiom_layers.keys()) # 1. A variable has a defined layer iff it appears in a head. # (This is stricter than it needs to be; we could allow # derived variables that are never generated by a rule. # But this test follows the axiom simplification step, and # after simplification this should not be too strict.) # All layers are integers and at least 0. # (Note: the "-1" layer for non-derived variables is # set elsewhere.) print("Verifying 1...") assert variables_in_heads == variables_with_layers for atom, layer in axiom_layers.items(): assert isinstance(layer, int) assert layer >= 0 # 2. For every rule head <- ... cond ... where cond is a literal # of a derived variable where the layer of head is equal to # the layer of cond, cond occurs with the same polarity in heads. # # Note regarding issue454 and issue453: Because of the negated axioms # mentioned in these issues, a derived variable may appear with *both* # polarities in heads. This makes this test less strong than it would # be otherwise. When these issues are addressed and axioms only occur # with one polarity in heads, this test will remain correct in its # current form, but it will be able to detect more violations of the # layering property. print("Verifying 2...") for axiom in axioms: head = axiom.effect head_positive = head.positive() body = axiom.condition for cond in body: cond_positive = cond.positive() if (cond_positive in variables_in_heads and axiom_layers[cond_positive] == axiom_layers[head_positive]): assert cond in literals_in_heads # 3. For every rule head <- ... cond ... where cond is a literal # of a derived variable, the layer of head is greater or equal # to the layer of cond. print("Verifying 3...") for axiom in axioms: head = axiom.effect head_positive = head.positive() body = axiom.condition for cond in body: cond_positive = cond.positive() if cond_positive in variables_in_heads: # We need the assertion to be on a single line for # our error handler to be able to print the line. assert (axiom_layers[cond_positive] <= axiom_layers[head_positive]), (axiom_layers[cond_positive], axiom_layers[head_positive])
16,218
Python
41.569554
143
0.648107
makolon/hsr_isaac_tamp/hsr_tamp/downward/src/translate/sas_tasks.py
from __future__ import print_function SAS_FILE_VERSION = 3 DEBUG = False class SASTask: """Planning task in finite-domain representation. The user is responsible for making sure that the data fits a number of structural restrictions. For example, conditions should generally be sorted and mention each variable at most once. See the validate methods for details.""" def __init__(self, variables, mutexes, init, goal, operators, axioms, metric): self.variables = variables self.mutexes = mutexes self.init = init self.goal = goal self.operators = sorted(operators, key=lambda op: ( op.name, op.prevail, op.pre_post)) self.axioms = sorted(axioms, key=lambda axiom: ( axiom.condition, axiom.effect)) self.metric = metric if DEBUG: self.validate() def validate(self): """Fail an assertion if the task is invalid. A task is valid if all its components are valid. Valid tasks are almost in a kind of "canonical form", but not quite. For example, operators and axioms are permitted to be listed in any order, even though it would be possible to require some kind of canonical sorting. Note that we require that all derived variables are binary. This is stricter than what later parts of the planner are supposed to handle, but some parts of the translator rely on this. We might want to consider making this a general requirement throughout the planner. Note also that there is *no* general rule on what the init (= fallback) value of a derived variable is. For example, in PSR-Large #1, it can be either 0 or 1. While it is "usually" 1, code should not rely on this. """ self.variables.validate() for mutex in self.mutexes: mutex.validate(self.variables) self.init.validate(self.variables) self.goal.validate(self.variables) for op in self.operators: op.validate(self.variables) for axiom in self.axioms: axiom.validate(self.variables, self.init) assert self.metric is False or self.metric is True, self.metric def dump(self): print("variables:") self.variables.dump() print("%d mutex groups:" % len(self.mutexes)) for mutex in self.mutexes: print("group:") mutex.dump() print("init:") self.init.dump() print("goal:") self.goal.dump() print("%d operators:" % len(self.operators)) for operator in self.operators: operator.dump() print("%d axioms:" % len(self.axioms)) for axiom in self.axioms: axiom.dump() print("metric: %s" % self.metric) def output(self, stream): print("begin_version", file=stream) print(SAS_FILE_VERSION, file=stream) print("end_version", file=stream) print("begin_metric", file=stream) print(int(self.metric), file=stream) print("end_metric", file=stream) self.variables.output(stream) print(len(self.mutexes), file=stream) for mutex in self.mutexes: mutex.output(stream) self.init.output(stream) self.goal.output(stream) print(len(self.operators), file=stream) for op in self.operators: op.output(stream) print(len(self.axioms), file=stream) for axiom in self.axioms: axiom.output(stream) def get_encoding_size(self): task_size = 0 task_size += self.variables.get_encoding_size() for mutex in self.mutexes: task_size += mutex.get_encoding_size() task_size += self.goal.get_encoding_size() for op in self.operators: task_size += op.get_encoding_size() for axiom in self.axioms: task_size += axiom.get_encoding_size() return task_size class SASVariables: def __init__(self, ranges, axiom_layers, value_names): self.ranges = ranges self.axiom_layers = axiom_layers self.value_names = value_names def validate(self): """Validate variables. All variables must have range at least 2, and derived variables must have range exactly 2. See comment on derived variables in the docstring of SASTask.validate. """ assert len(self.ranges) == len(self.axiom_layers) == len( self.value_names) for (var_range, layer, var_value_names) in zip( self.ranges, self.axiom_layers, self.value_names): assert var_range == len(var_value_names) assert var_range >= 2 assert layer == -1 or layer >= 0 if layer != -1: assert var_range == 2 def validate_fact(self, fact): """Assert that fact is a valid (var, value) pair.""" var, value = fact assert 0 <= var < len(self.ranges) assert 0 <= value < self.ranges[var] def validate_condition(self, condition): """Assert that the condition (list of facts) is sorted, mentions each variable at most once, and only consists of valid facts.""" last_var = -1 for (var, value) in condition: self.validate_fact((var, value)) assert var > last_var last_var = var def dump(self): for var, (rang, axiom_layer) in enumerate( zip(self.ranges, self.axiom_layers)): if axiom_layer != -1: axiom_str = " [axiom layer %d]" % axiom_layer else: axiom_str = "" print("v%d in {%s}%s" % (var, list(range(rang)), axiom_str)) def output(self, stream): print(len(self.ranges), file=stream) for var, (rang, axiom_layer, values) in enumerate(zip( self.ranges, self.axiom_layers, self.value_names)): print("begin_variable", file=stream) print("var%d" % var, file=stream) print(axiom_layer, file=stream) print(rang, file=stream) assert rang == len(values), (rang, values) for value in values: print(value, file=stream) print("end_variable", file=stream) def get_encoding_size(self): # A variable with range k has encoding size k + 1 to also give the # variable itself some weight. return len(self.ranges) + sum(self.ranges) class SASMutexGroup: def __init__(self, facts): self.facts = sorted(facts) def validate(self, variables): """Assert that the facts in the mutex group are sorted and unique and that they are all valid.""" for fact in self.facts: variables.validate_fact(fact) assert self.facts == sorted(set(self.facts)) def dump(self): for var, val in self.facts: print("v%d: %d" % (var, val)) def output(self, stream): print("begin_mutex_group", file=stream) print(len(self.facts), file=stream) for var, val in self.facts: print(var, val, file=stream) print("end_mutex_group", file=stream) def get_encoding_size(self): return len(self.facts) class SASInit: def __init__(self, values): self.values = values def validate(self, variables): """Validate initial state. Assert that the initial state contains the correct number of values and that all values are in range. """ assert len(self.values) == len(variables.ranges) for fact in enumerate(self.values): variables.validate_fact(fact) def dump(self): for var, val in enumerate(self.values): print("v%d: %d" % (var, val)) def output(self, stream): print("begin_state", file=stream) for val in self.values: print(val, file=stream) print("end_state", file=stream) class SASGoal: def __init__(self, pairs): self.pairs = sorted(pairs) def validate(self, variables): """Assert that the goal is nonempty and a valid condition.""" assert self.pairs variables.validate_condition(self.pairs) def dump(self): for var, val in self.pairs: print("v%d: %d" % (var, val)) def output(self, stream): print("begin_goal", file=stream) print(len(self.pairs), file=stream) for var, val in self.pairs: print(var, val, file=stream) print("end_goal", file=stream) def get_encoding_size(self): return len(self.pairs) class SASOperator: def __init__(self, name, prevail, pre_post, cost, propositional_action=None): self.name = name self.prevail = sorted(prevail) self.pre_post = self._canonical_pre_post(pre_post) self.cost = cost self.propositional_action = propositional_action def _canonical_pre_post(self, pre_post): # Return a sorted and uniquified version of pre_post. We would # like to just use sorted(set(pre_post)), but this fails because # the effect conditions are a list and hence not hashable. def tuplify(entry): var, pre, post, cond = entry return var, pre, post, tuple(cond) def listify(entry): var, pre, post, cond = entry return var, pre, post, list(cond) pre_post = map(tuplify, pre_post) pre_post = sorted(set(pre_post)) pre_post = list(map(listify, pre_post)) return pre_post def validate(self, variables): """Validate the operator. Assert that 1. Prevail conditions are valid conditions (i.e., sorted and all referring to different variables) 2. The pre_post list is sorted by (var, pre, post, cond), and the same (var, pre, post, cond) 4-tuple is not repeated. 3. Effect conditions are valid conditions and do not contain variables from the pre- or prevail conditions. 4. Variables occurring in pre_post rules do not have a prevail condition. 5. Preconditions in pre_post are -1 or valid facts. 6. Effects are valid facts. 7. Effect variables are non-derived. 8. If a variable has multiple pre_post rules, then pre is identical in all these rules. 9. There is at least one effect. 10. Costs are non-negative integers. Odd things that are *not* illegal: - The effect in a pre_post rule may be identical to the precondition or to an effect condition of that effect. TODO/open question: - It is currently not very clear what the semantics of operators should be when effects "conflict", i.e., when multiple effects trigger and want to set a given variable to two different values. In the case where both are unconditional effects, we should make sure that our representation doesn't actually contain two such effects, but when at least one of them is conditional, things are not so easy. To make our life simpler when generating SAS+ tasks from PDDL tasks, it probably makes most sense to generalize the PDDL rule in this case: there is a value order where certain values "win" over others in this situation. It probably makes sense to say the "highest" values should win in this case, because that's consistent with the PDDL rules if we say false = 0 and true = 1, and also with our sort order of effects it means we get the right result if we just apply effects in sequence. But whatever we end up deciding, we need to be clear about it, document it and make sure that all of our code knows the rules and follows them. """ variables.validate_condition(self.prevail) assert self.pre_post == self._canonical_pre_post(self.pre_post) prevail_vars = {var for (var, value) in self.prevail} pre_values = {} for var, pre, post, cond in self.pre_post: variables.validate_condition(cond) assert var not in prevail_vars if pre != -1: variables.validate_fact((var, pre)) variables.validate_fact((var, post)) assert variables.axiom_layers[var] == -1 if var in pre_values: assert pre_values[var] == pre else: pre_values[var] = pre for var, pre, post, cond in self.pre_post: for cvar, cval in cond: assert(cvar not in pre_values or pre_values[cvar] == -1) assert(cvar not in prevail_vars) assert self.pre_post assert self.cost >= 0 and self.cost == int(self.cost) def dump(self): print(self.name) print("Prevail:") for var, val in self.prevail: print(" v%d: %d" % (var, val)) print("Pre/Post:") for var, pre, post, cond in self.pre_post: if cond: cond_str = " [%s]" % ", ".join( ["%d: %d" % tuple(c) for c in cond]) else: cond_str = "" print(" v%d: %d -> %d%s" % (var, pre, post, cond_str)) def output(self, stream): print("begin_operator", file=stream) print(self.name[1:-1], file=stream) print(len(self.prevail), file=stream) for var, val in self.prevail: print(var, val, file=stream) print(len(self.pre_post), file=stream) for var, pre, post, cond in self.pre_post: print(len(cond), end=' ', file=stream) for cvar, cval in cond: print(cvar, cval, end=' ', file=stream) print(var, pre, post, file=stream) print(self.cost, file=stream) print("end_operator", file=stream) def get_encoding_size(self): size = 1 + len(self.prevail) for var, pre, post, cond in self.pre_post: size += 1 + len(cond) if pre != -1: size += 1 return size def get_applicability_conditions(self): """Return the combined applicability conditions (prevail conditions and preconditions) of the operator. Returns a sorted list of (var, value) pairs. This is guaranteed to contain at most one fact per variable and must hence be non-contradictory.""" conditions = {} for var, val in self.prevail: assert var not in conditions conditions[var] = val for var, pre, post, cond in self.pre_post: if pre != -1: assert var not in conditions or conditions[var] == pre conditions[var] = pre return sorted(conditions.items()) class SASAxiom: def __init__(self, condition, effect, propositional_axiom=None): self.condition = sorted(condition) self.effect = effect self.propositional_axiom = propositional_axiom assert self.effect[1] in (0, 1) for _, val in condition: assert val >= 0, condition def validate(self, variables, init): """Validate the axiom. Assert that the axiom condition is a valid condition, that the effect is a valid fact, that the effect variable is a derived variable, and that the layering condition is satisfied. See the docstring of SASTask.validate for information on the restriction on derived variables. The layering condition boils down to: 1. Axioms always set the "non-init" value of the derived variable. 2. Derived variables in the condition must have a lower of equal layer to derived variables appearing in the effect. 3. Conditions with equal layer are only allowed when the condition uses the "non-init" value of that variable. TODO/bug: rule #1 is currently disabled because we currently have axioms that violate it. This is likely due to the "extended domain transition graphs" described in the Fast Downward paper, Section 5.1. However, we want to eventually changes this. See issue454. For cases where rule #1 is violated, "non-init" should be "init" in rule #3. """ variables.validate_condition(self.condition) variables.validate_fact(self.effect) eff_var, eff_value = self.effect eff_layer = variables.axiom_layers[eff_var] assert eff_layer >= 0 eff_init_value = init.values[eff_var] ## The following rule is currently commented out because of ## the TODO/bug mentioned in the docstring. # assert eff_value != eff_init_value for cond_var, cond_value in self.condition: cond_layer = variables.axiom_layers[cond_var] if cond_layer != -1: assert cond_layer <= eff_layer if cond_layer == eff_layer: cond_init_value = init.values[cond_var] ## Once the TODO/bug above is addressed, the ## following four lines can be simplified because ## we are guaranteed to land in the "if" branch. if eff_value != eff_init_value: assert cond_value != cond_init_value else: assert cond_value == cond_init_value def dump(self): print("Condition:") for var, val in self.condition: print(" v%d: %d" % (var, val)) print("Effect:") var, val = self.effect print(" v%d: %d" % (var, val)) def output(self, stream): print("begin_rule", file=stream) print(len(self.condition), file=stream) for var, val in self.condition: print(var, val, file=stream) var, val = self.effect print(var, 1 - val, val, file=stream) print("end_rule", file=stream) def get_encoding_size(self): return 1 + len(self.condition)
18,268
Python
36.90249
81
0.591034
makolon/hsr_isaac_tamp/hsr_tamp/downward/src/translate/greedy_join.py
import sys import pddl import pddl_to_prolog class OccurrencesTracker: """Keeps track of the number of times each variable appears in a list of symbolic atoms.""" def __init__(self, rule): self.occurrences = {} self.update(rule.effect, +1) for cond in rule.conditions: self.update(cond, +1) def update(self, symatom, delta): for var in symatom.args: if var[0] == "?": if var not in self.occurrences: self.occurrences[var] = 0 self.occurrences[var] += delta assert self.occurrences[var] >= 0 if not self.occurrences[var]: del self.occurrences[var] def variables(self): return set(self.occurrences) class CostMatrix: def __init__(self, joinees): self.joinees = [] self.cost_matrix = [] for joinee in joinees: self.add_entry(joinee) def add_entry(self, joinee): new_row = [self.compute_join_cost(joinee, other) for other in self.joinees] self.cost_matrix.append(new_row) self.joinees.append(joinee) def delete_entry(self, index): for row in self.cost_matrix[index + 1:]: del row[index] del self.cost_matrix[index] del self.joinees[index] def find_min_pair(self): assert len(self.joinees) >= 2 min_cost = (sys.maxsize, sys.maxsize) for i, row in enumerate(self.cost_matrix): for j, entry in enumerate(row): if entry < min_cost: min_cost = entry left_index, right_index = i, j return left_index, right_index def remove_min_pair(self): left_index, right_index = self.find_min_pair() left, right = self.joinees[left_index], self.joinees[right_index] assert left_index > right_index self.delete_entry(left_index) self.delete_entry(right_index) return (left, right) def compute_join_cost(self, left_joinee, right_joinee): left_vars = pddl_to_prolog.get_variables([left_joinee]) right_vars = pddl_to_prolog.get_variables([right_joinee]) if len(left_vars) > len(right_vars): left_vars, right_vars = right_vars, left_vars common_vars = left_vars & right_vars return (len(left_vars) - len(common_vars), len(right_vars) - len(common_vars), -len(common_vars)) def can_join(self): return len(self.joinees) >= 2 class ResultList: def __init__(self, rule, name_generator): self.final_effect = rule.effect self.result = [] self.name_generator = name_generator def get_result(self): self.result[-1].effect = self.final_effect return self.result def add_rule(self, type, conditions, effect_vars): effect = pddl.Atom(next(self.name_generator), effect_vars) rule = pddl_to_prolog.Rule(conditions, effect) rule.type = type self.result.append(rule) return rule.effect def greedy_join(rule, name_generator): assert len(rule.conditions) >= 2 cost_matrix = CostMatrix(rule.conditions) occurrences = OccurrencesTracker(rule) result = ResultList(rule, name_generator) while cost_matrix.can_join(): joinees = list(cost_matrix.remove_min_pair()) for joinee in joinees: occurrences.update(joinee, -1) common_vars = set(joinees[0].args) & set(joinees[1].args) condition_vars = set(joinees[0].args) | set(joinees[1].args) effect_vars = occurrences.variables() & condition_vars for i, joinee in enumerate(joinees): joinee_vars = set(joinee.args) retained_vars = joinee_vars & (effect_vars | common_vars) if retained_vars != joinee_vars: joinees[i] = result.add_rule("project", [joinee], sorted(retained_vars)) joint_condition = result.add_rule("join", joinees, sorted(effect_vars)) cost_matrix.add_entry(joint_condition) occurrences.update(joint_condition, +1) # assert occurrences.variables() == set(rule.effect.args) # for var in set(rule.effect.args): # assert occurrences.occurrences[var] == 2 * rule.effect.args.count(var) return result.get_result()
4,347
Python
38.171171
88
0.602484
makolon/hsr_isaac_tamp/hsr_tamp/downward/src/translate/invariants.py
from collections import defaultdict import itertools import constraints import pddl import tools # Notes: # All parts of an invariant always use all non-counted variables # -> the arity of all predicates covered by an invariant is either the # number of the invariant variables or this value + 1 # # we currently keep the assumption that each predicate occurs at most once # in every invariant. def invert_list(alist): result = defaultdict(list) for pos, arg in enumerate(alist): result[arg].append(pos) return result def instantiate_factored_mapping(pairs): part_mappings = [[list(zip(preimg, perm_img)) for perm_img in itertools.permutations(img)] for (preimg, img) in pairs] return tools.cartesian_product(part_mappings) def find_unique_variables(action, invariant): # find unique names for invariant variables params = {p.name for p in action.parameters} for eff in action.effects: params.update([p.name for p in eff.parameters]) inv_vars = [] counter = itertools.count() for _ in range(invariant.arity()): while True: new_name = "?v%i" % next(counter) if new_name not in params: inv_vars.append(new_name) break return inv_vars def get_literals(condition): if isinstance(condition, pddl.Literal): yield condition elif isinstance(condition, pddl.Conjunction): for part in condition.parts: yield part def ensure_conjunction_sat(system, *parts): """Modifies the constraint system such that it is only solvable if the conjunction of all parts is satisfiable. Each part must be an iterator, generator, or an iterable over literals.""" pos = defaultdict(set) neg = defaultdict(set) for literal in itertools.chain(*parts): if literal.predicate == "=": # use (in)equalities in conditions if literal.negated: n = constraints.NegativeClause([literal.args]) system.add_negative_clause(n) else: a = constraints.Assignment([literal.args]) system.add_assignment_disjunction([a]) else: if literal.negated: neg[literal.predicate].add(literal) else: pos[literal.predicate].add(literal) for pred, posatoms in pos.items(): if pred in neg: for posatom in posatoms: for negatom in neg[pred]: parts = list(zip(negatom.args, posatom.args)) if parts: negative_clause = constraints.NegativeClause(parts) system.add_negative_clause(negative_clause) def ensure_cover(system, literal, invariant, inv_vars): """Modifies the constraint system such that it is only solvable if the invariant covers the literal""" a = invariant.get_covering_assignments(inv_vars, literal) assert(len(a) == 1) # if invariants could contain several parts of one predicate, this would # not be true but the depending code in parts relies on this assumption system.add_assignment_disjunction(a) def ensure_inequality(system, literal1, literal2): """Modifies the constraint system such that it is only solvable if the literal instantiations are not equal (ignoring whether one is negated and the other is not)""" if (literal1.predicate == literal2.predicate and literal1.args): parts = list(zip(literal1.args, literal2.args)) system.add_negative_clause(constraints.NegativeClause(parts)) class InvariantPart: def __init__(self, predicate, order, omitted_pos=-1): self.predicate = predicate self.order = order self.omitted_pos = omitted_pos def __eq__(self, other): # This implies equality of the omitted_pos component. return self.predicate == other.predicate and self.order == other.order def __ne__(self, other): return self.predicate != other.predicate or self.order != other.order def __le__(self, other): return self.predicate <= other.predicate or self.order <= other.order def __lt__(self, other): return self.predicate < other.predicate or self.order < other.order def __hash__(self): return hash((self.predicate, tuple(self.order))) def __str__(self): var_string = " ".join(map(str, self.order)) omitted_string = "" if self.omitted_pos != -1: omitted_string = " [%d]" % self.omitted_pos return "%s %s%s" % (self.predicate, var_string, omitted_string) def arity(self): return len(self.order) def get_assignment(self, parameters, literal): equalities = [(arg, literal.args[argpos]) for arg, argpos in zip(parameters, self.order)] return constraints.Assignment(equalities) def get_parameters(self, literal): return [literal.args[pos] for pos in self.order] def instantiate(self, parameters): args = ["?X"] * (len(self.order) + (self.omitted_pos != -1)) for arg, argpos in zip(parameters, self.order): args[argpos] = arg return pddl.Atom(self.predicate, args) def possible_mappings(self, own_literal, other_literal): allowed_omissions = len(other_literal.args) - len(self.order) if allowed_omissions not in (0, 1): return [] own_parameters = self.get_parameters(own_literal) arg_to_ordered_pos = invert_list(own_parameters) other_arg_to_pos = invert_list(other_literal.args) factored_mapping = [] for key, other_positions in other_arg_to_pos.items(): own_positions = arg_to_ordered_pos.get(key, []) len_diff = len(own_positions) - len(other_positions) if len_diff >= 1 or len_diff <= -2 or len_diff == -1 and not allowed_omissions: return [] if len_diff: own_positions.append(-1) allowed_omissions = 0 factored_mapping.append((other_positions, own_positions)) return instantiate_factored_mapping(factored_mapping) def possible_matches(self, own_literal, other_literal): assert self.predicate == own_literal.predicate result = [] for mapping in self.possible_mappings(own_literal, other_literal): new_order = [None] * len(self.order) omitted = -1 for (key, value) in mapping: if value == -1: omitted = key else: new_order[value] = key result.append(InvariantPart(other_literal.predicate, new_order, omitted)) return result def matches(self, other, own_literal, other_literal): return self.get_parameters(own_literal) == other.get_parameters(other_literal) class Invariant: # An invariant is a logical expression of the type # forall V1...Vk: sum_(part in parts) weight(part, V1, ..., Vk) <= 1. # k is called the arity of the invariant. # A "part" is a symbolic fact only variable symbols in {V1, ..., Vk, X}; # the symbol X may occur at most once. def __init__(self, parts): self.parts = frozenset(parts) self.predicates = {part.predicate for part in parts} self.predicate_to_part = {part.predicate: part for part in parts} assert len(self.parts) == len(self.predicates) def __eq__(self, other): return self.parts == other.parts def __ne__(self, other): return self.parts != other.parts def __lt__(self, other): return self.parts < other.parts def __le__(self, other): return self.parts <= other.parts def __hash__(self): return hash(self.parts) def __str__(self): return "{%s}" % ", ".join(str(part) for part in self.parts) def __repr__(self): return '<Invariant %s>' % self def arity(self): return next(iter(self.parts)).arity() def get_parameters(self, atom): return self.predicate_to_part[atom.predicate].get_parameters(atom) def instantiate(self, parameters): return [part.instantiate(parameters) for part in self.parts] def get_covering_assignments(self, parameters, atom): part = self.predicate_to_part[atom.predicate] return [part.get_assignment(parameters, atom)] # if there were more parts for the same predicate the list # contained more than one element def check_balance(self, balance_checker, enqueue_func): # Check balance for this hypothesis. actions_to_check = set() for part in self.parts: actions_to_check |= balance_checker.get_threats(part.predicate) for action in actions_to_check: heavy_action = balance_checker.get_heavy_action(action) if self.operator_too_heavy(heavy_action): return False if self.operator_unbalanced(action, enqueue_func): return False return True def operator_too_heavy(self, h_action): add_effects = [eff for eff in h_action.effects if not eff.literal.negated and self.predicate_to_part.get(eff.literal.predicate)] inv_vars = find_unique_variables(h_action, self) if len(add_effects) <= 1: return False for eff1, eff2 in itertools.combinations(add_effects, 2): system = constraints.ConstraintSystem() ensure_inequality(system, eff1.literal, eff2.literal) ensure_cover(system, eff1.literal, self, inv_vars) ensure_cover(system, eff2.literal, self, inv_vars) ensure_conjunction_sat(system, get_literals(h_action.precondition), get_literals(eff1.condition), get_literals(eff2.condition), [eff1.literal.negate()], [eff2.literal.negate()]) if system.is_solvable(): return True return False def operator_unbalanced(self, action, enqueue_func): inv_vars = find_unique_variables(action, self) relevant_effs = [eff for eff in action.effects if self.predicate_to_part.get(eff.literal.predicate)] add_effects = [eff for eff in relevant_effs if not eff.literal.negated] del_effects = [eff for eff in relevant_effs if eff.literal.negated] for eff in add_effects: if self.add_effect_unbalanced(action, eff, del_effects, inv_vars, enqueue_func): return True return False def minimal_covering_renamings(self, action, add_effect, inv_vars): """computes the minimal renamings of the action parameters such that the add effect is covered by the action. Each renaming is an constraint system""" # add_effect must be covered assigs = self.get_covering_assignments(inv_vars, add_effect.literal) # renaming of operator parameters must be minimal minimal_renamings = [] params = [p.name for p in action.parameters] for assignment in assigs: system = constraints.ConstraintSystem() system.add_assignment(assignment) mapping = assignment.get_mapping() if len(params) > 1: for (n1, n2) in itertools.combinations(params, 2): if mapping.get(n1, n1) != mapping.get(n2, n2): negative_clause = constraints.NegativeClause([(n1, n2)]) system.add_negative_clause(negative_clause) minimal_renamings.append(system) return minimal_renamings def add_effect_unbalanced(self, action, add_effect, del_effects, inv_vars, enqueue_func): minimal_renamings = self.minimal_covering_renamings(action, add_effect, inv_vars) lhs_by_pred = defaultdict(list) for lit in itertools.chain(get_literals(action.precondition), get_literals(add_effect.condition), get_literals(add_effect.literal.negate())): lhs_by_pred[lit.predicate].append(lit) for del_effect in del_effects: minimal_renamings = self.unbalanced_renamings( del_effect, add_effect, inv_vars, lhs_by_pred, minimal_renamings) if not minimal_renamings: return False # Otherwise, the balance check fails => Generate new candidates. self.refine_candidate(add_effect, action, enqueue_func) return True def refine_candidate(self, add_effect, action, enqueue_func): """refines the candidate for an add effect that is unbalanced in the action and adds the refined one to the queue""" part = self.predicate_to_part[add_effect.literal.predicate] for del_eff in [eff for eff in action.effects if eff.literal.negated]: if del_eff.literal.predicate not in self.predicate_to_part: for match in part.possible_matches(add_effect.literal, del_eff.literal): enqueue_func(Invariant(self.parts.union((match,)))) def unbalanced_renamings(self, del_effect, add_effect, inv_vars, lhs_by_pred, unbalanced_renamings): """returns the renamings from unbalanced renamings for which the del_effect does not balance the add_effect.""" system = constraints.ConstraintSystem() ensure_cover(system, del_effect.literal, self, inv_vars) # Since we may only rename the quantified variables of the delete effect # we need to check that "renamings" of constants are already implied by # the unbalanced_renaming (of the of the operator parameters). The # following system is used as a helper for this. It builds a conjunction # that formulates that the constants are NOT renamed accordingly. We # below check that this is impossible with each unbalanced renaming. check_constants = False constant_test_system = constraints.ConstraintSystem() for a, b in system.combinatorial_assignments[0][0].equalities: # first 0 because the system was empty before we called ensure_cover # second 0 because ensure_cover only adds assignments with one entry if b[0] != "?": check_constants = True neg_clause = constraints.NegativeClause([(a, b)]) constant_test_system.add_negative_clause(neg_clause) ensure_inequality(system, add_effect.literal, del_effect.literal) still_unbalanced = [] for renaming in unbalanced_renamings: if check_constants: new_sys = constant_test_system.combine(renaming) if new_sys.is_solvable(): # it is possible that the operator arguments are not # mapped to constants as required for covering the delete # effect still_unbalanced.append(renaming) continue new_sys = system.combine(renaming) if self.lhs_satisfiable(renaming, lhs_by_pred): implies_system = self.imply_del_effect(del_effect, lhs_by_pred) if not implies_system: still_unbalanced.append(renaming) continue new_sys = new_sys.combine(implies_system) if not new_sys.is_solvable(): still_unbalanced.append(renaming) return still_unbalanced def lhs_satisfiable(self, renaming, lhs_by_pred): system = renaming.copy() ensure_conjunction_sat(system, *itertools.chain(lhs_by_pred.values())) return system.is_solvable() def imply_del_effect(self, del_effect, lhs_by_pred): """returns a constraint system that is solvable if lhs implies the del effect (only if lhs is satisfiable). If a solvable lhs never implies the del effect, return None.""" # del_effect.cond and del_effect.atom must be implied by lhs implies_system = constraints.ConstraintSystem() for literal in itertools.chain(get_literals(del_effect.condition), [del_effect.literal.negate()]): poss_assignments = [] for match in lhs_by_pred[literal.predicate]: if match.negated != literal.negated: continue else: a = constraints.Assignment(list(zip(literal.args, match.args))) poss_assignments.append(a) if not poss_assignments: return None implies_system.add_assignment_disjunction(poss_assignments) return implies_system
17,227
Python
40.513253
94
0.604923
makolon/hsr_isaac_tamp/hsr_tamp/downward/src/translate/normalize.py
#! /usr/bin/env python3 import copy import pddl class ConditionProxy: def clone_owner(self): clone = copy.copy(self) clone.owner = copy.copy(clone.owner) return clone class PreconditionProxy(ConditionProxy): def __init__(self, action): self.owner = action self.condition = action.precondition def set(self, new_condition): self.owner.precondition = self.condition = new_condition def register_owner(self, task): task.actions.append(self.owner) def delete_owner(self, task): task.actions.remove(self.owner) def build_rules(self, rules): action = self.owner rule_head = get_action_predicate(action) rule_body = condition_to_rule_body(action.parameters, self.condition) rules.append((rule_body, rule_head)) def get_type_map(self): return self.owner.type_map class EffectConditionProxy(ConditionProxy): def __init__(self, action, effect): self.action = action self.owner = effect self.condition = effect.condition def set(self, new_condition): self.owner.condition = self.condition = new_condition def register_owner(self, task): self.action.effects.append(self.owner) def delete_owner(self, task): self.action.effects.remove(self.owner) def build_rules(self, rules): effect = self.owner rule_head = effect.literal if not rule_head.negated: rule_body = [get_action_predicate(self.action)] rule_body += condition_to_rule_body([], self.condition) rules.append((rule_body, rule_head)) def get_type_map(self): return self.action.type_map class AxiomConditionProxy(ConditionProxy): def __init__(self, axiom): self.owner = axiom self.condition = axiom.condition def set(self, new_condition): self.owner.condition = self.condition = new_condition def register_owner(self, task): task.axioms.append(self.owner) def delete_owner(self, task): task.axioms.remove(self.owner) def build_rules(self, rules): axiom = self.owner app_rule_head = get_axiom_predicate(axiom) app_rule_body = condition_to_rule_body(axiom.parameters, self.condition) rules.append((app_rule_body, app_rule_head)) params = axiom.parameters[:axiom.num_external_parameters] eff_rule_head = pddl.Atom(axiom.name, [par.name for par in params]) eff_rule_body = [app_rule_head] rules.append((eff_rule_body, eff_rule_head)) def get_type_map(self): return self.owner.type_map class GoalConditionProxy(ConditionProxy): def __init__(self, task): self.owner = task self.condition = task.goal def set(self, new_condition): self.owner.goal = self.condition = new_condition def register_owner(self, task): # this assertion should never trigger, because disjunctive # goals are now implemented with axioms # (see substitute_complicated_goal) assert False, "Disjunctive goals not (yet) implemented." def delete_owner(self, task): # this assertion should never trigger, because disjunctive # goals are now implemented with axioms # (see substitute_complicated_goal) assert False, "Disjunctive goals not (yet) implemented." def build_rules(self, rules): rule_head = pddl.Atom("@goal-reachable", []) rule_body = condition_to_rule_body([], self.condition) rules.append((rule_body, rule_head)) def get_type_map(self): # HACK! # Method uniquify_variables HAS already been called (which is good). # We call it here again for its SIDE EFFECT of collecting the type_map # (which is bad). Having "top-level conditions" (currently, only goal # conditions, but might also include safety conditions and similar) # contained in a separate wrapper class that stores a type map might # be a better design. type_map = {} self.condition.uniquify_variables(type_map) return type_map def get_action_predicate(action): name = action variables = [par.name for par in action.parameters] if isinstance(action.precondition, pddl.ExistentialCondition): variables += [par.name for par in action.precondition.parameters] return pddl.Atom(name, variables) def get_axiom_predicate(axiom): name = axiom variables = [par.name for par in axiom.parameters] if isinstance(axiom.condition, pddl.ExistentialCondition): variables += [par.name for par in axiom.condition.parameters] return pddl.Atom(name, variables) def all_conditions(task): for action in task.actions: yield PreconditionProxy(action) for effect in action.effects: yield EffectConditionProxy(action, effect) for axiom in task.axioms: yield AxiomConditionProxy(axiom) yield GoalConditionProxy(task) # [1] Remove universal quantifications from conditions. # # Replace, in a top-down fashion, <forall(vars, phi)> by <not(not-all-phi)>, # where <not-all-phi> is a new axiom. # # <not-all-phi> is defined as <not(forall(vars,phi))>, which is of course # translated to NNF. The parameters of the new axioms are exactly the free # variables of <forall(vars, phi)>. def remove_universal_quantifiers(task): def recurse(condition): # Uses new_axioms_by_condition and type_map from surrounding scope. if isinstance(condition, pddl.UniversalCondition): axiom_condition = condition.negate() parameters = sorted(axiom_condition.free_variables()) typed_parameters = tuple(pddl.TypedObject(v, type_map[v]) for v in parameters) axiom = new_axioms_by_condition.get((axiom_condition, typed_parameters)) if not axiom: condition = recurse(axiom_condition) axiom = task.add_axiom(list(typed_parameters), condition) new_axioms_by_condition[(condition, typed_parameters)] = axiom return pddl.NegatedAtom(axiom.name, parameters) else: new_parts = [recurse(part) for part in condition.parts] return condition.change_parts(new_parts) new_axioms_by_condition = {} for proxy in tuple(all_conditions(task)): # Cannot use generator because we add new axioms on the fly. if proxy.condition.has_universal_part(): type_map = proxy.get_type_map() proxy.set(recurse(proxy.condition)) # [2] Pull disjunctions to the root of the condition. # # After removing universal quantifiers, the (k-ary generalization of the) # following rules suffice for doing that: # (1) or(phi, or(psi, psi')) == or(phi, psi, psi') # (2) exists(vars, or(phi, psi)) == or(exists(vars, phi), exists(vars, psi)) # (3) and(phi, or(psi, psi')) == or(and(phi, psi), and(phi, psi')) def build_DNF(task): def recurse(condition): disjunctive_parts = [] other_parts = [] for part in condition.parts: part = recurse(part) if isinstance(part, pddl.Disjunction): disjunctive_parts.append(part) else: other_parts.append(part) if not disjunctive_parts: return condition # Rule (1): Associativity of disjunction. if isinstance(condition, pddl.Disjunction): result_parts = other_parts for part in disjunctive_parts: result_parts.extend(part.parts) return pddl.Disjunction(result_parts) # Rule (2): Distributivity disjunction/existential quantification. if isinstance(condition, pddl.ExistentialCondition): parameters = condition.parameters result_parts = [pddl.ExistentialCondition(parameters, (part,)) for part in disjunctive_parts[0].parts] return pddl.Disjunction(result_parts) # Rule (3): Distributivity disjunction/conjunction. assert isinstance(condition, pddl.Conjunction) result_parts = [pddl.Conjunction(other_parts)] while disjunctive_parts: previous_result_parts = result_parts result_parts = [] parts_to_distribute = disjunctive_parts.pop().parts for part1 in previous_result_parts: for part2 in parts_to_distribute: result_parts.append(pddl.Conjunction((part1, part2))) return pddl.Disjunction(result_parts) for proxy in all_conditions(task): if proxy.condition.has_disjunction(): proxy.set(recurse(proxy.condition).simplified()) # [3] Split conditions at the outermost disjunction. def split_disjunctions(task): for proxy in tuple(all_conditions(task)): # Cannot use generator directly because we add/delete entries. if isinstance(proxy.condition, pddl.Disjunction): for part in proxy.condition.parts: new_proxy = proxy.clone_owner() new_proxy.set(part) new_proxy.register_owner(task) proxy.delete_owner(task) # [4] Pull existential quantifiers out of conjunctions and group them. # # After removing universal quantifiers and creating the disjunctive form, # only the following (representatives of) rules are needed: # (1) exists(vars, exists(vars', phi)) == exists(vars + vars', phi) # (2) and(phi, exists(vars, psi)) == exists(vars, and(phi, psi)), # if var does not occur in phi as a free variable. def move_existential_quantifiers(task): def recurse(condition): existential_parts = [] other_parts = [] for part in condition.parts: part = recurse(part) if isinstance(part, pddl.ExistentialCondition): existential_parts.append(part) else: other_parts.append(part) if not existential_parts: return condition # Rule (1): Combine nested quantifiers. if isinstance(condition, pddl.ExistentialCondition): new_parameters = condition.parameters + existential_parts[0].parameters new_parts = existential_parts[0].parts return pddl.ExistentialCondition(new_parameters, new_parts) # Rule (2): Pull quantifiers out of conjunctions. assert isinstance(condition, pddl.Conjunction) new_parameters = [] new_conjunction_parts = other_parts for part in existential_parts: new_parameters += part.parameters new_conjunction_parts += part.parts new_conjunction = pddl.Conjunction(new_conjunction_parts) return pddl.ExistentialCondition(new_parameters, (new_conjunction,)) for proxy in all_conditions(task): if proxy.condition.has_existential_part(): proxy.set(recurse(proxy.condition).simplified()) # [5a] Drop existential quantifiers from axioms, turning them # into parameters. def eliminate_existential_quantifiers_from_axioms(task): # Note: This is very redundant with the corresponding method for # actions and could easily be merged if axioms and actions were # unified. for axiom in task.axioms: precond = axiom.condition if isinstance(precond, pddl.ExistentialCondition): # Copy parameter list, since it can be shared with # parameter lists of other versions of this axiom (e.g. # created when splitting up disjunctive preconditions). axiom.parameters = list(axiom.parameters) axiom.parameters.extend(precond.parameters) axiom.condition = precond.parts[0] # [5b] Drop existential quantifiers from action preconditions, # turning them into action parameters (that don't form part of the # name of the action). def eliminate_existential_quantifiers_from_preconditions(task): for action in task.actions: precond = action.precondition if isinstance(precond, pddl.ExistentialCondition): # Copy parameter list, since it can be shared with # parameter lists of other versions of this action (e.g. # created when splitting up disjunctive preconditions). action.parameters = list(action.parameters) action.parameters.extend(precond.parameters) action.precondition = precond.parts[0] # [5c] Eliminate existential quantifiers from effect conditions # # For effect conditions, we replace "when exists(x, phi) then e" with # "forall(x): when phi then e. def eliminate_existential_quantifiers_from_conditional_effects(task): for action in task.actions: for effect in action.effects: condition = effect.condition if isinstance(condition, pddl.ExistentialCondition): effect.parameters = list(effect.parameters) effect.parameters.extend(condition.parameters) effect.condition = condition.parts[0] def substitute_complicated_goal(task): goal = task.goal if isinstance(goal, pddl.Literal): return elif isinstance(goal, pddl.Conjunction): for item in goal.parts: if not isinstance(item, pddl.Literal): break else: return new_axiom = task.add_axiom([], goal) task.goal = pddl.Atom(new_axiom.name, new_axiom.parameters) # Combine Steps [1], [2], [3], [4], [5] and do some additional verification # that the task makes sense. def normalize(task): remove_universal_quantifiers(task) substitute_complicated_goal(task) build_DNF(task) split_disjunctions(task) move_existential_quantifiers(task) eliminate_existential_quantifiers_from_axioms(task) eliminate_existential_quantifiers_from_preconditions(task) eliminate_existential_quantifiers_from_conditional_effects(task) verify_axiom_predicates(task) def verify_axiom_predicates(task): # Verify that derived predicates are not used in :init or # action effects. axiom_names = set() for axiom in task.axioms: axiom_names.add(axiom.name) for fact in task.init: # Note that task.init can contain the assignment to (total-cost) # in addition to regular atoms. if getattr(fact, "predicate", None) in axiom_names: raise SystemExit( "error: derived predicate %r appears in :init fact '%s'" % (fact.predicate, fact)) for action in task.actions: for effect in action.effects: if effect.literal.predicate in axiom_names: raise SystemExit( "error: derived predicate %r appears in effect of action %r" % (effect.literal.predicate, action.name)) # [6] Build rules for exploration component. def build_exploration_rules(task): result = [] for proxy in all_conditions(task): proxy.build_rules(result) return result def condition_to_rule_body(parameters, condition): result = [] for par in parameters: result.append(par.get_atom()) if not isinstance(condition, pddl.Truth): if isinstance(condition, pddl.ExistentialCondition): for par in condition.parameters: result.append(par.get_atom()) condition = condition.parts[0] if isinstance(condition, pddl.Conjunction): parts = condition.parts else: parts = (condition,) for part in parts: if isinstance(part, pddl.Falsity): # Use an atom in the body that is always false because # it is not initially true and doesn't occur in the # head of any rule. return [pddl.Atom("@always-false", [])] assert isinstance(part, pddl.Literal), "Condition not normalized: %r" % part if not part.negated: result.append(part) return result if __name__ == "__main__": import pddl_parser task = pddl_parser.open() normalize(task) task.dump()
16,121
Python
39.507538
90
0.64692
makolon/hsr_isaac_tamp/hsr_tamp/downward/src/translate/options.py
import argparse import sys def parse_args(): argparser = argparse.ArgumentParser() argparser.add_argument( "domain", help="path to domain pddl file") argparser.add_argument( "task", help="path to task pddl file") argparser.add_argument( "--relaxed", dest="generate_relaxed_task", action="store_true", help="output relaxed task (no delete effects)") argparser.add_argument( "--full-encoding", dest="use_partial_encoding", action="store_false", help="By default we represent facts that occur in multiple " "mutex groups only in one variable. Using this parameter adds " "these facts to multiple variables. This can make the meaning " "of the variables clearer, but increases the number of facts.") argparser.add_argument( "--invariant-generation-max-candidates", default=100000, type=int, help="max number of candidates for invariant generation " "(default: %(default)d). Set to 0 to disable invariant " "generation and obtain only binary variables. The limit is " "needed for grounded input files that would otherwise produce " "too many candidates.") argparser.add_argument( "--sas-file", default="output.sas", help="path to the SAS output file (default: %(default)s)") argparser.add_argument( "--invariant-generation-max-time", default=300, type=int, help="max time for invariant generation (default: %(default)ds)") argparser.add_argument( "--add-implied-preconditions", action="store_true", help="infer additional preconditions. This setting can cause a " "severe performance penalty due to weaker relevance analysis " "(see issue7).") argparser.add_argument( "--keep-unreachable-facts", dest="filter_unreachable_facts", action="store_false", help="keep facts that can't be reached from the initial state") argparser.add_argument( "--skip-variable-reordering", dest="reorder_variables", action="store_false", help="do not reorder variables based on the causal graph. Do not use " "this option with the causal graph heuristic!") argparser.add_argument( "--keep-unimportant-variables", dest="filter_unimportant_vars", action="store_false", help="keep variables that do not influence the goal in the causal graph") argparser.add_argument( "--dump-task", action="store_true", help="dump human-readable SAS+ representation of the task") argparser.add_argument( "--layer-strategy", default="min", choices=["min", "max"], help="How to assign layers to derived variables. 'min' attempts to put as " "many variables into the same layer as possible, while 'max' puts each variable " "into its own layer unless it is part of a cycle.") # argparser.add_argument( # "--negative-axioms", action="store_true", # help="Allow negative axioms by not negating them") return argparser.parse_args() def copy_args_to_module(args): module_dict = sys.modules[__name__].__dict__ for key, value in vars(args).items(): module_dict[key] = value def setup(): args = parse_args() copy_args_to_module(args) setup()
3,319
Python
41.564102
89
0.654414
makolon/hsr_isaac_tamp/hsr_tamp/downward/src/translate/instantiate.py
#! /usr/bin/env python3 from __future__ import print_function from collections import defaultdict import build_model import pddl_to_prolog import pddl import timers def get_fluent_facts(task, model): fluent_predicates = set() for action in task.actions: for effect in action.effects: fluent_predicates.add(effect.literal.predicate) for axiom in task.axioms: fluent_predicates.add(axiom.name) return {fact for fact in model if fact.predicate in fluent_predicates} def get_objects_by_type(typed_objects, types): result = defaultdict(list) supertypes = {} for type in types: supertypes[type.name] = type.supertype_names for obj in typed_objects: result[obj.type_name].append(obj.name) for type in supertypes[obj.type_name]: result[type].append(obj.name) return result def get_atoms_by_predicate(atoms): result = {} # TODO: defaultdict? for atom in atoms: if isinstance(atom, pddl.Atom): result.setdefault(atom.predicate, []).append(atom) return result def instantiate(task, model): relaxed_reachable = False fluent_facts = get_fluent_facts(task, model) init_facts = set() init_assignments = {} for element in task.init: if isinstance(element, pddl.Assign): init_assignments[element.fluent] = element.expression else: init_facts.add(element) type_to_objects = get_objects_by_type(task.objects, task.types) predicate_to_atoms = get_atoms_by_predicate(init_facts | fluent_facts) instantiated_actions = [] instantiated_axioms = [] reachable_action_parameters = defaultdict(list) for atom in model: if isinstance(atom.predicate, pddl.Action): action = atom.predicate parameters = action.parameters inst_parameters = atom.args[:len(parameters)] # Note: It's important that we use the action object # itself as the key in reachable_action_parameters (rather # than action.name) since we can have multiple different # actions with the same name after normalization, and we # want to distinguish their instantiations. reachable_action_parameters[action].append(inst_parameters) variable_mapping = {par.name: arg for par, arg in zip(parameters, atom.args)} inst_action = action.instantiate( variable_mapping, init_facts, init_assignments, fluent_facts, type_to_objects, task.use_min_cost_metric, predicate_to_atoms) if inst_action: instantiated_actions.append(inst_action) elif isinstance(atom.predicate, pddl.Axiom): axiom = atom.predicate variable_mapping = {par.name: arg for par, arg in zip(axiom.parameters, atom.args)} inst_axiom = axiom.instantiate(variable_mapping, init_facts, fluent_facts) if inst_axiom: instantiated_axioms.append(inst_axiom) elif atom.predicate == "@goal-reachable": relaxed_reachable = True return (relaxed_reachable, fluent_facts, instantiated_actions, sorted(instantiated_axioms), reachable_action_parameters) def explore(task): prog = pddl_to_prolog.translate(task) model = build_model.compute_model(prog) with timers.timing("Completing instantiation"): return instantiate(task, model) if __name__ == "__main__": import pddl_parser task = pddl_parser.open() relaxed_reachable, atoms, actions, axioms, _ = explore(task) print("goal relaxed reachable: %s" % relaxed_reachable) print("%d atoms:" % len(atoms)) for atom in atoms: print(" ", atom) print() print("%d actions:" % len(actions)) for action in actions: action.dump() print() print() print("%d axioms:" % len(axioms)) for axiom in axioms: axiom.dump() print()
4,088
Python
34.868421
86
0.627446
makolon/hsr_isaac_tamp/hsr_tamp/downward/src/translate/variable_order.py
from __future__ import print_function from collections import defaultdict, deque from itertools import chain import heapq import sccs DEBUG = False class CausalGraph: """Weighted causal graph used for defining a variable order. The causal graph only contains pre->eff edges (in contrast to the variant that also has eff<->eff edges). The variable order is defined such that removing all edges v->v' with v>v' induces an acyclic subgraph of the causal graph. This corresponds to the pruning of the causal graph as described in the JAIR 2006 Fast Downward paper for the causal graph heuristic. The greedy method is based on weighting the edges of the causal graph. In this implementation these weights slightly differ from the description in the JAIR paper to reproduce the behaviour of the original implementation in the preprocessor component of the planner. """ def __init__(self, sas_task): self.weighted_graph = defaultdict(lambda: defaultdict(int)) ## var_no -> (var_no -> number) self.predecessor_graph = defaultdict(set) self.ordering = [] self.weight_graph_from_ops(sas_task.operators) self.weight_graph_from_axioms(sas_task.axioms) self.num_variables = len(sas_task.variables.ranges) self.goal_map = dict(sas_task.goal.pairs) def get_ordering(self): if not self.ordering: sccs = self.get_strongly_connected_components() self.calculate_topological_pseudo_sort(sccs) return self.ordering def weight_graph_from_ops(self, operators): ### A source variable can be processed several times. This was ### probably not intended originally but in experiments (cf. ### issue26) it performed better than the (clearer) weighting ### described in the Fast Downward paper (which would require ### a more complicated implementation). for op in operators: source_vars = [var for (var, value) in op.prevail] for var, pre, _, _ in op.pre_post: if pre != -1: source_vars.append(var) for target, _, _, cond in op.pre_post: for source in chain(source_vars, (var for var, _ in cond)): if source != target: self.weighted_graph[source][target] += 1 self.predecessor_graph[target].add(source) def weight_graph_from_axioms(self, axioms): for ax in axioms: target = ax.effect[0] for source, _ in ax.condition: if source != target: self.weighted_graph[source][target] += 1 self.predecessor_graph[target].add(source) def get_strongly_connected_components(self): unweighted_graph = [[] for _ in range(self.num_variables)] assert(len(self.weighted_graph) <= self.num_variables) for source, target_weights in self.weighted_graph.items(): unweighted_graph[source] = sorted(target_weights.keys()) return sccs.get_sccs_adjacency_list(unweighted_graph) def calculate_topological_pseudo_sort(self, sccs): for scc in sccs: if len(scc) > 1: # component needs to be turned into acyclic subgraph # Compute subgraph induced by scc subgraph = defaultdict(list) for var in scc: # for each variable in component only list edges inside # component. subgraph_edges = subgraph[var] for target, cost in sorted(self.weighted_graph[var].items()): if target in scc: if target in self.goal_map: subgraph_edges.append((target, 100000 + cost)) subgraph_edges.append((target, cost)) self.ordering.extend(MaxDAG(subgraph, scc).get_result()) else: self.ordering.append(scc[0]) def calculate_important_vars(self, goal): # Note for future refactoring: it is perhaps more idiomatic # and efficient to use a set rather than a defaultdict(bool). necessary = defaultdict(bool) for var, _ in goal.pairs: if not necessary[var]: necessary[var] = True self.dfs(var, necessary) return necessary def dfs(self, node, necessary): stack = [pred for pred in self.predecessor_graph[node]] while stack: n = stack.pop() if not necessary[n]: necessary[n] = True stack.extend(pred for pred in self.predecessor_graph[n]) class MaxDAG: """Defines a variable ordering for a SCC of the (weighted) causal graph. Conceptually, the greedy algorithm successively picks a node with minimal cummulated weight of incoming arcs and removes its incident edges from the graph until only a single node remains (cf. computation of total order of vertices when pruning the causal graph in the Fast Downward JAIR 2006 paper). """ def __init__(self, graph, input_order): self.weighted_graph = graph # input_order is only used to get the same tie-breaking as # with the old preprocessor self.input_order = input_order def get_result(self): incoming_weights = defaultdict(int) for weighted_edges in self.weighted_graph.values(): for target, weight in weighted_edges: incoming_weights[target] += weight weight_to_nodes = defaultdict(deque) for node in self.input_order: weight = incoming_weights[node] weight_to_nodes[weight].append(node) weights = list(weight_to_nodes.keys()) heapq.heapify(weights) done = set() result = [] while weights: min_key = weights[0] min_elem = None entries = weight_to_nodes[min_key] while entries and (min_elem is None or min_elem in done or min_key > incoming_weights[min_elem]): min_elem = entries.popleft() if not entries: del weight_to_nodes[min_key] heapq.heappop(weights) # remove min_key from heap if min_elem is None or min_elem in done: # since we use lazy deletion from the heap weights, # there can be weights with a "done" entry in # weight_to_nodes continue done.add(min_elem) result.append(min_elem) for target, weight in self.weighted_graph[min_elem]: if target not in done: weight = weight % 100000 if weight == 0: continue old_in_weight = incoming_weights[target] new_in_weight = old_in_weight - weight incoming_weights[target] = new_in_weight # add new entry to weight_to_nodes if new_in_weight not in weight_to_nodes: heapq.heappush(weights, new_in_weight) weight_to_nodes[new_in_weight].append(target) return result class VariableOrder: """Apply a given variable order to a SAS task.""" def __init__(self, ordering): """Ordering is a list of variable numbers in the desired order. If a variable does not occur in the ordering, it is removed from the task. """ self.ordering = ordering self.new_var = {v: i for i, v in enumerate(ordering)} def apply_to_task(self, sas_task): self._apply_to_variables(sas_task.variables) self._apply_to_init(sas_task.init) self._apply_to_goal(sas_task.goal) self._apply_to_mutexes(sas_task.mutexes) self._apply_to_operators(sas_task.operators) self._apply_to_axioms(sas_task.axioms) if DEBUG: sas_task.validate() def _apply_to_variables(self, variables): ranges = [] layers = [] names = [] for index, var in enumerate(self.ordering): ranges.append(variables.ranges[var]) layers.append(variables.axiom_layers[var]) names.append(variables.value_names[var]) variables.ranges = ranges variables.axiom_layers = layers variables.value_names = names def _apply_to_init(self, init): init.values = [init.values[var] for var in self.ordering] def _apply_to_goal(self, goal): goal.pairs = sorted((self.new_var[var], val) for var, val in goal.pairs if var in self.new_var) def _apply_to_mutexes(self, mutexes): new_mutexes = [] for group in mutexes: facts = [(self.new_var[var], val) for var, val in group.facts if var in self.new_var] if facts and len({var for var, _ in facts}) > 1: group.facts = facts new_mutexes.append(group) print("%s of %s mutex groups necessary." % (len(new_mutexes), len(mutexes))) mutexes[:] = new_mutexes def _apply_to_operators(self, operators): new_ops = [] for op in operators: pre_post = [] for eff_var, pre, post, cond in op.pre_post: if eff_var in self.new_var: new_cond = list((self.new_var[var], val) for var, val in cond if var in self.new_var) pre_post.append( (self.new_var[eff_var], pre, post, new_cond)) if pre_post: op.pre_post = pre_post op.prevail = [(self.new_var[var], val) for var, val in op.prevail if var in self.new_var] new_ops.append(op) print("%s of %s operators necessary." % (len(new_ops), len(operators))) operators[:] = new_ops def _apply_to_axioms(self, axioms): new_axioms = [] for ax in axioms: eff_var, eff_val = ax.effect if eff_var in self.new_var: ax.condition = [(self.new_var[var], val) for var, val in ax.condition if var in self.new_var] ax.effect = (self.new_var[eff_var], eff_val) new_axioms.append(ax) print("%s of %s axiom rules necessary." % (len(new_axioms), len(axioms))) axioms[:] = new_axioms def find_and_apply_variable_order(sas_task, reorder_vars=True, filter_unimportant_vars=True): if reorder_vars or filter_unimportant_vars: cg = CausalGraph(sas_task) if reorder_vars: order = cg.get_ordering() else: order = list(range(len(sas_task.variables.ranges))) if filter_unimportant_vars: necessary = cg.calculate_important_vars(sas_task.goal) print("%s of %s variables necessary." % (len(necessary), len(order))) order = [var for var in order if necessary[var]] VariableOrder(order).apply_to_task(sas_task)
11,640
Python
39.560975
81
0.557646
makolon/hsr_isaac_tamp/hsr_tamp/downward/src/translate/constraints.py
import itertools class NegativeClause: # disjunction of inequalities def __init__(self, parts): self.parts = parts assert len(parts) def __str__(self): disj = " or ".join(["(%s != %s)" % (v1, v2) for (v1, v2) in self.parts]) return "(%s)" % disj def is_satisfiable(self): for part in self.parts: if part[0] != part[1]: return True return False def apply_mapping(self, m): new_parts = [(m.get(v1, v1), m.get(v2, v2)) for (v1, v2) in self.parts] return NegativeClause(new_parts) class Assignment: def __init__(self, equalities): self.equalities = tuple(equalities) # represents a conjunction of expressions ?x = ?y or ?x = d # with ?x, ?y being variables and d being a domain value self.consistent = None self.mapping = None self.eq_classes = None def __str__(self): conj = " and ".join(["(%s = %s)" % (v1, v2) for (v1, v2) in self.equalities]) return "(%s)" % conj def _compute_equivalence_classes(self): eq_classes = {} for (v1, v2) in self.equalities: c1 = eq_classes.setdefault(v1, {v1}) c2 = eq_classes.setdefault(v2, {v2}) if c1 is not c2: if len(c2) > len(c1): v1, c1, v2, c2 = v2, c2, v1, c1 c1.update(c2) for elem in c2: eq_classes[elem] = c1 self.eq_classes = eq_classes def _compute_mapping(self): if not self.eq_classes: self._compute_equivalence_classes() # create mapping: each key is mapped to the smallest # element in its equivalence class (with objects being # smaller than variables) mapping = {} for eq_class in self.eq_classes.values(): variables = [item for item in eq_class if item.startswith("?")] constants = [item for item in eq_class if not item.startswith("?")] if len(constants) >= 2: self.consistent = False self.mapping = None return if constants: set_val = constants[0] else: set_val = min(variables) for entry in eq_class: mapping[entry] = set_val self.consistent = True self.mapping = mapping def is_consistent(self): if self.consistent is None: self._compute_mapping() return self.consistent def get_mapping(self): if self.consistent is None: self._compute_mapping() return self.mapping class ConstraintSystem: def __init__(self): self.combinatorial_assignments = [] self.neg_clauses = [] def __str__(self): combinatorial_assignments = [] for comb_assignment in self.combinatorial_assignments: disj = " or ".join([str(assig) for assig in comb_assignment]) disj = "(%s)" % disj combinatorial_assignments.append(disj) assigs = " and\n".join(combinatorial_assignments) neg_clauses = [str(clause) for clause in self.neg_clauses] neg_clauses = " and ".join(neg_clauses) return assigs + "(" + neg_clauses + ")" def _all_clauses_satisfiable(self, assignment): mapping = assignment.get_mapping() for neg_clause in self.neg_clauses: clause = neg_clause.apply_mapping(mapping) if not clause.is_satisfiable(): return False return True def _combine_assignments(self, assignments): new_equalities = [] for a in assignments: new_equalities.extend(a.equalities) return Assignment(new_equalities) def add_assignment(self, assignment): self.add_assignment_disjunction([assignment]) def add_assignment_disjunction(self, assignments): self.combinatorial_assignments.append(assignments) def add_negative_clause(self, negative_clause): self.neg_clauses.append(negative_clause) def combine(self, other): """Combines two constraint systems to a new system""" combined = ConstraintSystem() combined.combinatorial_assignments = (self.combinatorial_assignments + other.combinatorial_assignments) combined.neg_clauses = self.neg_clauses + other.neg_clauses return combined def copy(self): other = ConstraintSystem() other.combinatorial_assignments = list(self.combinatorial_assignments) other.neg_clauses = list(self.neg_clauses) return other def dump(self): print("AssignmentSystem:") for comb_assignment in self.combinatorial_assignments: disj = " or ".join([str(assig) for assig in comb_assignment]) print(" ASS: ", disj) for neg_clause in self.neg_clauses: print(" NEG: ", str(neg_clause)) def is_solvable(self): """Check whether the combinatorial assignments include at least one consistent assignment under which the negative clauses are satisfiable""" for assignments in itertools.product(*self.combinatorial_assignments): combined = self._combine_assignments(assignments) if not combined.is_consistent(): continue if self._all_clauses_satisfiable(combined): return True return False
5,589
Python
33.720497
79
0.570943
makolon/hsr_isaac_tamp/hsr_tamp/downward/src/translate/timers.py
from __future__ import print_function import contextlib import os import sys import time class Timer: def __init__(self): self.start_time = time.time() self.start_clock = self._clock() def _clock(self): times = os.times() return times[0] + times[1] def __str__(self): return "[%.3fs CPU, %.3fs wall-clock]" % ( self._clock() - self.start_clock, time.time() - self.start_time) @contextlib.contextmanager def timing(text, block=False): timer = Timer() if block: print("%s..." % text) else: print("%s..." % text, end=' ') sys.stdout.flush() yield if block: print("%s: %s" % (text, timer)) else: print(timer) sys.stdout.flush()
771
Python
19.315789
50
0.542153
makolon/hsr_isaac_tamp/hsr_tamp/downward/src/translate/simplify.py
"""This module contains a function for simplifying tasks in finite-domain representation (SASTask). Usage: simplify.filter_unreachable_propositions(sas_task) simplifies `sas_task` in-place. If simplification detects that the task is unsolvable, the function raises `simplify.Impossible`. If it detects that is has an empty goal, the function raises `simplify.TriviallySolvable`. The simplification procedure generates DTGs for the task and then removes facts that are unreachable from the initial state in a DTG. Note that such unreachable facts can exist even though we perform a relaxed reachability analysis before grounding (and DTG reachability is weaker than relaxed reachability) because the previous relaxed reachability does not take into account any mutex information, while PDDL-to-SAS conversion gets rid of certain operators that cannot be applicable given the mutex information. Despite the name, the method touches more than the set of facts. For example, operators that have preconditions on pruned facts are removed, too. (See also the docstring of filter_unreachable_propositions.) """ from __future__ import print_function from collections import defaultdict from itertools import count import sas_tasks DEBUG = False # TODO: # This is all quite hackish and would be easier if the translator were # restructured so that more information is immediately available for # the propositions, and if propositions had more structure. Directly # working with int pairs is awkward. class DomainTransitionGraph: """Domain transition graphs. Attributes: - init (int): the initial state value of the DTG variable - size (int): the number of values in the domain - arcs (defaultdict: int -> set(int)): the DTG arcs (unlabeled) There are no transition labels or goal values. The intention is that nodes are represented as ints in {1, ..., domain_size}, but this is not enforced. For derived variables, the "fallback value" that is produced by negation by failure should be used for `init`, so that it is always considered reachable. """ def __init__(self, init, size): """Create a DTG with no arcs.""" self.init = init self.size = size self.arcs = defaultdict(set) def add_arc(self, u, v): """Add an arc from u to v.""" self.arcs[u].add(v) def reachable(self): """Return the values reachable from the initial value. Represented as a set(int).""" queue = [self.init] reachable = set(queue) while queue: node = queue.pop() new_neighbors = self.arcs.get(node, set()) - reachable reachable |= new_neighbors queue.extend(new_neighbors) return reachable def dump(self): """Dump the DTG.""" print("DTG size:", self.size) print("DTG init value:", self.init) print("DTG arcs:") for source, destinations in sorted(self.arcs.items()): for destination in sorted(destinations): print(" %d => %d" % (source, destination)) def build_dtgs(task): """Build DTGs for all variables of the SASTask `task`. Return a list(DomainTransitionGraph), one for each variable. For derived variables, we do not consider the axiom bodies, i.e., we treat each axiom as if it were an operator with no preconditions. In the case where the only derived variables used are binary and all rules change the value from the default value to the non-default value, this results in the correct DTG. Otherwise, at worst it results in an overapproximation, which would not threaten correctness.""" init_vals = task.init.values sizes = task.variables.ranges dtgs = [DomainTransitionGraph(init, size) for (init, size) in zip(init_vals, sizes)] def add_arc(var_no, pre_spec, post): """Add a DTG arc for var_no induced by transition pre_spec -> post. pre_spec may be -1, in which case arcs from every value other than post are added.""" if pre_spec == -1: pre_values = set(range(sizes[var_no])).difference([post]) else: pre_values = [pre_spec] for pre in pre_values: dtgs[var_no].add_arc(pre, post) def get_effective_pre(var_no, conditions, effect_conditions): """Return combined information on the conditions on `var_no` from operator conditions and effect conditions. - conditions: dict(int -> int) containing the combined operator prevail and preconditions - effect_conditions: list(pair(int, int)) containing the effect conditions Result: - -1 if there is no condition on var_no - val if there is a unique condition var_no=val - None if there are contradictory conditions on var_no""" result = conditions.get(var_no, -1) for cond_var_no, cond_val in effect_conditions: if cond_var_no == var_no: if result == -1: # This is the first condition on var_no. result = cond_val elif cond_val != result: # We have contradictory conditions on var_no. return None return result for op in task.operators: conditions = dict(op.get_applicability_conditions()) for var_no, _, post, cond in op.pre_post: effective_pre = get_effective_pre(var_no, conditions, cond) if effective_pre is not None: add_arc(var_no, effective_pre, post) for axiom in task.axioms: var_no, val = axiom.effect add_arc(var_no, -1, val) return dtgs always_false = object() always_true = object() class Impossible(Exception): pass class TriviallySolvable(Exception): pass class DoesNothing(Exception): pass class VarValueRenaming: def __init__(self): self.new_var_nos = [] # indexed by old var_no self.new_values = [] # indexed by old var_no and old value self.new_sizes = [] # indexed by new var_no self.new_var_count = 0 self.num_removed_values = 0 def dump(self): old_var_count = len(self.new_var_nos) print("variable count: %d => %d" % ( old_var_count, self.new_var_count)) print("number of removed values: %d" % self.num_removed_values) print("variable conversions:") for old_var_no, (new_var_no, new_values) in enumerate( zip(self.new_var_nos, self.new_values)): old_size = len(new_values) if new_var_no is None: print("variable %d [size %d] => removed" % ( old_var_no, old_size)) else: new_size = self.new_sizes[new_var_no] print("variable %d [size %d] => %d [size %d]" % ( old_var_no, old_size, new_var_no, new_size)) for old_value, new_value in enumerate(new_values): if new_value is always_false: new_value = "always false" elif new_value is always_true: new_value = "always true" print(" value %d => %s" % (old_value, new_value)) def register_variable(self, old_domain_size, init_value, new_domain): assert 1 <= len(new_domain) <= old_domain_size assert init_value in new_domain if len(new_domain) == 1: # Remove this variable completely. new_values_for_var = [always_false] * old_domain_size new_values_for_var[init_value] = always_true self.new_var_nos.append(None) self.new_values.append(new_values_for_var) self.num_removed_values += old_domain_size else: new_value_counter = count() new_values_for_var = [] for value in range(old_domain_size): if value in new_domain: new_values_for_var.append(next(new_value_counter)) else: self.num_removed_values += 1 new_values_for_var.append(always_false) new_size = next(new_value_counter) assert new_size == len(new_domain) self.new_var_nos.append(self.new_var_count) self.new_values.append(new_values_for_var) self.new_sizes.append(new_size) self.new_var_count += 1 def apply_to_task(self, task): if DEBUG: self.dump() self.apply_to_variables(task.variables) self.apply_to_mutexes(task.mutexes) self.apply_to_init(task.init) self.apply_to_goals(task.goal.pairs) self.apply_to_operators(task.operators) self.apply_to_axioms(task.axioms) def apply_to_variables(self, variables): variables.ranges = self.new_sizes new_axiom_layers = [None] * self.new_var_count for old_no, new_no in enumerate(self.new_var_nos): if new_no is not None: new_axiom_layers[new_no] = variables.axiom_layers[old_no] assert None not in new_axiom_layers variables.axiom_layers = new_axiom_layers self.apply_to_value_names(variables.value_names) def apply_to_value_names(self, value_names): new_value_names = [[None] * size for size in self.new_sizes] for var_no, values in enumerate(value_names): for value, value_name in enumerate(values): new_var_no, new_value = self.translate_pair((var_no, value)) if new_value is always_true: if DEBUG: print("Removed true proposition: %s" % value_name) elif new_value is always_false: if DEBUG: print("Removed false proposition: %s" % value_name) else: new_value_names[new_var_no][new_value] = value_name assert all((None not in value_names) for value_names in new_value_names) value_names[:] = new_value_names def apply_to_mutexes(self, mutexes): new_mutexes = [] for mutex in mutexes: new_facts = [] for var, val in mutex.facts: new_var_no, new_value = self.translate_pair((var, val)) if (new_value is not always_true and new_value is not always_false): new_facts.append((new_var_no, new_value)) if len(new_facts) >= 2: mutex.facts = new_facts new_mutexes.append(mutex) mutexes[:] = new_mutexes def apply_to_init(self, init): init_pairs = list(enumerate(init.values)) try: self.convert_pairs(init_pairs) except Impossible: assert False, "Initial state impossible? Inconceivable!" new_values = [None] * self.new_var_count for new_var_no, new_value in init_pairs: new_values[new_var_no] = new_value assert None not in new_values init.values = new_values def apply_to_goals(self, goals): # This may propagate Impossible up. self.convert_pairs(goals) if not goals: # We raise an exception because we do not consider a SAS+ # task without goals well-formed. Our callers are supposed # to catch this and replace the task with a well-formed # trivially solvable task. raise TriviallySolvable def apply_to_operators(self, operators): new_operators = [] num_removed = 0 for op in operators: new_op = self.translate_operator(op) if new_op is None: num_removed += 1 if DEBUG: print("Removed operator: %s" % op.name) else: new_operators.append(new_op) print("%d operators removed" % num_removed) operators[:] = new_operators def apply_to_axioms(self, axioms): new_axioms = [] num_removed = 0 for axiom in axioms: try: self.apply_to_axiom(axiom) except (Impossible, DoesNothing): num_removed += 1 if DEBUG: print("Removed axiom:") axiom.dump() else: new_axioms.append(axiom) print("%d axioms removed" % num_removed) axioms[:] = new_axioms def translate_operator(self, op): """Compute a new operator from op where the var/value renaming has been applied. Return None if op should be pruned (because it is always inapplicable or has no effect.)""" # We do not call this apply_to_operator, breaking the analogy # with the other methods, because it creates a new operator # rather than transforming in-place. The reason for this is # that it would be quite difficult to generate the operator # in-place. # This method is trickier than it may at first appear. For # example, pre_post values should be fully sorted (see # documentation in the sas_tasks module), and pruning effect # conditions from a conditional effects can break this sort # order. Recreating the operator from scratch solves this # because the pre_post entries are sorted by # SASOperator.__init__. # Also, when we detect a pre_post pair where the effect part # can never trigger, the precondition part is still important, # but may be demoted to a prevail condition. Whether or not # this happens depends on the presence of other pre_post # entries for the same variable. We solve this by computing # the sorting into prevail vs. preconditions from scratch, too. applicability_conditions = op.get_applicability_conditions() try: self.convert_pairs(applicability_conditions) except Impossible: # The operator is never applicable. return None conditions_dict = dict(applicability_conditions) new_prevail_vars = set(conditions_dict) new_pre_post = [] for entry in op.pre_post: new_entry = self.translate_pre_post(entry, conditions_dict) if new_entry is not None: new_pre_post.append(new_entry) # Mark the variable in the entry as not prevailed. new_var = new_entry[0] new_prevail_vars.discard(new_var) if not new_pre_post: # The operator has no effect. return None new_prevail = sorted( (var, value) for (var, value) in conditions_dict.items() if var in new_prevail_vars) return sas_tasks.SASOperator( name=op.name, prevail=new_prevail, pre_post=new_pre_post, cost=op.cost, propositional_action=op.propositional_action) def apply_to_axiom(self, axiom): # The following line may generate an Impossible exception, # which is propagated up. self.convert_pairs(axiom.condition) new_var, new_value = self.translate_pair(axiom.effect) # If the new_value is always false, then the condition must # have been impossible. assert new_value is not always_false if new_value is always_true: raise DoesNothing axiom.effect = new_var, new_value def translate_pre_post(self, pre_post_entry, conditions_dict): """Return a translated version of a pre_post entry. If the entry never causes a value change, return None. (It might seem that a possible precondition part of pre_post gets lost in this case, but pre_post entries that become prevail conditions are handled elsewhere.) conditions_dict contains all applicability conditions (prevail/pre) of the operator, already converted. This is used to detect effect conditions that can never fire. The method may assume that the operator remains reachable, i.e., that it does not have impossible preconditions, as these are already checked elsewhere. Possible cases: - effect is always_true => return None - effect equals prevailed value => return None - effect condition is impossible given operator applicability condition => return None - otherwise => return converted pre_post tuple """ var_no, pre, post, cond = pre_post_entry new_var_no, new_post = self.translate_pair((var_no, post)) if new_post is always_true: return None if pre == -1: new_pre = -1 else: _, new_pre = self.translate_pair((var_no, pre)) assert new_pre is not always_false, ( "This function should only be called for operators " "whose applicability conditions are deemed possible.") if new_post == new_pre: return None new_cond = list(cond) try: self.convert_pairs(new_cond) except Impossible: # The effect conditions can never be satisfied. return None for cond_var, cond_value in new_cond: if (cond_var in conditions_dict and conditions_dict[cond_var] != cond_value): # This effect condition is not compatible with # the applicability conditions. return None assert new_post is not always_false, ( "if we survived so far, this effect can trigger " "(as far as our analysis can determine this), " "and then new_post cannot be always_false") assert new_pre is not always_true, ( "if this pre_post changes the value and can fire, " "new_pre cannot be always_true") return new_var_no, new_pre, new_post, new_cond def translate_pair(self, fact_pair): (var_no, value) = fact_pair new_var_no = self.new_var_nos[var_no] new_value = self.new_values[var_no][value] return new_var_no, new_value def convert_pairs(self, pairs): # We call this convert_... because it is an in-place method. new_pairs = [] for pair in pairs: new_var_no, new_value = self.translate_pair(pair) if new_value is always_false: raise Impossible elif new_value is not always_true: assert new_var_no is not None new_pairs.append((new_var_no, new_value)) pairs[:] = new_pairs def build_renaming(dtgs): renaming = VarValueRenaming() for dtg in dtgs: renaming.register_variable(dtg.size, dtg.init, dtg.reachable()) return renaming def filter_unreachable_propositions(sas_task): """We remove unreachable propositions and then prune variables with only one value. Examples of things that are pruned: - Constant propositions that are not detected in instantiate.py because instantiate.py only reasons at the predicate level, and some predicates such as "at" in Depot are constant for some objects (hoists), but not others (trucks). Example: "at(hoist1, distributor0)" and the associated variable in depots-01. - "none of those" values that are unreachable. Example: at(truck1, ?x) = <none of those> in depots-01. - Certain values that are relaxed reachable but detected as unreachable after SAS instantiation because the only operators that set them have inconsistent preconditions. Example: on(crate0, crate0) in depots-01. """ if DEBUG: sas_task.validate() dtgs = build_dtgs(sas_task) renaming = build_renaming(dtgs) # apply_to_task may raise Impossible if the goal is detected as # unreachable or TriviallySolvable if it has no goal. We let the # exceptions propagate to the caller. renaming.apply_to_task(sas_task) print("%d propositions removed" % renaming.num_removed_values) if DEBUG: sas_task.validate()
20,231
Python
37.684512
80
0.609757
makolon/hsr_isaac_tamp/hsr_tamp/downward/src/translate/translate.py
#! /usr/bin/env python3 from __future__ import print_function import os import sys import traceback def python_version_supported(): return sys.version_info >= (3, 6) # if not python_version_supported(): # sys.exit("Error: Translator only supports Python >= 3.6.") from collections import defaultdict from copy import deepcopy from itertools import product import axiom_rules import fact_groups import instantiate import normalize import options import pddl import pddl_parser import sas_tasks import signal import simplify import timers import tools import variable_order # TODO: The translator may generate trivial derived variables which are always # true, for example if there ia a derived predicate in the input that only # depends on (non-derived) variables which are detected as always true. # Such a situation was encountered in the PSR-STRIPS-DerivedPredicates domain. # Such "always-true" variables should best be compiled away, but it is # not clear what the best place to do this should be. Similar # simplifications might be possible elsewhere, for example if a # derived variable is synonymous with another variable (derived or # non-derived). DEBUG = False ## For a full list of exit codes, please see driver/returncodes.py. Here, ## we only list codes that are used by the translator component of the planner. TRANSLATE_OUT_OF_MEMORY = 20 TRANSLATE_OUT_OF_TIME = 21 simplified_effect_condition_counter = 0 added_implied_precondition_counter = 0 def strips_to_sas_dictionary(groups, assert_partial): dictionary = {} for var_no, group in enumerate(groups): for val_no, atom in enumerate(group): dictionary.setdefault(atom, []).append((var_no, val_no)) if assert_partial: assert all(len(sas_pairs) == 1 for sas_pairs in dictionary.values()) return [len(group) + 1 for group in groups], dictionary def translate_strips_conditions_aux(conditions, dictionary, ranges): condition = {} for fact in conditions: if fact.negated: # we handle negative conditions later, because then we # can recognize when the negative condition is already # ensured by a positive condition continue for var, val in dictionary.get(fact, ()): # The default () here is a bit of a hack. For goals (but # only for goals!), we can get static facts here. They # cannot be statically false (that would have been # detected earlier), and hence they are statically true # and don't need to be translated. # TODO: This would not be necessary if we dealt with goals # in the same way we deal with operator preconditions etc., # where static facts disappear during grounding. So change # this when the goal code is refactored (also below). (**) if (condition.get(var) is not None and val not in condition.get(var)): # Conflicting conditions on this variable: Operator invalid. return None condition[var] = {val} def number_of_values(var_vals_pair): var, vals = var_vals_pair return len(vals) for fact in conditions: if fact.negated: ## Note: here we use a different solution than in Sec. 10.6.4 ## of the thesis. Compare the last sentences of the third ## paragraph of the section. ## We could do what is written there. As a test case, ## consider Airport ADL tasks with only one airport, where ## (occupied ?x) variables are encoded in a single variable, ## and conditions like (not (occupied ?x)) do occur in ## preconditions. ## However, here we avoid introducing new derived predicates ## by treat the negative precondition as a disjunctive ## precondition and expanding it by "multiplying out" the ## possibilities. This can lead to an exponential blow-up so ## it would be nice to choose the behaviour as an option. done = False new_condition = {} atom = pddl.Atom(fact.predicate, fact.args) # force positive for var, val in dictionary.get(atom, ()): # see comment (**) above poss_vals = set(range(ranges[var])) poss_vals.remove(val) if condition.get(var) is None: assert new_condition.get(var) is None new_condition[var] = poss_vals else: # constrain existing condition on var prev_possible_vals = condition.get(var) done = True prev_possible_vals.intersection_update(poss_vals) if len(prev_possible_vals) == 0: # Conflicting conditions on this variable: # Operator invalid. return None if not done and len(new_condition) != 0: # we did not enforce the negative condition by constraining # an existing condition on one of the variables representing # this atom. So we need to introduce a new condition: # We can select any from new_condition and currently prefer the # smallest one. candidates = sorted(new_condition.items(), key=number_of_values) var, vals = candidates[0] condition[var] = vals def multiply_out(condition): # destroys the input sorted_conds = sorted(condition.items(), key=number_of_values) flat_conds = [{}] for var, vals in sorted_conds: if len(vals) == 1: for cond in flat_conds: cond[var] = vals.pop() # destroys the input here else: new_conds = [] for cond in flat_conds: for val in vals: new_cond = deepcopy(cond) new_cond[var] = val new_conds.append(new_cond) flat_conds = new_conds return flat_conds return multiply_out(condition) def translate_strips_conditions(conditions, dictionary, ranges, mutex_dict, mutex_ranges): if not conditions: return [{}] # Quick exit for common case. # Check if the condition violates any mutexes. if translate_strips_conditions_aux(conditions, mutex_dict, mutex_ranges) is None: return None return translate_strips_conditions_aux(conditions, dictionary, ranges) def translate_strips_operator(operator, dictionary, ranges, mutex_dict, mutex_ranges, implied_facts): conditions = translate_strips_conditions(operator.precondition, dictionary, ranges, mutex_dict, mutex_ranges) if conditions is None: return [] sas_operators = [] for condition in conditions: op = translate_strips_operator_aux(operator, dictionary, ranges, mutex_dict, mutex_ranges, implied_facts, condition) if op is not None: sas_operators.append(op) return sas_operators def negate_and_translate_condition(condition, dictionary, ranges, mutex_dict, mutex_ranges): # condition is a list of lists of literals (DNF) # the result is the negation of the condition in DNF in # finite-domain representation (a list of dictionaries that map # variables to values) negation = [] if [] in condition: # condition always satisfied return None # negation unsatisfiable for combination in product(*condition): cond = [l.negate() for l in combination] cond = translate_strips_conditions(cond, dictionary, ranges, mutex_dict, mutex_ranges) if cond is not None: negation.extend(cond) return negation if negation else None def translate_strips_operator_aux(operator, dictionary, ranges, mutex_dict, mutex_ranges, implied_facts, condition): # collect all add effects effects_by_variable = defaultdict(lambda: defaultdict(list)) # effects_by_variables: var -> val -> list(FDR conditions) add_conds_by_variable = defaultdict(list) for conditions, fact in operator.add_effects: eff_condition_list = translate_strips_conditions(conditions, dictionary, ranges, mutex_dict, mutex_ranges) if eff_condition_list is None: # Impossible condition for this effect. continue for var, val in dictionary[fact]: effects_by_variable[var][val].extend(eff_condition_list) add_conds_by_variable[var].append(conditions) # collect all del effects del_effects_by_variable = defaultdict(lambda: defaultdict(list)) for conditions, fact in operator.del_effects: eff_condition_list = translate_strips_conditions(conditions, dictionary, ranges, mutex_dict, mutex_ranges) if eff_condition_list is None: # Impossible condition for this effect. continue for var, val in dictionary[fact]: del_effects_by_variable[var][val].extend(eff_condition_list) # add effect var=none_of_those for all del effects with the additional # condition that the deleted value has been true and no add effect triggers for var in del_effects_by_variable: no_add_effect_condition = negate_and_translate_condition( add_conds_by_variable[var], dictionary, ranges, mutex_dict, mutex_ranges) if no_add_effect_condition is None: # there is always an add effect continue none_of_those = ranges[var] - 1 for val, conds in del_effects_by_variable[var].items(): for cond in conds: # add guard if var in cond and cond[var] != val: continue # condition inconsistent with deleted atom cond[var] = val # add condition that no add effect triggers for no_add_cond in no_add_effect_condition: new_cond = dict(cond) # This is a rather expensive step. We try every no_add_cond # with every condition of the delete effect and discard the # overal combination if it is unsatisfiable. Since # no_add_effect_condition is precomputed it can contain many # no_add_conds in which a certain literal occurs. So if cond # plus the literal is already unsatisfiable, we still try # all these combinations. A possible optimization would be # to re-compute no_add_effect_condition for every delete # effect and to unfold the product(*condition) in # negate_and_translate_condition to allow an early break. for cvar, cval in no_add_cond.items(): if cvar in new_cond and new_cond[cvar] != cval: # the del effect condition plus the deleted atom # imply that some add effect on the variable # triggers break new_cond[cvar] = cval else: effects_by_variable[var][none_of_those].append(new_cond) return build_sas_operator(operator.name, condition, effects_by_variable, operator.cost, ranges, implied_facts) def build_sas_operator(name, condition, effects_by_variable, cost, ranges, implied_facts): if options.add_implied_preconditions: implied_precondition = set() for fact in condition.items(): implied_precondition.update(implied_facts[fact]) prevail_and_pre = dict(condition) pre_post = [] for var, effects_on_var in effects_by_variable.items(): orig_pre = condition.get(var, -1) added_effect = False for post, eff_conditions in effects_on_var.items(): pre = orig_pre # if the effect does not change the variable value, we ignore it if pre == post: continue eff_condition_lists = [sorted(eff_cond.items()) for eff_cond in eff_conditions] if ranges[var] == 2: # Apply simplifications for binary variables. if prune_stupid_effect_conditions(var, post, eff_condition_lists, effects_on_var): global simplified_effect_condition_counter simplified_effect_condition_counter += 1 if (options.add_implied_preconditions and pre == -1 and (var, 1 - post) in implied_precondition): global added_implied_precondition_counter added_implied_precondition_counter += 1 pre = 1 - post for eff_condition in eff_condition_lists: # we do not need to represent a precondition as effect condition # and we do not want to keep an effect whose condition contradicts # a pre- or prevail condition filtered_eff_condition = [] eff_condition_contradicts_precondition = False for variable, value in eff_condition: if variable in prevail_and_pre: if prevail_and_pre[variable] != value: eff_condition_contradicts_precondition = True break else: filtered_eff_condition.append((variable, value)) if eff_condition_contradicts_precondition: continue pre_post.append((var, pre, post, filtered_eff_condition)) added_effect = True if added_effect: # the condition on var is not a prevail condition but a # precondition, so we remove it from the prevail condition condition.pop(var, -1) if not pre_post: # operator is noop return None prevail = list(condition.items()) return sas_tasks.SASOperator(name, prevail, pre_post, cost) def prune_stupid_effect_conditions(var, val, conditions, effects_on_var): ## (IF <conditions> THEN <var> := <val>) is a conditional effect. ## <var> is guaranteed to be a binary variable. ## <conditions> is in DNF representation (list of lists). ## ## We simplify <conditions> by applying two rules: ## 1. Conditions of the form "var = dualval" where var is the ## effect variable and dualval != val can be omitted. ## (If var != dualval, then var == val because it is binary, ## which means that in such situations the effect is a no-op.) ## The condition can only be omitted if there is no effect ## producing dualval (see issue736). ## 2. If conditions contains any empty list, it is equivalent ## to True and we can remove all other disjuncts. ## ## returns True when anything was changed if conditions == [[]]: return False # Quick exit for common case. assert val in [0, 1] dual_val = 1 - val dual_fact = (var, dual_val) if dual_val in effects_on_var: return False simplified = False for condition in conditions: # Apply rule 1. while dual_fact in condition: # print "*** Removing dual condition" simplified = True condition.remove(dual_fact) # Apply rule 2. if not condition: conditions[:] = [[]] simplified = True break return simplified def translate_strips_axiom(axiom, dictionary, ranges, mutex_dict, mutex_ranges): conditions = translate_strips_conditions(axiom.condition, dictionary, ranges, mutex_dict, mutex_ranges) if conditions is None: return [] if axiom.effect.negated: [(var, _)] = dictionary[axiom.effect.positive()] effect = (var, ranges[var] - 1) else: [effect] = dictionary[axiom.effect] axioms = [] for condition in conditions: axioms.append(sas_tasks.SASAxiom(condition.items(), effect)) return axioms def translate_strips_operators(actions, strips_to_sas, ranges, mutex_dict, mutex_ranges, implied_facts): result = [] for action in actions: sas_ops = translate_strips_operator(action, strips_to_sas, ranges, mutex_dict, mutex_ranges, implied_facts) for sas_op in sas_ops: sas_op.propositional_action = action result.extend(sas_ops) return result def translate_strips_axioms(axioms, strips_to_sas, ranges, mutex_dict, mutex_ranges): result = [] for axiom in axioms: sas_axioms = translate_strips_axiom(axiom, strips_to_sas, ranges, mutex_dict, mutex_ranges) for sas_axiom in sas_axioms: sas_axiom.propositional_action = axiom result.extend(sas_axioms) return result def dump_task(init, goals, actions, axioms, axiom_layer_dict): old_stdout = sys.stdout with open("output.dump", "w") as dump_file: sys.stdout = dump_file print("Initial state") for atom in init: print(atom) print() print("Goals") for goal in goals: print(goal) for action in actions: print() print("Action") action.dump() for axiom in axioms: print() print("Axiom") axiom.dump() print() print("Axiom layers") for atom, layer in axiom_layer_dict.items(): print("%s: layer %d" % (atom, layer)) sys.stdout = old_stdout def translate_task(strips_to_sas, ranges, translation_key, mutex_dict, mutex_ranges, mutex_key, init, goals, actions, axioms, metric, implied_facts): with timers.timing("Processing axioms", block=True): axioms, axiom_layer_dict = axiom_rules.handle_axioms(actions, axioms, goals, options.layer_strategy) if options.dump_task: # Remove init facts that don't occur in strips_to_sas: they're constant. nonconstant_init = filter(strips_to_sas.get, init) dump_task(nonconstant_init, goals, actions, axioms, axiom_layer_dict) init_values = [rang - 1 for rang in ranges] # Closed World Assumption: Initialize to "range - 1" == Nothing. for fact in init: pairs = strips_to_sas.get(fact, []) # empty for static init facts for var, val in pairs: curr_val = init_values[var] if curr_val != ranges[var] - 1 and curr_val != val: assert False, "Inconsistent init facts! [fact = %s]" % fact init_values[var] = val init = sas_tasks.SASInit(init_values) goal_dict_list = translate_strips_conditions(goals, strips_to_sas, ranges, mutex_dict, mutex_ranges) if goal_dict_list is None: # "None" is a signal that the goal is unreachable because it # violates a mutex. return unsolvable_sas_task("Goal violates a mutex") assert len(goal_dict_list) == 1, "Negative goal not supported" ## we could substitute the negative goal literal in ## normalize.substitute_complicated_goal, using an axiom. We currently ## don't do this, because we don't run into this assertion, if the ## negative goal is part of finite domain variable with only two ## values, which is most of the time the case, and hence refrain from ## introducing axioms (that are not supported by all heuristics) goal_pairs = list(goal_dict_list[0].items()) if not goal_pairs: return solvable_sas_task("Empty goal") goal = sas_tasks.SASGoal(goal_pairs) operators = translate_strips_operators(actions, strips_to_sas, ranges, mutex_dict, mutex_ranges, implied_facts) axioms = translate_strips_axioms(axioms, strips_to_sas, ranges, mutex_dict, mutex_ranges) axiom_layers = [-1] * len(ranges) for atom, layer in axiom_layer_dict.items(): assert layer >= 0 [(var, val)] = strips_to_sas[atom] axiom_layers[var] = layer variables = sas_tasks.SASVariables(ranges, axiom_layers, translation_key) mutexes = [sas_tasks.SASMutexGroup(group) for group in mutex_key] return sas_tasks.SASTask(variables, mutexes, init, goal, operators, axioms, metric) def trivial_task(solvable): variables = sas_tasks.SASVariables( [2], [-1], [["Atom dummy(val1)", "Atom dummy(val2)"]]) # We create no mutexes: the only possible mutex is between # dummy(val1) and dummy(val2), but the preprocessor would filter # it out anyway since it is trivial (only involves one # finite-domain variable). mutexes = [] init = sas_tasks.SASInit([0]) if solvable: goal_fact = (0, 0) else: goal_fact = (0, 1) goal = sas_tasks.SASGoal([goal_fact]) operators = [] axioms = [] metric = True return sas_tasks.SASTask(variables, mutexes, init, goal, operators, axioms, metric) def solvable_sas_task(msg): print("%s! Generating solvable task..." % msg) return trivial_task(solvable=True) def unsolvable_sas_task(msg): print("%s! Generating unsolvable task..." % msg) return trivial_task(solvable=False) def pddl_to_sas(task): with timers.timing("Instantiating", block=True): (relaxed_reachable, atoms, actions, axioms, reachable_action_params) = instantiate.explore(task) if not relaxed_reachable: return unsolvable_sas_task("No relaxed solution") # HACK! Goals should be treated differently. if isinstance(task.goal, pddl.Conjunction): goal_list = task.goal.parts else: goal_list = [task.goal] for item in goal_list: assert isinstance(item, pddl.Literal) with timers.timing("Computing fact groups", block=True): groups, mutex_groups, translation_key = fact_groups.compute_groups( task, atoms, reachable_action_params) with timers.timing("Building STRIPS to SAS dictionary"): ranges, strips_to_sas = strips_to_sas_dictionary( groups, assert_partial=options.use_partial_encoding) with timers.timing("Building dictionary for full mutex groups"): mutex_ranges, mutex_dict = strips_to_sas_dictionary( mutex_groups, assert_partial=False) if options.add_implied_preconditions: with timers.timing("Building implied facts dictionary..."): implied_facts = build_implied_facts(strips_to_sas, groups, mutex_groups) else: implied_facts = {} with timers.timing("Building mutex information", block=True): if options.use_partial_encoding: mutex_key = build_mutex_key(strips_to_sas, mutex_groups) else: # With our current representation, emitting complete mutex # information for the full encoding can incur an # unacceptable (quadratic) blowup in the task representation # size. See issue771 for details. print("using full encoding: between-variable mutex information skipped.") mutex_key = [] with timers.timing("Translating task", block=True): sas_task = translate_task( strips_to_sas, ranges, translation_key, mutex_dict, mutex_ranges, mutex_key, task.init, goal_list, actions, axioms, task.use_min_cost_metric, implied_facts) print("%d effect conditions simplified" % simplified_effect_condition_counter) print("%d implied preconditions added" % added_implied_precondition_counter) if options.filter_unreachable_facts: with timers.timing("Detecting unreachable propositions", block=True): try: simplify.filter_unreachable_propositions(sas_task) except simplify.Impossible: return unsolvable_sas_task("Simplified to trivially false goal") except simplify.TriviallySolvable: return solvable_sas_task("Simplified to empty goal") if options.reorder_variables or options.filter_unimportant_vars: with timers.timing("Reordering and filtering variables", block=True): variable_order.find_and_apply_variable_order( sas_task, options.reorder_variables, options.filter_unimportant_vars) return sas_task def build_mutex_key(strips_to_sas, groups): assert options.use_partial_encoding group_keys = [] for group in groups: group_key = [] for fact in group: represented_by = strips_to_sas.get(fact) if represented_by: assert len(represented_by) == 1 group_key.append(represented_by[0]) else: print("not in strips_to_sas, left out:", fact) group_keys.append(group_key) return group_keys def build_implied_facts(strips_to_sas, groups, mutex_groups): ## Compute a dictionary mapping facts (FDR pairs) to lists of FDR ## pairs implied by that fact. In other words, in all states ## containing p, all pairs in implied_facts[p] must also be true. ## ## There are two simple cases where a pair p implies a pair q != p ## in our FDR encodings: ## 1. p and q encode the same fact ## 2. p encodes a STRIPS proposition X, q encodes a STRIPS literal ## "not Y", and X and Y are mutex. ## ## The first case cannot arise when we use partial encodings, and ## when we use full encodings, I don't think it would give us any ## additional information to exploit in the operator translation, ## so we only use the second case. ## ## Note that for a pair q to encode a fact "not Y", Y must form a ## fact group of size 1. We call such propositions Y "lonely". ## In the first step, we compute a dictionary mapping each lonely ## proposition to its variable number. lonely_propositions = {} for var_no, group in enumerate(groups): if len(group) == 1: lonely_prop = group[0] assert strips_to_sas[lonely_prop] == [(var_no, 0)] lonely_propositions[lonely_prop] = var_no ## Then we compute implied facts as follows: for each mutex group, ## check if prop is lonely (then and only then "not prop" has a ## representation as an FDR pair). In that case, all other facts ## in this mutex group imply "not prop". implied_facts = defaultdict(list) for mutex_group in mutex_groups: for prop in mutex_group: prop_var = lonely_propositions.get(prop) if prop_var is not None: prop_is_false = (prop_var, 1) for other_prop in mutex_group: if other_prop is not prop: for other_fact in strips_to_sas[other_prop]: implied_facts[other_fact].append(prop_is_false) return implied_facts def dump_statistics(sas_task): print("Translator variables: %d" % len(sas_task.variables.ranges)) print("Translator derived variables: %d" % len([layer for layer in sas_task.variables.axiom_layers if layer >= 0])) print("Translator facts: %d" % sum(sas_task.variables.ranges)) print("Translator goal facts: %d" % len(sas_task.goal.pairs)) print("Translator mutex groups: %d" % len(sas_task.mutexes)) print("Translator total mutex groups size: %d" % sum(mutex.get_encoding_size() for mutex in sas_task.mutexes)) print("Translator operators: %d" % len(sas_task.operators)) print("Translator axioms: %d" % len(sas_task.axioms)) print("Translator task size: %d" % sas_task.get_encoding_size()) try: peak_memory = tools.get_peak_memory_in_kb() except Warning as warning: print(warning) else: print("Translator peak memory: %d KB" % peak_memory) def main(): timer = timers.Timer() with timers.timing("Parsing", True): task = pddl_parser.open( domain_filename=options.domain, task_filename=options.task) with timers.timing("Normalizing task"): normalize.normalize(task) if options.generate_relaxed_task: # Remove delete effects. for action in task.actions: for index, effect in reversed(list(enumerate(action.effects))): if effect.literal.negated: del action.effects[index] sas_task = pddl_to_sas(task) dump_statistics(sas_task) with timers.timing("Writing output"): with open(options.sas_file, "w") as output_file: sas_task.output(output_file) print("Done! %s" % timer) def handle_sigxcpu(signum, stackframe): print() print("Translator hit the time limit") # sys.exit() is not safe to be called from within signal handlers, but # os._exit() is. os._exit(TRANSLATE_OUT_OF_TIME) if __name__ == "__main__": try: signal.signal(signal.SIGXCPU, handle_sigxcpu) except AttributeError: print("Warning! SIGXCPU is not available on your platform. " "This means that the planner cannot be gracefully terminated " "when using a time limit, which, however, is probably " "supported on your platform anyway.") try: # Reserve about 10 MB of emergency memory. # https://stackoverflow.com/questions/19469608/ emergency_memory = b"x" * 10**7 main() except MemoryError: del emergency_memory print() print("Translator ran out of memory, traceback:") print("=" * 79) traceback.print_exc(file=sys.stdout) print("=" * 79) sys.exit(TRANSLATE_OUT_OF_MEMORY)
31,201
Python
41.107962
85
0.594308
makolon/hsr_isaac_tamp/hsr_tamp/downward/src/translate/graph.py
#! /usr/bin/env python3 from __future__ import print_function class Graph: def __init__(self, nodes): self.nodes = nodes self.neighbours = {u: set() for u in nodes} def connect(self, u, v): self.neighbours[u].add(v) self.neighbours[v].add(u) def connected_components(self): remaining_nodes = set(self.nodes) result = [] def dfs(node): result[-1].append(node) remaining_nodes.remove(node) for neighbour in self.neighbours[node]: if neighbour in remaining_nodes: dfs(neighbour) while remaining_nodes: node = next(iter(remaining_nodes)) result.append([]) dfs(node) result[-1].sort() return sorted(result) def transitive_closure(pairs): # Warshall's algorithm. result = set(pairs) nodes = {u for (u, v) in pairs} | {v for (u, v) in pairs} for k in nodes: for i in nodes: for j in nodes: if (i, j) not in result and (i, k) in result and (k, j) in result: result.add((i, j)) return sorted(result) if __name__ == "__main__": g = Graph([1, 2, 3, 4, 5, 6]) g.connect(1, 2) g.connect(1, 3) g.connect(4, 5) print(g.connected_components())
1,334
Python
27.404255
82
0.531484
makolon/hsr_isaac_tamp/hsr_tamp/downward/src/translate/fact_groups.py
from __future__ import print_function import invariant_finder import options import pddl import timers DEBUG = False def expand_group(group, task, reachable_facts): result = [] for fact in group: try: pos = list(fact.args).index("?X") except ValueError: result.append(fact) else: # NOTE: This could be optimized by only trying objects of the correct # type, or by using a unifier which directly generates the # applicable objects. It is not worth optimizing this at this stage, # though. for obj in task.objects: newargs = list(fact.args) newargs[pos] = obj.name atom = pddl.Atom(fact.predicate, newargs) if atom in reachable_facts: result.append(atom) return result def instantiate_groups(groups, task, reachable_facts): return [expand_group(group, task, reachable_facts) for group in groups] class GroupCoverQueue: def __init__(self, groups): if groups: self.max_size = max([len(group) for group in groups]) self.groups_by_size = [[] for i in range(self.max_size + 1)] self.groups_by_fact = {} for group in groups: group = set(group) # Copy group, as it will be modified. self.groups_by_size[len(group)].append(group) for fact in group: self.groups_by_fact.setdefault(fact, []).append(group) self._update_top() else: self.max_size = 0 def __bool__(self): return self.max_size > 1 __nonzero__ = __bool__ def pop(self): result = list(self.top) # Copy; this group will shrink further. if options.use_partial_encoding: for fact in result: for group in self.groups_by_fact[fact]: group.remove(fact) self._update_top() return result def _update_top(self): while self.max_size > 1: max_list = self.groups_by_size[self.max_size] while max_list: candidate = max_list.pop() if len(candidate) == self.max_size: self.top = candidate return self.groups_by_size[len(candidate)].append(candidate) self.max_size -= 1 def choose_groups(groups, reachable_facts): queue = GroupCoverQueue(groups) uncovered_facts = reachable_facts.copy() result = [] while queue: group = queue.pop() uncovered_facts.difference_update(group) result.append(group) print(len(uncovered_facts), "uncovered facts") result += [[fact] for fact in uncovered_facts] return result def build_translation_key(groups): group_keys = [] for group in groups: group_key = [str(fact) for fact in group] if len(group) == 1: group_key.append(str(group[0].negate())) else: group_key.append("<none of those>") group_keys.append(group_key) return group_keys def collect_all_mutex_groups(groups, atoms): # NOTE: This should be functionally identical to choose_groups # when partial_encoding is set to False. Maybe a future # refactoring could take that into account. all_groups = [] uncovered_facts = atoms.copy() for group in groups: uncovered_facts.difference_update(group) all_groups.append(group) all_groups += [[fact] for fact in uncovered_facts] return all_groups def sort_groups(groups): return sorted(sorted(group) for group in groups) def compute_groups(task, atoms, reachable_action_params): groups = invariant_finder.get_groups(task, reachable_action_params) with timers.timing("Instantiating groups"): groups = instantiate_groups(groups, task, atoms) # Sort here already to get deterministic mutex groups. groups = sort_groups(groups) # TODO: I think that collect_all_mutex_groups should do the same thing # as choose_groups with partial_encoding=False, so these two should # be unified. with timers.timing("Collecting mutex groups"): mutex_groups = collect_all_mutex_groups(groups, atoms) with timers.timing("Choosing groups", block=True): groups = choose_groups(groups, atoms) groups = sort_groups(groups) with timers.timing("Building translation key"): translation_key = build_translation_key(groups) if DEBUG: for group in groups: if len(group) >= 2: print("{%s}" % ", ".join(map(str, group))) return groups, mutex_groups, translation_key
4,737
Python
34.358209
86
0.601436