Python3 Installation¶
Note
DQ Robotics Python3 is recommended for most users.
Note
DQ Robotics Python3 is distributed as a LGPLV3 licensed package. Interface submodules might have additional licenses.
Note
Had any issues? Report them at the Python-Issue-Tracker.
Installation (Release)¶
The DQ Robotics Python3 is delivered through PyPI. On a Ubuntu LTS (Excluding EOL versions) system, open a terminal and run:
python3 -m pip install --user dqrobotics
Warning
The installation will fail for any unsupported system, even if that system has pip.
Installation (Development)¶
Warning
This package is unstable, which means that the API can suddenly change.
The development version of the library can be installed using the additional --pre
flag.
python3 -m pip install --user dqrobotics --pre
Updates¶
You can get updates with
python3 -m pip install --user dqrobotics --upgrade
Import¶
All the code is under the dqrobotics
module.
from dqrobotics import *
a = DQ(1,2,3,4,5,6,7,8)
print(a)
Using with the Robot Operating System (ROS)¶
The recommended pip
installation installs the library for a given user and should be visible to any ROS code executed by that user.
Interface modules¶
Warning
We offer support (on a voluntary basis) for the interface modules but no support whatsoever for the third-party software they interface with. For that, refer to their vendors.
Interface modules for DQRobotics Python3 are installed together with the core module.
Interface with CoppeliaSim (Formely V-REP)¶
Note
The V-REP interface (also compatible with CoppeliaSim) module uses BSD-licensed code distributed by CoppeliaRobotics. Refer to their license for details.
You do not need to do anything specific to make DQRobotics work with CoppeliaSim. It should work with the default configurations of CoppeliaSim. If it doe s not work out-of-the-box, be sure that the connection port is correctly configured (refer to CoppeliaSimRemoteAPI). The standard way is to have port 19997
configured in your remoteApiConnections.txt
.
Warning
Known issue: For MacOS users, CoppeliaSim’s default remote API port 19997
does not seem to open correctly on application startup. This is a CoppeliaSim issue, not an issue with DQRobotics. Another way way to open the port is to:
add
simRemoteApi.start(19997)
to the main script of the scenestart the simulation.
After that, the :DQ_VrepInterface
can be used normally. Note that this way, will you be unable to start and stop the simulation remotely.
The minimal example below will obtain the pose of the Floor on the default scene in CoppeliaSim.
from dqrobotics import *
from dqrobotics.interfaces.vrep import DQ_VrepInterface
remote_api_port = 19997 # This port needs to be configured correctly in your CoppeliaSim!
vi = DQ_VrepInterface()
try:
if not vi.connect(19997, 100, 10):
raise RuntimeError("Unable to connect to CoppeliaSim, be sure CoppeliaSim is opened in the default scene "
"and that port {} is correctly opened.".format(remote_api_port))
x_floor = vi.get_object_pose("Floor")
print("The pose of the floor is {}".format(x_floor))
print("The translation of the floor is {}".format(translation(x_floor)))
print("The rotation of the floor is {}".format(rotation(x_floor)))
except KeyboardInterrupt:
print("Interrupted by user, finishing cleanly.")
except Exception as e:
print("Exception caught: {}, finishing cleanly.".format(e))
finally:
vi.disconnect()
When it works correctly, the result will be
The pose of the floor is 1 + E*( - 0.05k)
The translation of the floor is - 0.1k
The rotation of the floor is 1
Interface with quadprog¶
Note
The quadprog package is licensed under GPLv2+. Refer to their license for details. The wrapper class DQ_QuadprogSolver
is licensed under the terms of DQRobotics.
To use the DQ_QuadprogSolver
(a wrapper of quadprog), you have to install quadprog. To do so, open a terminal and run:
python3 -m pip install quadprog --user
You can then import DQ_QuadprogSolver
as follows
from dqrobotics.solvers import DQ_QuadprogSolver