-
Notifications
You must be signed in to change notification settings - Fork 26
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
Update Python package with new ScenarI/O APIs #176
Update Python package with new ScenarI/O APIs #176
Conversation
This reverts commit 8e23abc724268a10a8bce89268c156420949ee64.
They will be replaced by new proxy resources of the scenario::gazebo::Model class
It will be replace by the new bullet plugin of ignition physics
TODO: add the envs there
a79a167
to
5197196
Compare
5197196
to
8c51e7f
Compare
111a769
to
3f4ba8a
Compare
3f4ba8a
to
5ec561a
Compare
They are relay classes that wrap a scenario::base::Model class
Ready to be reviewed |
@@ -50,6 +50,7 @@ namespace scenario { | |||
std::string getModelFileFromFuel(const std::string& URI, | |||
const bool useCache = false); | |||
std::string getRandomString(const size_t length); | |||
std::string getInstallPrefix(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to document that this is only valid if gym-ignition
is installed in Developer
mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I take advantage and I will document all the utils functions together in a new commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 9e8f58e
@@ -94,6 +94,11 @@ target_link_libraries(ScenarioGazebo | |||
set_target_properties(ScenarioGazebo PROPERTIES | |||
PUBLIC_HEADER "${SCENARIO_PUBLIC_HDRS}") | |||
|
|||
if(NOT CMAKE_BUILD_TYPE STREQUAL "PyPI") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will make life complicated for anyone packaging the project in any form, being it as part of a superbuild, as Debian packages or a conda recipe. Instead of conflating build logic and packaging logic, could we have an explicit CMake variable to select if the gym-ignition
project get installed in User mode or Developer mode, and then just specify the default based on the CMAKE_BUILD_TYPE
, something like:
if(NOT CMAKE_BUILD_TYPE STREQUAL "PyPI")
set(GYM_IGNITION_DEVELOPER_MODE_DEFAULT ON)
else()
set(GYM_IGNITION_DEVELOPER_MODE_DEFAULT OFF)
endif()
option(GYM_IGNITION_DEVELOPER_MODE "If ON, gym-ignition is installed in Developer mode, otherwise in user mode" ${GYM_IGNITION_DEVELOPER_MODE_DEFAULT})
if(GYM_IGNITION_DEVELOPER_MODE)
target_compile_options(ScenarioGazebo PRIVATE
-DGYMIGNITION_CMAKE_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}")
endif()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion of propagating the build type as normal option. I will have a look at it. I don't remember precisely why we had to define a new build type for PyPI in the first place, for sure I tried to use a normal CMake variable as first attempt and then I faced problems that led me to this build type workaround, that is much more convoluted. What I'm sure is that I didn't do it if there were more simple solutions :)
I am planning to give a refreshing also to the CMake project, I will keep you comment in mind.
This will make life complicated for anyone packaging the project in any form, being it as part of a superbuild, as Debian packages or a conda recipe.
This is something I don't understand. The PyPI type is not meant to be used by any downstream user or packager. It is meant to be used to create packages for PyPI, as the name (and we are the maintainers of the packages). Any other usage is not supported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will make life complicated for anyone packaging the project in any form, being it as part of a superbuild, as Debian packages or a conda recipe.
This is something I don't understand. The PyPI type is not meant to be used by any downstream user or packager. It is meant to be used to create packages for PyPI, as the name (and we are the maintainers of the packages). Any other usage is not supported.
Exactly. With this modification, now the only way to properly install gym-ignition
in a relocatable way is to set the CMAKE_BUILD_TYPE
to PyPI
, and I guess that this is not supported if you are not installing for PyPI
. I guess we want to support "proper" installation also if the project is not installed with PyPI
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ow ok now I understood your initial point: supporting a relocatable installation which could be implemented in the same way we package the project for PyPI.
Note the using PyPI for this purpose is wrong. In fact, due to how the shared libraries must be placed in the site_package
folder, you need to have the following installation tree:
install_tree/
├── gym_ignition
│ ├── [...]
│ ├── __init__.py
│ └── plugins
│ ├── libControllerRunner.so
│ ├── libECMProvider.so
│ ├── libJointController.so
│ └── libPhysicsSystem.so
├── gym_ignition_environments
│ ├── __init__.py
│ └── [...]
├── libECMSingleton.so
├── scenario_bindings.py
└── _scenario_bindings.so
As you can see, shared libraries are installed in the root of the CMAKE_INSTALL_PREFIX
, and plugins inside gym_ignition/plugins
. This is not what you want to obtain in a regular installation! In light of this, we should start thinking how to make coexist a (static) relocatable Developer installation with the PyPI build type without messing too much with the CMake project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not what you want to obtain in a regular installation! In light of this, we should start thinking how to make coexist a (static) relocatable Developer installation with the PyPI build type without messing too much with the CMake project.
Yes, we can also have a separate issue for that.
Gazebo simulator. | ||
|
||
Args: | ||
task_cls: The class of the handled task. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which classes are supported?
# Execute a paused step | ||
ok_run = self.gazebo.run(paused=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to explain the meaning of and need for a paused step in this context somewhere in the documentation in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Link for future #37
This PR updates most of the Python resources to work with the new ScenarI/O APIs. In particular:
Robot
interfaces ceccd7fGazeboRobot
class a113c01PyBulletRuntime
7658ea3PyBulletRobot
a113c01What's more meaningful to review are the following items:
gym.Env
interfaces. It's only the selected runtime that exposes it. This allows treating the runtime as environment and not anymore as wrapper, removing a forwarding step.GazeboRuntime
to use ScenarI/O bindings 70404c1This PR is already quite heavy and I don't want to add anything else. The environments will be still composed of a Runtime and a Task, but now this is no longer enough. In fact, there will be a third component that populates the environments: the Randomizer (and they are implemented as environment wrappers that extend
gym.Env.reset()
). The introduction of randomizers was necessary to allow Tasks to operate on multiple models. The next PR will introduce them.