-
Notifications
You must be signed in to change notification settings - Fork 7
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
adds shared_ptr overloads for mjbots constructors #30
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,16 +54,21 @@ MjbotsRobotInterface::MjbotsRobotInterface(const std::vector<JointMoteus> &joint | |
::mjbots::pi3hat::Euler imu_mounting_deg, | ||
int imu_rate_hz, | ||
::mjbots::pi3hat::Euler imu_world_offset_deg) | ||
: MjbotsRobotInterface(make_share_vector(joint_list), realtime_params, soft_start_duration, robot_max_torque) {} | ||
|
||
MjbotsRobotInterface::MjbotsRobotInterface(std::vector<std::shared_ptr<JointMoteus>> joint_ptrs, | ||
const RealtimeParams &realtime_params, | ||
int soft_start_duration, | ||
float robot_max_torque, | ||
::mjbots::pi3hat::Euler imu_mounting_deg, | ||
int imu_rate_hz, | ||
::mjbots::pi3hat::Euler imu_world_offset_deg) | ||
: soft_start_(robot_max_torque, soft_start_duration) | ||
{ | ||
joints = joint_ptrs; | ||
|
||
for (JointMoteus joint: joint_list){ | ||
// Make vector of shared_pointer objects using joint copy constructer | ||
// (original list will be descoped) | ||
joints.push_back(std::make_shared<JointMoteus>(joint)); | ||
} | ||
|
||
for( auto & j: joints){ | ||
for (auto &j : joints) | ||
{ | ||
positions_.push_back( j->get_position_reference() ); | ||
velocities_.push_back( j->get_velocity_reference() ); | ||
torque_cmd_.push_back( j->get_servo_torque_reference() ); | ||
|
@@ -96,10 +101,8 @@ MjbotsRobotInterface::MjbotsRobotInterface(const std::vector<JointMoteus> &joint | |
moteus_data_.commands = {commands_.data(), commands_.size()}; | ||
moteus_data_.replies = {replies_.data(), replies_.size()}; | ||
moteus_data_.timeout = timeout_; | ||
|
||
} | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: white space There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed, we should do a formatting run (see #35). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea Ethan has been pushing for more auto formatting and I've been slowly coming around to the idea. |
||
void MjbotsRobotInterface::Init() { | ||
SendCommand(); | ||
ProcessReply(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit white space