Skip to content
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

Vive teleop #351

Open
wants to merge 49 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
59d0a29
created script for controlling robot using vive
Oct 17, 2018
35b136d
improved control using viv
Nov 5, 2018
389255f
made easier to run vive demo
Nov 5, 2018
7b3264d
Merge branch 'master' into vive-teleop
Nov 6, 2018
46229b5
changes to make pybullet run
Nov 9, 2018
ad7315c
merged in gregs pybulllet changes
Nov 9, 2018
a500880
Merge branch 'gizatt_ee_teleop_stability' into vive-teleop
Nov 11, 2018
6b2c275
made run on real robot
jmcculloch2018 Nov 13, 2018
f1f513b
Merge branch 'master' into vive-teleop
Nov 13, 2018
ebd9014
cleanup for pr
Nov 13, 2018
d47bae5
updated documentation
Nov 14, 2018
07ec730
added play / pause to pt clouds and updated documentation
jmcculloch2018 Nov 15, 2018
9aa64cf
cleaned up for pr
jmcculloch2018 Nov 15, 2018
71df109
Merge branch 'vive-teleop' into gizatt_mbt_sim
jmcculloch2018 Nov 26, 2018
8f0bf6f
Added feature so that restarts plan after fails (waits for user to re…
jmcculloch2018 Dec 5, 2018
181aaa8
made ability to reset
jmcculloch2018 Dec 14, 2018
0bce79f
Added feature so that restarts plan after fails (waits for user to re…
jmcculloch2018 Dec 5, 2018
f278595
simple teleop based off of vive code, ready for pygame
peteflorence Feb 1, 2019
6c8140b
functional arm teleop
peteflorence Feb 1, 2019
2799a63
add gripper to simple teleop
peteflorence Feb 1, 2019
2b48f69
add roll to simple teleop
peteflorence Feb 1, 2019
b59a666
move gripper after moving robot to home
peteflorence Feb 1, 2019
f8bf915
slight cleanup of simple teleop
peteflorence Feb 1, 2019
00451f3
remove files didnt mean to commit
peteflorence Feb 1, 2019
d2c42a1
add control of yaw with side buttons on mouse
peteflorence Feb 1, 2019
f671d2b
controlling all 6dof now
peteflorence Feb 1, 2019
5a86a14
reset orientation goals when resetting
peteflorence Feb 1, 2019
1484a3f
do less prints in task space streaming controller
peteflorence Feb 7, 2019
8d8bb80
very functional teleop on real robot
peteflorence Feb 7, 2019
e68efe5
reasonably good state for non-blocking schunk driving
peteflorence Feb 8, 2019
e92f316
slightly better tuned sensitivity for keyboard controls
peteflorence Feb 8, 2019
5b6995c
log in the loop when teleopping
peteflorence Feb 9, 2019
669c305
temp pushing my sim config
peteflorence Feb 4, 2019
9b77102
update sim parameters
peteflorence Feb 9, 2019
ee0b86e
add timestamp to CartesianGoalPoint msg
peteflorence Feb 12, 2019
5f2987c
add rpy to goal msg
peteflorence Feb 12, 2019
f290539
remove unneeded from simple_teleop script
peteflorence Feb 12, 2019
64e6cce
more simplify teleop
peteflorence Feb 12, 2019
073800a
add __init__ for simple_teleop
peteflorence Feb 12, 2019
cba017e
switch to cLoader for yaml
peteflorence Feb 19, 2019
0fe4d6e
update simulation config
peteflorence Feb 20, 2019
9ea1df6
added logging
jmcculloch2018 Feb 24, 2019
60b8175
Merged master
jmcculloch2018 Feb 24, 2019
5aa1e28
merged in pete's changes
jmcculloch2018 Feb 25, 2019
cd4dabb
updated cmakelist
jmcculloch2018 Feb 26, 2019
9e962cd
Made cameras work
jmcculloch2018 Mar 5, 2019
b25e9eb
changed to jacobian transform control
jmcculloch2018 Mar 12, 2019
189c57c
Changed to damped least squares control
jmcculloch2018 Mar 15, 2019
90c794e
ready for data collection
jmcculloch2018 Apr 2, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
[submodule "src/catkin_projects/wsg50-ros-pkg"]
path = src/catkin_projects/wsg50-ros-pkg
url = [email protected]:RobotLocomotion/wsg50-ros-pkg
branch = pf-fix-ascii
[submodule "src/catkin_projects/razer_hydra_ros"]
path = src/catkin_projects/razer_hydra_ros
url = [email protected]:aleeper/razer_hydra_ros
url = [email protected]:aleeper/razer_hydra
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ ExternalProject_Add(spartan_lcmtypes

if (WITH_BULLET3)
set(BULLET3_GIT_REPOSITORY
"git@github.com:bulletphysics/bullet3.git"
"https://github.com/bulletphysics/bullet3.git"
CACHE STRING
"Location of bullet3 repo.")

Expand Down Expand Up @@ -268,7 +268,7 @@ if (WITH_TRIMESH)
message(FATAL_ERROR "Not using linux, don't know how to install v-hacd.")
endif()

SET(TRIMESH_GIT_REPOSITORY git@github.com:mikedh/trimesh.git)
SET(TRIMESH_GIT_REPOSITORY https://github.com/gizatt/trimesh.git)
SET(TRIMESH_GIT_TAG 2.35.15)
# Installs our customized version of trimesh
# to the project's site-packages build folder.
Expand Down
55 changes: 53 additions & 2 deletions apps/iiwa/iiwa_hardware.pmd
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ group "8.ROS" {
host = "localhost";
}

cmd "2.1 Static Transform Publisher"{
exec = "roslaunch station_config static_transforms.launch";
host = "localhost";
}

cmd "3.rviz" {
exec = "rosrun rviz rviz -d $SPARTAN_SOURCE_DIR/src/catkin_projects/station_config/RLG_iiwa_1/rviz.rviz";
host = "localhost";
Expand Down Expand Up @@ -167,8 +172,12 @@ group "8.ROS" {
host = "localhost";
}



}



group "9.iiwa_sim" {

cmd "0.drake_iiwa_sim" {
Expand All @@ -186,11 +195,33 @@ group "9.iiwa_sim" {
host = "localhost";
}

cmd "3.ROS-OpenNI-drake-iiwa-sim" {
exec = "roslaunch camera_config openni2_drake_iiwa_sim.launch camera_serial_number:=carmine_1";
cmd "3.ROS-OpenNI-drake-iiwa-sim-left" {
exec = "roslaunch camera_config openni2_drake_iiwa_sim.launch camera_serial_number:=sim_d415_left";
host = "localhost";
}

cmd "4.ROS-OpenNI-drake-iiwa-sim-right" {
exec = "roslaunch camera_config openni2_drake_iiwa_sim.launch camera_serial_number:=sim_d415_right";
host = "localhost";
}

}


group "imitation" {
cmd "1.imitation_tools" {
exec = "roslaunch imitation_tools imitation_bagging.launch camera_serial_number:=sim_d415_left";
host = "localhost";
}
cmd "2.vive_teleop" {
exec = "python $SPARTAN_SOURCE_DIR/scripts/bin/vive_teleop.py";
host = "localhost";
}
}

cmd "imitation_extract" {
exec = "python ./src/catkin_projects/imitation_tools/scripts/batch_extract_all_logs.py && cp -r ./data_volume ./export";
host = "localhost";
}

script "1.1.robot_full_startup" {
Expand Down Expand Up @@ -276,3 +307,23 @@ script "6.start_drake_iiwa_sim"
start cmd "2.state-translator";
start cmd "4.director";
}

script "7.start_vive_imitation"
{
start cmd "0.roscore";
wait ms 3000;

start cmd "2.ROS Model and TF Publisher";
start cmd "3.rviz";
start cmd "4.Robot Movement Service";
start cmd "5.IK Service";
start cmd "8.fusion_server";

start group "9.iiwa_sim";
start cmd "1.plan-runner";
start cmd "2.state-translator";
start cmd "4.director";

start group "imitation";

}
Binary file removed data/rosbag/iiwa/sr300_box.bag
Binary file not shown.
40 changes: 40 additions & 0 deletions doc/coordinate_conventions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Coordinate Conventions in pytorch-dense-correspondence

Keeping coordinate systems consistent is not a spontaneous event.

There are a few reasons this is not always straightforward:

- Typical computer vision "x,y,z" convention in 3D space is "right-down-forward"
- Associated with this right-down-forward convention, it's easiest to think about pixel positions
as being associated with this right, down convention. This gives us the "(u, v)" convention for defining
pixel coordinates.
- On the other hand, images that are arrays/tensors in numpy or torch are accessed as row, column, in that order.
That isn't consisent with the (u, v) convention
- Also on the other hand, typical robot convention is to think of "x" as being forward, away from the robot, and "y" to the left.
This gives "forward-left-up" for "x,y,z"

## Conventions

In this repo we would like to follow this simple convention for cartesian 3D frames:

- <b>All cartesian frames are specified in right-down-forward coordinates</b>.

But we currently have a more hybrid / mixed approach with accessing pixel data:

- <b>When doing 3D vision, we use the OpenCV "(u,v)" convention for pixel coordinates. This aligns with our
cartesian coordinate system as follows in this diagram:

<p align="center">
<img src="./OpenCVcoordinates.png" width="450"/>
</p>

- <b>All data stored as numpy arrays or torch tensors should be stored in row, column format</b>. This means
that in order to access the correct pixel in this data, if using (u,v) coordinates, you should access the data
as:

```python
pixel_at_u_v = data_tensor[v,u]
```
- To convert between (u,v) and single index the formulas are n = u + image_width * v. Similarly (u,v) = (n % image_width, n / image_width).


Binary file added doc/gripper_and_palm_frame.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/OpenCVcoordinates.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 44 additions & 11 deletions doc/vive_guide.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# Vive Teleop
This is a guide to using the HTC vive headset and controllers to teleop the robot in simulation or using hardware.

# Prerequisites
# Prerequisites for VR computer
- Follow the [HTC Vive Installation Guide](https://support.steampowered.com/kb_article.php?ref=2001-UXCM-4439)
- Install [Steam](https://store.steampowered.com/about/) and SteamVR
- Install Spartan using docker and checkout branch vive-teleop
- Clone spartan

# Install required packages
# Prerequisites for robot computer (run on same computer if using simulation)
- Install spartan using docker

# Install required packages (VR computer)
Run the following commands to install required packages
```
sudo apt-get install libudev-dev libvulkan-dev libsdl2-dev libglfw3-dev libssl-dev zlib1g-dev python-pip ros-kinetic-tf ros-kinetic-tf2*
Expand All @@ -16,7 +19,7 @@ pip install openvr

Additionally, clone the [OpenVR repository](https://github.com/ValveSoftware/openvr) into a known location

# Install ROS Plugins using catkin
# Install ROS Plugins using catkin (VR computer)
The Plugin is build using catkin. You have to create a catkin workspace first. Open up a terminal and:
```
mkdir -p catkin_ws/src
Expand All @@ -34,12 +37,42 @@ cd ..
catkin_make
source devel/setup.bash
```
# Run Vive Telop
# Run Vive Teleop Simulation
1. Start SteamVR and ensure that headset and controllers are tracking
2. Start spartan and run simulation or robot setup through procman
3. Source your catkin workspace and run `roslaunch htc_vive_teleop_stuff htc_vive_tf_and_joy.launch`
4. Close the instance of rviz opened by procman and start it outside the docker container
- Source your catkin workspace
2. In a new terminal, navigate to your spartan directory
- `./setup/docker/docker_run.py -nethost`
- In docker, start procman and run start simulation
- Through procman start the process *vive-teleop*
3. In a new terminal, navigate to your catkin workspace
- `source devel/setup.bash`
- `roslaunch htc_vive_teleop_stuff htc_vive_tf_and_joy.launch`
4. Close the instance of rviz opened by procman
5. In a new terminal, navigate to your catkin workspace
- `source devel/setup.bash`
- cd to your spartan folder and run `source build/setup_environment.sh`
- Run `rosrun rviz rviz -d $SPARTAN_SOURCE_DIR/src/catkin_projects/station_config/RLG_iiwa_1/rviz_vive.rviz";`
5. Through procman start the process *vive-teleop*
- `rosrun rviz rviz -d $SPARTAN_SOURCE_DIR/src/catkin_projects/station_config/RLG_iiwa_1/rviz_vive.rviz`
6. Put on the vive headset and look around. Press and hold the trackpad to move the arm and hold the trigger to close the gripper. Press the menu button (above trackpad) to play / pause point clouds.

# Run Vive Teleop on Robot
On robot computer:
1. Run `hostname -I` and look at the first entry to determine your ip address (should be 128.30.27.155 for kuka2). Write this number anywhere you see ROBOT_IP_HERE.
1. Navigate to your spartan directory and run `./setup/docker/docker_run.py -nethost`
2. Run `export ROS_IP=ROBOT_IP_HERE`
3. Start procman and set up robot normally
4. Through procman start the process *vive-teleop*

On VR computer:
1. Run `hostname -I` and look at the first entry to determine your ip address (should be 128.30.xx.xxx). Write this number anywhere you see VR_IP_HERE.
2. Start SteamVR and ensure that headset and controllers are tracking
3. In a new terminal, navigate to your catkin workspace
1. `export ROS_MASTER_URI=http://ROBOT_IP_HERE:11311`
2. `export ROS_IP=VR_IP_HERE`
3. `source devel/setup.bash`
4. `roslaunch htc_vive_teleop_stuff htc_vive_tf_and_joy.launch`
4. In a new terminal, navigate to your catkin workspace
1. `export ROS_MASTER_URI=http://ROBOT_IP_HERE:11311`
2. `export ROS_IP=VR_IP_HERE`
3. `source devel/setup.bash`
4. cd to your spartan folder and run `source build/setup_environment.sh`
5. `rosrun rviz rviz -d $SPARTAN_SOURCE_DIR/src/catkin_projects/station_config/RLG_iiwa_1/rviz_vive.rviz`
5. Put on the vive headset and look around. Press and hold the trackpad to move the arm and hold the trigger to close the gripper. Press the menu button (above trackpad) to play / pause point clouds.
Loading