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

Use the odri yaml file to load the robot configuration #104

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ create_robots_library(solo8)
create_robots_library(solo8ti)
create_robots_library(solo12)

# YAML parameters.
string(
CONCAT odri_control_interface_yaml_path
"${PythonModules_robot_properties_solo_PATH}/"
"robot_properties_solo/robot_properties_solo/odri_control_interface/"
"solo12_driver.yaml")
target_compile_definitions(
solo12
PUBLIC ODRI_CONTROL_INTERFACE_YAML_PATH="${odri_control_interface_yaml_path}")

#
# Build executables like the calibration programs.
#
Expand Down
70 changes: 7 additions & 63 deletions src/solo12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <odri_control_interface/common.hpp>
#include "solo/common_programs_header.hpp"
#include "real_time_tools/spinner.hpp"
#include "odri_control_interface/utils.hpp"

namespace solo
{
Expand Down Expand Up @@ -83,69 +84,12 @@ void Solo12::initialize(const std::string& network_id,
serial_reader_ =
std::make_shared<blmc_drivers::SerialReader>(serial_port, 5);

main_board_ptr_ = std::make_shared<MasterBoardInterface>(network_id_);

VectorXi motor_numbers(12);
motor_numbers << 0, 3, 2, 1, 5, 4, 6, 9, 8, 7, 11, 10;
VectorXb motor_reversed(12);
motor_reversed << false, true, true, true, false, false, false, true, true,
true, false, false;

double lHAA = 0.9;
double lHFE = 1.45;
double lKFE = 2.80;
Eigen::VectorXd joint_lower_limits(12);
joint_lower_limits << -lHAA, -lHFE, -lKFE, -lHAA, -lHFE, -lKFE, -lHAA,
-lHFE, -lKFE, -lHAA, -lHFE, -lKFE;
Eigen::VectorXd joint_upper_limits(12);
joint_upper_limits << lHAA, lHFE, lKFE, lHAA, lHFE, lKFE, lHAA, lHFE, lKFE,
lHAA, lHFE, lKFE;

// Define the joint module.
joints_ = std::make_shared<odri_control_interface::JointModules>(
main_board_ptr_,
motor_numbers,
motor_torque_constants_(0),
joint_gear_ratios_(0),
motor_max_current_(0),
motor_reversed,
joint_lower_limits,
joint_upper_limits,
80.,
0.2);

// Define the IMU.
VectorXl rotate_vector(3);
rotate_vector << 1, 2, 3;
VectorXl orientation_vector(4);
orientation_vector << 1, 2, 3, 4;
imu_ = std::make_shared<odri_control_interface::IMU>(
main_board_ptr_, rotate_vector, orientation_vector);

// Define the robot.
robot_ = std::make_shared<odri_control_interface::Robot>(
main_board_ptr_, joints_, imu_);

std::vector<odri_control_interface::CalibrationMethod> directions{
odri_control_interface::POSITIVE,
odri_control_interface::POSITIVE,
odri_control_interface::POSITIVE,
odri_control_interface::NEGATIVE,
odri_control_interface::POSITIVE,
odri_control_interface::POSITIVE,
odri_control_interface::POSITIVE,
odri_control_interface::POSITIVE,
odri_control_interface::POSITIVE,
odri_control_interface::NEGATIVE,
odri_control_interface::POSITIVE,
odri_control_interface::POSITIVE};

// Use zero position offsets for now. Gets updated in the calibration
// method.
Eigen::VectorXd position_offsets(12);
position_offsets.fill(0.);
calib_ctrl_ = std::make_shared<odri_control_interface::JointCalibrator>(
robot_->joints, directions, position_offsets, 5., 0.05, 3.0, 0.001);
// Main driver interface.
robot_ = odri_control_interface::RobotFromYamlFile(
network_id_, ODRI_CONTROL_INTERFACE_YAML_PATH);

calib_ctrl_ = odri_control_interface::JointCalibratorFromYamlFile(
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this? a calib controller is created by default now no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, things have changed and I think you are right. One is created by default now. I will update the PR and test it on the real solo.

ODRI_CONTROL_INTERFACE_YAML_PATH, robot_->joints);

// Initialize the robot.
robot_->Init();
Expand Down