-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [core] Full support of serialization of 'Robot'. (#770) (#775) * [core] Do NOT use 'enable_shared_from_this' if not strictly necessary. (#775) * [core] Rename macro 'PRINT_WARNING' in 'JIMINY_WARNING' to avoid conflicts. (#775) * [python/simulator] 'plot' now support multi-robot simulations. (#770) * [gym/common] Speedup 'PDController' env pipeline block. (#770) * [gym/common] Speedup 'StackedJiminyEnv' wrapper. (#770) * [gym/common] More generic 'FilterObservation', 'StackedJiminyEnv' wrappers. (#770) (#776) * [gym/common] Improve 'render_mode' support. * [gym/zoo] Cleanup and speedup toy model environments. (#770) * [gym/rllib] Fix multi-GPU support using custom PPO (#774) * [gym/rllib] Fix 'train' method typing and documentation. (#775) * [misc] Fix partially broken 'mypy' static type checking for 'jiminy_py' module. (#770) * [misc] Add RL tutorial notebook.
- Loading branch information
Showing
69 changed files
with
3,990 additions
and
1,041 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 |
---|---|---|
@@ -1,6 +1,80 @@ | ||
#ifndef JIMINY_SERIALIZATION_H | ||
#define JIMINY_SERIALIZATION_H | ||
|
||
#include <optional> // `std::optional` | ||
#include <string> // `std::string` | ||
#include <vector> // `std::vector` | ||
#include <memory> // `std::shared_ptr` | ||
|
||
#include "jiminy/core/fwd.h" | ||
|
||
|
||
// Forward declarations | ||
namespace pinocchio | ||
{ | ||
struct GeometryObject; | ||
struct GeometryModel; | ||
} | ||
|
||
namespace jiminy | ||
{ | ||
class Model; | ||
class Robot; | ||
|
||
class stateful_binary_iarchive; | ||
class stateful_binary_oarchive; | ||
} | ||
|
||
/* Jiminy-specific API for saving and loading data to binary format. | ||
Internally, it leverages `boost::serialization`, but unlike the classic interface `serialize`, | ||
it can be specified to pass option arguments, which allows for providing opt-in storage | ||
optimizations and recovery information when loading partially corrupted data. */ | ||
namespace jiminy | ||
{ | ||
template<typename T> | ||
std::string saveToBinary(const T & obj); | ||
|
||
template<typename T> | ||
void loadFromBinary(T & obj, const std::string & data); | ||
|
||
std::string saveToBinary(const std::shared_ptr<jiminy::Robot> & robot, | ||
bool isPersistent = true); | ||
|
||
void loadFromBinary(std::shared_ptr<jiminy::Robot> & robot, | ||
const std::string & data, | ||
const std::optional<std::string> & meshPathDir = std::nullopt, | ||
const std::vector<std::string> & meshPackageDirs = {}); | ||
} | ||
|
||
/* Partial specialization of `boost::serialization` API to enable serialization of complex classes. | ||
Unlike `loadFromBinary`, `saveToBinary`, this API does not expose mechanics to customize its | ||
internal, so the most conservation assumptions are made, eventually impeding performance. */ | ||
namespace boost::serialization | ||
{ | ||
// *************************************** pinocchio *************************************** // | ||
|
||
template<class Archive> | ||
void load_construct_data( | ||
Archive & ar, pinocchio::GeometryObject * geomPtr, const unsigned int version); | ||
|
||
template<class Archive> | ||
void serialize(Archive & ar, pinocchio::GeometryObject & geom, const unsigned int version); | ||
|
||
template<class Archive> | ||
void serialize(Archive & ar, pinocchio::GeometryModel & model, const unsigned int version); | ||
|
||
// ***************************************** jiminy **************************************** // | ||
|
||
template<class Archive> | ||
void serialize(Archive & ar, jiminy::Model & model, const unsigned int version); | ||
|
||
template<class Archive> | ||
void load_construct_data(Archive & ar, jiminy::Robot * robotPtr, const unsigned int version); | ||
|
||
template<class Archive> | ||
void serialize(Archive & ar, jiminy::Robot & robot, const unsigned int version); | ||
} | ||
|
||
#include "jiminy/core/io/serialization.hxx" | ||
|
||
#endif // JIMINY_SERIALIZATION_H |
Oops, something went wrong.