-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge refined codebase from hackathon branch to main. #64
Changes from all commits
5ca9e84
f6c4b05
534ec23
40ebce9
4753de6
ab137ba
edbe810
2f11154
b9e993e
f7da5e4
8d718e6
7bee8ba
58a1ece
6acac7b
31c9e33
46619ac
b4dcfc0
b6f8da6
9689808
b8d259b
33dabca
9fdd4b9
ac74471
4d8c079
46fac90
eda1105
aa0a201
d2ab7a9
847770e
1da22c1
67ada82
0df13d9
8a4d1e2
fcaf143
74d39ef
a793b7f
9a86c7e
1a67042
f30d925
6945638
1bade6a
c6e999a
1457622
d9387fe
0dfcb86
281f9e7
da555f5
ef6add0
9345d97
bf95314
c947995
ff39e4e
959c0be
eae4006
214bc9f
f5c74b2
53d78ec
3adb52c
d8871d2
de32777
a970a27
9af2766
e0e3df3
42e71ea
809821c
7342517
dc7dce7
4ac0cce
8ea4627
725b82c
8e7fbf8
2a3bd80
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Generate Documents with pdoc | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- hackathon | ||
|
||
jobs: | ||
setup-python: | ||
name: Generate Documentations | ||
runs-on: ubuntu-22.04 | ||
permissions: # Job-level permissions configuration starts here | ||
contents: write # 'write' access to repository contents | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # Ensures history is available for pushing changes | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' # Set this to your Python version | ||
|
||
- name: install-rcareworld | ||
run: | | ||
cd ./pyrcareworld | ||
pip install -r requirements.txt | ||
pip install -e . | ||
cd ../ | ||
|
||
- name: Install pdoc | ||
run: | | ||
pip install pdoc3 | ||
pdoc --skip-errors --html pyrcareworld -o docs | ||
|
||
- name: Commit Documentation | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Actions" | ||
git add docs/* | ||
git commit -m "Update documentation" || echo "No changes to commit" | ||
|
||
- name: Push Changes | ||
uses: ad-m/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: ${{ github.ref }} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. keep the original readme |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,16 +2,107 @@ | |
|
||
# Here is the code for RCareWorld V1.0.0 🦾 | ||
- Check the website https://emprise.cs.cornell.edu/rcareworld/ | ||
- Check the documentation and tutorials | ||
- [Full Install](https://sunny-building-1e7.notion.site/Full-install-RCareWorld-All-you-need-to-know-c5432d938f9545299f2b268373ec8abc?pvs=4) | ||
- [Minimum install](https://sunny-building-1e7.notion.site/Prebuilt-RCareWorld-All-you-need-to-know-8081cfe25ac4446784f463bc25152dc8?pvs=4) | ||
- Discuss in the forum https://github.com/empriselab/RCareWorld/discussions | ||
- Watch our presentation https://www.youtube.com/watch?v=mNy1cloWrP0 | ||
- Online OH calendar https://calendar.google.com/calendar/u/1?cid=Y18yODM5NTEwZDJjMjViOGQ1Njc4ZjAxNmI0NjYxYjQ5NDNhMjI1MTg1Y2Q4MGE1MGFhN2QwMDMyMDhkZjE5NWNmQGdyb3VwLmNhbGVuZGFyLmdvb2dsZS5jb20 | ||
And book additional time slots: https://calendly.com/ruolinye | ||
|
||
# RCareWorld now available on pypi and docker | ||
https://pypi.org/project/pyrcareworld/1.0.0/ | ||
Run `pip install pyrcareworld==1.0.0` to install from pypi | ||
|
||
https://hub.docker.com/repository/docker/cathyye2000/rcareworld/general The docker image for Python environment. Documents coming soon | ||
- Auto-generated APIs https://emprise.cs.cornell.edu/rcareworld-doc/ | ||
|
||
We support Windows, Linux (Tested on Ubuntu), and MacOS. You need to make sure git and git-lfs are installed on your system. You should use Git Bash if you have it (else Powershell) for windows, | ||
and use bash for Linux and MacOS. | ||
|
||
Please make sure your computer has enough (at least 5GB) free space before starting. | ||
|
||
# Pre-Installation Guide | ||
|
||
## Installing Git and Git Large File Storage | ||
|
||
You can skip this step if you already have git and git-lfs installed on your system. | ||
|
||
### Windows | ||
Follow https://www.youtube.com/watch?v=JgOs70Y7jew for git installation on Windows. | ||
|
||
### Linux | ||
#### Fedora | ||
Use `sudo dnf install git-all` | ||
#### Debian-Based Distribution (Ubuntu) | ||
Use `sudo apt install git-all` | ||
#### Other options | ||
Reference https://git-scm.com/download/linux | ||
|
||
### Mac | ||
Follow https://www.youtube.com/watch?v=Mf3l8z6oxQ0 for git installation on Mac. | ||
|
||
### Git Large File Storage | ||
Installation for git-lfs on all OS systems can be found here: https://docs.github.com/en/repositories/working-with-files/managing-large-files/installing-git-large-file-storage. | ||
|
||
## Cloning the Hackathon Repo | ||
|
||
Open up Terminal, Git Bash, or Powershell depending on the Operating System your computer is using. | ||
|
||
If you have ssh key setup on github use: | ||
`git clone [email protected]:empriselab/RCareWorld.git` | ||
|
||
otherwise, | ||
`git clone https://github.com/empriselab/RCareWorld.git` | ||
|
||
Navigate to the `RCareWorld` repository using the cd command. | ||
Example command: `cd RCareWorld` | ||
|
||
Checkout to the hackathon branch: | ||
`git checkout hackathon` | ||
|
||
Next, `git lfs pull`. | ||
|
||
Then navigate to `TestInstall` folder which is in `hackathon_demo` folder. | ||
|
||
You should expect to see `Linux.zip`, `Mac.zip`, and `Windows.zip` under `hackathon_demo/Build/TestInstall` folder. Unzip the one that matches your system. | ||
|
||
# Install Guide | ||
|
||
If you are preceeding immediately after the "Cloning the Hackathon Repo" step, navigate back to the RCareWorld directory. | ||
Example commands: `cd ~/RCareWorld` | ||
|
||
If you already have anaconda installed on your system, skip installing `install_conda`. | ||
|
||
## Windows | ||
Run `install/Windows/install_conda.bat`, and then run `install/Windows/install_pyrcareworld.bat`. | ||
|
||
Example commands: | ||
`./install/Windows/install_pyrcareworld.bat` | ||
|
||
Note on Windows you may need to install Microsoft Visual C++ 14.0 or greater using Visual Studio Installer. | ||
If you are confused as to how to do this, reference this tutorial: https://www.youtube.com/watch?v=yBvxsw6OOw4. | ||
|
||
## Ubuntu | ||
Run `install/Ubuntu/install_conda.sh`, and then run `install/Ubuntu/install_pyrcareworld.sh`. | ||
|
||
Example commands: | ||
`bash install/Ubuntu/install_pyrcareworld.sh` | ||
|
||
## Mac | ||
Run `install/Mac/install_conda.sh`, and then run `install/Mac/install_pyrcareworld.sh`. | ||
|
||
Example commands: | ||
`bash install/Mac/install_pyrcareworld.sh`. | ||
|
||
# Testing Installation | ||
Navigate to the `RCareWorld` folder and then to the `hackathon_demo` folder. | ||
|
||
Inside the `hackathon_demo` folder, you will find four files titled `test_install_linux.py`, `test_install_mac.py`, `test_install_mac_silicon.py`, and `test_install_windows.py`. In order to test installation, use the following commands: | ||
|
||
First activate the conda environment: `conda activate rcareworld`. | ||
|
||
## Windows | ||
Run `python test_install_windows.py`. | ||
|
||
## Linux | ||
Run `python test_install_linux.py`. | ||
|
||
## Mac | ||
### Intel | ||
Run `python test_install_mac.py`. | ||
### Apple Silicon | ||
Run `python test_install_mac_silicon.py`. | ||
### Don't know if Intel or Apple Silicon | ||
It is necessary that you run the correct test. If you do not know whether you have Apple Silicon or Intel, please reference this site https://www.sweetwater.com/sweetcare/articles/intel-based-mac-or-mac-with-apple-silicon/. | ||
|
||
## Test Result | ||
If you have correctly installed based on the installation guide, then a Unity window should open up and the resulting image should appear. | ||
 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Build filter=lfs diff=lfs merge=lfs -text | ||
*.zip filter=lfs diff=lfs merge=lfs -text |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
!**/*.zip |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove these large files. |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rm There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same for the zip files below. |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. keep the demos, but rename the folder from hackathon_demo to 'demo' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
from pyrcareworld.envs import RCareWorld | ||
from pyrcareworld.attributes import sponge_attr | ||
import random | ||
|
||
# Script to test bed bathing in hackathon. | ||
if __name__ == "__main__": | ||
# connect with the Unity environment | ||
# Change the path to the Unity executable file | ||
env = RCareWorld( | ||
executable_file="<YOurPathHere>" | ||
) | ||
|
||
# A collection of all force readings over all steps. | ||
all_nonzero_forces = [] | ||
|
||
# Create a robot and a target object | ||
# Control the robot arm | ||
robot = env.create_robot( | ||
id=123456, gripper_list=[123456], robot_name="stretch3", base_pos=[0, 0, 0] | ||
) | ||
# Control the robot base | ||
robot_base = env.create_robot(id = 12346, robot_name = 'mobile_base', base_pos = [0, 0, 1]) | ||
# The red cuba in the environment | ||
target = env.create_object(id=2333, name="Cube", is_in_scene=True) | ||
# Move the robot to the target object | ||
for i in range(10): | ||
position = target.getPosition() | ||
# print(position) | ||
robot.BioIKMove(position) | ||
env.step() | ||
# Move the robot base, don't move faster than this | ||
for i in range(100): | ||
position = robot_base.getRobotState()["position"] | ||
position[2]+=0.004 | ||
print(position) | ||
robot_base.setTransform(position) | ||
env.step() | ||
while True: | ||
position = target.getPosition() | ||
rotation = target.getRotation() | ||
robot.directlyMoveTo(position) | ||
|
||
# force on the sponge | ||
forces = env.instance_channel.data[509]["forces"] | ||
# painted area | ||
prop = env.instance_channel.data[509]["proportion"] | ||
msg = "" | ||
if len(forces) > 0: | ||
for force in forces: | ||
all_nonzero_forces.append(force) | ||
|
||
msg += ( | ||
"Forces Score: " | ||
+ str(sponge_attr.score_forces(all_nonzero_forces)) | ||
+ "\n" | ||
) | ||
|
||
if prop != None: | ||
msg += "Bathing Score: " + str(prop) + "\n" | ||
if len(msg) > 0: | ||
msg += "*************" | ||
print(msg) | ||
|
||
env.step() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from pyrcareworld.envs import RCareWorld | ||
import cv2 | ||
import numpy as np | ||
|
||
env = RCareWorld(executable_file="@Editor") | ||
|
||
|
||
env.instance_channel.set_action("GetRGB", id=654321, width=512, height=1024) | ||
info = env.instance_channel.data[654321] | ||
|
||
env.step() | ||
image_byte = env.instance_channel.data[654321]["rgb"] | ||
image_rgb = np.frombuffer(image_byte, dtype=np.uint8) | ||
image_rgb = cv2.imdecode(image_rgb, cv2.IMREAD_COLOR) | ||
cv2.imshow("show", image_rgb) | ||
cv2.waitKey(0) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from pyrcareworld.envs import RCareWorld | ||
import cv2 | ||
import numpy as np | ||
|
||
env = RCareWorld(executable_file="@Editor") | ||
cam = env.create_camera(id=654321, name="Camera", width=512, height=1024, is_in_scene=True) | ||
image_rgb = cam.getRGB() | ||
image_rgb = cv2.imdecode(image_rgb, cv2.IMREAD_COLOR) | ||
cv2.imshow("show", image_rgb) | ||
cv2.waitKey(0) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this. we don't use this to build doc anymore.