Skip to content

Commit 42b403a

Browse files
authored
Merge pull request #54 from ROBOTIS-GIT/master
merge for sync kinetic-devel and master branch
2 parents ff2b8bd + ee6f240 commit 42b403a

File tree

3 files changed

+64
-10
lines changed

3 files changed

+64
-10
lines changed

.travis.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# This config file for Travis CI utilizes ros-industrial/industrial_ci package.
2+
# For more info for the package, see https://github.com/ros-industrial/industrial_ci/blob/master/README.rst
3+
4+
dist: trusty
5+
sudo: required
6+
services:
7+
- docker
8+
language: generic
9+
python:
10+
- "2.7"
11+
compiler:
12+
- gcc
13+
notifications:
14+
email:
15+
on_success: always
16+
on_failure: always
17+
recipients:
18+
19+
env:
20+
matrix:
21+
- ROS_DISTRO="kinetic" ROS_REPOSITORY_PATH=http://packages.ros.org/ros/ubuntu USE_DEB=true
22+
- ROS_DISTRO="kinetic" PRERELEASE=true PRERELEASE_DOWNSTREAM_DEPTH=0
23+
matrix:
24+
allow_failures:
25+
- env: ROS_DISTRO="kinetic" PRERELEASE=true PRERELEASE_DOWNSTREAM_DEPTH=0
26+
branches:
27+
only:
28+
- master
29+
- develop
30+
- kinetic-devel
31+
install:
32+
- git clone https://github.com/ros-industrial/industrial_ci.git .ci_config
33+
script:
34+
- source .ci_config/travis.sh
35+

robotis_controller/src/robotis_controller/robotis_controller.cpp

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,8 @@ void RobotisController::initializeDevice(const std::string init_file_path)
485485
{
486486
if (dxl->bulk_read_items_.size() != 0)
487487
{
488+
uint16_t data16 = 0;
489+
488490
bulkread_start_addr = dxl->bulk_read_items_[0]->address_;
489491
bulkread_data_length = 0;
490492

@@ -497,8 +499,12 @@ void RobotisController::initializeDevice(const std::string init_file_path)
497499
bulkread_data_length += addr_leng;
498500
for (int l = 0; l < addr_leng; l++)
499501
{
500-
// ROS_WARN("[%12s] INDIR_ADDR: %d, ITEM_ADDR: %d", joint_name.c_str(), indirect_addr, dxl->ctrl_table[dxl->bulk_read_items[i]->item_name]->address + _l);
501-
write2Byte(joint_name, indirect_addr, dxl->ctrl_table_[dxl->bulk_read_items_[i]->item_name_]->address_ + l);
502+
//ROS_WARN("[%12s] INDIR_ADDR: %d, ITEM_ADDR: %d", joint_name.c_str(), indirect_addr, dxl->ctrl_table_[dxl->bulk_read_items_[i]->item_name_]->address_ + l);
503+
read2Byte(joint_name, indirect_addr, &data16);
504+
if (data16 != dxl->ctrl_table_[dxl->bulk_read_items_[i]->item_name_]->address_ + l)
505+
{
506+
write2Byte(joint_name, indirect_addr, dxl->ctrl_table_[dxl->bulk_read_items_[i]->item_name_]->address_ + l);
507+
}
502508
indirect_addr += 2;
503509
}
504510
}
@@ -552,6 +558,8 @@ void RobotisController::initializeDevice(const std::string init_file_path)
552558
{
553559
if (sensor->bulk_read_items_.size() != 0)
554560
{
561+
uint16_t data16 = 0;
562+
555563
bulkread_start_addr = sensor->bulk_read_items_[0]->address_;
556564
bulkread_data_length = 0;
557565

@@ -565,9 +573,13 @@ void RobotisController::initializeDevice(const std::string init_file_path)
565573
for (int l = 0; l < addr_leng; l++)
566574
{
567575
// ROS_WARN("[%12s] INDIR_ADDR: %d, ITEM_ADDR: %d", sensor_name.c_str(), indirect_addr, sensor->ctrl_table[sensor->bulk_read_items[i]->item_name]->address + _l);
568-
write2Byte(sensor_name,
569-
indirect_addr,
570-
sensor->ctrl_table_[sensor->bulk_read_items_[i]->item_name_]->address_ + l);
576+
read2Byte(sensor_name, indirect_addr, &data16);
577+
if (data16 != sensor->ctrl_table_[sensor->bulk_read_items_[i]->item_name_]->address_ + l)
578+
{
579+
write2Byte(sensor_name,
580+
indirect_addr,
581+
sensor->ctrl_table_[sensor->bulk_read_items_[i]->item_name_]->address_ + l);
582+
}
571583
indirect_addr += 2;
572584
}
573585
}
@@ -934,8 +946,8 @@ void RobotisController::process()
934946
dxl->dxl_state_->goal_velocity_ = dxl->convertValue2Velocity(data);
935947
else if (dxl->goal_current_item_ != 0 && item->item_name_ == dxl->goal_current_item_->item_name_)
936948
dxl->dxl_state_->goal_torque_ = dxl->convertValue2Torque(data);
937-
else
938-
dxl->dxl_state_->bulk_read_table_[item->item_name_] = data;
949+
950+
dxl->dxl_state_->bulk_read_table_[item->item_name_] = data;
939951
}
940952
}
941953

@@ -1154,8 +1166,8 @@ void RobotisController::process()
11541166
dxl->dxl_state_->goal_velocity_ = dxl->convertValue2Velocity(data);
11551167
else if (dxl->goal_current_item_ != 0 && item->item_name_ == dxl->goal_current_item_->item_name_)
11561168
dxl->dxl_state_->goal_torque_ = dxl->convertValue2Torque(data);
1157-
else
1158-
dxl->dxl_state_->bulk_read_table_[item->item_name_] = data;
1169+
1170+
dxl->dxl_state_->bulk_read_table_[item->item_name_] = data;
11591171
}
11601172
}
11611173

@@ -1239,7 +1251,7 @@ void RobotisController::process()
12391251

12401252
if (result_state == NULL)
12411253
{
1242-
fprintf(stderr, "[%s] %s", (*module_it)->getModuleName().c_str(), joint_name.c_str());
1254+
ROS_ERROR("[%s] %s ", (*module_it)->getModuleName().c_str(), joint_name.c_str());
12431255
continue;
12441256
}
12451257

robotis_device/src/robotis_device/robot.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,13 @@ Robot::Robot(std::string robot_file_path, std::string dev_desc_dir_path)
154154
uint16_t indirect_data_addr = dxl->ctrl_table_[INDIRECT_DATA_1]->address_;
155155
for (int _i = 0; _i < sub_tokens.size(); _i++)
156156
{
157+
std::map<std::string, ControlTableItem *>::iterator bulkread_it = dxl->ctrl_table_.find(sub_tokens[_i]);
158+
if(bulkread_it == dxl->ctrl_table_.end())
159+
{
160+
fprintf(stderr, "\n ##### BULK READ ITEM [ %s ] NOT FOUND!! #####\n\n", sub_tokens[_i].c_str());
161+
continue;
162+
}
163+
157164
dxl->bulk_read_items_.push_back(new ControlTableItem());
158165
ControlTableItem *dest_item = dxl->bulk_read_items_[_i];
159166
ControlTableItem *src_item = dxl->ctrl_table_[sub_tokens[_i]];

0 commit comments

Comments
 (0)