Skip to content

Commit

Permalink
Fixed state interfaces (#53)
Browse files Browse the repository at this point in the history
Signed-off-by: ahcorde <ahcorde@gmail.com>
  • Loading branch information
ahcorde committed Feb 5, 2021
1 parent 79207cc commit 682d657
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions gazebo_ros2_control/src/gazebo_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,18 +168,18 @@ bool GazeboSystem::initSim(
for (unsigned int i = 0; i < hardware_info.joints[j].state_interfaces.size(); i++) {
if (hardware_info.joints[j].state_interfaces[i].name == "position") {
RCLCPP_INFO_STREAM(this->nh_->get_logger(), "\t\t position");
this->dataPtr->joint_pos_cmd_[j] = std::make_shared<hardware_interface::CommandInterface>(
joint_name, hardware_interface::HW_IF_POSITION, &this->dataPtr->joint_position_cmd_[j]);
this->dataPtr->joint_pos_state_[j] = std::make_shared<hardware_interface::StateInterface>(
joint_name, hardware_interface::HW_IF_POSITION, &this->dataPtr->joint_position_[j]);
}
if (hardware_info.joints[j].state_interfaces[i].name == "velocity") {
RCLCPP_INFO_STREAM(this->nh_->get_logger(), "\t\t velocity");
this->dataPtr->joint_vel_cmd_[j] = std::make_shared<hardware_interface::CommandInterface>(
joint_name, hardware_interface::HW_IF_VELOCITY, &this->dataPtr->joint_velocity_cmd_[j]);
this->dataPtr->joint_vel_state_[j] = std::make_shared<hardware_interface::StateInterface>(
joint_name, hardware_interface::HW_IF_VELOCITY, &this->dataPtr->joint_velocity_[j]);
}
if (hardware_info.joints[j].state_interfaces[i].name == "effort") {
RCLCPP_INFO_STREAM(this->nh_->get_logger(), "\t\t effort");
this->dataPtr->joint_eff_cmd_[j] = std::make_shared<hardware_interface::CommandInterface>(
joint_name, hardware_interface::HW_IF_EFFORT, &this->dataPtr->joint_effort_cmd_[j]);
this->dataPtr->joint_eff_state_[j] = std::make_shared<hardware_interface::StateInterface>(
joint_name, hardware_interface::HW_IF_EFFORT, &this->dataPtr->joint_effort_[j]);
}
}
}
Expand Down

0 comments on commit 682d657

Please sign in to comment.