Skip to content

Commit

Permalink
Merge pull request #11 from Improbable-AI/qa
Browse files Browse the repository at this point in the history
Minor changes to docs
  • Loading branch information
taochenshh authored Feb 11, 2020
2 parents 8889283 + 3a8bbd5 commit 5f9c6f2
Show file tree
Hide file tree
Showing 23 changed files with 209 additions and 118 deletions.
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# AIRobot

[![Documentation Status](https://readthedocs.org/projects/airobot/badge/?version=latest)](https://airobot.readthedocs.io/en/latest/?badge=latest)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/Improbable-AI/airobot/blob/master/LICENSE)

AIRobot is a python library to interface with robots. It follows a similar architecture from [PyRobot](https://pyrobot.org).
- [Citation](#citation)
- [Installation](#installation)
Expand All @@ -10,6 +13,7 @@ AIRobot is a python library to interface with robots. It follows a similar archi
- [Run Tests](#run-tests)
- [License](#license)
- [Coding Style](#coding-style)
- [Acknowledgement](#acknowledgement)

## Citation

Expand Down Expand Up @@ -104,6 +108,8 @@ MIT license

AIRobot uses [Google style](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html) for formatting docstrings. We use [Flake8](https://pypi.org/project/flake8/) to perform additional formatting and semantic checking of code.

## Acknowledgement

We gratefully acknowledge the support from Sony Research Grant and DARPA Machine Common Sense Program.


3 changes: 1 addition & 2 deletions examples/ur5e/real/joint_position_control.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import time

import airobot as ar
from airobot import Robot


def main():
Expand All @@ -23,7 +22,7 @@ def main():
collision free (change the goal positions when use_urscript=True
at your own risk).
"""
robot = Robot('ur5e_2f140', pb=False, use_cam=False)
robot = ar.Robot('ur5e_2f140', pb=False, use_cam=False)
robot.arm.go_home()

goal_pos = [0.5, -2, -1.1, -0.95, 1.7, -0.1]
Expand Down
3 changes: 0 additions & 3 deletions examples/ur5e/real/pushing.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ def draw_segments(pts, labels, core_samples_mask):
print('Estimated number of clusters: %d' % n_clusters_)
for k, col in zip(unique_labels, colors):
if k == -1:
# Black used for noise.
col = [0, 0, 0, 1]
continue
class_member_mask = (labels == k)

Expand Down Expand Up @@ -262,7 +260,6 @@ def main():
push(bot, reset_pos, z_lowest=args.z_min)
except Exception as e:
print(e)
pass
time.sleep(1)


Expand Down
5 changes: 2 additions & 3 deletions examples/ur5e/real/set_ee_pose.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import time

import airobot as ar
from airobot import Robot


def print_pose(robot):
Expand Down Expand Up @@ -42,7 +41,7 @@ def main():
to be collision free (change the goal poses when use_urscript=True
at your own risk).
"""
robot = Robot('ur5e_2f140', pb=False, use_cam=False)
robot = ar.Robot('ur5e_2f140', pb=False, use_cam=False)
robot.arm.go_home()
max_iter = 5

Expand Down Expand Up @@ -84,7 +83,7 @@ def main():
robot.arm.set_comm_mode(use_urscript=True)

goal_pos = [0.6, -0.4, 0.2]
success = robot.arm.set_ee_pose(goal_pos, wait=True)
robot.arm.set_ee_pose(goal_pos, wait=True)
print_pose(robot)


Expand Down
4 changes: 2 additions & 2 deletions examples/ur5e/sim/block_stacking.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import time

import airobot as ar
import numpy as np
from airobot import Robot
from airobot import log_warn
from airobot.utils.common import euler2quat


Expand All @@ -14,7 +14,7 @@ def main():
robot = Robot('ur5e_2f140')
success = robot.arm.go_home()
if not success:
ar.log_warn('Robot go_home failed!!!')
log_warn('Robot go_home failed!!!')
ori = euler2quat([0, 0, np.pi / 2])
robot.pb_client.load_urdf('table/table.urdf',
[.5, 0, 0.4],
Expand Down
6 changes: 3 additions & 3 deletions examples/ur5e/sim/get_camera_images.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import airobot as ar
import matplotlib.pyplot as plt
import numpy as np
from airobot import Robot
from airobot import log_info


def main():
Expand All @@ -25,8 +25,8 @@ def main():
plt.imshow(rgb)
plt.figure()
plt.imshow(depth * 25, cmap='gray', vmin=0, vmax=255)
ar.log_info('Maximum Depth (m): %f' % np.max(depth))
ar.log_info('Minimum Depth (m): %f' % np.min(depth))
log_info('Maximum Depth (m): %f' % np.max(depth))
log_info('Minimum Depth (m): %f' % np.min(depth))
plt.figure()
plt.imshow(seg)
plt.show()
Expand Down
22 changes: 11 additions & 11 deletions examples/ur5e/sim/get_joint_info.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import airobot as ar
import numpy as np
from airobot import Robot
from airobot import log_info


def main():
Expand All @@ -10,22 +10,22 @@ def main():
"""
robot = Robot('ur5e_2f140', pb_cfg={'gui': True})
robot.arm.go_home()
ar.log_info('\nJoint positions for all actuated joints:')
log_info('\nJoint positions for all actuated joints:')
jpos = robot.arm.get_jpos()
ar.log_info(np.round(jpos, decimals=3))
log_info(np.round(jpos, decimals=3))
joint = 'shoulder_pan_joint'
ar.log_info('Joint [%s] position: %.3f' %
(joint, robot.arm.get_jpos('shoulder_pan_joint')))
ar.log_info('Joint velocities:')
log_info('Joint [%s] position: %.3f' %
(joint, robot.arm.get_jpos('shoulder_pan_joint')))
log_info('Joint velocities:')
jvel = robot.arm.get_jvel()
ar.log_info(np.round(jvel, decimals=3))
ar.log_info('Joint torques:')
log_info(np.round(jvel, decimals=3))
log_info('Joint torques:')
jtorq = robot.arm.get_jtorq()
ar.log_info(np.round(jtorq, decimals=3))
log_info(np.round(jtorq, decimals=3))
robot.arm.eetool.close()
ar.log_info('Gripper position (close): %.3f' % robot.arm.eetool.get_pos())
log_info('Gripper position (close): %.3f' % robot.arm.eetool.get_pos())
robot.arm.eetool.open()
ar.log_info('Gripper position (open): %.3f' % robot.arm.eetool.get_pos())
log_info('Gripper position (open): %.3f' % robot.arm.eetool.get_pos())


if __name__ == '__main__':
Expand Down
52 changes: 26 additions & 26 deletions examples/ur5e/sim/load_object.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import time

import airobot as ar
import numpy as np
from airobot import Robot
from airobot import log_info
from airobot.utils.common import euler2quat


Expand All @@ -16,25 +16,25 @@ def main():
robot.arm.go_home()

ori = euler2quat([0, 0, np.pi / 2])
table_id = robot.pb_client.load_urdf('table/table.urdf',
[1, 0, 0.4],
ori,
scaling=0.9)
robot.pb_client.load_urdf('table/table.urdf',
[1, 0, 0.4],
ori,
scaling=0.9)
sphere_id = robot.pb_client.load_geom('sphere',
size=0.05,
mass=1,
base_pos=[1, 0, 1.0],
rgba=[0, 1, 0, 1])
box_id = robot.pb_client.load_geom('box',
size=0.05,
mass=1,
base_pos=[1, 0.12, 1.0],
rgba=[1, 0, 0, 1])
box_id2 = robot.pb_client.load_geom('box',
size=[0.06, 0.02, 0.03],
mass=1,
base_pos=[1.3, 0.12, 1.0],
rgba=[0, 0, 1, 1])
robot.pb_client.load_geom('box',
size=0.05,
mass=1,
base_pos=[1, 0.12, 1.0],
rgba=[1, 0, 0, 1])
robot.pb_client.load_geom('box',
size=[0.06, 0.02, 0.03],
mass=1,
base_pos=[1.3, 0.12, 1.0],
rgba=[0, 0, 1, 1])
cylinder_id = robot.pb_client.load_geom('cylinder',
size=[0.06, 0.08],
mass=1,
Expand All @@ -47,19 +47,19 @@ def main():
base_pos=[0.9, -0.4, 1.0],
rgba=[0.5, 0.2, 1, 1])
pos, quat, lin_vel, ang_vel = robot.pb_client.get_body_state(cylinder_id)
ar.log_info('Cylinder:')
ar.log_info(' position: %s' % np.array2string(pos,
log_info('Cylinder:')
log_info(' position: %s' % np.array2string(pos,
precision=2))
log_info(' quaternion: %s' % np.array2string(quat,
precision=2))
log_info(' linear vel: %s' % np.array2string(lin_vel,
precision=2))
log_info(' angular vel: %s' % np.array2string(ang_vel,
precision=2))
ar.log_info(' quaternion: %s' % np.array2string(quat,
precision=2))
ar.log_info(' linear vel: %s' % np.array2string(lin_vel,
precision=2))
ar.log_info(' angular vel: %s' % np.array2string(ang_vel,
precision=2))
ar.log_info('Removing sphere')
res = robot.pb_client.remove_body(sphere_id)
log_info('Removing sphere')
robot.pb_client.remove_body(sphere_id)
time.sleep(2)
ar.log_info('Reset duck')
log_info('Reset duck')
robot.pb_client.reset_body(duck_id, base_pos=[0.9, -0.4, 1.0],
base_quat=[0, 0, 0, 1],
lin_vel=[0, 2, 0],
Expand Down
12 changes: 6 additions & 6 deletions examples/ur5e/sim/set_ee_pose.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import time

import airobot as ar
from airobot import Robot
from airobot import log_info


def main():
Expand All @@ -20,11 +20,11 @@ def main():
robot.arm.set_ee_pose(tgt_pos, tgt_euler)
time.sleep(1)
pos, quat, rot, euler = robot.arm.get_ee_pose()
ar.log_info('End effector pose:')
ar.log_info('Position:')
ar.log_info(pos)
ar.log_info('Euler angles:')
ar.log_info(euler)
log_info('End effector pose:')
log_info('Position:')
log_info(pos)
log_info('Euler angles:')
log_info(euler)


if __name__ == '__main__':
Expand Down
16 changes: 8 additions & 8 deletions examples/ur5e/sim/ur_dual_cam.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

from copy import deepcopy

import airobot as ar
import matplotlib.pyplot as plt
import numpy as np
from airobot import Robot
from airobot import log_info
from airobot.sensor.camera.rgbdcam_pybullet import RGBDCameraPybullet
from airobot.utils.common import ang_in_mpi_ppi
from airobot.utils.common import clamp
Expand Down Expand Up @@ -173,13 +173,13 @@ def render(self, **kwargs):
def main():
env = URRobotGym(gui=False)
ob = env.reset()
ar.log_info('\nThe action is a 5-dim vector A. \n'
'The range of each element is [-1, 1].\n'
'A[0] is dx, A[1] is dy, A[2] is dz;\n'
'A[3] is the delta of the gripper orientation;\n'
'A[4] is the gripper opening angle, \n'
'-1 means opening the gripper, \n'
'1 means closing the gripper.\n')
log_info('\nThe action is a 5-dim vector A. \n'
'The range of each element is [-1, 1].\n'
'A[0] is dx, A[1] is dy, A[2] is dz;\n'
'A[3] is the delta of the gripper orientation;\n'
'A[4] is the gripper opening angle, \n'
'-1 means opening the gripper, \n'
'1 means closing the gripper.\n')
image = plt.imshow(ob, interpolation='none',
animated=True, label="cam")
ax = plt.gca()
Expand Down
3 changes: 1 addition & 2 deletions examples/yumi/sim/joint_position_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

import airobot as ar
import numpy as np
from airobot import Robot


def main():
"""
This function demonstrates how to move the robot arm
to the desired joint positions.
"""
robot = Robot('yumi_grippers')
robot = ar.Robot('yumi_grippers')
robot.arm.go_home()

robot.arm.right_arm.set_jpos(
Expand Down
3 changes: 1 addition & 2 deletions examples/yumi/sim/set_ee_pose.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import time

import airobot as ar
from airobot import Robot


def main():
"""
Move the robot end effector to the desired pose.
"""
robot = Robot('yumi_grippers')
robot = ar.Robot('yumi_grippers')
robot.arm.go_home()
tgt_pos = [0.35, 0.0, 0.2]
robot.arm.set_ee_pose(tgt_pos, arm='right')
Expand Down
Loading

0 comments on commit 5f9c6f2

Please sign in to comment.