Behavior Control
This control is developed by:
AvatarDJ Sures
Created February 19 2018
Updated February 1
Help Index

Lewansoul Servo

How To Download and Use This Control

  1. Make sure you have the latest version of EZ-Builder installed.
  2. Select Download This Control button below to download the file.
  3. Double click the downloaded file to open it.
  4. The installer will automatically add this control to EZ-Builder.
Download This Control

Control the LewanSoul Digital servos (i.e. LX-16A) with EZ-Builder. The servos must be powered appropriately, and connected to the EZ-B v4 or IoTiny with the respective port. Visit the Config menu of this plugin to view the port configuration.



Cable Accessory
This plugin requires a cable accessory to easily connect your servo to the EZ-B v4 or IoTiny. You can find the cable accessory in our store by clicking here


Details
The Virtual Ports (V1..V99) in EZ-Builder can be assigned to the LewanSoul servos.

- This plugin requires the RX signal wire of the servo be connected to TX of the selected UART or digital port (if Software UART is selected) using the Dynamixel servo Cable.

- Hardware UART is available on the EZ-B v4 only, and is recommended if using an EZ-B v4 with Dynamixel servo Cable. View the EZ-B v4 datasheet to identify the UART ports (0, 1, or 2). Datasheet can be found here: http://www.ez-robot.com/Tutorials/Lesson/18

- Software UART is available on both the EZ-B v4 and IoTiny. We only  recommend using software UART on IoTiny and hardware UART on EZ-B v4.

- The configuration menu also provides an option to select the Virtual Ports, which correspond with the ID's of the UBTech servos. If the LewanSoul servo ID #0 is connected, select V0. #1 = V1, #2 = V2, etc..

- Default baudrate of LewanSoul servos is 115,200

- Discussion on these servos is here: https://www.ez-robot.com/Community/Forum/Thread?threadId=10643

Continuous Rotation (Motor) Mode
The servos can be configured for Continuous Rotation (i.e. Motor Mode) by using the EZ-Script ControlCommand()...

Code:

ControlCommand("LewanSoul servo", SetToContinuousMode, v1)

You can change the port (which is v1 in the above example) to what ever port you wish to be in continuous rotation mode. Once you do that, the servos will now respond as regular continuous rotation servos, where position 90 is stop, 180 is fast one direction and 1 is fast in the other direction. The values further from 90 in either direction are change the speed. This allows these servos to be used with the Continuous Rotation Movement Panel.

Servo Mode
If you switched the servo into Continuous rotation mode, you can use the ControlCommand() to switch back to servo mode. This can be done with the following command...

Code:

ControlCommand("LewanSoul servo", SetToServoMode, v1)


Reading servo Positions
If the servo is connected to both the RX and TX of the selected UART, the servo position can be read. This feature is available in both EZ-Script and Auto Position control. In EZ-Script, the GetServoRealtime() function will query the specified servo. Otherwise, in the Auto Position config screen, the servos can be queried using the Realtime query button in the frame editor.

February 16
I see, no worries i can understand you perfectly. For me the way I set them up with the joystick was the easiest way to make them move. Once I get the my battery replacement I will power up the servos and share the way have them set them up. The only problem I have so far is that I can only steer the front wheels left and right but not the back ones. Maybe we can figure out a way to make them move the way they are supposed to. 

P.S.

I want to wait until I get my new battery just to make sure I share the correct set up that I have.
February 16
For the steering I currently used a slider (Min=60, Max=120, Default=90) in the "Mobile Interface". The value is passed to the variable $Steering_angle. If changed, the following code is executed:

Code:

servo(V1, $Steering_angle)
servo(V2, $Steering_angle)
servo(V3, 90 - ($Steering_angle-90))
servo(V4, 90 - ($Steering_angle-90))

V1 and V2 steer the front axis and V2 and V3 steer the rear axis.
February 18 — Updated February 18
Great rover project and another great plugin!! This is very cool!!!:)

I have been rolling the idea of changing the servo setup in my robot for quiet some time,
this seems to be a good option!! Daisychaining will be helping a lot to clean the wiring mess, and positional feedback is a very nice addon!!

I also found this over on GitHub, which is looking good

https://github.com/maximkulkin/lewansoul-lx16a
February 18 — Updated February 19
Alright, finally after a busy weekend and a few hiccups along the way I was able to open up my program. Here is what I have, the way I have it set up lets me move it in any direction I want with an xbox one controller.  I still need to work on the steering, if you find a solution let me know. 

User-inserted image



This is the code. 

User-inserted image
Set up for joystick#2

User-inserted image
Set up for joystick #1
February 18
@Mickey666Maus it is indeed, it has been a really good learning process for me getting to know how to work with the EZBv4, there is just an endless amount of projects that you can work on.