- added position_p_gain sync write

- MotionModule/SensorModule member variable access changed (public -> protected).
- some bug fixed.
This commit is contained in:
ROBOTIS-zerom
2016-05-25 11:37:07 +09:00
parent cbc4144b36
commit 30586ed499
8 changed files with 293 additions and 88 deletions

View File

@@ -41,6 +41,7 @@ public:
ControlTableItem *goal_position_item;
ControlTableItem *goal_velocity_item;
ControlTableItem *goal_current_item;
ControlTableItem *position_p_gain_item;
Dynamixel(int id, std::string model_name, float protocol_version);

View File

@@ -30,6 +30,7 @@ public:
double goal_position;
double goal_velocity;
double goal_current;
double position_p_gain;
std::map<std::string, UINT32_T> bulk_read_table;
@@ -43,6 +44,7 @@ public:
goal_position(0.0),
goal_velocity(0.0),
goal_current(0.0),
position_p_gain(0.0),
position_offset(0.0)
{
bulk_read_table.clear();

View File

@@ -24,7 +24,8 @@ Dynamixel::Dynamixel(int id, std::string model_name, float protocol_version)
present_current_item(0),
goal_position_item(0),
goal_velocity_item(0),
goal_current_item(0)
goal_current_item(0),
position_p_gain_item(0)
{
this->id = id;
this->model_name = model_name;

View File

@@ -106,6 +106,9 @@ Robot::Robot(std::string robot_file_path, std::string dev_desc_dir_path)
UINT16_T _indirect_data_addr = _dxl->ctrl_table[INDIRECT_DATA_1]->address;
for(int _i = 0; _i < sub_tokens.size(); _i++)
{
if(_dxl->bulk_read_items[_i] == NULL)
continue;
_dxl->bulk_read_items.push_back(new ControlTableItem());
ControlTableItem *_dest_item = _dxl->bulk_read_items[_i];
ControlTableItem *_src_item = _dxl->ctrl_table[sub_tokens[_i]];
@@ -122,10 +125,13 @@ Robot::Robot(std::string robot_file_path, std::string dev_desc_dir_path)
_indirect_data_addr += _dest_item->data_length;
}
}
else // INDIRECT_ADDRESS_1 exist
else // INDIRECT_ADDRESS_1 not exist
{
for(int _i = 0; _i < sub_tokens.size(); _i++)
_dxl->bulk_read_items.push_back(_dxl->ctrl_table[sub_tokens[_i]]);
{
if(_dxl->ctrl_table[sub_tokens[_i]] != NULL)
_dxl->bulk_read_items.push_back(_dxl->ctrl_table[sub_tokens[_i]]);
}
}
}
}