#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#  distance_analysis.py
#  
#  Copyright 2015 linaro <linaro@raspberry>
#  
#  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 2 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, write to the Free Software
#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#  MA 02110-1301, USA.
#  
#  

'''imported modules'''
from multiprocessing import Process
from random import randint
import time
from random import choice
'''own modules'''
from dist_sensors import sensors as sens
from inverse_kinematics import move_a_bit

'''globals'''
minn = 30
maxx = 180
medium = 100

choice_list = [minn,maxx,medium]
crampys_range = range(50,150,50)

#u = Process(target=sens.permap, args=())	
#u.start()
while True:
	move_a_bit.arm(choice(choice_list) + 60,choice(choice_list),choice(choice_list),choice(choice_list),choice(choice_list) -30,choice(choice_list))
	time.sleep(0.8)

count = minn

#joints = [a,
while True:
	if count <= maxx:
		for i in crampys_range:
			print "angle =", i
			move_a_bit.arm(i,i,i,i,i,i)
			time.sleep(0.5)
			count = i
	else:
		while count >= 50:
			move_a_bit.arm(count,count,count,count,count,count)
			time.sleep(0.5)
			count -= 10
			



