Skip to content

Subject: calllib Error: "Value exceeds allowable range" with Negative Goal Position in MATLAB #667

@mamang1101

Description

@mamang1101

Hello,

I am using the Dynamixel SDK in MATLAB to control my motors. My goal is to rotate a motor in the reverse direction by providing a negative Goal Position value.

I have successfully connected to the port and set the Operating Mode for my motors to Extended Position Control Mode (4). All the initial setup commands execute without any errors.

However, the problem occurs when I try to send a negative position value. When I run the command write4ByteTxRx(..., -100), I receive the following error:

Error using calllib: Value exceeds the allowable range for the data type.

Even though the motor is in a mode that should support a wide range of negative values, MATLAB's calllib function fails with this data type error.

Could you please advise on how to resolve this issue? I need to be able to send negative goal positions to control the motor's direction properly.

Thank you for your help.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Succeeded to open the port!
Succeeded to change the baudrate!
Operating mode changed to extended position control mode.
Operating mode changed to extended position control mode.
Operating mode changed to extended position control mode.
Dynamixel has been successfully connected
Dynamixel has been successfully connected
Dynamixel has been successfully connected

GOAL_POSITION_VALUE = -100;
write4ByteTxRx(port_num, PROTOCOL_VERSION, 3, ADDR_GOAL_POSITION, GOAL_POSITION_VALUE);

Error using calllib
Value exceeds the allowable range for the data type.

Error in write4ByteTxRx (line 35)
calllib(lib_name, 'write4ByteTxRx', port_num, uint8(protocol_version), uint16(id), uint16(address), int32(data));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions