I installed drake (tried both from apt and compiler from source) and then i want to to run some examples in order to start learning the software. (I have some-experience because i have run some notebooks in pydrake). However, the some examples that also include visualization do not seem to work.
What i want:
A working simple example that uses either drake-visualizer
or meldis
and meshcat
, written in C++, to
- Completely test my installation and
- then use it as a standard practice to build my own simulations and learn drake. (Like ros tutorials)
What i have tried:
Apt installation - 1st way:
I followed these instructions to install a pre-compiled version of drake. (Apart from updating my
PATH
andPYTHONPATH
environmental variables).I downloaded drake-external-examples to test my installation. I compiled and run the
drake_cmake_installed_apt
examples, and all the tests passed.Then, as i wanted to test visualization, I built
drake_cmake_installed
that contains the example ofuniformly_accerated_particle
. Here one test failed. The output is:
Running tests...
Test project /home/papaveneti/drake2/drake_examples/drake_cmake_installed/build
Start 1: import_all_test
1/6 Test #1: import_all_test .................. Passed 0.35 sec
Start 2: find_resource_example
2/6 Test #2: find_resource_example ............ Passed 0.02 sec
Start 3: find_resource_example_py
3/6 Test #3: find_resource_example_py ......... Passed 0.11 sec
Start 4: particle_test
4/6 Test #4: particle_test .................... Passed 0.02 sec
Start 5: simple_bindings_test
5/6 Test #5: simple_bindings_test .............***Failed 0.21 sec
Start 6: simple_continuous_time_system
6/6 Test #6: simple_continuous_time_system .... Passed 0.02 sec
83% tests passed, 1 tests failed out of 6
Total Test time (real) = 0.72 sec
The following tests FAILED:
5 - simple_bindings_test (Failed)
Errors while running CTest
make: *** [Makefile:84: test] Error 8
But from what i understant, the problem is that the module simple_bindings
that is created in the example, isn't being found during the execution of simple_bindings.py
. So, this doesn't affect the visualiazation.
Then, i run:
$ /opt/drake/bin/drake-visualizer & ( cd src/particles/ && exec ./uniformly_accelerated_particle)
Apt installation - 2nd way:
I did the same steps, but before building and running the examples, I run:
export PATH="/opt/drake/bin${PATH:+:${PATH}}"
export PYTHONPATH="/opt/drake/lib/python$(python3 -c 'import sys; print("{0}.{1}".format(*sys.version_info))')/site-packages${PYTHONPATH:+:${PYTHONPATH}}"
I got exactly the same results.
Source installation:
I had the same results, while trying to run the same examples. (I think the python bindings were succesful, but i have since uninstalled it).
extra
- OS: ubuntu 20.04 LTS
- I want to use cmake (not bazel) in order to use drake alongside ros1 in the future (after i have learned the basics of drake).
- I want to use the C++ version of drake.
The file atlas_run_dynamics.cc is an OK demo for that purpose. You can copy that file to your project, build, and run it:
It adds visualization of the simulation by calling
visualization::AddDefaultVisualization(&builder);
, which is the canonical way to visualize todrake-visualizer
and/ormeldis
.By default, it runs faster than realtime so I suggest running with
--simulator_target_realtime_rate=1
to slow it down.See also drake-ros which offers a way to visualize a Drake simulation using RViz.
p.s. Sorry that the particles was broken. We intended to delete that example code but forgot to delete all of the copies.