This repository has been archived by the owner on Sep 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
43 changed files
with
638 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
cmake_minimum_required (VERSION 2.8.3) | ||
project (dvrk_python) | ||
|
||
## Find catkin macros and libraries | ||
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) | ||
## is used, also find other catkin packages | ||
find_package (catkin REQUIRED COMPONENTS | ||
rospy | ||
) | ||
|
||
## The catkin_package macro generates cmake config files for your package | ||
## Declare things to be passed to dependent projects | ||
## INCLUDE_DIRS: uncomment this if you package contains header files | ||
## LIBRARIES: libraries you create in this project that dependent projects also need | ||
## CATKIN_DEPENDS: catkin_packages dependent projects also need | ||
## DEPENDS: system dependencies of this project that dependent projects also need | ||
catkin_package ( | ||
# INCLUDE_DIRS include | ||
# LIBRARIES my_pkg | ||
CATKIN_DEPENDS rospy | ||
# DEPENDS system_lib | ||
) | ||
|
||
## Mark executable scripts (Python etc.) for installation | ||
## in contrast to setup.py, you can choose the destination | ||
# install(PROGRAMS | ||
# scripts/my_python_script | ||
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} | ||
# ) | ||
|
||
catkin_python_setup () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
## Introduction | ||
|
||
This directory contains: | ||
* dvrk_python module. This modules defines the class `robot` which uses the dVRK ROS topics to communicate with the `dvrk_console_json` application included in the `dvrk_robot` ROS package. | ||
* tutorial examples. Python scripts using the `dvrk_python` module. | ||
|
||
## Requirements | ||
|
||
You will need to build the dVRK software stack using the ROS catkin build tools, see https://github.com/jhu-dvrk/sawIntuitiveResearchKit/wiki/CatkinBuild | ||
|
||
The `dvrk_python` package is included in the `dvrk_ros` git repository. Please checkout the whole `dvrk_ros` repository and build it using the catkin build tools (don't use `catkin_make`). | ||
|
||
You will also need some extra Python packages: | ||
```sh | ||
sudo apt-get install ros-hydro-python-orocos-kdl ros-hydro-orocos-kinematics-dynamics ros-hydro-tf | ||
``` | ||
|
||
## Runtime | ||
|
||
You first need to start the dVRK console application: | ||
```sh | ||
rosrun dvrk_robot dvrk_console_json -j your_console_config_file.json | ||
``` | ||
|
||
Once the console is running, you can check which arms are available using the `rostopic` command: | ||
```sh | ||
rostopic list | ||
``` | ||
|
||
You should see one namespace per arm under `/dvrk`, e.g. `/dvrk/PSM1`, `/dvrk/MTML` and/or `/dvrk/ECM` based on your console configuration. | ||
|
||
Then in Python: | ||
```python | ||
from dvrk_python.robot import * | ||
mtml = robot('MTML') | ||
mtml.home() | ||
mtml.get_current_joint_position() | ||
... | ||
``` |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0"?> | ||
<package> | ||
<name>dvrk_python</name> | ||
<version>1.3.0</version> | ||
<description>The dVRK Python package</description> | ||
|
||
<maintainer email="[email protected]">Anton Deguet</maintainer> | ||
<license>CISST</license> | ||
|
||
<buildtool_depend>catkin</buildtool_depend> | ||
<build_depend>rospy</build_depend> | ||
<run_depend>rospy</run_depend> | ||
|
||
<!-- The export tag contains other, unspecified, tags --> | ||
<export> | ||
</export> | ||
|
||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
## ! DO NOT MANUALLY INVOKE THIS setup.py, USE CATKIN INSTEAD | ||
from distutils.core import setup | ||
from catkin_pkg.python_setup import generate_distutils_setup | ||
|
||
# fetch values from package.xml | ||
setup_args = generate_distutils_setup(packages=['dvrk_python'], | ||
package_dir={'': 'src'}, | ||
) | ||
|
||
setup(**setup_args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# __all__ = ["robot.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from robot import * | ||
import time | ||
|
||
def effort_test(robotName): | ||
r=robot(robotName) | ||
|
||
while(r.get_desired_joint_effort()[2] < 1): | ||
print r.get_desired_joint_effort()[2] | ||
r.delta_move_cartesian_translation([0.0,0.0,-0.001]) | ||
time.sleep(.3) | ||
print r.get_desired_joint_effort()[2] | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
if __name__ == '__main__': | ||
if (len(sys.argv) != 2): | ||
print sys.argv[0] + ' requires one argument, i.e. name of dVRK arm' | ||
else: | ||
effort_test(sys.argv[1]) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
"""In example we will learn how to turn off the robot. We will show how the following methods work: | ||
* shutdown() | ||
Lets take a look:""" | ||
|
||
# we are using the robot api and therefore we will need to import this class | ||
from dvrk_python.robot import * | ||
|
||
# check if we are given the name of the robot arm or not, if we are we can create a robot and call shutdown() | ||
if (len(sys.argv) != 2): | ||
print sys.argv[0] + ' requires one argument, i.e. name of dVRK arm' | ||
|
||
else: | ||
robotName = sys.argv[1] | ||
# initialize the robot, in this demo we called the robot r, and power the robot. | ||
r = robot(robotName) | ||
|
||
# shutdown() will turn off the robot | ||
r.shutdown() |
Oops, something went wrong.