Skip to content

Commit 3871e64

Browse files
committed
Merge branch 'master' of [email protected]:DAInamite/programming-humanoid-robot-in-python.git
2 parents b8b6d31 + ac29bdc commit 3871e64

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

joint_control/add_training_data.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
"\n",
8686
"pose_name = 'Back'\n",
8787
"data_file = path.join('robot_pose_data', pose_name)\n",
88-
"data = pickle.load(open(data_file))"
88+
"data = pickle.load(open(data_file, 'rb'))"
8989
]
9090
},
9191
{
@@ -122,7 +122,7 @@
122122
"source": [
123123
"new_data = [0, 0, 0, 0, 0, 0, 0, 0, 0, -1.5707963267948966]\n",
124124
"data.append(new_data)\n",
125-
"pickle.dump(data, open(data_file, 'w'))"
125+
"pickle.dump(data, open(data_file, 'wb'))"
126126
]
127127
},
128128
{

joint_control/learn_posture.ipynb

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"\n",
2525
"* the dateset are in *robot_pose_data* folder\n",
2626
"* each file contains the data belongs to this posture, e.g. the data in *Back* file are collected when robot was in \"Back\" posture\n",
27-
"* the data file can be load by ```pickle```, e.g. ```pickle.load(open('Back'))```, the data is a list of feature data\n",
27+
"* the data file can be load by ```pickle```, e.g. ```pickle.load(open('Back', 'rb'))```, the data is a list of feature data\n",
2828
"* the features (e.g. each row of the data) are ['LHipYawPitch', 'LHipRoll', 'LHipPitch', 'LKneePitch', 'RHipYawPitch', 'RHipRoll', 'RHipPitch', 'RKneePitch', 'AngleX', 'AngleY'], where 'AngleX' and 'AngleY' are body angle (e.g. ```Perception.imu```) and others are joint angles."
2929
]
3030
},
@@ -103,7 +103,7 @@
103103
" # YOUR CODE HERE\n",
104104
" \n",
105105
" filename = path.join(ROBOT_POSE_DATA_DIR, classes[i])\n",
106-
" data = pickle.load(open(filename))\n",
106+
" data = pickle.load(open(filename, 'rb'))\n",
107107
" target = [i] * len(data)\n",
108108
" return data, target"
109109
]
@@ -370,7 +370,7 @@
370370
"source": [
371371
"import pickle\n",
372372
"ROBOT_POSE_CLF = 'robot_pose.pkl'\n",
373-
"pickle.dump(clf, open(ROBOT_POSE_CLF, 'w'))"
373+
"pickle.dump(clf, open(ROBOT_POSE_CLF, 'wb'))"
374374
]
375375
},
376376
{

0 commit comments

Comments
 (0)