From 57a6fc4d5a15eb6af315545cd30a79a57f89cb6f Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Mon, 9 Nov 2020 20:05:20 +0100 Subject: [PATCH 01/21] Implement add_bipedal_locomotion_application cmake function --- cmake/AddBipedalLocomotionApplication.cmake | 55 +++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 cmake/AddBipedalLocomotionApplication.cmake diff --git a/cmake/AddBipedalLocomotionApplication.cmake b/cmake/AddBipedalLocomotionApplication.cmake new file mode 100644 index 0000000000..f9f6fef7b3 --- /dev/null +++ b/cmake/AddBipedalLocomotionApplication.cmake @@ -0,0 +1,55 @@ +# Copyright (C) 2019 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. + +function(add_bipedal_locomotion_application) + + set(options) + set(oneValueArgs NAME) + set(multiValueArgs + SOURCES + HEADERS + LINK_LIBRARIES + SUBDIRECTORIES) + + set(prefix "bipedal_component") + + cmake_parse_arguments(${prefix} + "${options}" + "${oneValueArgs}" + "${multiValueArgs}" + ${ARGN}) + + set(name ${${prefix}_NAME}) + set(sources ${${prefix}_SOURCES}) + set(headers ${${prefix}_HEADERS}) + set(link_libraries ${${prefix}_LINK_LIBRARIES}) + set(subdirectories ${${prefix}_SUBDIRECTORIES}) + + # add an executable to the project using the specified source files. + add_executable(${name} ${sources} ${headers}) + + # Add C++17 features + target_compile_features(${name} PRIVATE cxx_std_17) + target_compile_definitions(${name} PRIVATE -D_USE_MATH_DEFINES) + + target_link_libraries(${name} PRIVATE ${link_libraries}) + + # Specify include directories for both compilation and installation process. + # The $ generator expression is useful to ensure to create + # relocatable configuration files, see https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html + #creating-relocatable-packages + target_include_directories(${name} PRIVATE "$") + + # Specify installation targets, typology and destination folders. + install(TARGETS ${name} + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin) + + # Add all subdirectories + foreach(subdir ${subdirectories}) + add_subdirectory(${subdir}) + endforeach() + + message(STATUS "Created target application ${name}.") + +endfunction() From fc0c62a23fcfd0d9c72b17587d468886ed28e708 Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Mon, 9 Nov 2020 20:08:02 +0100 Subject: [PATCH 02/21] Implement getJointList() in IRobotControl interface and in the YARP implementation --- .../BipedalLocomotion/RobotInterface/YarpRobotControl.h | 6 ++++++ .../YarpImplementation/src/YarpRobotControl.cpp | 5 +++++ .../BipedalLocomotion/RobotInterface/IRobotControl.h | 6 ++++++ 3 files changed, 17 insertions(+) diff --git a/src/RobotInterface/YarpImplementation/include/BipedalLocomotion/RobotInterface/YarpRobotControl.h b/src/RobotInterface/YarpImplementation/include/BipedalLocomotion/RobotInterface/YarpRobotControl.h index fb84c39d9c..681609fbee 100644 --- a/src/RobotInterface/YarpImplementation/include/BipedalLocomotion/RobotInterface/YarpRobotControl.h +++ b/src/RobotInterface/YarpImplementation/include/BipedalLocomotion/RobotInterface/YarpRobotControl.h @@ -104,6 +104,12 @@ class YarpRobotControl : public IRobotControl bool setReferences(Eigen::Ref desiredJointValues, const IRobotControl::ControlMode& mode) final; + /** + * Get the list of the controlled joints + * @return A vector containing the name of the controlled joints. + */ + std::vector getJointList() const final; + /** * Destructor */ diff --git a/src/RobotInterface/YarpImplementation/src/YarpRobotControl.cpp b/src/RobotInterface/YarpImplementation/src/YarpRobotControl.cpp index 8365c826fb..d42742b0aa 100644 --- a/src/RobotInterface/YarpImplementation/src/YarpRobotControl.cpp +++ b/src/RobotInterface/YarpImplementation/src/YarpRobotControl.cpp @@ -635,3 +635,8 @@ bool YarpRobotControl::checkMotionDone(bool& motionDone, return true; } + +std::vector YarpRobotControl::getJointList() const +{ + return m_pimpl->axesName; +} diff --git a/src/RobotInterface/include/BipedalLocomotion/RobotInterface/IRobotControl.h b/src/RobotInterface/include/BipedalLocomotion/RobotInterface/IRobotControl.h index aa6b0880bb..7eee594c06 100644 --- a/src/RobotInterface/include/BipedalLocomotion/RobotInterface/IRobotControl.h +++ b/src/RobotInterface/include/BipedalLocomotion/RobotInterface/IRobotControl.h @@ -90,6 +90,12 @@ class IRobotControl virtual bool setReferences(Eigen::Ref desiredJointValues, const IRobotControl::ControlMode& controlMode) = 0; + /** + * Get the list of the controlled joints + * @return A vector containing the name of the controlled joints. + */ + virtual std::vector getJointList() const = 0; + /** * Destructor. */ From cc465068b383b7caec65e1bfaedcdf754db7fc0a Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Mon, 9 Nov 2020 20:18:08 +0100 Subject: [PATCH 03/21] Implement the JointPositionTracking application --- .../JointPositionTracking/Module.h | 93 ++++++ utilities/JointPositionTracking/src/Main.cpp | 36 +++ .../JointPositionTracking/src/Module.cpp | 285 ++++++++++++++++++ 3 files changed, 414 insertions(+) create mode 100644 utilities/JointPositionTracking/include/BipedalLocomotion/JointPositionTracking/Module.h create mode 100644 utilities/JointPositionTracking/src/Main.cpp create mode 100644 utilities/JointPositionTracking/src/Module.cpp diff --git a/utilities/JointPositionTracking/include/BipedalLocomotion/JointPositionTracking/Module.h b/utilities/JointPositionTracking/include/BipedalLocomotion/JointPositionTracking/Module.h new file mode 100644 index 0000000000..876dac033c --- /dev/null +++ b/utilities/JointPositionTracking/include/BipedalLocomotion/JointPositionTracking/Module.h @@ -0,0 +1,93 @@ +/** + * @file Module.h + * @authors Giulio Romualdi + * @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_POSITION_TRACKING_MODULE_H +#define BIPEDAL_LOCOMOTION_UTILITIES_JOINT_POSITION_TRACKING_MODULE_H + +// std +#include +#include +#include + +// YARP +#include + +#include +#include +#include +#include + +namespace BipedalLocomotion +{ +namespace JointPositionTracking +{ + +class Module : public yarp::os::RFModule +{ + double m_dT; /**< RFModule period. */ + std::string m_robot; /**< Robot name. */ + + Eigen::VectorXd m_currentJointPos; + + std::shared_ptr m_robotDevice; + + BipedalLocomotion::RobotInterface::YarpRobotControl m_robotControl; + BipedalLocomotion::RobotInterface::YarpSensorBridge m_sensorBridge; + + std::vector m_setPoints; + std::vector::const_iterator m_currentSetPoint; + + BipedalLocomotion::Planners::QuinticSpline m_spline; + std::vector m_timeKnots; + std::vector m_trajectoryKnots; + + double m_initTrajectoryTime; + + bool generateNewTrajectory(); + + bool createPolydriver( + std::shared_ptr handler); + + bool initializeRobotControl( + std::shared_ptr handler); + + bool instantiateSensorBridge( + std::shared_ptr handler); + + std::vector m_logJointPos; + std::vector m_logDesiredJointPos; + +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 JointPositionTracking +} // namespace BipedalLocomotion + +#endif // BIPEDAL_LOCOMOTION_UTILITIES_JOINT_POSITION_TRACKING_MODULE_H diff --git a/utilities/JointPositionTracking/src/Main.cpp b/utilities/JointPositionTracking/src/Main.cpp new file mode 100644 index 0000000000..50dbb4d2ac --- /dev/null +++ b/utilities/JointPositionTracking/src/Main.cpp @@ -0,0 +1,36 @@ +/** + * @file Main.cpp + * @authors Giulio Romualdi + * @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 +#include +#include + +#include + +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("jointPositionTrackingOptions.ini"); + + rf.configure(argc, argv); + + // create the module + BipedalLocomotion::JointPositionTracking::Module module; + + return module.runModule(rf); +} diff --git a/utilities/JointPositionTracking/src/Module.cpp b/utilities/JointPositionTracking/src/Module.cpp new file mode 100644 index 0000000000..705d7a05e6 --- /dev/null +++ b/utilities/JointPositionTracking/src/Module.cpp @@ -0,0 +1,285 @@ +/** + * @file Module.cpp + * @authors Giulio Romualdi + * @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. + */ + +#include +#include + +#include +#include +#include + +#include + +#include + +using Vector1d = Eigen::Matrix; + +using namespace BipedalLocomotion; +using namespace BipedalLocomotion::JointPositionTracking; + +double Module::getPeriod() +{ + return m_dT; +} + +bool Module::createPolydriver(std::shared_ptr handler) +{ + // create the polydriver + m_robotDevice = std::make_shared(); + + auto robotInterfaceOptions = handler->getGroup("ROBOT_INTERFACE"); + + if (robotInterfaceOptions.lock() == nullptr) + { + std::cerr << "[Module::createPolydriver] Robot interface options is empty." << std::endl; + return false; + } + + std::vector jointsList; + robotInterfaceOptions.lock()->getParameter("joints_list", jointsList); + + std::vector controlBoards; + robotInterfaceOptions.lock()->getParameter("remote_control_boards", controlBoards); + + if(jointsList.size() != 1 || controlBoards.size() != 1) + { + std::cerr << "[Module::createPolydriver] The current implementation can be used to control " + "only one joint. Please be sure that the size of the joint_list and " + "remote_control_boards is equal to one." + << std::endl; + return false; + } + + std::string robotName; + robotInterfaceOptions.lock()->getParameter("robot_name", robotName); + + // open the remotecontrolboardremepper YARP device + yarp::os::Property options; + options.put("device", "remotecontrolboardremapper"); + + options.addGroup("axesNames"); + yarp::os::Bottle& bot = options.findGroup("axesNames").addList(); + for (const auto& joint : jointsList) + bot.addString(joint); + + yarp::os::Bottle remoteControlBoards; + + yarp::os::Bottle& remoteControlBoardsList = remoteControlBoards.addList(); + for (const auto& controlBoard : controlBoards) + remoteControlBoardsList.addString("/" + robotName + "/" + controlBoard); + + options.put("remoteControlBoards", remoteControlBoards.get(0)); + options.put("localPortPrefix", "/" + this->getName() + "/remoteControlBoard"); + yarp::os::Property& remoteControlBoardsOpts = options.addGroup("REMOTE_CONTROLBOARD_OPTIONS"); + remoteControlBoardsOpts.put("writeStrict", "on"); + + if (!m_robotDevice->open(options)) + { + std::cerr << "[Module::createPolydriver] Could not open remotecontrolboardremapper object." + << std::endl; + return false; + } + return true; +} + +bool Module::initializeRobotControl(std::shared_ptr handler) +{ + if (!m_robotControl.initialize(handler->getGroup("ROBOT_CONTROL"))) + { + std::cerr << "[Module::initializeRobotControl] Unable to initialize the " + "control board" + << std::endl; + return false; + } + if (!m_robotControl.setDriver(m_robotDevice)) + { + std::cerr << "[Module::initializeRobotControl] Unable to initialize the " + "control board" + << std::endl; + return false; + } + + return true; +} + +bool Module::instantiateSensorBridge(std::shared_ptr handler) +{ + if (!m_sensorBridge.initialize(handler->getGroup("SENSOR_BRIDGE"))) + { + std::cerr << "[Module::initializeSensorBridge] Unable to initialize the sensor bridge" + << std::endl; + return false; + } + + yarp::dev::PolyDriverList list; + list.push(m_robotDevice.get(), "Remote control board"); + if (!m_sensorBridge.setDriversList(list)) + { + std::cerr << "[Module::initializeSensorBridge] Unable to set the driver list" << std::endl; + return false; + } + + return true; +} + +bool Module::configure(yarp::os::ResourceFinder& rf) +{ + m_currentJointPos.resize(1); + + auto parametersHandler = std::make_shared(rf); + + std::string name; + if(!parametersHandler->getParameter("name", name)) + return false; + this->setName(name.c_str()); + + if(!parametersHandler->getParameter("sampling_time", m_dT)) + return false; + + double maxValue = 0; + if(!parametersHandler->getParameter("max_angle_deg", maxValue)) + return false; + + maxValue *= M_PI / 180; + + double minValue = 0; + if(!parametersHandler->getParameter("min_angle_deg", minValue)) + return false; + + minValue *= M_PI / 180; + + double trajectoryDuration = 5; + if(!parametersHandler->getParameter("trajectory_duration", trajectoryDuration)) + return false; + + this->createPolydriver(parametersHandler); + this->initializeRobotControl(parametersHandler); + this->instantiateSensorBridge(parametersHandler); + + m_setPoints.push_back((maxValue + minValue) / 2); + m_setPoints.push_back(maxValue); + m_setPoints.push_back(minValue); + m_setPoints.push_back((maxValue + minValue) / 2); + + m_spline.setAdvanceTimeStep(m_dT); + m_spline.setInitialConditions(Vector1d::Zero(), Vector1d::Zero()); + m_spline.setFinalConditions(Vector1d::Zero(), Vector1d::Zero()); + + m_timeKnots.clear(); + m_timeKnots.push_back(0); + m_timeKnots.push_back(trajectoryDuration); + + if (!m_sensorBridge.advance()) + { + std::cerr << "[Module::updateModule] Unable to read the sensor." << std::endl; + return false; + } + m_sensorBridge.getJointPositions(m_currentJointPos); + + // the trajectory will bring the robot in the initial configuration + m_setPoints.push_back(m_currentJointPos[0]); + m_currentSetPoint = m_setPoints.begin(); + + m_trajectoryKnots.push_back(m_currentJointPos); + m_trajectoryKnots.push_back(Vector1d::Constant(*m_currentSetPoint)); + + m_spline.setKnots(m_trajectoryKnots, m_timeKnots); + + m_initTrajectoryTime = yarp::os::Time::now(); + + std::cout << "[Module::configure] Starting the experiment." << std::endl; + + return true; +} + +bool Module::generateNewTrajectory() +{ + double initTrajectory = *m_currentSetPoint; + + // the trajectory is ended + if (std::next(m_currentSetPoint, 1) == m_setPoints.end()) + return false; + + std::advance(m_currentSetPoint, 1); + double endTrajectory = *m_currentSetPoint; + + m_trajectoryKnots[0] = Vector1d::Constant(initTrajectory); + m_trajectoryKnots[1] = Vector1d::Constant(endTrajectory); + + m_spline.setKnots(m_trajectoryKnots, m_timeKnots); + + m_initTrajectoryTime = yarp::os::Time::now(); + + return true; +} + +bool Module::updateModule() +{ + if (!m_sensorBridge.advance()) + { + std::cerr << "[Module::updateModule] Unable to read the sensor." << std::endl; + return false; + } + + m_sensorBridge.getJointPositions(m_currentJointPos); + + // set the reference + m_robotControl.setReferences(m_spline.get().position, + RobotInterface::IRobotControl::ControlMode::PositionDirect); + + m_logJointPos.push_back(m_currentJointPos[0]); + m_logDesiredJointPos.push_back(m_spline.get().position[0]); + + // advance the spline + m_spline.advance(); + + const double now = yarp::os::Time::now(); + if (now - m_initTrajectoryTime > m_timeKnots.back() + 2) + { + std::cout << "[Module::updateModule] Generate a new trajectory." << std::endl; + + if (!generateNewTrajectory()) + { + std::cerr << "[Module::updateModule] Experiment finished." << std::endl; + return false; + } + } + + return true; +} + +bool Module::close() +{ + std::cout << "[Module::close] I'm storing the dataset." << std::endl; + + // set the file name + std::time_t t = std::time(nullptr); + std::tm tm = *std::localtime(&t); + + std::ofstream stream; /**< std stream. */ + std::stringstream fileName; + + fileName << "Dataset_" << m_robotControl.getJointList().front() << "_" + << std::put_time(&tm, "%Y_%m_%d_%H_%M_%S") << ".txt"; + stream.open(fileName.str().c_str()); + + const auto minSize = std::min(m_logJointPos.size(), m_logDesiredJointPos.size()); + + stream << "desired_joint, measured_joint" << std::endl; + for (int i = 0; i < minSize; i++) + stream << m_logDesiredJointPos[i] << ", " << m_logJointPos[i] << std::endl; + + stream.close(); + + std::cout << "[Module::close] Dataset stored. Closing." << std::endl; + + // switch back in position control + m_robotControl.setReferences(m_spline.get().position, + RobotInterface::IRobotControl::ControlMode::Position); + + return true; +} From 0307a1d668ed6fa1d142bd6b31b2a6e8f4edbf0d Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Mon, 9 Nov 2020 20:18:52 +0100 Subject: [PATCH 04/21] Add the jointPositionTrackingOptions.ini configuration file --- .../config/jointPositionTrackingOptions.ini | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 utilities/JointPositionTracking/config/jointPositionTrackingOptions.ini diff --git a/utilities/JointPositionTracking/config/jointPositionTrackingOptions.ini b/utilities/JointPositionTracking/config/jointPositionTrackingOptions.ini new file mode 100644 index 0000000000..86a77e88fc --- /dev/null +++ b/utilities/JointPositionTracking/config/jointPositionTrackingOptions.ini @@ -0,0 +1,19 @@ +name joint-position-tracking +sampling_time 0.01 +max_angle_deg 70.0 +min_angle_deg 0.0 +trajectory_duration 5.0 + +[ROBOT_INTERFACE] +robot_name icub +joints_list ("r_hip_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 From d254e5c64adaa0d8a8d68fd631f32d53031e4043 Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Mon, 9 Nov 2020 20:19:30 +0100 Subject: [PATCH 05/21] Add the python and sh script for the JointPositionTracking application --- .../script/plot_dataset.py | 85 +++++++++++++++++++ .../JointPositionTracking/script/run_test.sh | 15 ++++ 2 files changed, 100 insertions(+) create mode 100644 utilities/JointPositionTracking/script/plot_dataset.py create mode 100755 utilities/JointPositionTracking/script/run_test.sh diff --git a/utilities/JointPositionTracking/script/plot_dataset.py b/utilities/JointPositionTracking/script/plot_dataset.py new file mode 100644 index 0000000000..cc86846dec --- /dev/null +++ b/utilities/JointPositionTracking/script/plot_dataset.py @@ -0,0 +1,85 @@ +# This software may be modified and distributed under the terms of the +# GNU Lesser General Public License v2.1 or any later version. +# Authors: Giulio Romualdi and Nicola Piga + +#!/usr/bin/env python3 + +import numpy as np +import argparse +import csv +import matplotlib +import matplotlib.pyplot as plt + +from matplotlib import rc +rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']}) +rc('text', usetex=True) + +def read_data(file_name): + data = [] + + with open(file_name, newline='') as csv_data: + for row in csv_data: + try: + data.append([float(num_string.rstrip()) for num_string in row.split(sep = ", ") if num_string != '']) + except: + pass + + return np.array(data) + +def times(signal, i0 = 0): + times = signal.copy() + counter = i0 * (1.0 / 100.0) + dt = 1.0 / 100.0 + for i in range(len(times)): + times[i] = counter + counter = counter + dt + + return times + +def plot_data(axes, x_data, y_data, color, linewidth = 1.0): + + col = [] + if color == "blue": + col = plt.cm.Blues(0.8) + elif color == "red": + col = plt.cm.Reds(0.8) + + return axes.plot(x_data, y_data, color = col, linewidth = linewidth) + +def plot_and_save(data): + fig, ax = plt.subplots(1) + + channel_0 = data[:, 0] + channel_1 = data[:, 1] + + plot_0, = plot_data(ax, times(channel_0), channel_0, "red") + plot_1, = plot_data(ax, times(channel_1), channel_1, "blue") + + legend = [plot_0, plot_1] + legend = fig.legend(legend, labels = ["$\mathrm{Reference}$", "$\mathrm{Actual}$"], ncol = 2, loc = "upper center", frameon=False) + + for line in legend.get_lines(): + line.set_linewidth(2.0) + + label_font_size = 10 + ax.grid() + ax.set_xlabel('time [s]', fontsize = label_font_size) + ax.set_ylabel('position [rad]', fontsize = label_font_size) + ax.set_title('joint position', fontsize = label_font_size) + + figure = plt.gcf() + plt.savefig("./figure.png", bbox_inches='tight', dpi = 150) + + # plt.show() + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description='plot_dataset.py is a python script useful to plot a dataset generated by JointControlModule and save it.') + parser.add_argument('--dataset', type = str, required = True, help='Name of the dataset') + args = parser.parse_args() + + data = read_data(args.dataset) + + plot_and_save(data) + + diff --git a/utilities/JointPositionTracking/script/run_test.sh b/utilities/JointPositionTracking/script/run_test.sh new file mode 100755 index 0000000000..81e51bb0f3 --- /dev/null +++ b/utilities/JointPositionTracking/script/run_test.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +echo "Welcome to the JointPositionTrackingTest. I will first move the robot and then I will store the plot the data in a file called image.png \n" + +echo "I'm going to move the robot. Watch out! \n" + +JointPositionTracking --from ../config/jointPositionTrackingOptions.ini + +echo "The trajectory is terminated. \n" + +echo "Plot data \n" + +python3 ./plot_dataset.py --dataset `ls -t Dataset* | head -1` + +echo "Done. Thanks for using the script. \n" From ba6228714bb73f17d36e8192c4785ecb47ae2307 Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Mon, 9 Nov 2020 20:20:11 +0100 Subject: [PATCH 06/21] Implement the CMakeLists.txt file for the JointPositionTracking application --- utilities/JointPositionTracking/CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 utilities/JointPositionTracking/CMakeLists.txt diff --git a/utilities/JointPositionTracking/CMakeLists.txt b/utilities/JointPositionTracking/CMakeLists.txt new file mode 100644 index 0000000000..4986cc2c50 --- /dev/null +++ b/utilities/JointPositionTracking/CMakeLists.txt @@ -0,0 +1,10 @@ +# This software may be modified and distributed under the terms of the +# GNU Lesser General Public License v2.1 or any later version. +# Authors: Giulio Romualdi + +add_bipedal_locomotion_application( + NAME JointPositionTracking + SOURCES src/Main.cpp src/Module.cpp + HEADERS include/BipedalLocomotion/JointPositionTracking/Module.h + LINK_LIBRARIES YARP::YARP_dev BipedalLocomotion::Planners BipedalLocomotion::ParametersHandlerYarpImplementation BipedalLocomotion::RobotInterfaceYarpImplementation + ) From 7ff849d472881bdb27e639fa7fbe988e13301cac Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Mon, 9 Nov 2020 20:20:24 +0100 Subject: [PATCH 07/21] Add a README.md for the JointPositionTracking application --- utilities/JointPositionTracking/README.md | 27 +++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 utilities/JointPositionTracking/README.md diff --git a/utilities/JointPositionTracking/README.md b/utilities/JointPositionTracking/README.md new file mode 100644 index 0000000000..fe67badfc8 --- /dev/null +++ b/utilities/JointPositionTracking/README.md @@ -0,0 +1,27 @@ +## JointPositionTracking + +The **JointPositionTracking** is a simple tool for testing the joint position tracking of a robot in a `YARP` environment. + + + +# :running: How to use the application +The fastest way to use the application is to run the `sh` script [`run_test.sh`](./script/run_test.sh). +The script will: + +- move the robot +- store the desired and actual joint position in a `txt` file +- run a python script to plot the data in a file called `figure.png` + +The [`jointPositionTrackingOptions`](./config/jointPositionTrackingOptions.ini) file contains some parameters that you may modify to control a given joint: +- `max_angle_deg`: is the max angle reached by the joint (the value is in degrees) +- `min_angle_def`: is the min angle reached by the joint (the value is in degrees) +- `trajectory_duration`: is the duration of the generated trajectory (the value is in seconds) +- `robot_name`: name of the robot +- `joints_list`: list of the controlled joint (for the time being multiple joints control is not supported. Please specify only one joint) +- `remote_control_boards`: list of associated control board (for the time being multiple joints control is not supported. Please specify only one control board) + +This is an example of usage + + + +![](https://user-images.githubusercontent.com/16744101/97494667-e5576280-1966-11eb-840b-56e5120f6b29.gif) \ No newline at end of file From 50f0a5bcdd7ce96c2c5e124b8406981bdffdc5d7 Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Mon, 9 Nov 2020 20:21:19 +0100 Subject: [PATCH 08/21] Enable the compilation of the Utilities --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 98d037b108..6d3f0246e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,6 +71,9 @@ include(AddBipedalLocomotionUnitTest) #Function to automatize the process of creating a new library include(AddBipedalLocomotionLibrary) +#Function to automatize the process of creating a new application +include(AddBipedalLocomotionApplication) + #Utility to install ini files include(InstallIniFiles) @@ -114,3 +117,5 @@ include(AddUninstallTarget) include(GenerateAndAddUrdfModel) add_subdirectory(Python) + +add_subdirectory(utilities) From c7be961444753bdc41f7d546cc4e0defafde4d86 Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Mon, 9 Nov 2020 20:24:00 +0100 Subject: [PATCH 09/21] Update the CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 426f5aa956..65136e6ece 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,5 +17,6 @@ All notable changes to this project are documented in this file. - Renamed from ``bipedal-locomotion-controllers`` to ``bipedal-locomotion-framework`` (https://github.com/dic-iit/bipedal-locomotion-framework/pull/40). - Implement `Contact` library. (https://github.com/dic-iit/bipedal-locomotion-framework/pull/43 and https://github.com/dic-iit/bipedal-locomotion-framework/pull/45) - Added `CommonConversions` and `ManifConversions` libraries to handle type conversions. +- Implement the `JointPositionTracking` application. (https://github.com/dic-iit/bipedal-locomotion-framework/pull/136) [Unreleased]: https://github.com/dic-iit/bipedal-locomotion-framework/ From e7b3248a9a1bddbbabc391ee6b2b1be1fb4bbc21 Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Mon, 9 Nov 2020 20:27:45 +0100 Subject: [PATCH 10/21] Enable the compilation of the JointPositionTracking only if the FRAMEWORK_COMPILE_YarpImplementation and FRAMEWORK_COMPILE_Planners are on --- utilities/JointPositionTracking/CMakeLists.txt | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/utilities/JointPositionTracking/CMakeLists.txt b/utilities/JointPositionTracking/CMakeLists.txt index 4986cc2c50..d3f9575c8f 100644 --- a/utilities/JointPositionTracking/CMakeLists.txt +++ b/utilities/JointPositionTracking/CMakeLists.txt @@ -2,9 +2,13 @@ # GNU Lesser General Public License v2.1 or any later version. # Authors: Giulio Romualdi -add_bipedal_locomotion_application( - NAME JointPositionTracking - SOURCES src/Main.cpp src/Module.cpp - HEADERS include/BipedalLocomotion/JointPositionTracking/Module.h - LINK_LIBRARIES YARP::YARP_dev BipedalLocomotion::Planners BipedalLocomotion::ParametersHandlerYarpImplementation BipedalLocomotion::RobotInterfaceYarpImplementation - ) +if(FRAMEWORK_COMPILE_YarpImplementation AND FRAMEWORK_COMPILE_Planners) + + add_bipedal_locomotion_application( + NAME JointPositionTracking + SOURCES src/Main.cpp src/Module.cpp + HEADERS include/BipedalLocomotion/JointPositionTracking/Module.h + LINK_LIBRARIES YARP::YARP_dev BipedalLocomotion::Planners BipedalLocomotion::ParametersHandlerYarpImplementation BipedalLocomotion::RobotInterfaceYarpImplementation + ) + +endif() From 73d8839b25e527227c20fd9caa0a19935981da91 Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Mon, 9 Nov 2020 22:24:28 +0100 Subject: [PATCH 11/21] Add utilities CMakeLists.txt file --- utilities/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 utilities/CMakeLists.txt diff --git a/utilities/CMakeLists.txt b/utilities/CMakeLists.txt new file mode 100644 index 0000000000..fb1c1c4ccc --- /dev/null +++ b/utilities/CMakeLists.txt @@ -0,0 +1,6 @@ +# Copyright (C) 2019 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(JointPositionTracking) From 19d45d893c57c5e705e51f92f6415d877138f7a3 Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Tue, 10 Nov 2020 12:47:10 +0100 Subject: [PATCH 12/21] Add the blf- prefix to the Framework application --- cmake/AddBipedalLocomotionApplication.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmake/AddBipedalLocomotionApplication.cmake b/cmake/AddBipedalLocomotionApplication.cmake index f9f6fef7b3..3a43a57886 100644 --- a/cmake/AddBipedalLocomotionApplication.cmake +++ b/cmake/AddBipedalLocomotionApplication.cmake @@ -33,6 +33,12 @@ function(add_bipedal_locomotion_application) target_compile_features(${name} PRIVATE cxx_std_17) target_compile_definitions(${name} PRIVATE -D_USE_MATH_DEFINES) + set_target_properties(${name} PROPERTIES + OUTPUT_NAME "blf-${name}" + VERSION ${BipedalLocomotionFramework_VERSION} + PRIVATE_HEADER "${headers}") + + target_link_libraries(${name} PRIVATE ${link_libraries}) # Specify include directories for both compilation and installation process. From df825b85a57d8e0218ec7d6f5f5412cecb8200bc Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Tue, 10 Nov 2020 12:47:42 +0100 Subject: [PATCH 13/21] Rename JointPositionTracking into joint-position-tracking --- utilities/CMakeLists.txt | 2 +- .../CMakeLists.txt | 2 +- .../README.md | 0 .../config/jointPositionTrackingOptions.ini | 0 .../include/BipedalLocomotion/JointPositionTracking/Module.h | 0 .../script/plot_dataset.py | 0 .../script/run_test.sh | 0 .../src/Main.cpp | 0 .../src/Module.cpp | 0 9 files changed, 2 insertions(+), 2 deletions(-) rename utilities/{JointPositionTracking => joint-position-tracking}/CMakeLists.txt (94%) rename utilities/{JointPositionTracking => joint-position-tracking}/README.md (100%) rename utilities/{JointPositionTracking => joint-position-tracking}/config/jointPositionTrackingOptions.ini (100%) rename utilities/{JointPositionTracking => joint-position-tracking}/include/BipedalLocomotion/JointPositionTracking/Module.h (100%) rename utilities/{JointPositionTracking => joint-position-tracking}/script/plot_dataset.py (100%) rename utilities/{JointPositionTracking => joint-position-tracking}/script/run_test.sh (100%) rename utilities/{JointPositionTracking => joint-position-tracking}/src/Main.cpp (100%) rename utilities/{JointPositionTracking => joint-position-tracking}/src/Module.cpp (100%) diff --git a/utilities/CMakeLists.txt b/utilities/CMakeLists.txt index fb1c1c4ccc..4153f71bab 100644 --- a/utilities/CMakeLists.txt +++ b/utilities/CMakeLists.txt @@ -3,4 +3,4 @@ # GNU Lesser General Public License v2.1 or any later version. -add_subdirectory(JointPositionTracking) +add_subdirectory(joint-position-tracking) diff --git a/utilities/JointPositionTracking/CMakeLists.txt b/utilities/joint-position-tracking/CMakeLists.txt similarity index 94% rename from utilities/JointPositionTracking/CMakeLists.txt rename to utilities/joint-position-tracking/CMakeLists.txt index d3f9575c8f..4b090eb49c 100644 --- a/utilities/JointPositionTracking/CMakeLists.txt +++ b/utilities/joint-position-tracking/CMakeLists.txt @@ -5,7 +5,7 @@ if(FRAMEWORK_COMPILE_YarpImplementation AND FRAMEWORK_COMPILE_Planners) add_bipedal_locomotion_application( - NAME JointPositionTracking + NAME joint-position-tracking SOURCES src/Main.cpp src/Module.cpp HEADERS include/BipedalLocomotion/JointPositionTracking/Module.h LINK_LIBRARIES YARP::YARP_dev BipedalLocomotion::Planners BipedalLocomotion::ParametersHandlerYarpImplementation BipedalLocomotion::RobotInterfaceYarpImplementation diff --git a/utilities/JointPositionTracking/README.md b/utilities/joint-position-tracking/README.md similarity index 100% rename from utilities/JointPositionTracking/README.md rename to utilities/joint-position-tracking/README.md diff --git a/utilities/JointPositionTracking/config/jointPositionTrackingOptions.ini b/utilities/joint-position-tracking/config/jointPositionTrackingOptions.ini similarity index 100% rename from utilities/JointPositionTracking/config/jointPositionTrackingOptions.ini rename to utilities/joint-position-tracking/config/jointPositionTrackingOptions.ini diff --git a/utilities/JointPositionTracking/include/BipedalLocomotion/JointPositionTracking/Module.h b/utilities/joint-position-tracking/include/BipedalLocomotion/JointPositionTracking/Module.h similarity index 100% rename from utilities/JointPositionTracking/include/BipedalLocomotion/JointPositionTracking/Module.h rename to utilities/joint-position-tracking/include/BipedalLocomotion/JointPositionTracking/Module.h diff --git a/utilities/JointPositionTracking/script/plot_dataset.py b/utilities/joint-position-tracking/script/plot_dataset.py similarity index 100% rename from utilities/JointPositionTracking/script/plot_dataset.py rename to utilities/joint-position-tracking/script/plot_dataset.py diff --git a/utilities/JointPositionTracking/script/run_test.sh b/utilities/joint-position-tracking/script/run_test.sh similarity index 100% rename from utilities/JointPositionTracking/script/run_test.sh rename to utilities/joint-position-tracking/script/run_test.sh diff --git a/utilities/JointPositionTracking/src/Main.cpp b/utilities/joint-position-tracking/src/Main.cpp similarity index 100% rename from utilities/JointPositionTracking/src/Main.cpp rename to utilities/joint-position-tracking/src/Main.cpp diff --git a/utilities/JointPositionTracking/src/Module.cpp b/utilities/joint-position-tracking/src/Module.cpp similarity index 100% rename from utilities/JointPositionTracking/src/Module.cpp rename to utilities/joint-position-tracking/src/Module.cpp From e044c9c25bcca44f04beee7c785e1ef72cd80c9a Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Tue, 10 Nov 2020 12:49:19 +0100 Subject: [PATCH 14/21] Fix joint-position-tracking script accordingly to f1733459ea6835105b37252f0dafde8e80e692d8 --- utilities/joint-position-tracking/script/run_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/joint-position-tracking/script/run_test.sh b/utilities/joint-position-tracking/script/run_test.sh index 81e51bb0f3..9332df4cec 100755 --- a/utilities/joint-position-tracking/script/run_test.sh +++ b/utilities/joint-position-tracking/script/run_test.sh @@ -4,7 +4,7 @@ echo "Welcome to the JointPositionTrackingTest. I will first move the robot and echo "I'm going to move the robot. Watch out! \n" -JointPositionTracking --from ../config/jointPositionTrackingOptions.ini +blf-joint-position-tracking --from ../config/jointPositionTrackingOptions.ini echo "The trajectory is terminated. \n" From 327226101c0464851e910f3012a8f0a3aa841bcf Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Tue, 10 Nov 2020 12:51:50 +0100 Subject: [PATCH 15/21] Update the joint-position-tracking/README.md --- utilities/joint-position-tracking/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utilities/joint-position-tracking/README.md b/utilities/joint-position-tracking/README.md index fe67badfc8..4c6b314a87 100644 --- a/utilities/joint-position-tracking/README.md +++ b/utilities/joint-position-tracking/README.md @@ -1,6 +1,6 @@ -## JointPositionTracking +## joint-position-tracking -The **JointPositionTracking** is a simple tool for testing the joint position tracking of a robot in a `YARP` environment. +The **joint-position-tracking** is a simple tool for testing the joint position tracking of a robot in a `YARP` environment. @@ -24,4 +24,4 @@ This is an example of usage -![](https://user-images.githubusercontent.com/16744101/97494667-e5576280-1966-11eb-840b-56e5120f6b29.gif) \ No newline at end of file +![](https://user-images.githubusercontent.com/16744101/97494667-e5576280-1966-11eb-840b-56e5120f6b29.gif) From e741cd3fd5b6c8b69c141351399c5b7dbe691c80 Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Wed, 11 Nov 2020 09:39:15 +0100 Subject: [PATCH 16/21] Fix bug in add_bipedal_locomotion_application cmake function --- cmake/AddBipedalLocomotionApplication.cmake | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/cmake/AddBipedalLocomotionApplication.cmake b/cmake/AddBipedalLocomotionApplication.cmake index 3a43a57886..a52e29ea28 100644 --- a/cmake/AddBipedalLocomotionApplication.cmake +++ b/cmake/AddBipedalLocomotionApplication.cmake @@ -35,21 +35,16 @@ function(add_bipedal_locomotion_application) set_target_properties(${name} PROPERTIES OUTPUT_NAME "blf-${name}" - VERSION ${BipedalLocomotionFramework_VERSION} - PRIVATE_HEADER "${headers}") - + VERSION ${BipedalLocomotionFramework_VERSION}) target_link_libraries(${name} PRIVATE ${link_libraries}) - # Specify include directories for both compilation and installation process. - # The $ generator expression is useful to ensure to create - # relocatable configuration files, see https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html - #creating-relocatable-packages + target_include_directories(${name} PRIVATE "$") # Specify installation targets, typology and destination folders. install(TARGETS ${name} - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin) + DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin) # Add all subdirectories foreach(subdir ${subdirectories}) From d1d7de1822ce3759577e43df40bb37832b5b62d0 Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Wed, 11 Nov 2020 09:40:23 +0100 Subject: [PATCH 17/21] Add FRAMEWORK_COMPILE_JointPositionTrackingApplication cmake option --- cmake/BipedalLocomotionFrameworkFindDependencies.cmake | 4 ++++ utilities/joint-position-tracking/CMakeLists.txt | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/BipedalLocomotionFrameworkFindDependencies.cmake b/cmake/BipedalLocomotionFrameworkFindDependencies.cmake index a4d9beda8b..4084c87aea 100644 --- a/cmake/BipedalLocomotionFrameworkFindDependencies.cmake +++ b/cmake/BipedalLocomotionFrameworkFindDependencies.cmake @@ -189,3 +189,7 @@ framework_dependent_option(FRAMEWORK_COMPILE_FloatingBaseEstimators framework_dependent_option(FRAMEWORK_COMPILE_ManifConversions "Compile manif Conversions libraries?" ON "FRAMEWORK_USE_manif" OFF) + +framework_dependent_option(FRAMEWORK_COMPILE_JointPositionTrackingApplication + "Compile joint-position-tracking application?" ON + "FRAMEWORK_COMPILE_YarpImplementation;FRAMEWORK_COMPILE_Planners;FRAMEWORK_COMPILE_RobotInterface" OFF) diff --git a/utilities/joint-position-tracking/CMakeLists.txt b/utilities/joint-position-tracking/CMakeLists.txt index 4b090eb49c..f22acfef48 100644 --- a/utilities/joint-position-tracking/CMakeLists.txt +++ b/utilities/joint-position-tracking/CMakeLists.txt @@ -2,7 +2,7 @@ # GNU Lesser General Public License v2.1 or any later version. # Authors: Giulio Romualdi -if(FRAMEWORK_COMPILE_YarpImplementation AND FRAMEWORK_COMPILE_Planners) +if(FRAMEWORK_COMPILE_JointPositionTrackingApplication) add_bipedal_locomotion_application( NAME joint-position-tracking From a65c1838f4d61f363fe18347a311243b3ca58540 Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Sat, 14 Nov 2020 13:19:25 +0100 Subject: [PATCH 18/21] Rename the configuration file of the joint-position-tracking application --- .../iCubGenova09/blf-joint-position-tracking-options.ini} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename utilities/joint-position-tracking/config/{jointPositionTrackingOptions.ini => robots/iCubGenova09/blf-joint-position-tracking-options.ini} (100%) diff --git a/utilities/joint-position-tracking/config/jointPositionTrackingOptions.ini b/utilities/joint-position-tracking/config/robots/iCubGenova09/blf-joint-position-tracking-options.ini similarity index 100% rename from utilities/joint-position-tracking/config/jointPositionTrackingOptions.ini rename to utilities/joint-position-tracking/config/robots/iCubGenova09/blf-joint-position-tracking-options.ini From f3f62c8e27fe6b58127651e4d63b8abcf39750fd Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Sat, 14 Nov 2020 13:19:59 +0100 Subject: [PATCH 19/21] Rename the scripts of the joint-position-tracking-application --- .../blf-joint-position-tracking-script.sh | 20 +++++++++++++++++++ ...f_joint_position_tracking_plot_dataset.py} | 0 .../script/run_test.sh | 15 -------------- 3 files changed, 20 insertions(+), 15 deletions(-) create mode 100755 utilities/joint-position-tracking/script/blf-joint-position-tracking-script.sh rename utilities/joint-position-tracking/script/{plot_dataset.py => blf_joint_position_tracking_plot_dataset.py} (100%) delete mode 100755 utilities/joint-position-tracking/script/run_test.sh diff --git a/utilities/joint-position-tracking/script/blf-joint-position-tracking-script.sh b/utilities/joint-position-tracking/script/blf-joint-position-tracking-script.sh new file mode 100755 index 0000000000..5291a6e141 --- /dev/null +++ b/utilities/joint-position-tracking/script/blf-joint-position-tracking-script.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +scriptDirectory="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +pythonScriptRootPath=`realpath $scriptDirectory/../share/BipedalLocomotionFramework/python` + +echo $pythonScriptRootPath + +echo "Welcome to the JointPositionTrackingTest. I will first move the robot and then I will store the plot the data in a file called image.png" + +echo "I'm going to move the robot. Watch out!" + +blf-joint-position-tracking --from blf-joint-position-tracking-options.ini + +echo "The trajectory is terminated." + +echo "Plot data" + +python3 "$pythonScriptRootPath"/blf_joint_position_tracking_plot_dataset.py --dataset `ls -t Dataset* | head -1` + +echo "Done. Thanks for using the script." diff --git a/utilities/joint-position-tracking/script/plot_dataset.py b/utilities/joint-position-tracking/script/blf_joint_position_tracking_plot_dataset.py similarity index 100% rename from utilities/joint-position-tracking/script/plot_dataset.py rename to utilities/joint-position-tracking/script/blf_joint_position_tracking_plot_dataset.py diff --git a/utilities/joint-position-tracking/script/run_test.sh b/utilities/joint-position-tracking/script/run_test.sh deleted file mode 100755 index 9332df4cec..0000000000 --- a/utilities/joint-position-tracking/script/run_test.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -echo "Welcome to the JointPositionTrackingTest. I will first move the robot and then I will store the plot the data in a file called image.png \n" - -echo "I'm going to move the robot. Watch out! \n" - -blf-joint-position-tracking --from ../config/jointPositionTrackingOptions.ini - -echo "The trajectory is terminated. \n" - -echo "Plot data \n" - -python3 ./plot_dataset.py --dataset `ls -t Dataset* | head -1` - -echo "Done. Thanks for using the script. \n" From c4d4e391f31638bb9e2a9b59ea362cff84e4540c Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Sat, 14 Nov 2020 13:20:36 +0100 Subject: [PATCH 20/21] Add the possibility to run the joint-position-tracking-script from any folder --- utilities/joint-position-tracking/CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/utilities/joint-position-tracking/CMakeLists.txt b/utilities/joint-position-tracking/CMakeLists.txt index f22acfef48..18efbf0393 100644 --- a/utilities/joint-position-tracking/CMakeLists.txt +++ b/utilities/joint-position-tracking/CMakeLists.txt @@ -11,4 +11,13 @@ if(FRAMEWORK_COMPILE_JointPositionTrackingApplication) LINK_LIBRARIES YARP::YARP_dev BipedalLocomotion::Planners BipedalLocomotion::ParametersHandlerYarpImplementation BipedalLocomotion::RobotInterfaceYarpImplementation ) + install_ini_files(${CMAKE_CURRENT_SOURCE_DIR}/config) + + install(FILES script/blf_joint_position_tracking_plot_dataset.py + DESTINATION "${CMAKE_INSTALL_PREFIX}/share/BipedalLocomotionFramework/python") + + install(FILES script/blf-joint-position-tracking-script.sh + PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ + DESTINATION "${CMAKE_INSTALL_BINDIR}") + endif() From 16f0c92b975ad38c566fb3899b04b58bd57c5099 Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Sat, 14 Nov 2020 13:20:57 +0100 Subject: [PATCH 21/21] Update the joint-position-tracking README --- utilities/joint-position-tracking/README.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/utilities/joint-position-tracking/README.md b/utilities/joint-position-tracking/README.md index 4c6b314a87..4215c43286 100644 --- a/utilities/joint-position-tracking/README.md +++ b/utilities/joint-position-tracking/README.md @@ -1,18 +1,16 @@ -## joint-position-tracking +# joint-position-tracking The **joint-position-tracking** is a simple tool for testing the joint position tracking of a robot in a `YARP` environment. +## :running: How to use the application +The fastest way to use the application is to run the `sh` script [`blf-joint-position-tracking-script.sh`](./script/blf-joint-position-tracking-script.sh). If you correctly installed the the framework you can run the script from any folder. - -# :running: How to use the application -The fastest way to use the application is to run the `sh` script [`run_test.sh`](./script/run_test.sh). The script will: - - move the robot - store the desired and actual joint position in a `txt` file - run a python script to plot the data in a file called `figure.png` -The [`jointPositionTrackingOptions`](./config/jointPositionTrackingOptions.ini) file contains some parameters that you may modify to control a given joint: +The [`blf-joint-position-tracking-options.ini`](./config/robots/iCubGenova09/blf-joint-position-tracking-options.ini) file contains some parameters that you may modify to control a given joint: - `max_angle_deg`: is the max angle reached by the joint (the value is in degrees) - `min_angle_def`: is the min angle reached by the joint (the value is in degrees) - `trajectory_duration`: is the duration of the generated trajectory (the value is in seconds) @@ -20,8 +18,9 @@ The [`jointPositionTrackingOptions`](./config/jointPositionTrackingOptions.ini) - `joints_list`: list of the controlled joint (for the time being multiple joints control is not supported. Please specify only one joint) - `remote_control_boards`: list of associated control board (for the time being multiple joints control is not supported. Please specify only one control board) -This is an example of usage +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. +This is an example of usage ![](https://user-images.githubusercontent.com/16744101/97494667-e5576280-1966-11eb-840b-56e5120f6b29.gif)