Asked

How To Move A Servo 360 Using Blocky With Time

I would like to control a 360-degree continuous rotation servo using Blockly in Synthiam ARC, specifying the duration of movement instead of a specific angle. Which blocks should I use to achieve this? I assume I need to use the "Move Servo" block to identify the servo number. What other blocks should I use to set the duration and speed for the servo's movement? Should I also consider using the "Move Forward" block, which allows setting left speed, right speed, and duration in milliseconds?


Related Hardware EZ-B v4
Related Control Continuous Servo

ARC Pro

Upgrade to ARC Pro

ARC Pro is your gateway to a community of like-minded robot enthusiasts and professionals, all united by a passion for advanced robot programming.

PRO
Canada
#1  

To control a 360-degree continuous rotation servo using Blockly in Synthiam ARC, you can use the Continuous servo Movement Panel skill. Since continuous rotation servos don't have a specific position but rather a speed and direction, you'll need to specify the speed and duration for which the servo should move.

Here's how you can achieve this using Blockly:

  1. Add the Continuous servo Movement Panel: Ensure that you have added the Continuous servo Movement Panel to your ARC project. This panel will allow you to control the continuous rotation servos.

  2. Open Blockly: Go to the Blockly interface in ARC.

  3. Set servo Speed: Use the Set Speed block to specify the speed for the left and right servos. The speed is a percentage value between 0 and 100. You can adjust the speed to control how fast the servo rotates.

  4. Move Servo: Use the Move Forward, Move Reverse, Move Left, or Move Right block to specify the direction in which you want the servo to move. These blocks will control the movement of the robot using the Continuous servo Movement Panel.

  5. Set Duration: Use the Wait block to specify the duration for which the servo should move. The duration is specified in milliseconds. For example, if you want the servo to move for 2 seconds, set the wait time to 2000 milliseconds.

  6. Stop Servo: After the wait duration, use the Stop block to stop the servo movement. This will ensure that the servo stops rotating after the specified time.

Here's a simple example of how the Blockly code might look:

Set Speed Left: 50% Right: 50%
Move Forward
Wait 2000 milliseconds
Stop

Steps in Blockly:

  • Set Speed: Drag the Set Speed block and set the desired speed for both left and right servos.
  • Move Forward: Drag the Move Forward block to start the movement.
  • Wait: Drag the Wait block and set the duration in milliseconds.
  • Stop: Drag the Stop block to stop the movement after the wait time.

This setup will move your continuous rotation servo forward at the specified speed for the specified duration and then stop it. Adjust the speed and direction blocks as needed for your specific application.


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
#2  

Athena is correct - but only if you’re using the continuous rotation servo as a movement method. Meaning, it has a wheel attached to it to move the robot. That’s why you’d use a movement panel. A Movement Panel is responsible for moving the robot.

if the servo is to be used as something else, you can use a regular servo command in Blockly to move the servo. So yes, use the move servo block.

One bit of information that would help you is understanding how a continuous rotation servo works. This document explains what positions would make the servo move: https://synthiam.com/Support/Advanced-Fundamentals/servo-motor#part5

That same document explains the difference between a continuous rotation and standard servo. It’s important to know that a continuous rotation servo has no internals to understand positioning.

@athena can explain more.

PRO
Canada
#3  

Thank you for the additional context! Let's delve a bit deeper into how continuous rotation servos work and how you can control them using Blockly in Synthiam ARC.

Understanding Continuous Rotation Servos

A continuous rotation servo differs from a standard servo in that it doesn't have a fixed position range (like 0 to 180 degrees). Instead, it rotates continuously in either direction. The speed and direction of rotation are controlled by the PWM signal:

  • Neutral Position (90 degrees): The servo stops moving.
  • Greater than 90 degrees (e.g., 180): The servo rotates in one direction, with speed increasing as the value approaches 180.
  • Less than 90 degrees (e.g., 0): The servo rotates in the opposite direction, with speed increasing as the value approaches 0.

Controlling a Continuous Rotation servo with Blockly

If you're using the continuous rotation servo for purposes other than moving the robot (e.g., rotating an arm or a sensor), you can use the regular servo control blocks in Blockly. Here's how you can set it up:

  1. Add the Continuous servo Skill:

    • Ensure the Continuous servo skill is added to your ARC project.
  2. Open Blockly:

    • Navigate to the Blockly interface in ARC.
  3. Set servo Position:

    • Use the Set Servo block to specify the port and position for the servo.
    • For example, setting the position to 180 will rotate the servo in one direction at full speed, while setting it to 0 will rotate it in the opposite direction at full speed.
  4. Set Duration:

    • Use the Wait block to specify how long the servo should rotate. The duration is in milliseconds.
  5. Stop Servo:

    • To stop the servo, set the position back to 90 using the Set Servo block.

Example Blockly Code

Here's an example of how your Blockly code might look:

Set servo (port: D0, position: 180)  // Rotate in one direction
Wait 2000 milliseconds               // Wait for 2 seconds
Set servo (port: D0, position: 90)   // Stop the servo

Steps in Blockly:

  • Set Servo: Drag the Set Servo block and set the port and position to control the direction and speed.
  • Wait: Drag the Wait block and set the duration in milliseconds.
  • Set servo to Stop: Drag another Set Servo block to stop the servo by setting the position to 90.

This setup will rotate your continuous rotation servo in the specified direction for the specified duration and then stop it. Adjust the position values as needed for your application. If you have any more questions or need further assistance, feel free to ask!


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.