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

[ dynamixel_workbench_controllers] Controller bugfix #238

Closed
wants to merge 2 commits into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,9 @@ bool DynamixelController::getPresentPosition(std::vector<std::string> dxl_name)
{
WayPoint wp;
uint32_t read_position;
for (auto const& dxl:dynamixel_)
for (auto const id:id_array)
{
result = dxl_wb_->readRegister((uint8_t)dxl.second,
result = dxl_wb_->readRegister(id,
control_items_["Present_Position"]->address,
control_items_["Present_Position"]->data_length,
&read_position,
Expand All @@ -300,7 +300,7 @@ bool DynamixelController::getPresentPosition(std::vector<std::string> dxl_name)
ROS_ERROR("%s", log);
}

wp.position = dxl_wb_->convertValue2Radian((uint8_t)dxl.second, read_position);
wp.position = dxl_wb_->convertValue2Radian(id, read_position);
pre_goal_.push_back(wp);
}
}
Expand Down Expand Up @@ -581,7 +581,6 @@ void DynamixelController::writeCallback(const ros::TimerEvent&)
int32_t dynamixel_position[dynamixel_.size()];

static uint32_t point_cnt = 0;
static uint32_t position_cnt = 0;

for (auto const& joint:jnt_tra_msg_->joint_names)
{
Expand All @@ -600,19 +599,13 @@ void DynamixelController::writeCallback(const ros::TimerEvent&)
ROS_ERROR("%s", log);
}

position_cnt++;
if (position_cnt >= jnt_tra_msg_->points[point_cnt].positions.size())
point_cnt++;
if (point_cnt >= jnt_tra_msg_->points.size())
{
point_cnt++;
position_cnt = 0;
if (point_cnt >= jnt_tra_msg_->points.size())
{
is_moving_ = false;
point_cnt = 0;
position_cnt = 0;
is_moving_ = false;
point_cnt = 0;

ROS_INFO("Complete Execution");
}
ROS_INFO("Complete Execution");
}
}

Expand Down