Add python pycharm project
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
function global:deactivate ([switch]$NonDestructive) {
|
||||
# Revert to original values
|
||||
if (Test-Path function:_OLD_VIRTUAL_PROMPT) {
|
||||
copy-item function:_OLD_VIRTUAL_PROMPT function:prompt
|
||||
remove-item function:_OLD_VIRTUAL_PROMPT
|
||||
}
|
||||
|
||||
if (Test-Path env:_OLD_VIRTUAL_PYTHONHOME) {
|
||||
copy-item env:_OLD_VIRTUAL_PYTHONHOME env:PYTHONHOME
|
||||
remove-item env:_OLD_VIRTUAL_PYTHONHOME
|
||||
}
|
||||
|
||||
if (Test-Path env:_OLD_VIRTUAL_PATH) {
|
||||
copy-item env:_OLD_VIRTUAL_PATH env:PATH
|
||||
remove-item env:_OLD_VIRTUAL_PATH
|
||||
}
|
||||
|
||||
if (Test-Path env:VIRTUAL_ENV) {
|
||||
remove-item env:VIRTUAL_ENV
|
||||
}
|
||||
|
||||
if (!$NonDestructive) {
|
||||
# Self destruct!
|
||||
remove-item function:deactivate
|
||||
}
|
||||
}
|
||||
|
||||
deactivate -nondestructive
|
||||
|
||||
$env:VIRTUAL_ENV="C:\Users\Tobi\PycharmProjects\Cozmo_LineFollow\venv"
|
||||
|
||||
if (! $env:VIRTUAL_ENV_DISABLE_PROMPT) {
|
||||
# Set the prompt to include the env name
|
||||
# Make sure _OLD_VIRTUAL_PROMPT is global
|
||||
function global:_OLD_VIRTUAL_PROMPT {""}
|
||||
copy-item function:prompt function:_OLD_VIRTUAL_PROMPT
|
||||
function global:prompt {
|
||||
Write-Host -NoNewline -ForegroundColor Green '(venv) '
|
||||
_OLD_VIRTUAL_PROMPT
|
||||
}
|
||||
}
|
||||
|
||||
# Clear PYTHONHOME
|
||||
if (Test-Path env:PYTHONHOME) {
|
||||
copy-item env:PYTHONHOME env:_OLD_VIRTUAL_PYTHONHOME
|
||||
remove-item env:PYTHONHOME
|
||||
}
|
||||
|
||||
# Add the venv to the PATH
|
||||
copy-item env:PATH env:_OLD_VIRTUAL_PATH
|
||||
$env:PATH = "$env:VIRTUAL_ENV\Scripts;$env:PATH"
|
||||
@@ -0,0 +1,75 @@
|
||||
import cozmo
|
||||
import time
|
||||
from cozmo.util import degrees, distance_mm, speed_mmps
|
||||
|
||||
|
||||
def cozmo_program(robot: cozmo.robot.Robot):
|
||||
# robot.say_text("Hi Martina").wait_for_completed()
|
||||
# Drive forwards for 150 millimeters at 50 millimeters-per-second.
|
||||
# robot.drive_straight(distance_mm(150), speed_mmps(50)).wait_for_completed()
|
||||
|
||||
# Turn 90 degrees to the left.
|
||||
# Note: To turn to the right, just use a negative number.
|
||||
# robot.turn_in_place(degrees(90)).wait_for_completed()
|
||||
|
||||
print("fov_x ", robot.camera.config.fov_x)
|
||||
print("fov_y ", robot.camera.config.fov_y)
|
||||
print("focal_length ", robot.camera.config.focal_length)
|
||||
|
||||
cozmo = CozmoDriver(robot)
|
||||
cozmo.updateLift()
|
||||
cozmo.drive()
|
||||
|
||||
turn_speed = 30
|
||||
forward_speed = 50
|
||||
|
||||
l_wheel_speed = (0 * forward_speed) + (turn_speed * 1)
|
||||
r_wheel_speed = (0 * forward_speed) - (turn_speed * 1)
|
||||
robot.drive_wheels(l_wheel_speed,r_wheel_speed,l_wheel_speed *4,r_wheel_speed *4)
|
||||
time.sleep(9.5)
|
||||
|
||||
|
||||
|
||||
class CozmoDriver:
|
||||
""" Contains all functions that will be used to move cozmo
|
||||
"""
|
||||
|
||||
def __init__(self, robot: cozmo.robot.Robot):
|
||||
self.speed = 50
|
||||
self.turnSpeed = 30
|
||||
self.robot = robot
|
||||
self.initializeDriver()
|
||||
|
||||
def initializeDriver(self):
|
||||
""" Set Cozmo in the starting position
|
||||
"""
|
||||
self.updateLift()
|
||||
self.updateHead()
|
||||
|
||||
def drive(self):
|
||||
""" Start driving
|
||||
"""
|
||||
self.robot.drive_wheel_motors(self.speed, self.speed)
|
||||
|
||||
def driveLeft(self):
|
||||
""" Drive to left
|
||||
"""
|
||||
self.robot.drive_wheel_motors(self.speed - 15, self.speed)
|
||||
|
||||
def driveRight(self):
|
||||
""" Drive to right
|
||||
"""
|
||||
self.robot.drive_wheel_motors(self.speed, self.speed - 15)
|
||||
|
||||
def updateLift(self):
|
||||
""" Set Lift to maximum height
|
||||
"""
|
||||
self.robot.set_lift_height(1).wait_for_completed()
|
||||
|
||||
|
||||
def updateHead(self):
|
||||
""" Set Head to minimum angle
|
||||
"""
|
||||
self.robot.set_head_angle(cozmo.robot.MIN_HEAD_ANGLE).wait_for_completed()
|
||||
|
||||
cozmo.run_program(cozmo_program)
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,76 @@
|
||||
# This file must be used with "source bin/activate" *from bash*
|
||||
# you cannot run it directly
|
||||
|
||||
deactivate () {
|
||||
# reset old environment variables
|
||||
if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then
|
||||
PATH="${_OLD_VIRTUAL_PATH:-}"
|
||||
export PATH
|
||||
unset _OLD_VIRTUAL_PATH
|
||||
fi
|
||||
if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then
|
||||
PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}"
|
||||
export PYTHONHOME
|
||||
unset _OLD_VIRTUAL_PYTHONHOME
|
||||
fi
|
||||
|
||||
# This should detect bash and zsh, which have a hash command that must
|
||||
# be called to get it to forget past commands. Without forgetting
|
||||
# past commands the $PATH changes we made may not be respected
|
||||
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
|
||||
hash -r
|
||||
fi
|
||||
|
||||
if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
|
||||
PS1="${_OLD_VIRTUAL_PS1:-}"
|
||||
export PS1
|
||||
unset _OLD_VIRTUAL_PS1
|
||||
fi
|
||||
|
||||
unset VIRTUAL_ENV
|
||||
if [ ! "$1" = "nondestructive" ] ; then
|
||||
# Self destruct!
|
||||
unset -f deactivate
|
||||
fi
|
||||
}
|
||||
|
||||
# unset irrelevant variables
|
||||
deactivate nondestructive
|
||||
|
||||
VIRTUAL_ENV="C:\Users\Tobi\PycharmProjects\Cozmo_LineFollow\venv"
|
||||
export VIRTUAL_ENV
|
||||
|
||||
_OLD_VIRTUAL_PATH="$PATH"
|
||||
PATH="$VIRTUAL_ENV/Scripts:$PATH"
|
||||
export PATH
|
||||
|
||||
# unset PYTHONHOME if set
|
||||
# this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
|
||||
# could use `if (set -u; : $PYTHONHOME) ;` in bash
|
||||
if [ -n "${PYTHONHOME:-}" ] ; then
|
||||
_OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}"
|
||||
unset PYTHONHOME
|
||||
fi
|
||||
|
||||
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
|
||||
_OLD_VIRTUAL_PS1="${PS1:-}"
|
||||
if [ "x(venv) " != x ] ; then
|
||||
PS1="(venv) ${PS1:-}"
|
||||
else
|
||||
if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then
|
||||
# special case for Aspen magic directories
|
||||
# see http://www.zetadev.com/software/aspen/
|
||||
PS1="[`basename \`dirname \"$VIRTUAL_ENV\"\``] $PS1"
|
||||
else
|
||||
PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1"
|
||||
fi
|
||||
fi
|
||||
export PS1
|
||||
fi
|
||||
|
||||
# This should detect bash and zsh, which have a hash command that must
|
||||
# be called to get it to forget past commands. Without forgetting
|
||||
# past commands the $PATH changes we made may not be respected
|
||||
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
|
||||
hash -r
|
||||
fi
|
||||
@@ -0,0 +1,45 @@
|
||||
@echo off
|
||||
|
||||
rem This file is UTF-8 encoded, so we need to update the current code page while executing it
|
||||
for /f "tokens=2 delims=:" %%a in ('"%SystemRoot%\System32\chcp.com"') do (
|
||||
set "_OLD_CODEPAGE=%%a"
|
||||
)
|
||||
if defined _OLD_CODEPAGE (
|
||||
"%SystemRoot%\System32\chcp.com" 65001 > nul
|
||||
)
|
||||
|
||||
set "VIRTUAL_ENV=C:\Users\Tobi\PycharmProjects\Cozmo_LineFollow\venv"
|
||||
|
||||
if not defined PROMPT (
|
||||
set "PROMPT=$P$G"
|
||||
)
|
||||
|
||||
if defined _OLD_VIRTUAL_PROMPT (
|
||||
set "PROMPT=%_OLD_VIRTUAL_PROMPT%"
|
||||
)
|
||||
|
||||
if defined _OLD_VIRTUAL_PYTHONHOME (
|
||||
set "PYTHONHOME=%_OLD_VIRTUAL_PYTHONHOME%"
|
||||
)
|
||||
|
||||
set "_OLD_VIRTUAL_PROMPT=%PROMPT%"
|
||||
set "PROMPT=(venv) %PROMPT%"
|
||||
|
||||
if defined PYTHONHOME (
|
||||
set "_OLD_VIRTUAL_PYTHONHOME=%PYTHONHOME%"
|
||||
set PYTHONHOME=
|
||||
)
|
||||
|
||||
if defined _OLD_VIRTUAL_PATH (
|
||||
set "PATH=%_OLD_VIRTUAL_PATH%"
|
||||
) else (
|
||||
set "_OLD_VIRTUAL_PATH=%PATH%"
|
||||
)
|
||||
|
||||
set "PATH=%VIRTUAL_ENV%\Scripts;%PATH%"
|
||||
|
||||
:END
|
||||
if defined _OLD_CODEPAGE (
|
||||
"%SystemRoot%\System32\chcp.com" %_OLD_CODEPAGE% > nul
|
||||
set "_OLD_CODEPAGE="
|
||||
)
|
||||
@@ -0,0 +1,21 @@
|
||||
@echo off
|
||||
|
||||
if defined _OLD_VIRTUAL_PROMPT (
|
||||
set "PROMPT=%_OLD_VIRTUAL_PROMPT%"
|
||||
)
|
||||
set _OLD_VIRTUAL_PROMPT=
|
||||
|
||||
if defined _OLD_VIRTUAL_PYTHONHOME (
|
||||
set "PYTHONHOME=%_OLD_VIRTUAL_PYTHONHOME%"
|
||||
set _OLD_VIRTUAL_PYTHONHOME=
|
||||
)
|
||||
|
||||
if defined _OLD_VIRTUAL_PATH (
|
||||
set "PATH=%_OLD_VIRTUAL_PATH%"
|
||||
)
|
||||
|
||||
set _OLD_VIRTUAL_PATH=
|
||||
|
||||
set VIRTUAL_ENV=
|
||||
|
||||
:END
|
||||
@@ -0,0 +1,12 @@
|
||||
#!C:\Users\Tobi\PycharmProjects\Cozmo_LineFollow\venv\Scripts\python.exe
|
||||
# EASY-INSTALL-ENTRY-SCRIPT: 'setuptools==39.1.0','console_scripts','easy_install-3.6'
|
||||
__requires__ = 'setuptools==39.1.0'
|
||||
import re
|
||||
import sys
|
||||
from pkg_resources import load_entry_point
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(
|
||||
load_entry_point('setuptools==39.1.0', 'console_scripts', 'easy_install-3.6')()
|
||||
)
|
||||
Binary file not shown.
@@ -0,0 +1,12 @@
|
||||
#!C:\Users\Tobi\PycharmProjects\Cozmo_LineFollow\venv\Scripts\python.exe
|
||||
# EASY-INSTALL-ENTRY-SCRIPT: 'setuptools==39.1.0','console_scripts','easy_install'
|
||||
__requires__ = 'setuptools==39.1.0'
|
||||
import re
|
||||
import sys
|
||||
from pkg_resources import load_entry_point
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(
|
||||
load_entry_point('setuptools==39.1.0', 'console_scripts', 'easy_install')()
|
||||
)
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,12 @@
|
||||
#!C:\Users\Tobi\PycharmProjects\Cozmo_LineFollow\venv\Scripts\python.exe
|
||||
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==10.0.1','console_scripts','pip'
|
||||
__requires__ = 'pip==10.0.1'
|
||||
import re
|
||||
import sys
|
||||
from pkg_resources import load_entry_point
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(
|
||||
load_entry_point('pip==10.0.1', 'console_scripts', 'pip')()
|
||||
)
|
||||
Binary file not shown.
@@ -0,0 +1,12 @@
|
||||
#!C:\Users\Tobi\PycharmProjects\Cozmo_LineFollow\venv\Scripts\python.exe
|
||||
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==10.0.1','console_scripts','pip3'
|
||||
__requires__ = 'pip==10.0.1'
|
||||
import re
|
||||
import sys
|
||||
from pkg_resources import load_entry_point
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(
|
||||
load_entry_point('pip==10.0.1', 'console_scripts', 'pip3')()
|
||||
)
|
||||
@@ -0,0 +1,12 @@
|
||||
#!C:\Users\Tobi\PycharmProjects\Cozmo_LineFollow\venv\Scripts\python.exe
|
||||
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==10.0.1','console_scripts','pip3.6'
|
||||
__requires__ = 'pip==10.0.1'
|
||||
import re
|
||||
import sys
|
||||
from pkg_resources import load_entry_point
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(
|
||||
load_entry_point('pip==10.0.1', 'console_scripts', 'pip3.6')()
|
||||
)
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user