-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into TSID/joint_regularization
- Loading branch information
Showing
22 changed files
with
2,564 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ build/* | |
|
||
# Qtcreator | ||
*.user* | ||
*.autosave |
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,8 @@ | ||
# Copyright (C) 2019 Istituto Italiano di Tecnologia (IIT). All rights reserved. | ||
# Copyright (C) 2020 Istituto Italiano di Tecnologia (IIT). All rights reserved. | ||
# This software may be modified and distributed under the terms of the | ||
# GNU Lesser General Public License v2.1 or any later version. | ||
|
||
|
||
add_subdirectory(joint-position-tracking) | ||
add_subdirectory(joint-trajectory-player) | ||
add_subdirectory(mas-imu-test) |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# This software may be modified and distributed under the terms of the | ||
# GNU Lesser General Public License v2.1 or any later version. | ||
# Authors: Ines Sorrentino | ||
|
||
add_bipedal_locomotion_application( | ||
NAME joint-trajectory-player | ||
SOURCES src/Main.cpp src/Module.cpp | ||
HEADERS include/BipedalLocomotion/JointTrajectoryPlayer/Module.h | ||
LINK_LIBRARIES YARP::YARP_dev | ||
BipedalLocomotion::Planners | ||
BipedalLocomotion::ParametersHandlerYarpImplementation | ||
BipedalLocomotion::RobotInterfaceYarpImplementation | ||
matioCpp::matioCpp | ||
BipedalLocomotion::matioCppConversions | ||
) | ||
|
||
install_ini_files(${CMAKE_CURRENT_SOURCE_DIR}/config) |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# joint-trajectory-player | ||
|
||
The **joint-trajectory-player** is a simple tool for playing a joint trajectory on a robot in a `YARP` environment. The tool allows you to save the measured joint positions and measured currents. | ||
|
||
## :running: How to use the application | ||
The application can be launched with the following command: | ||
``` | ||
blf-joint-trajectory-player --from blf-joint-trajectory-player-options.ini --trajectory_file file_of_the_joint_trajectory.mat | ||
``` | ||
The `.mat` file must have a field called `traj` containing the trajectory stored as a matrix in row major order. | ||
If you correctly installed the framework you can run the application from any folder. | ||
|
||
The [`blf-joint-trajectory-player-options.ini`](./config/robots/iCubGazeboV3/blf-joint-trajectory-player-options.ini) file contains some parameters that you may modify to control a given set of joints: | ||
- `robot_name`: name of the robot | ||
- `joints_list`: list of the controlled joints | ||
- `remote_control_boards`: list of associated control boards | ||
|
||
Please if you want to run the application for a different robot remember to create a new folder in `./config/robots/`. The name of the folder should match the name of the robot. |
17 changes: 17 additions & 0 deletions
17
...oint-trajectory-player/config/robots/iCubGazeboV3/blf-joint-trajectory-player-options.ini
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name joint-trajectory-player | ||
sampling_time 0.01 | ||
|
||
[ROBOT_INTERFACE] | ||
robot_name icubSim | ||
joints_list ("r_hip_pitch", "r_hip_roll", "r_hip_yaw", "r_knee", "r_ankle_pitch", "r_ankle_roll") | ||
remote_control_boards ("right_leg") | ||
|
||
[ROBOT_CONTROL] | ||
positioning_duration 3.0 | ||
positioning_tolerance 0.05 | ||
position_direct_max_admissible_error 0.1 | ||
|
||
[SENSOR_BRIDGE] | ||
check_for_nan false | ||
stream_joint_states true | ||
|
100 changes: 100 additions & 0 deletions
100
utilities/joint-trajectory-player/include/BipedalLocomotion/JointTrajectoryPlayer/Module.h
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 |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/** | ||
* @file Module.h | ||
* @authors Ines Sorrentino | ||
* @copyright 2020 Istituto Italiano di Tecnologia (IIT). This software may be modified and | ||
* distributed under the terms of the GNU Lesser General Public License v2.1 or any later version. | ||
*/ | ||
|
||
#ifndef BIPEDAL_LOCOMOTION_UTILITIES_JOINT_TRAJECTORY_PLAYER_MODULE_H | ||
#define BIPEDAL_LOCOMOTION_UTILITIES_JOINT_TRAJECTORY_PLAYER_MODULE_H | ||
|
||
// std | ||
#include <deque> | ||
#include <memory> | ||
#include <string> | ||
#include <vector> | ||
|
||
// YARP | ||
#include <yarp/os/RFModule.h> | ||
|
||
#include <matioCpp/matioCpp.h> | ||
|
||
#include <BipedalLocomotion/ParametersHandler/IParametersHandler.h> | ||
#include <BipedalLocomotion/Planners/QuinticSpline.h> | ||
#include <BipedalLocomotion/RobotInterface/YarpRobotControl.h> | ||
#include <BipedalLocomotion/RobotInterface/YarpSensorBridge.h> | ||
|
||
namespace BipedalLocomotion | ||
{ | ||
namespace JointTrajectoryPlayer | ||
{ | ||
|
||
class Module : public yarp::os::RFModule | ||
{ | ||
double m_dT; /**< RFModule period. */ | ||
std::string m_robot; /**< Robot name. */ | ||
|
||
Eigen::VectorXd m_currentJointPos; /**< Current joint positions. */ | ||
|
||
std::shared_ptr<yarp::dev::PolyDriver> m_robotDevice; /**< PolyDriver. */ | ||
|
||
RobotInterface::YarpRobotControl m_robotControl; /**< Robot control object. */ | ||
RobotInterface::YarpSensorBridge m_sensorBridge; /**< Sensor bridge object. */ | ||
|
||
int m_numOfJoints; /**< Number of joints to control. */ | ||
|
||
std::unordered_map<std::string, std::vector<double>> m_logJointPos; /**< Measured joint | ||
positions. */ | ||
|
||
std::vector<std::string> m_axisList; /**< Axis name list. */ | ||
|
||
matioCpp::MultiDimensionalArray<double> m_traj; /**< Joint trajectory. */ | ||
|
||
unsigned int m_idxTraj{0}; /**< Index to iterate the trajectory. */ | ||
|
||
enum class State | ||
{ | ||
idle, | ||
positioning, | ||
running | ||
}; | ||
State m_state{State::idle}; /** State machine */ | ||
|
||
bool createPolydriver(std::shared_ptr<ParametersHandler::IParametersHandler> handler); | ||
|
||
bool initializeRobotControl(std::shared_ptr<ParametersHandler::IParametersHandler> handler); | ||
|
||
bool instantiateSensorBridge(std::shared_ptr<ParametersHandler::IParametersHandler> handler); | ||
|
||
bool readStateFromFile(const std::string& filename, const std::size_t numFields); | ||
|
||
public: | ||
/** | ||
* Get the period of the RFModule. | ||
* @return the period of the module. | ||
*/ | ||
double getPeriod() override; | ||
|
||
/** | ||
* Main function of the RFModule. | ||
* @return true in case of success and false otherwise. | ||
*/ | ||
bool updateModule() override; | ||
|
||
/** | ||
* Configure the RFModule. | ||
* @param rf is the reference to a resource finder object | ||
* @return true in case of success and false otherwise. | ||
*/ | ||
bool configure(yarp::os::ResourceFinder& rf) override; | ||
|
||
/** | ||
* Close the RFModule. | ||
* @return true in case of success and false otherwise. | ||
*/ | ||
bool close() override; | ||
}; | ||
} // namespace JointTrajectoryPlayer | ||
} // namespace BipedalLocomotion | ||
|
||
#endif // BIPEDAL_LOCOMOTION_UTILITIES_JOINT_TRAJECTORY_PLAYER_MODULE_H |
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* @file Main.cpp | ||
* @authors Ines Sorrentino | ||
* @copyright 2020 Istituto Italiano di Tecnologia (IIT). This software may be modified and | ||
* distributed under the terms of the GNU Lesser General Public License v2.1 or any later version. | ||
*/ | ||
|
||
// YARP | ||
#include <yarp/os/LogStream.h> | ||
#include <yarp/os/Network.h> | ||
#include <yarp/os/RFModule.h> | ||
|
||
#include <BipedalLocomotion/JointTrajectoryPlayer/Module.h> | ||
|
||
int main(int argc, char* argv[]) | ||
{ | ||
// initialize yarp network | ||
yarp::os::Network yarp; | ||
if (!yarp.checkNetwork()) | ||
{ | ||
yError() << "[main] Unable to find YARP network"; | ||
return EXIT_FAILURE; | ||
} | ||
|
||
// prepare and configure the resource finder | ||
yarp::os::ResourceFinder& rf = yarp::os::ResourceFinder::getResourceFinderSingleton(); | ||
|
||
rf.setDefaultConfigFile("blf-joint-trajectory-player-options.ini"); | ||
|
||
rf.configure(argc, argv); | ||
|
||
// create the module | ||
BipedalLocomotion::JointTrajectoryPlayer::Module module; | ||
|
||
return module.runModule(rf); | ||
} |
Oops, something went wrong.