Comments (9)
Okay, that worked. My emergency stop command in multi-turn mode is simply:
//give stop command in multi-turn mode
dxl_wb.itemWrite(ID, "Goal_Position", dxl_wb.itemRead(ID, "Present_Position"));
Thanks again for your help. I think you can go ahead and close this issue.
from opencm9.04.
Hi, @8035mpg.
First, the function you are using is not recommended.
Maybe you are using the old code. We recommend that you use the Arduino IDE and the latest firmware version.
Going back to the code, I think the return type of the readWord() function is unsigned.
Therefore, signed casting is required (int16_t).
And can I see the code that sets "multi turn mode"? It seems that multi turn mode is not activated and can not go down from zero.
from opencm9.04.
I'm using the OpenCM IDE. I'll go download and install the Arduino IDE and give it a try. Can you give me the link to documentation on the different functions available with Arduino IDE for commanding dynamixels (like "readWord", "writeByte", etc.)?
Also, I tried casting the output of Dxl.readWord() to "int16_t" and got a compile error. Here's a screenshot:
The code that sets multi-turn mode is as follows:
//set to multi-turn mode
Dxl.writeWord(ID, 6, 4095); //set CW angle limit
Dxl.writeWord(ID, 8, 4095); //set CCW angle limit
SerialUSB.println("Multi-turn Mode");
from opencm9.04.
Also, if 'Dxl.readWord()' is not recommended, what can I use instead?
from opencm9.04.
You can refer to e-Manual for new APIs.
from opencm9.04.
Ok, I changed over to Arduino IDE and it is now able to read negative positions. But two questions about the new API.
(1) I noticed in the examples that they always write this at the beginning:
//setup comm with OpenCM9.04 board
#if defined(__OPENCM904__)
#define DEVICE_NAME "1" //Dynamixel on Serial1(USART1) <-OpenCM9.04
#elif define(__OPENCR__)
#define DEVICE_NAME ""
#endif
This is not necessary, right? I am assuming I don't have to do this and can just write:
#define SERIAL1 1
dxl_wb.begin(SERIAL1, 57600);
(2) What is the purpose of this line of code? Is it even necessary?:
dxl_wb.ping(ID);
For reference, here is an excerpt of the output when moving from positive position values to negative position values after I got it to work with Arduino IDE and APIs:
Position: 1171, Goal: -7000
Position: 1101, Goal: -7000
Position: 1027, Goal: -7000
Position: 960, Goal: -7000
Position: 891, Goal: -7000
Position: 820, Goal: -7000
Position: 750, Goal: -7000
Position: 675, Goal: -7000
Position: 608, Goal: -7000
Position: 539, Goal: -7000
Position: 466, Goal: -7000
Position: 396, Goal: -7000
Position: 323, Goal: -7000
Position: 256, Goal: -7000
Position: 186, Goal: -7000
Position: 115, Goal: -7000
Position: 45, Goal: -7000
Position: -27, Goal: -7000
Position: -95, Goal: -7000
Position: -163, Goal: -7000
Position: -234, Goal: -7000
Position: -303, Goal: -7000
Position: -377, Goal: -7000
Position: -444, Goal: -7000
Position: -514, Goal: -7000
Position: -585, Goal: -7000
Position: -655, Goal: -7000
Position: -729, Goal: -7000
Position: -796, Goal: -7000
Position: -866, Goal: -7000
Position: -938, Goal: -7000
And here are the parts of the code that set the dynamixel mode and print out the position and goal values:
//set to multi-turn mode
dxl_wb.itemWrite(ID, "CW_Angle_Limit", 4095); //CW limit
dxl_wb.itemWrite(ID, "CCW_Angle_Limit", 4095); //CCW limit
dxl_wb.itemWrite(ID, "Moving_Speed", 500); //set speed
//move to new goal within while loop
dxl_wb.itemWrite(ID, "Goal_Position", goal);
while ( abs(goal - dxl_wb.itemRead(ID, "Present_Position")) > 50 )
{
Serial.print("Position: ");
Serial.print(dxl_wb.itemRead(ID, "Present_Position"));
Serial.print(", Goal: ");
Serial.println(dxl_wb.itemRead(ID, "Goal_Position"));
}
from opencm9.04.
(1) You can use it in your own way, but it must be a string. (e.g., "1", "2", "3")
(2) You can check the communication status with DXL through Ping command. Since the bool type is returned, the connection status can be checked by return value. (Similar to the function of Ping in Network)
And thank you for providing your code for reference :)
from opencm9.04.
How do I give a STOP command when the Dynamixel is turning in multi-turn mode (before it reaches the goal position)? I cannot set the speed to '0' because '0'-speed means maximum speed in multi-turn mode.
from opencm9.04.
If you want to stop at a certain position, you should change "Goal Position" to that value.
Therefore, you should monitor the current position value and set the "Goal Position" to the desired value or the position value indicated by the current position.
from opencm9.04.
Related Issues (20)
- br410 uart over ble profile code HOT 2
- Are they a set? OpenCM9.04 Release 1.5.0 and OpenCM9.04 Firmware ver 23. HOT 2
- OpenCM 9.04 model for circuit design programs HOT 6
- Will Wire.h be implemented in hardware? HOT 3
- How to modifying the PWM frequency on the OpenCM9.04 ? HOT 2
- Cant't make OpenCM communicate with sensors via I2C HOT 2
- stdint.h not found error on compile for OpenCM
- ros2 micro-ros support
- Arduino IDE Board Manager cannot install OpenCM board HOT 2
- Trying to run the I2C in slave mode HOT 7
- Support all of the Arduino installs - Now including ARM64 HOT 1
- Serial Port problems with <ros.h> on arduino IDE HOT 5
- Conflict with wire.h HOT 1
- Issues about sync read and its examples HOT 2
- Problem with example "n_Bulk_read_write" (groupBulkWrite addparam failed) HOT 7
- [OpenCM904 Not Detected UART Flash Loader] HOT 3
- [3.7.21][C++][USB2Dynamixel][XM540-W150-R] Issue: Writing and reading negative value of the current HOT 1
- Bootloader source HOT 1
- openCM904C Serial/UART Not working HOT 8
- Can't connect to MCU with ST-LINK/V2 and ST-LINK Utility HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opencm9.04.