Skip to content
Snippets Groups Projects
Commit a7212f5d authored by Pierre-Alexandre Leziart's avatar Pierre-Alexandre Leziart
Browse files

Adding fake robot class for debug purpose

parent 91793997
No related branches found
No related tags found
No related merge requests found
......@@ -62,6 +62,7 @@ set(${PROJECT_NAME}_HEADERS
include/qrw/Filter.hpp
include/qrw/Controller.hpp
include/qrw/MpcWrapper.hpp
include/qrw/FakeRobot.hpp
include/other/st_to_cc.hpp
)
......
///////////////////////////////////////////////////////////////////////////////////////////////////
///
/// \brief This is the header for FakeRobot class
///
/// \details Create a fake robot object for debug purpose
///
//////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef FAKEROBOT_H_INCLUDED
#define FAKEROBOT_H_INCLUDED
#include <Eigen/Core>
#include <Eigen/Dense>
#include "qrw/Types.h"
class FakeRobot {
public:
////////////////////////////////////////////////////////////////////////////////////////////////
///
/// \brief Constructor
///
////////////////////////////////////////////////////////////////////////////////////////////////
FakeRobot();
////////////////////////////////////////////////////////////////////////////////////////////////
///
/// \brief Destructor
///
////////////////////////////////////////////////////////////////////////////////////////////////
~FakeRobot() {} // Empty destructor
// Fake functions
void Initialize(Vector12 const& des_pos) {}
void ParseSensorData() {}
void SendCommandAndWaitEndOfCycle(double dt) {}
FakeJoints* joints = new FakeJoints();
FakeImu* imu = new FakeImu();
};
class FakeJoints {
public:
////////////////////////////////////////////////////////////////////////////////////////////////
///
/// \brief Constructor
///
////////////////////////////////////////////////////////////////////////////////////////////////
FakeJoints();
////////////////////////////////////////////////////////////////////////////////////////////////
///
/// \brief Destructor
///
////////////////////////////////////////////////////////////////////////////////////////////////
~FakeJoints() {} // Empty destructor
// Fake functions
void PrintVector() {}
void SetZeroCommands() {}
Vector12 GetPositions() { return Vector12::Zero(); }
Vector12 GetVelocities() { return Vector12::Zero(); }
void SetPositionGains(Vector12 const& data) {}
void SetVelocityGains(Vector12 const& data) {}
void SetDesiredPositions(Vector12 const& data) {}
void SetDesiredVelocities(Vector12 const& data) {}
void SetTorques(Vector12 const& data) {}
};
class FakeImu {
public:
////////////////////////////////////////////////////////////////////////////////////////////////
///
/// \brief Constructor
///
////////////////////////////////////////////////////////////////////////////////////////////////
FakeImu();
////////////////////////////////////////////////////////////////////////////////////////////////
///
/// \brief Destructor
///
////////////////////////////////////////////////////////////////////////////////////////////////
~FakeImu() {} // Empty destructor
// Fake functions
Vector12 GetLinearAcceleration() { return Vector12::Zero(); }
Vector12 GetGyroscope() { return Vector12::Zero(); }
Vector12 GetAttitudeEuler() { return Vector12::Zero(); }
};
#endif // FAKEROBOT_H_INCLUDED
......@@ -5,13 +5,14 @@
#include "qrw/Types.h"
#include "qrw/Params.hpp"
#include "qrw/Controller.hpp"
#include "qrw/FakeRobot.hpp"
using namespace odri_control_interface;
#include <iostream>
#include <stdexcept>
int put_on_the_floor(std::shared_ptr<Robot> robot, Vector12 const& q_init)
int put_on_the_floor(std::shared_ptr<FakeRobot> robot, Vector12 const& q_init)
{
/*Make the robot go to the default initial position and wait for the user
to press the Enter key to start the main control loop
......@@ -55,7 +56,8 @@ int main()
Params params = Params();
// Define the robot from a yaml file.
std::shared_ptr<Robot> robot = RobotFromYamlFile(CONFIG_SOLO12_YAML);
// std::shared_ptr<Robot> robot = RobotFromYamlFile(CONFIG_SOLO12_YAML);
std::shared_ptr<FakeRobot> robot = std::make_shared<FakeRobot>();
// Store initial position data.
Vector12 des_pos;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment