Skip to content

Commit

Permalink
Merge pull request #364 from ijnek/ijnek-fix-variable-length-array-wa…
Browse files Browse the repository at this point in the history
…rning-2

fix variable length warning using std::vector
  • Loading branch information
ROBOTIS-Will authored Oct 6, 2022
2 parents 2f00271 + b910088 commit 0e8e600
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
19 changes: 7 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,11 @@
[![humble-devel Status](https://github.com/ROBOTIS-GIT/dynamixel-workbench/workflows/humble-devel/badge.svg)](https://github.com/ROBOTIS-GIT/dynamixel-workbench/tree/humble-devel)
[![ROS2 Rolling Status](https://github.com/ROBOTIS-GIT/dynamixel-workbench/workflows/ros2-ci/badge.svg)](https://github.com/ROBOTIS-GIT/dynamixel-workbench/tree/ros2)

# Dynamixel Workbench
# DYNAMIXEL Workbench
![](https://github.com/ROBOTIS-GIT/emanual/blob/master/assets/images/sw/dynamixel/dynamixel_workbench/DYNAMIXEL_WORKBENCH_LOGO.png)

## ROS Packages for Dynamixel Workbench
|Version|Kinetic + Ubuntu Xenial|Melodic + Ubuntu Bionic|
|:---:|:---:|:---:|
|[![GitHub version](https://badge.fury.io/gh/ROBOTIS-GIT%2Fdynamixel-workbench.svg)](https://badge.fury.io/gh/ROBOTIS-GIT%2Fdynamixel-workbench)|[![Build Status](https://travis-ci.org/ROBOTIS-GIT/dynamixel-workbench.svg?branch=kinetic-devel)](https://travis-ci.org/ROBOTIS-GIT/dynamixel-workbench)|[![Build Status](https://travis-ci.org/ROBOTIS-GIT/dynamixel-workbench.svg?branch=melodic-devel)](https://travis-ci.org/ROBOTIS-GIT/dynamixel-workbench)|

## ROBOTIS e-Manual for Dynamixel Workbench
- [ROBOTIS e-Manual for Dynamixel Workbench](http://emanual.robotis.com/docs/en/software/dynamixel/dynamixel_workbench/)
## ROBOTIS e-Manual for DYNAMIXEL Workbench
- [ROBOTIS e-Manual for DYNAMIXEL Workbench](http://emanual.robotis.com/docs/en/software/dynamixel/dynamixel_workbench/)

## Wiki for dynamixel_workbench Packages
- http://wiki.ros.org/dynamixel_workbench (metapackage)
Expand All @@ -26,16 +21,16 @@
- http://wiki.ros.org/dynamixel_workbench_single_manager_gui
- http://wiki.ros.org/dynamixel_workbench_toolbox

## Open Source related to Dynamixel Workbench
## Open Source related to DYNAMIXEL Workbench
- [dynamixel_workbench](https://github.com/ROBOTIS-GIT/dynamixel-workbench)
- [dynamixel_workbench_msgs](https://github.com/ROBOTIS-GIT/dynamixel-workbench-msgs)
- [dynamixel_sdk](https://github.com/ROBOTIS-GIT/DynamixelSDK)
- [open_manipulator](https://github.com/ROBOTIS-GIT/open_manipulator)
- [OpenCR-Hardware](https://github.com/ROBOTIS-GIT/OpenCR-Hardware)
- [OpenCR](https://github.com/ROBOTIS-GIT/OpenCR)

## Documents and Videos related to Dynamixel Workbench
- [ROBOTIS e-Manual for Dynamixel Workbench](http://emanual.robotis.com/docs/en/software/dynamixel/dynamixel_workbench/)
- [ROBOTIS e-Manual for Dynamixel SDK](http://emanual.robotis.com/docs/en/software/dynamixel/dynamixel_sdk/overview/)
## Documents and Videos related to DYNAMIXEL Workbench
- [ROBOTIS e-Manual for DYNAMIXEL Workbench](http://emanual.robotis.com/docs/en/software/dynamixel/dynamixel_workbench/)
- [ROBOTIS e-Manual for DYNAMIXEL SDK](http://emanual.robotis.com/docs/en/software/dynamixel/dynamixel_sdk/overview/)
- [ROBOTIS e-Manual for OpenManipulator](http://emanual.robotis.com/docs/en/platform/openmanipulator/)
- [ROBOTIS e-Manual for OpenCR](http://emanual.robotis.com/docs/en/parts/controller/opencr10/)
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

/* Authors: Taehun Lim (Darby) */

#include <memory>
#include "../../include/dynamixel_workbench_toolbox/dynamixel_driver.h"

DynamixelDriver::DynamixelDriver() : tools_cnt_(0),
Expand Down Expand Up @@ -773,13 +774,13 @@ bool DynamixelDriver::readRegister(uint8_t id, uint16_t address, uint16_t length
{
ErrorFromSDK sdk_error = {0, false, false, 0};

uint8_t data_read[length];
std::vector<uint8_t> data_read(length);

sdk_error.dxl_comm_result = packetHandler_->readTxRx(portHandler_,
id,
address,
length,
(uint8_t *)&data_read,
data_read.data(),
&sdk_error.dxl_error);
if (sdk_error.dxl_comm_result != COMM_SUCCESS)
{
Expand Down Expand Up @@ -1009,7 +1010,7 @@ bool DynamixelDriver::syncWrite(uint8_t index, uint8_t *id, uint8_t id_num, int3
ErrorFromSDK sdk_error = {0, false, false, 0};

uint8_t parameter[4] = {0, 0, 0, 0};
uint8_t multi_parameter[4*data_num_for_each_id];
std::vector<uint8_t> multi_parameter(4*data_num_for_each_id);
uint8_t cnt = 0;

for (int i = 0; i < id_num; i++)
Expand All @@ -1023,7 +1024,7 @@ bool DynamixelDriver::syncWrite(uint8_t index, uint8_t *id, uint8_t id_num, int3
}
}

sdk_error.dxl_addparam_result = syncWriteHandler_[index].groupSyncWrite->addParam(id[i], (uint8_t *)&multi_parameter);
sdk_error.dxl_addparam_result = syncWriteHandler_[index].groupSyncWrite->addParam(id[i], multi_parameter.data());
if (sdk_error.dxl_addparam_result != true)
{
if (log != NULL) *log = "groupSyncWrite addparam failed";
Expand Down

0 comments on commit 0e8e600

Please sign in to comment.