[PYTHON] Make PLEN Control Server compatible with ViVi PLEN2

I used to calibrate ViVi PLEN directly with a command via TCP communication, but it was so confusing that I tried to see if it could be done with a genuine PLEN Control Server. There was some trial and error, but I managed to get it to work, so I recorded it.

What is PLEN Control Server: PLEN2 uses BlueTooth serial communication for wireless communication, but it seems that application development can be facilitated by undertaking the communication and acting as a Web server.

There are two types, the application version and the Python version, but of course the application version does not work. So I dropped the Python version from Github and took a look at the contents. https://github.com/plenprojectcompany/plen-ControlServer

From the conclusion, if I correct the following three points, it works for the time being.

  1. I searched for the device'Arduino Micro'and made a connection to establish serial communication between the Control Server and PLEN2. Since the connection with ViVi Plen is a wired serial, the return value (in my environment) is'COM3'.
  2. The communication speed setting is not adjusted automatically. It was decided at 115200.
  3. Fixed the difference that seems to be because my development environment was Python3. Print syntax Changed to Str because the value given to Serial.write () throws an error in UTF. Serial.write (str.encode ())

However, a problem occurs here. The current PLEN2 and ViVi PLEN seem to have different base versions, and I couldn't even try to get ViVi to download the motion file.

Consider porting the relevant part of the PLEN2 farm to ViVi PLEN.

2020/05/10 postscript ViVi PLEN treats motion files as SPIFFS files. Since it uses 2Mb and other files use a total of 8Kb, it is necessary to secure 3Mb of FS in the Arduino IDE settings.

2020/05/16 postscript firmware.ino Changed the assignment to m_header_tmp in void setMotionHeader () to match the original

Protocol.cpp 30, // MOTION HEADER To 35, // MOTION HEADER change to

JointController.cpp According to the assembly instructions, the pin position and the servo position did not match, so const unsigned char servo_map[PLEN2::JointController::SUM] = {16, 7, 6, 5, 4, 3, 2, 1, 0, 18, 19, 20, 17, 8, 9, 10, 11, 12, 13, 14, 15, 21, 22, 23}; Swap the 3rd and 4th values of const unsigned char servo_map[PLEN2::JointController::SUM] = {16, 7, 5, 6, 4, 3, 2, 1, 0, 18, 19, 20, 17, 8, 9, 10, 11, 12, 13, 14, 15, 21, 22, 23};

Now the PLEN Control Server and ViVi are connected via serial.

Recommended Posts

Make PLEN Control Server compatible with ViVi PLEN2
Make compute server diskless with LTSP
[Python] Let's make matplotlib compatible with Japanese
Make pyautogui [super-appropriate] compatible with multi-display environment Part2
Make pyautogui [super-appropriate] compatible with multi-display environment Part1
How to make Linux compatible with Japanese keyboard
How to make an HTTPS server with Go / Gin
Tftp server with Docker
Make Lambda Layers with Lambda
Make Yubaba with Discord.py
Proxy server with Docker
Make slides with iPython
Local server with python
Control scripts with exceptions