Skip to content
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

Implement joint trajectory player #169

Merged
merged 16 commits into from
Jan 22, 2021

Conversation

isorrentino
Copy link
Collaborator

The application reads a trajectory from a file and executes it either on a simulated robot or on a real robot. It also saves the measured joint positions. It also allows you to specify in a configuration file which robot joints to use.

…nts of the trajectory file added. Initial trajectory to go to the initial desired position added. Removed iDynTree vectors. Some problems fixed.
@isorrentino isorrentino changed the title Trajectory player implemented Implement joint trajectory player Jan 15, 2021
Copy link
Member

@GiulioRomualdi GiulioRomualdi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also add a readme where you could explain how to run the application

Comment on lines 170 to 171
if (!parametersHandler->getParameter("trajectory_file", trajectoryFile))
return false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would print an error here

Comment on lines 35 to 40
Eigen::VectorXd m_currentJointPos;

std::shared_ptr<yarp::dev::PolyDriver> m_robotDevice;

RobotInterface::YarpRobotControl m_robotControl;
RobotInterface::YarpSensorBridge m_sensorBridge;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add the documentation here?


#include <yarp/dev/IEncoders.h>

using Vector1d = Eigen::Matrix<double, 1, 1>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you do not need this

Comment on lines 50 to 54
m_numOfJoints = 0;
yarp::dev::IEncoders* axis;
m_robotDevice->view(axis);
if (axis != nullptr)
axis->getAxes(&m_numOfJoints);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there another way to get this information in the RobotInterface?

}

std::pair<bool, std::deque<Eigen::VectorXd>>
Module::readStateFromFile(const std::string& filename, const std::size_t num_fields)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

num_fields -> numFields

Comment on lines 222 to 224
m_robotControl.checkMotionDone(isMotionDone, isMimeExpired, jointlist);

if (isMotionDone)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function was not meant to be used in this way. What I did in the past is to create a state machine and use checkMotionDone as a trigger to change the state. We can discuss this offline

Comment on lines 273 to 275
fileName << "Dataset_Measured_" << m_robotControl.getJointList().front() << "_"
<< std::put_time(&tm, "%Y_%m_%d_%H_%M_%S") << ".txt";
stream.open(fileName.str().c_str());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm not mistaken the main purpose of this application is to collect some data to analyze them in matlab. In this case you may also use matio-cpp developed by @S-Dafarra. You can find a usage example in #62

Copy link
Collaborator

@prashanthr05 prashanthr05 Jan 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@isorrentino
Copy link
Collaborator Author

I modified the code based on @GiulioRomualdi suggestions. The PR is again ready for review.

Copy link
Member

@GiulioRomualdi GiulioRomualdi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @isorrentino

utilities/joint-trajectory-player/src/Module.cpp Outdated Show resolved Hide resolved
@GiulioRomualdi GiulioRomualdi merged commit d869f15 into ami-iit:master Jan 22, 2021
@isorrentino isorrentino deleted the feature/jointControlModule branch February 8, 2021 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants