Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieu-lapeyre committed Feb 19, 2015
2 parents 17a8c27 + 3ee5cfc commit d5ed8e8
Show file tree
Hide file tree
Showing 6 changed files with 794 additions and 6 deletions.
352 changes: 352 additions & 0 deletions software/notebooks/Demo Interface.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,352 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Initialisation"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from poppy.creatures import PoppyHumanoid\n",
"from pypot.primitive.move import MoveRecorder, MovePlayer\n",
"\n",
"poppy = PoppyHumanoid()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#Position"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Debout"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"poppy.stand_position.start()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Assis"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"poppy.sit_position.start()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Limit torque"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"poppy.limit_torque.start()"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"poppy.limit_torque.stop()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Idle"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"poppy.upper_body_idle_motion.start()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"poppy.head_idle_motion.start()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"poppy.upper_body_idle_motion.stop()\n",
"poppy.head_idle_motion.stop()"
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": false
},
"source": [
"# Interaction"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## arms turning compliant"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"poppy.arms_turn_compliant.start()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## arms copy"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"poppy.arms_copy_motion.start()"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"poppy.arms_turn_compliant.stop()\n",
"poppy.arms_copy_motion.stop()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Apprend un mouvement"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"rec = MoveRecorder(poppy, 50, poppy.arms)"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING:pypot.dynamixel.error:Timeout after sending DxlSyncReadDataPacket(ids=(31, 32, 33, 34, 35, 36, 37, 41, 42, 43, 44, 51, 52, 53, 54), address=36, length=6) to motors [42, 43, 44]\n"
]
}
],
"source": [
"for m in poppy.arms:\n",
" m.compliant = True\n",
" \n",
"rec.start()"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"rec.stop()\n",
"\n",
"move = MovePlayer(poppy, rec.move)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"for m in poppy.arms:\n",
" m.compliant = False"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"move.start()"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"move.stop()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Snap"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from pypot.server.snap import SnapRobotServer\n",
"\n",
"snap_server = SnapRobotServer(poppy, '0.0.0.0', 8080)\n",
"snap_server.run()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Killall primitives"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import time\n",
"\n",
"while poppy.active_primitives:\n",
" for p in poppy.active_primitives:\n",
" p.stop()\n",
" \n",
" time.sleep(0.1)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Loading

0 comments on commit d5ed8e8

Please sign in to comment.