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

install instructions + run example #15

Open
1 of 8 tasks
ahundt opened this issue Dec 14, 2017 · 17 comments
Open
1 of 8 tasks

install instructions + run example #15

ahundt opened this issue Dec 14, 2017 · 17 comments

Comments

@ahundt
Copy link

ahundt commented Dec 14, 2017

I've built http://drake.mit.edu/from_source.html with the bazel build. What are the steps for building this repository?

Current Status of my progress towards running an iiwa example:

Also, here is the automated setup script I'm creating as I go:
https://github.com/ahundt/robotics_setup/blob/master/locomotion_robotics.sh

@sammy-tri
Copy link
Collaborator

The README.md is a bit incomplete about the last steps, I see. You'll need to unzip a copy of the FRI library source code and apply the patch as described in https://github.com/RobotLocomotion/drake-iiwa-driver#c-driver (which should apply to FRI 1.7 through 1.13, possibly other versions). After that you should just be able to do bazel build //... from the top level directory and the driver will be emitted as bazel-bin/kuka-driver/kuka_driver. There's also CMake build infrastructure, but it hasn't really been tested outside of other superbuilds.

You'll also need the corresponding Java application installed through Sunrise as described in https://github.com/RobotLocomotion/drake-iiwa-driver#creating-the-java-application

@ahundt
Copy link
Author

ahundt commented Dec 14, 2017

I was able to guess some of that, but I think there are assumptions that I have access to your internal repository.


± bazel build //...
..............
INFO: Analysed target //kuka-driver:kuka_driver (16 packages loaded).
INFO: Found 1 target...
WARNING: /private/var/tmp/_bazel_athundt/2e02f43188a422c4c0469b2e655f98c4/external/kuka_fri/BUILD.bazel:5:1: input 'external/kuka_fri/build/GNUMake' to @kuka_fri//:kuka-fri-build is a directory; dependency checking of directories is unsound
WARNING: /private/var/tmp/_bazel_athundt/2e02f43188a422c4c0469b2e655f98c4/external/kuka_fri/BUILD.bazel:5:1: input 'external/kuka_fri/src' to @kuka_fri//:kuka-fri-build is a directory; dependency checking of directories is unsound
INFO: From Linking external/glib/libglib.a [for host]:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/glib/libglib.a(empty.o) has no symbols
warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: warning for library: bazel-out/host/bin/external/glib/libglib.a the table of contents is empty (no object file members in the library define global symbols)
INFO: From Linking external/glib/libglib.a:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/darwin-fastbuild/bin/external/glib/libglib.a(empty.o) has no symbols
warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: warning for library: bazel-out/darwin-fastbuild/bin/external/glib/libglib.a the table of contents is empty (no object file members in the library define global symbols)
INFO: From Linking external/lcm/lcm-gen [for host]:
clang: warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument]
ERROR: /private/var/tmp/_bazel_athundt/2e02f43188a422c4c0469b2e655f98c4/external/kuka_fri/BUILD.bazel:5:1: Executing genrule @kuka_fri//:kuka-fri-build failed (Exit 2)

... snip (a bunch of g++ commands) ...
cp -uf SimulatedTransformationProvider ../../bin
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
cp: illegal option -- u
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
       cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
make[1]: *** [install] Error 64
cp: illegal option -- u
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
       cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
make[1]: *** [install] Error 64
cp: illegal option -- u
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
       cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
make[1]: *** [install] Error 64
cp: illegal option -- u
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
       cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
make[1]: *** [install] Error 64
cp: illegal option -- u
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
       cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
make[1]: *** [install] Error 64
cp: illegal option -- u
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
       cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
make[1]: *** [install] Error 64
make: *** [examples] Error 2
Target //kuka-driver:kuka_driver failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 54.095s, Critical Path: 18.46s
FAILED: Build did NOT complete successfully
-> [1]

@sammy-tri
Copy link
Collaborator

Ah! I have unfortunately never tested the build on mac, which I see you've just discovered.

You may be able to get it to build by editing build/GNUMake/tools.mak and changing the definition of CP on line 13 to just be cp -f without the -u.

@ahundt
Copy link
Author

ahundt commented Dec 14, 2017

ok removing u worked for that step.

@ahundt
Copy link
Author

ahundt commented Dec 14, 2017

hmm, I'm still working on the macOS setup but since ubuntu was recommended by dependencies I started that but I've run into some problems on 16.04 RobotLocomotion/drake#7615

@ahundt
Copy link
Author

ahundt commented Dec 15, 2017

I'm confused about the setup and configuration process needed to run on the linux side. I know what to do with respect to installing sunrise and the java code on the robot controller.

  1. If I build drake, spartan, director, and drake-iiwa-driver with Bazel, is there a way to install on the system and set up a CMake find script so my own project can use the headers and binaries?
  2. How do I connect this to the other repositories?
  3. Do I need to provide a find path in my project's user code?
  4. Alternately, do you recommend I go with all CMake builds?

Sorry for so many questions and I appreciate the help!

Also, here is the automated setup script I'm creating as I go:
https://github.com/ahundt/robotics_setup/blob/master/locomotion_robotics.sh

@ahundt
Copy link
Author

ahundt commented Dec 15, 2017

Any chance you have or could create a docker container startup command that I could run from 16.04?

This might let me dodge all the setup issues and skip right to testing things out, but no worries if it doesn't exist or won't be practical. Thanks again for your help!

@ahundt ahundt changed the title install instructions install instructions + run example Dec 15, 2017
@peteflorence
Copy link

peteflorence commented Dec 16, 2017 via email

@ahundt
Copy link
Author

ahundt commented Dec 16, 2017

I also created a list so it will be easy for me to communicate my current progress towards running an example in the initial issue post at the top.

@ahundt
Copy link
Author

ahundt commented Dec 16, 2017

@peteflorence thanks for the recommendation, I'll give that a shot!

I'm familiar with ccmake and I've read most of the instructions, but is there a command you can recommend that would actually move the robot?

I'm not sure what to expect when I complete this step from the README.md:

Next, build the driver program to communicate with the iiwa arm using FRI, and with the controlling application using LCM. 
Compiling this project will output a single program in the build directory called "kuka_driver". 
Running it with no arguments will connect to the IIWA at it's default address and port (192.170.10.2, port 30200), negotiate LCM into the command state, and report the IIWA status via LCM.

If I run the program and it negotiates the connection I assume it will report some kind of success status but the following questions remain:

  1. What do I do after running kuka_driver?
  2. How should I expect the robot to be mounted?
  3. Are there any safety precautions I should take?

Sorry for the flurry of questions, I appreciate your help!

@sammy-tri
Copy link
Collaborator

(sorry for the delayed response!) Also sorry because that text is not very clear and even kinda wrong.

When kuka_driver starts up, it just sits there waiting for FRI traffic from the cabinet. It won't do anything until there's a Java application running which creates the FRISession (which then starts communicating with kuka_driver). It will print to the console indicating the establishment of the FRI session (DrakeFRIPositionDriver / DrakeFRITorqueDriver will also print that the session is established on the Kuka pad).

I don't think the mounting of the robot matters much as long as it's compatible with Kuka's requirements.

The arm shouldn't move at all until an LCM message is received by the driver, so no major safety precautions. The driver will (by default) stop the arm if it the torque sensed at a joint exceeds an limit in the driver. (That being said, I still wouldn't want to get pinched between the arm and anything else if that happens).

I just realized that I never committed the version of our code which starts DrakeFRITorqueDriver in joint impedance mode to git. I'll do that shortly (it does a bit less damage in the event of a collision).

Also those Java programs are not well named. The iiwa will track the positions sent in the LCM messages in either mode. I don't have sufficient experience sending non-zero torques to the arm to know precisely what happens, but I believe the extra torque will be added to whatever the iiwa is doing for position control and cause additional deflection at that joint.

@sammy-tri
Copy link
Collaborator

#18 has the change for joint impedance mode in the torque driver. Will probably land tomorrow.

@ahundt
Copy link
Author

ahundt commented Dec 21, 2017

Cool! I'm still working on getting this set up and I'm just not familiar with drake, lcm, etc yet. Would you mind giving me:

  1. An exact command line command that I could run with an existing example that causes the robot to move?
  2. Point me to where I can find & build the above (for example there are both bazel and cmake builds, I don't know which to use)

I should be good to go W.R.T. installing the java code, actually I already have my own test code on the cabinet that should work to start FRI. I just need something I can just run and step through in a debugger so I can learn how the whole stack works and see if there are delays/etc.

Thanks for your help!

@sammy-tri
Copy link
Collaborator

I need to apologize again for the fact that there's not a general purpose demo of moving the robot with drake in drake (there was, as I mentioned in #14, and we haven't regained that functionality).

In the interest of moving the robot at all, I created this branch https://github.com/sammy-tri/drake/tree/just_do_something (specifically this commit sammy-tri/drake@ed851a4 ) which clones kuka_plan_runner and demonstrates a minimal implementation of moving the robot. Running it repeatedly will move the robot back and forth between two poses which I chose arbitrarily.

To run, build drake-iiwa-driver and drake (either from my branch or with the patch applied) with bazel (bazel build //...), and run in separate terminals:
drake-iiwa-driver/bazel-bin/kuka-driver/kuka_driver

And from the root of the drake build:
bazel-bin/examples/kuka_iiwa_arm/kuka_do_something

You can test it in simulation first by running from the root of the drake build:
bazel-bin/tools/drake_visualizer
bazel-bin/examples/kuka_iiwa_arm/kuka_simulation
bazel-bin/examples/kuka_iiwa_arm/kuka_do_something

This example doesn't really show off any interesting features in drake (no inverse kinematics, doesn't use drake systems, etc)... but it does move the robot. I'm sorry again there isn't a better example. I'll get to work on that soon.

@ahundt
Copy link
Author

ahundt commented Dec 24, 2017

Awesome, thanks that will be perfect! It is super helpful to have something simple like that to ensure everything builds right, the pipeline is transferring data correctly, and to walk through the code so I know the areas to focus on learning. I'll give it a try after the holiday

@sammy-tri
Copy link
Collaborator

With the merge of RobotLocomotion/drake#7728 there's now a slightly better demo program/setup for moving the robot around, but it's not great. https://github.com/RobotLocomotion/drake/blob/master/examples/kuka_iiwa_arm/README.md documents how to run it with kuka_simulation, replacing that with kuka_driver should work to run on a real robot.

@ahundt
Copy link
Author

ahundt commented Jan 16, 2018

awesome, thanks! I'll see if I can give it a try this week, hopefully Thursday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants