Try to get dobot processing sketch working under Linux


#1

Hi everyone!

The idea is to get dobot working under linux.
The only source code I am aware of, is the processing sketch found under github (see reddit for link).

  1. First step is to install processing (I use v3.0.1) which should be straight forward, just download from processing site and install.
  2. Clone github repo and open in processing ide.
  3. When serial init method is commented out, the program works almost almout of the box (maybe some fonts missing, some minor issues which can be easy figured out, I don’t remeber )
    You can point to a position in the window with the mouse and the (simulated) robot arm on screen will move accordingly.
    Now to the not so funny part:
    Connect your dobot to the USB interface and comment in the serial init method.
    The protocol changed, I guess due to the new hardware shield, the serial connection can be established to the dobot and it continually sends some data, but I was not able to get the sense of it, I think that even the baudrate was changed and I was not able to get it right.
    But the dobot will recognize the connection and with a little help from the dobot team I am convinced that we could get it running.
    Thanks for establishing this forum, so we have a better place for discussion and thoughts…
    Maybe one of the Dobot Team member can get a little bit more light in this topic.
    Thanks Tilli Kay

#2

Hi, glad to see your post here ! :grin:
Yes, as you know, we had changed the protocol.
And yesterday we had just uploaded the protocol docuement and the code of DobotTools on github.
Here is the link: github.com/dobotteam/dobot, check it out!


#3

@TillyKay
In the sendDeltaXYZ() function change “state” to 4.0 (writing additive mode) and change X and Y places in the call to sendPackage() function.
For more details have a look at https://github.com/DobotTeam/Dobot/blob/master/protocol/Dobot_protocol_en_1.0_beta.pdf

The coordinate system is still a bit off and dobot drops commands randomly, but at least you can make it move under any OS.
Another way to make it move under any OS would be a python script. Here I’ve created a gist: https://gist.github.com/maxosprojects/7c2732c5be3e61eb6deb
You use it with dobot.xyz(x, y, z). Add time.sleep() with enough sleep for dobot to finish the command otherwise it will drop it. For completeness sake - dobot drops commands randomly anyway, but “sleep” helps a lot.
The gist also prints the stuff dobot returns on the serial interface, which are floats in 10-float chunks. So you are interested in last numbers 0-9 - that gives you one unit of report of dobot’s state (x, y, z, angles, etc.). Refer to the protocol description (link above) for how to understand those floats.


#4

I forced the serial port to com3 and 9600 speed to get it to run

_ String portName = Serial.list()[1];_
_ myPort = new Serial(this, portName, 9600);_

and tried changes given byTillyKay
Gripper moves once and then nothing.

What can I do to get it to work?


#5

does it at least move to the right location?


#6

No it does not move at all.
gripper closes and opens and joint 3 falls down

Tnx


#7

Will this work under Windows python3.5
What is dobot.xyz(x, y, z) and time.sleep() ?
Where do I get them?

Tnx


#8

I suspect the joint doesn’t fall down, but just moves down (not like in free fall, as the motors are not released - you can see the difference when pressing the middle button, called stepper en, on the blackbox).

I’m afraid you may have a broken firmware or arduino.

dobot.xyz(x, y, z) makes dobot move to absolute x, y, z coordinates in dobot’s own coordinate system. If you dobot looks straight ahead when turned on then the python gist would make it move forward and back once at a specific height (-40 in this case). time.sleep() introduces a delay in between sending commands so that t decrease chances of dobot dropping subsequent commands for unknown reason https://docs.python.org/2/library/time.html#time.time

FYI, for cleaner experiment make sure you first turn the power switch on on the blackbox and only then plug the usb cable into your computer - that makes dobot read the accelerometers correctly and figure out its initial configuration.

The python gist won’t work in python3 without changes. Specifically, you would need to wrap the arguments to print in parentheses and install pyserial for python3 (if it is not installed). That is as far as I could take in with python3. I suspect there will be more changes required.
Better install python2.7 - it’s not a big deal - they can live together if installed right.

Alternatively, you can run a VirtualBox Ubuntu 14.04 VM as a sandbox environment (or even a windows vm https://dev.windows.com/en-us/microsoft-edge/tools/vms/windows/ for that matter) and install whatever python version you want there. Though free windows vms expire after 3 months.

PS: the advantage of that python gist is that it reports you back dobot’s status.
I may fork the original Processing sketch later, apply all fixes, enable dobot status logging and give it a try under windows. Stay tuned.


#9

No middle button (stepper_en)
my buttons Reset, Laser adj, Sensor cal
my dobot a kickstarter dobot

Dobot runs under — dobottools_v1.0.1_20160204
no idea what firmware is loaded in it?

I’ll load up python 2.7 and give it a go.

Tnx


#10

I took off the front face of that blackbox so long ago that I forgot it was ever there :slight_smile: My bad, sorry. The button is still middle, but called “Laser Adjustment” on the front face (which is labeled as Stepper_En on the circuit board, if you look under the top lid, which makes much more sense as it is in fact setting Stepper_En on the stepper drivers that disables the drivers and you can freely move the arm around).
Mine is from kickstarter too.

Wait a second. You’re on windows. Does dobot work using any of the dobot windows apps? I was still in Linux context (as the topic suggests).
If you’re on windows and none of the windows apps work for you (make sure you hold the X+ X- etc buttons, and not just click them), then you should try to flash the firmware again. If even that doesn’t help, then you have a hardware problem.


#11

Apps I use to control Dobot that work
dobottools_v1.0.1_20160204
and
DobotApplication_1.0.1 running under Windoze 7 pro
it may be using arduino 1.0.6

video of me driving with dobottools at:

Tnx


#12

Hi everyone,
due to the post from X.Junjie and noteb it is now much more clear, how the Dobot is interacting with the PC.
Thanks for releasing the Protocol documentation and the source code of the DobotTools.
Since I am using an older version of Qt (v4.6.3), there is still a bit of work for me, but I got the DobotServer working.
So it definitely uses 256K baud and the packages look like stated in the documentation, so all is setup for using Dobot under Unixes like Linux or Mac, etc. That would have been a no go, for me.
When I finished my work I will release it on github.

The next problem I see is that Dobot might randomly loose some commands, like noteb stated. Without fixing this it is hard to believe that we will get a reliable working robot arm.

If I understood the comment on Kickstarter correctly, the Dobot Team is NOT going to open source the arduino sketch source code nor the FPGA code, please correct me if I missed something.
Beside the fact that it was promised in the campaign and the communication policy and speed of updates of the last month (which I can fully understand due to the small team, and the amount of work they have done/ to do) I would really appreciate a rethinking of this decision.
The community is able to help here a lot, since beginner can get help from more advanced users, which frees the Dobot Team from the burden of writing tutorial or answering the similar question again, and again, or just getting bugfixes for free.
Without the source code the community is not able to help, and all which remains to do is to cry out for bugfixes and support.
You decide…

Kind regards TK


#13

I tried your python gist on a Fedora 23. Sadly I could not make it work.

I tried changing the baudrate to 9600, and the device seems to be /dev/ttyACM0.

Any suggestions?


#14

Ok, I changed the baud rate to 256000, and then the dobot moves!
I’m not sure it moves the right way, but at least it moves.


#15

Glad it worked for you. Not sure why it works with any baud rate under Ubuntu and MacOS but not under Fedora and Windows. I specifically avoided setting 256000 rate in the python gist as it depends on the version of pyserial module you have installed - the 256000 is not standard and is not available in older pyserial versions, as well as it is not available in Arduino IDE.
The direction of movement is determined by the coordinates you pass to dobot.xyz(x,y,z). Refer to documentation to see which axis is which.

This is the end of my journey with dobot as it is as I’m going to replace the top board with RAMPS (as more and more owners opt to) to get full control of the device I paid for (quite a lot for the value tbh) to be open (as was promised).
I will hook the accelerometers too (just for initial reading) and create a proper firmware to be able to control it via ROS. I’m going to use powerful inverse kinematics (IK) and trajectory planning open-source projects (that are available to ROS) that would simplify the firmware drastically and enable much more than the dobot proprietary firmware will ever be able to do (not even talking about bugs and fundamental flaws). ROS modules can be written in C or python, so it’s quite nice for the for a non-trivial repeating job (or even for such).
The reddit dobot forum would be a better place for now to share the progress on that as I suspect it won’t be welcomed here by the forum owners.


#16

Interesting, I was thinking the same thing. I will follow over to the Reddit forum then and follow your progress. (Although I’m more of an old-school mailing list guy myself)


#17

Hi,
I got DobotTools working under Qt4 (had to change some calls to new interfaces, e.g. TimeDate), but dobot is loosing steps in an unreliable way. I decided to NOT take more effort in this closed source black box…
I have ordered a RAMPS v1.4 board and will switch over to open-dobot project on reddit/github.
Looks more promising to me.

KR Till


#18

Hi, we just released a version using 9600 Baud rate rather than 256K, which seems to be more robust in our previous test. and we do encourage you to use 9600 firmware and do the development.

and yes, we are currently not openning the source at this moment, but it does not mean we are not going to open it in the future. I value your advice a lot, and I will take it into the consideration. Thanks a lot!


#19

As mentioned in upper post, the 9600 Baud is much more stable in communication. and replied in another post, we are working on the protocol, so that it may fits your need better in the future.

Your idea with ROS is very welcomed here. I worked with ROS before, and its a wonderful platform for robot.But I am not sure if there is a problem for you to directly communicate with Dobot controller through the current protocol. And after we upgrading the protocol, you can just upgrade the node for communication, rest nodes coulde be the same.


#20

Hi X.Junjie,

thank you for your answer and your reconsideration.
Will give your new sketch a try…
Can you at least give some advices about the architecture of the arduino sketch?
What is the FPGA doing?
Some info about the protocol ATMega <-> FPGA ?
TK