dji RoboMaster EP Programming Manual

dji RoboMaster EP Programming Manual

Hide thumbs Also See for RoboMaster EP:

Advertisement

Quick Links

Advertisement

Table of Contents
loading

Summary of Contents for dji RoboMaster EP

  • Page 2 ( )...
  • Page 3 The RoboMaster EP programming guide is designed to help new users quickly learn programming techniques for controlling the EP. The RoboMaster lab offers hundreds of graphical programming blocks that allow you to access features like PID control, computer vision, and more. While at first this may be challenging for beginners unfamiliar with robots or basic programming, this guide includes instructions and example programs for each block to help new users develop their skills.
  • Page 4 (1) Objective: Sets the first program executed when the robot powers on (2) Type: Embedded block (3) Example: Move forward 1 meter This will control the EP to move forward by 1 meter. Note: If blocks (other than event triggering blocks and function blocks) are not placed within the “Start” area, they will not be executed.
  • Page 5 (2) Type: Settings block (3) Examples: Rotate with variable speeds, Rotate together, Rotate contra directionally ① Rotate with variable speeds In Chassis Lead Mode, you will only set parameters for the chassis. When the chassis is rotating to the left or right with variable rotation speeds, check that the gimbal continuously follows the chassis and that the angle between the gimbal and the chassis front is zero when chassis motion stops.
  • Page 6 Note: In Gimbal Lead Mode, if the gimbal is not rotating, the chassis will not be able to rotate left or right on its own. ③ Rotate contra directionally In Free Mode, the gimbal and the chassis rotate in opposite directions. In this mode, you will need to check whether the gimbal and the chassis are interfering with each other’s motion.
  • Page 7 In free mode, the "set chassis to follow gimbal at (0) ° "and “set gimbal to follow chassis at (0)° ”blocks will not be able to take effect. Python API: Function: robot.set_mode(mode_enum) Parameters: ● mode_enum(enum) ■ rm_define.robot_mode_gimbal_follow ■ rm_define.robot_mode_chassis_follow ■ rm_define.robot_mode_free (1) Objective: Starts, pauses, or stops the timer (2) Type: Execution block (3) Example: Time a rotation...
  • Page 8 Note: 1) Selecting “Pause” will hold the time currently displayed on the timer. The timer will resume measurement from this time when it starts again. Refer to the example below in which t1=2 and t2=5. 2) Select “Stop” to stop the timing process. The previously recorded time will be deleted, and the timer will begin measurement from zero when it starts again.
  • Page 9 Python API: Function: tools.timer_ctrl(behavior_enum) Parameters: ● behavior_enum(enum): ■ rm_define.timer_start ■ rm_define.timer_stop ■ rm_define.timer_reset (1) Objective: Applies higher magnifications to support visual recognition over longer distances, enabling the robot to focus on unclear objects more accurately (2) Type: Execution block (3) Example: Enlarge camera frame Place a Vision Marker 10 meters in front of the robot’s gimbal and set the camera magnification to 4;...
  • Page 10 Before running the enlarge camera frame program: After enlarging the camera frame:...
  • Page 11 Python API: Function: media_ctrl.zoom_value_update(value) Parameters: ● value (int): [1, 4] (1) Objective: Obtains the total time elapsed from when the timer first started to the current time (in seconds) (2) Type: Information block (variable-type) (3) Example: Time a rotation This uses variables to measure the time it takes the chassis to complete one full rotation. You can check details using the FPV window:...
  • Page 12 Python API: Function: tools.timer_current() Return value: ● time_stamp(float) (1) Objective: Obtains the program running time (in seconds) (2) Type: Information block (variable-type) (3) Example: Calculate program runtime This obtains the program running time using variables. You can check specific details using the FPV window:...
  • Page 13 Python API: Function: tools.run_time_of_program() Return value: time (float) ● (1) Objective: Acquires current time information including the year, month, day, hour, minute, and second (2) Type: Information block (variable-type) (3) Example: Compare time values If the number of the current month is larger than the number of the current day, the robot will nod its head; if the number of the current month is less than or equal to the number of the current day, the robot will shake its head.
  • Page 14 Python API: Function: tools.get_localtime(time_enum) Parameters: ● time_enum (enum): ■rm_define.localtime_year ■rm_define.localtime_month ■rm_define.localtime_day ■rm_define.localtime_hour ■rm_define.localtime_minute ■rm_define.localtime_second Return value ● time (int) (1) Objective: Indicates the total time elapsed from when the robot started running up to the current time (in seconds) (2) Type: Information block (variable-type) (3) Example: Calculate running time This measures the total time elapsed from when the robot most recently started running up to the current hour, minute, and second.
  • Page 15 You can check data changes using the FPV window. The robot will need to take a break when program runtime reaches one hour. (i.e., when runTime_hour>1). Note: 1) The start time refers to the time when the robot is powered on. 2) If the robot restarts after a power failure, it will recount the running time.
  • Page 16 (1) Objective: Sets the flash rate for LEDs (2) Type: Settings block (3) Example: Configure reverse light This will set the rear LED of the chassis to flash red four times per second when reversing. Python API: Function: led_ctrl.set_flash(armor_enum, frequency) Parameters: ●armor_enum(enum): ■rm_define.armor_all...
  • Page 17 (1) Objective: Sets chassis LED colors and effects ● Solid: LED will remain steady ● Off: LED will switch off ● Pulse: LED will flicker ● Blink: LED will blink at a specified frequency (2) Type: Execution block (3) Example: Display streaming color effects This will set the robot to switch off all LEDs on the chassis for one second, and then flash all LED colors in sequence.
  • Page 18 ■ rm_define.effect_always_off ■ rm_define.effect_breath ■ rm_define.effect_flash (1) Objective: Sets gimbal LED colors and effects ● Solid: LED will remain steady ● Off: LED will switch off ● Pulse: LED will flicker ● Blink: LED will blink at a specified frequency ●...
  • Page 19 ■ rm_define.armor_top_all ■ rm_define.armor_top_left ■ rm_define.armor_top_right ● r(int): [0, 255] ● g(int): [0, 255] ● b(int): [0, 255] ● led_effect_enum(enum): ■ rm_define.effect_always_on ■ rm_define.effect_always_off ■ rm_define.effect_breath ■ rm_define.effect_flash ■ rm_define.effect_marquee (1) Objective: Sets the flash sequence for the gimbal LEDs; eight LEDs are located on each side of the gimbal and can be controlled independently (2) Type: Execution block (3) Example: Switch on a single light...
  • Page 20 Note: You can choose multiple LEDs to activate simultaneously. Python API: Function: led_ctrl.set_signle_led(armor_enum, led_index, led_effect_enum) Parameters: ● armor_enum(enum): ■ rm_define.armor_top_all ■ rm_define.armor_top_left ■ rm_define.armor_top_right ● index(int/list): [1, 8] ● led_effect_enum(enum): ■ rm_define.effect_always_on ■ rm_define.effect_always_off (1) Objective: Switches off designated LEDs (2) Type: Execution block (3) Example: Configure signal light This will set the robot to switch on LEDs on the right side of the gimbal before turning right;...
  • Page 21 Python API: Function: led_ctrl.turn_off(armor_enum) Parameters: ● armor_enum(enum) ■ rm_define.armor_all ■ rm_define.armor_bottom_front ■ rm_define.armor_bottom_back ■ rm_define.armor_bottom_left ■ rm_define.armor_bottom_right ■ rm_define.armor_top_left ■ rm_define.armor_top_right (1) Objective: Controls the trajectory light (2) Type: Execution block (3) Example: Launch the trajectory light This will set the robot to switch on the trajectory light when firing shots. Python API:...
  • Page 22 (1) Objective: Sets the output percentage for the PWM port; the larger the value used, the longer the port will maintain a high level of output over the specified time period. (The basic frequency for the PWM port is 50Hz.) (2) Type: Settings block (3) Examples: Turn LED on/off, Rotate navigation gear ①...
  • Page 23 Notes: 1) PWM ports are located on the chassis control module. To access them, remove the transparent cover. There are six PWM ports in total. 2) PWM (pulse width modulation) controls the duration of a high level of output during a certain period, and is broadly used to control LEDs, navigation gears, and more.
  • Page 24 Python API: Function: chassis_ctrl.set_pwm_value(pwm_port_enum, output_percent) Parameters: ● pwm_port_enum(enum) ■ rm_define.pwm_all ■ rm_define.pwm1 ■ rm_define.pwm2 ■ rm_define.pwm3 ■ rm_define.pwm4 ■ rm_define.pwm5 ■ rm_define.pwm6 ● output_percent(int): [0, 100] (1) Objective: Enables/disables the chassis accelerator (2) Type: Settings block (3) Example: Operate chassis accelerator When the chassis is moving automatically, this will enable you to use the joystick to manually rotate or translate the chassis and increase its translation speed.
  • Page 25 Notes: 1) If the “Enable chassis accelerator” block has not been added, you will not be able to manually control the chassis while running the program. After adding this block, you will be able to manually control and accelerate the robot’s movements. 2) Joystick sensitivity refers to the push range of the joystick;...
  • Page 26 Python API: Function: chassis_ctrl.enable_stick_overlay() chassis_ctrl.disable_stick_overlay() (1) Objective: In Gimbal Lead Mode, maintains a specific angle for the chassis relative to the movement of the gimbal (2) Type: Settings block (3) Example: Gimbal Lead Mode The angle between the chassis and the movement of the gimbal will increase at first, then eventually fall to zero.
  • Page 27 Notes: 1)This block will not work in Chassis Lead Mode or in Free Mode. 2)A zero-degree angle between the chassis and the movement of the gimbal means that the chassis and the gimbal are rotating in the same direction along the yaw axis. Python API:...
  • Page 28 (1) Objective: Sets the default translation speed of the chassis to 0.5 m/s; the chassis will move faster when set to a higher speed value. (2) Type: Settings block (3) Example: Reduce reversal speed This will control the chassis to translate forward at 1 m/s for 1.5 seconds, then translate backwards at 0.5 m/s for three seconds to return to the starting point.
  • Page 29 Python API: Function: chassis_ctrl.set_rotate_speed(speed) Parameters: ● speed(int): [0, 600] °/s (1) Objective: Allows each wheel’s rotation speed to be set independently; only valid combinations of rotation direction and speed will take effect. (2) Type: Execution block (3) Examples: Reversing in an “S” pattern, Translating in a circle ①...
  • Page 30 ② Translating in a circle This will control the robot to translate along a circular path. Notes: 1) The robot will translate forward at the default rotation speed of 100 rpm for the front-left wheel, 100 rpm for the front-right wheel, 100 rpm for the rear-left wheel, and 100 rpm for the rear-right wheel. 2) To determine a valid combination of wheel rotation directions and speeds, push the robot manually to move it in the desired pattern and observe the rotational direction of each wheel;...
  • Page 31 When the robot translates backward and to the left, the front-left wheel and the rear-right wheel will rotate backward, so their rotation speed values should be negative, while the front-right wheel and the rear-left wheel will stay still, so their rotation speed values should be zero. When the robot rotates to the left, the front-right wheel and the rear-right wheel will rotate forward, so their rotation speed values should be positive, while the front-left wheel and the rear-left wheel will rotate backwards, so their rotation speed values should be negative.
  • Page 32 (1) Objective: Sets the chassis to translate in a specified direction (2) Type: Execution block (3) Example: Make a round trip This will control the EP to translate forward for one second, then turn around and return to the starting point. Note: This block will control the chassis to continuously translate in a specified direction until the robot receives a “set chassis to stop moving,”...
  • Page 33 Python API: Function: chassis_ctrl.move_with_time(degree, time) Parameters: ● degree(int): [-180, 180] ° ● time(float): [0, 20] s (1) Objective: Sets the distance the chassis will translate in a specified direction (2) Type: Execution block (3) Example: Translate in a cross-pattern This will control the robot to translate forward, backward, left and right in a cross-shaped sequence.
  • Page 34 Python API: Function: chassis_ctrl.move_with_distance(degree, distance) Parameters: ● degree(int): [-180, 180] ° ● distance(float): [0, 5] m (1) Objective: Sets the chassis to translate in a specified direction and at a specified speed (2) Type: Execution block (3) Example: Return to starting position This sets the chassis to translate forward and to the right at 1 m/s, then translate backward and to the left at 0.5 m/s to return to the original position.
  • Page 35 Python API: Function: chassis_ctrl.move_degree_with_speed(speed, degree) Parameters: ● speed(float): [0, 3.5] m/s ● degree(int): [-180, 180] ° (1) Objective: Sets the chassis to rotate in a specified direction (2) Type: Execution block (3) Example: Rotate at variable speed This will control the chassis to rotate increasingly quickly to the right.
  • Page 36 Note: 1) This block is not available in Gimbal Lead Mode. 2) Be sure there are no obstacles around the robot before setting a high chassis rotation speed. 3) This block will set the chassis to rotate constantly in a specified direction until it receives a “set chassis to stop moving”,“wait (1) s”...
  • Page 37 This block is not available in Gimbal Lead Mode. Python API: Function: chassis_ctrl.rotate_with_time(direction_enum, time) Parameters: ● direction_enum(enum): ■ rm_define.clockwise ■ rm_define.anticlockwise ● time(float): [0, 20] s (1) Objective: Sets the angle and direction of chassis rotation (2) Type: Execution block (3) Example: Translate continuously back and forth This sets the EP to translate back and forth continuously with the gimbal directed outward.
  • Page 38 (1) Objective: Sets the chassis to move in a specified direction while rotating simultaneously (2) Type: Execution block (3) Example: Translate in a figure-8 pattern This sets the robot to translate in a figure-8. Note: The “set the chassis to rotate” block is not available in Gimbal Lead Mode; however, the “set the chassis to translate”...
  • Page 39 (1) Objective: Sets the chassis to translate in a specified direction and at a specified speed (2) Type: Execution block (3) Example: Translate in a circle with the gimbal aimed toward the central point Python API: Function: chassis_ctrl.move_with_speed(speed_x, speed_y, speed_rotation) Parameters: ●...
  • Page 40 Python API: Function: chassis_ctrl.stop() (1) Objective: Obtains the current pitch angle for the chassis along its current yaw/pitch/roll axes based on the chassis location when the robot begins running (2) Type: Information block (variable-type) (3) Example: Signal turn This sets the yellow LED indicator to come on when you manually control the robot to turn left, and sets the blue LED indicator to come on when you manually control the robot to turn right.
  • Page 41 Note: 1) Rotating the chassis along the yaw axis results in left and right rotation. 2)Rotating the chassis along the pitch axis results in up and down rotation. 3) Rotating the chassis along the roll axis will cause the robot to turn over.
  • Page 42 Python API: Function: chassis_ctrl.get_attitude(attitude_enum) Parameters: ● attitude_enum(enum): ■rm_define.chassis_yaw ■rm_define.chassis_pitch ■rm_define.chassis_roll Return value: ● degree(float) (1) Objective: Obtains the current location coordinates and orientation of the chassis (2) Type: Information block (variable-type) (3) Example: Obtain current position information This enables you to check numerical data for the current chassis position by manually pushing the robot back and forth or turning it left and right.
  • Page 43 Note: Because the chassis is under closed-loop control, it is normal to feel some resistance when moving the robot manually. Python API: Function: chassis_ctrl.get_position_based_power_on(action_enum) Parameters: ● action_enum(enum): ■ rm_define.chassis_forward ■ rm_define.chassis_translation ■ rm_define.chassis_rotate Return value: ● position(float) (1) Objective: Runs the program for the corresponding block when the chassis hits an obstacle while driving (2) Type: Event block (3) Example: Self-defend This enables the self-defense mechanism to activate when the chassis impacts an obstacle, causing the robot...
  • Page 44 Python API: Function: def chassis_impact_detection(msg) Type: Event callback (1) Objective: Returns “True” when the chassis hits an obstacle while driving; otherwise, returns “False” (2) Type: Boolean block (3) Example: Emit danger warning If the chassis impacts an obstacle while the robot is being controlled through the FPV interface, the “hit”...
  • Page 45 Python API: Function:chassis_ctrl.is_impact() Return value: ● impact_status(bool)
  • Page 46 (1) Objective: Enables/disables the gimbal accelerator (2) Type: Settings block (3) Example: Activate semi-automatic defense This allows you to use the FPV interface to manually control the gimbal’s rotation for aiming and firing, while the robot’s chassis continuously rotates left and right. Python API:...
  • Page 47 (2) Type: Settings block (3) Example: Chassis Lead Mode This will set the gimbal to turn 45 degrees clockwise, and then 90 degrees counterclockwise before returning to the center when the chassis is stationary. Note: 1)This block is not available in Gimbal Lead Mode or Free Mode. 2) A zero-degree angle indicates that the gimbal and chassis are translating in the same direction along the yaw axis.
  • Page 48 Note: Before increasing the gimbal’s rotation speed, ensure that there are no obstacles near the robot. Python API: Function: gimbal_ctrl.set_rotate_speed(speed) Parameters: ● speed(float): [0, 540] °/s (1) Objective: Sets gimbal movements ● Recenter: The gimbal will return to its original position along the pitch axis and yaw axis. ●...
  • Page 49 Note: In Chassis Lead Mode, “set gimbal to recenter” is not available. ②Hovering This will set the gimbal to rotate upward for 0.5 second, then pause for 2 seconds. It will then rotate downward for 0.5 second, then return to its original position and stop translating. Python API:...
  • Page 50 gimbal_ctrl.stop() gimbal_ctrl.suspend() gimbal_ctrl.resume() (1) Objective: Sets a specific rotation direction for the gimbal (2) Type: Execution block (3) Example: Rotate chassis and gimbal in opposite directions Note: 1) In Chassis Lead Mode, only the “set gimbal to rotate (up/down)” block is available; the “set gimbal to rotate (left/right)”...
  • Page 51 ■ rm_define.gimbal_up ■ rm_define.gimbal_down ■ rm_define.gimbal_left ■ rm_define.gimbal_right (1) Objective: Sets the gimbal to rotate at a specific angle and direction (2) Type: Execution block (3) Example: Gimbal rotation This will set the gimbal to rotate left or right with the selected sound effect. Note: In Chassis Lead Mode, only the “set gimbal to rotate (up/down) in (0)°”...
  • Page 52 (1) Objective: Sets the gimbal to rotate along yaw axis to a designated position (2) Type: Execution block (3) Example: Configure rear gun This will set the chassis to translate forward while the gimbal continuously fires shots behind it. Note: 1) In Chassis Lead mode this block is not available.
  • Page 53 ②Follow arrow markers...
  • Page 54 Note: The gimbal will rotate up and down along the pitch axis and left and right along the yaw axis. Python API: Function: gimbal_ctrl.pitch_ctrl(degree) Parameters: ● degree(int): [-20, 35]° (1) Objective: Sets the gimbal to rotate at a specific angle at a designated position (2) Type: Execution block (3) Example: Tiered firing...
  • Page 55 Note: 1)In Chassis Lead Mode, the “set gimbal to rotate along pitch axis to (0)°” block is available but the “set gimbal to rotate along yaw axis to (0)°” block is not. ”set gimbal to rotate (up) in (0)°” refers to the position relative to the gimbal’s current position. “set gimbal to rotate along yaw axis to (0)°”、“set gimbal to rotate along pitch axis to (0)°”、“set gimbal to rotate along yaw axis to (0)°, and pitch axis to (0)°”...
  • Page 56 Function: gimbal_ctrl.angle_ctrl(yaw_degree, pitch_degree) Parameters: ● yaw_degree (int): [-250, 250]° ● pitch_degree (int): [-20, 35]° (1) Objective: Sets the gimbal to rotate on its yaw and pitch axis simultaneously at a specified rotation speed (2) Type: Execution block (3) Example: Flexible neck rotation Note: The value of the rotation speed represents the gimbal’s rotation direction.
  • Page 57 (1) Objective: Obtains the current attitude angle for the gimbal along its current yaw or pitch axes (2) Type: Information block (variable-type) (3) Example: Translate in the gimbal’s direction This will set the gimbal to aim towards a specific direction. The robot will translate towards the specified direction for one second after the gimbal is pressed.
  • Page 58 (1) Objective: Sets the number of beads fired per shot (2) Type: Settings block (3) Example: Fire 6 beads in sequence Note: A maximum of 8 beads can be fired each time. Python API: Function: gun_ctrl.set_fire_count(count) Parameters: ● count(int): [1, 8] (1) Objective: Sets the Blaster to single shot mode (2) Type: Execution block, Blocking block (3) Example: Fire single shot...
  • Page 59 Note: Single Shot mode means one bead is fired each time by default. You can shoot several beads at once by setting the “set blaster to fire (1) bead/time” block. Python API: Function: gun_ctrl.fire_once() (1) Objective: Sets the Blaster to full auto mode (2) Type: Execution block, Non-blocking block (3) Example: Fire strafe shots Note:...
  • Page 60 Fires beads continuously for five seconds Fire one bead and wait for five seconds Python API: Function: gun_ctrl.fire_continuous() (1) Objective: Stops the Blaster from firing (2) Type: Execution block (3) Example: Stop firing Note: Because the “single shot”is a blocking block, the “stop firing” block does not apply to it. ”stop firing”only has limitations on “full auto”.
  • Page 61 Control the blaster to shoot the infrared beam consecutively within two seconds, four shots per second. Note: 1) The robot can shoot infrared beam eight times per second at most. 2) This module has no effect on the "Shoot Infrared Beam Once" module. 3) During programming in the laboratory, blast-type operations are not affected by system settings.
  • Page 62 Note: There is no visible effect when using the modules "Shoot Infrared Beam Once" and "Shoot Infrared Beam Consecutively" to shoot infrared beams. (1) Description: Control the blaster to shoot infrared beams consecutively. (2) Type: Execution, Non-blocking (3) Example: Infrared shooting. The gimbal rotates around the yaw axis and the blaster consecutively shoots the infrared beam.
  • Page 63 Wait for five seconds quietly after Shoot infrared beams five time consecutively shooting infrared beam once. without interruption within five seconds. (1) Description: Stop shooting infrared beam. (2) Type: Execution (3) Example: Stop shooting Stop after the blaster shoots infrared beam consecutively for five seconds. Note: 1) As "Shoot Infrared Beams for a Single Time"...
  • Page 64 (1) Description: Set the grip force level of the gripper. The higher the level, the greater the grip force. (2) Type: Setting (3) Example: Object shape changes upon grip Place a soft object onto the gripper and continuously increase the grip force. It can be observed through the FPV window that the shape change of the gripped object becomes more and more obvious.
  • Page 65 When the grip force level is set at level 4, there was obvious change in the shape of the object: Note: 1) The higher the force level, the greater the grip force, and the faster the operation speed. 2) The force required for the gripper to grip different objects varies. For example, the force level is recommended to be set at a lower level for gripping egg shells and at a higher level for gripping a cup.
  • Page 66 Note: 1) Gripper control (Open, Close) is a continuous movement; therefore it must be used with time control modules such as "Wait for (1)s". 2) The gripper remains still after it reaches its limit. (1) Description: Returns "True" when the current gripper status meets the condition; otherwise, returns "False".
  • Page 67 It can be observed from the FPV window that it takes about 2.1 seconds.
  • Page 68 (1) Description: Learn whether the gripper is fully closed. If the return value is 1, the gripper is fully closed; if the value is 0, the gripper is not fully closed. (2) Type: Information (3) Example: Gripper closes Control the gripper's movement according to its current state until it is fully closed. (1) Description: Learn whether the gripper is fully opened.
  • Page 69 (1) Description: Using the robot body coordinate system as the reference frame, and control the robotic arm to move in a specified direction for a set distance. (2) Type: Execution (3) Example: Robotic arm dance Control the robotic arm to move forward, backward, upward, and downward. Note: 1) The robotic arm of this robot is a parallel robotic arm.
  • Page 70 (1) Description: Control and move the robotic arm to a specified position. The front and back direction along the body is X while the vertical direction along the body is Y. The unit is millimeter. (2) Type: Execution (3) Example: Grasp objects Place a water bottle in front of the robot and control the robotic arm so that it can accurately reach the target position.
  • Page 71 (1) Description: Control the robotic arm so that it can return to the original position, which is (0, 0) of the body coordinate system. (2) Type: Execution (3) Example: Draw a square Control the gripper to grip a writing brush and draw a square by moving the robotic arm and then return to the original position.
  • Page 72 It can be observed through the FPV window: (1) Description: Control a specified servo (No.) to rotate to a set angle. If the set angle is a positive value, the servo rotates clockwise; if the set angle is a negative value, the servo rotates counterclockwise. (2) Type: Execution (3) Example: Pendulum Make a pendulum using a servo, a servo gear, and adhesive tape, then control the servo so that it rotates...
  • Page 73 Note: 1) The servo supports two kinds of control: angle control and speed control. This module is applicable to situations with a high requirement for the rotation angle control of the servo. 2) When the servo is installed on the robotic arm, using servo-related modules in the "extension modules" to control the servo is not supported.
  • Page 74 (1) Description: Control a specified servo (No.) to rotate at a set speed. If the speed is a positive value, the servo rotates clockwise; if the speed is a negative value, the servo rotates counterclockwise. (2) Type: Execution (3) Example: The servo speed changes along with the direction. Control the servo to accelerate while rotating clockwise and to decelerate while rotating counterclockwise.
  • Page 75 (1) Description: Obtain the angle of a specified servo (No.). (2) Type: Information (3) Example: Servo angle Obtain the changes of the servo angle as the servo rotates continuously. It can be observed through the FPV window.
  • Page 77 (1) Objective: Enables or disables the EP’s visual identification functions for vision marker, person, and other EP robot (2) Type: Settings block (3) Example: Imitate V-signal hand gesture Sets the gimbal to translate in a V shape when the robot identifies the V-sign hand gesture. Note: The robot’s smart identification function is disabled by default.
  • Page 79 In the above two example programs, robot will be unable to identify people, meaning the gimbal’s LED indicator will not blink. Python API: Function: vision_ctrl.enable_detection(function_enum) vision_ctrl.disable_detection(function_enum) Parameters: ● function_enum(enum): ■ rm_define.vision_detection_marker ■ rm_define.vision_detection_pose ■ rm_define.vision_detection_car ■ rm_define.vision_detection_people (1) Objective: Enables/disables line identification (2) Type: Settings block (3) Example: Identify blue lines When the robot identifies blue lines, all blue LED chassis and gimbal indicators will blink.
  • Page 80 be able to respond to line inspection commands. 2) The default line color that the robot is set to identify is blue. Python API: Function: vision_ctrl.enable_detection(function_enum) vision_ctrl.disable_detection(function_enum) Parameters: ● function_enum(enum): ■ rm_define.vision_detection_line (1) Objective: Enables/disables clapping identification (2) Type: Settings block (3) Example: Wake up the robot by clapping Initially, the LED chassis and gimbal indicators are turned off.
  • Page 81 clapping. Python API: Function: media_ctrl.enable_sound_recognition(function_enum) media_ctrl.disable_sound_recognition(function_enum) Parameters: ● function_enum(enum): ■ rm_define.sound_detection_applause (1) Objective: Sets the maximum Vision Marker identification distance for the gimbal; beyond this distance, the robot will be unable to recognize Vision Markers. (2) Type: Settings block (3) Example: Set identification distance When the robot identifies a forward arrow it will translate forward by 1 meter.
  • Page 82 (1) Description: Set visual tag colors that the robot can identify. (2) Type: Setting (3) Example: Switch different visual tag identification colors. After the robot identifies the red tag number 1, the chassis LED indicator stays solid red; after it identifies the green label number 1, the chassis LED indicator stays solid green.
  • Page 83 Note: The default line color that the robot can identify is blue. Python API: Function: vision_ctrl.line_follow_color_set(color_enum) Parameters: ● color_enum(enum): ■ rm_define.line_follow_color_blue ■ rm_define.line_follow_color_red ■ rm_define.line_follow_color_green (1) Objective: Reduces the exposure in Line Follow Mode to prevent blurriness caused by fast turns, ensuring effective and accurate visual identification...
  • Page 84 (2) Type: Settings block (3) Example: Identify lines Python API: Function: media_ctrl.exposure_value_update(exposure_value_enum) Parameters: ● exposure_value_enum(enum): ■ rm_define.exposure_value_large ■ rm_define.exposure_value_medium...
  • Page 85 ■ rm_define.exposure_value_small (1) Objective: Sets the robot to identify and aim at the central position of the corresponding Vision Markers (2) Type: Execution block (3) Example: Set robot to aim at the red heart Note: 1)You must enable Vision Marker identification for the robot to be able to identify Vision Markers. 2)In this block, when the robot identifies a red heart, it will automatically aim toward it;...
  • Page 86 ① Indicate turn When the robot identifies a left arrow, the left turn LED indicators on the gimbal will blink and the robot will translate left for 1 second; when the robot identifies a right arrow, the right turn LED indicators on the gimbal will blink and the chassis will translate right for 1 second.
  • Page 87 Note: 1) The Event is of high priority, which means that no matter where the main function runs, the main function will be suspended and the program in the Event will start running once the triggering conditions are fulfilled. 2) To have the robot identify a person, rotate the gimbal slightly upward, have the person stand at a distance of 1 meter, and ensure that the person stands upright within the robot’s field of view.
  • Page 88 Python API: Function: def vision_recognized_people(msg) def vision_recognized_car(msg) def vision_recognized_pose_all(msg) def vision_recognized_pose_victory(msg) def vision_recognized_pose_give_in(msg) def vision_recognized_pose_capture(msg) def vision_recognized_marker_trans_all(msg) def vision_recognized_marker_trans_left(msg) def vision_recognized_marker_trans_right(msg) def vision_recognized_marker_trans_stop(msg) def vision_recognized_marker_trans_forward(msg) def vision_recognized_marker_trans_red_heart(msg) def vision_recognized_marker_trans_target(msg) def vision_recognized_marker_trans_dice(msg) def vision_recognized_marker_number_all(msg) def vision_recognized_marker_number_[one, …, nine](msg) def vision_recognized_marker_letter_all(msg) def vision_recognized_marker_letter_[A, …, Z](msg) Type: Event callback (1) Objective: Sets the block to run its internal program when a specific clapping pattern is identified (2) Type: Event block...
  • Page 89 Python API: Function: def sound_recognized_applause_twice(msg) def sound_recognized_applause_thrice(msg) Type: Event callback (1) Objective: Sets the robot to return the condition “True” when specified information (such as an object,...
  • Page 90 Vision Marker, gesture, and so on) is identified; otherwise, the condition “False” is returned. (2) Type: Boolean block (3) Example: Identify people When the robot identifies a person, all red LED chassis indicators will blink and all red LED gimbal indicators will scroll; otherwise, all LED chassis and gimbal indicators will remain in the default color.
  • Page 91 ■ rm_define.cond_recognized_marker_trans_red_heart ■ rm_define.cond_recognized_marker_trans_target ■ rm_define.cond_recognized_marker_trans_dice ■ rm_define.cond_recognized_marker_number_all ■ rm_define.cond_recognized_marker_number_[zero,..., nine] ■ rm_define.cond_recognized_marker_letter_all ■ rm_define.cond_recognized_marker_letter_[A,..., Z] ■ rm_define.cond_recognized_pose_all ■ rm_define.cond_recognized_pose_victory ■ rm_define.cond_recognized_give_in ■ rm_define.cond_recognized_capture (1) Objective: Sets the robot to return the condition “True” when a specific clapping pattern is identified; otherwise, the condition “False”...
  • Page 92 Python API: Function: vision_ctrl.check_condition(condition_enum) Parameters: ● condition_enum(enum): ■ rm_define.cond_sound_recognized_applause_twice ■ rm_define.cond_sound_recognized_applause_thrice (1) Objective: When specific information (such as an object, Vision Marker, gesture, and so on) is identified, the system will continue executing commands; otherwise, it will continue to wait. (2) Type: Execution block, Blocking block (3) Example: Practice shooting Note:...
  • Page 93 Python API: Function: vision_ctrl.cond_wait(condition_enum) Parameters: ● condition_enum(enum): ■ rm_define.cond_recognized_people ■ rm_define.cond_recognized_car ■ rm_define.cond_recognized_marker_trans_all ■ rm_define.cond_recognized_marker_trans_left ■ rm_define.cond_recognized_marker_trans_right ■ rm_define.cond_recognized_marker_trans_forward ■ rm_define.cond_recognized_marker_trans_stop ■ rm_define.cond_recognized_marker_trans_red_heart ■ rm_define.cond_recognized_marker_trans_target ■ rm_define.cond_recognized_marker_trans_dice ■ rm_define.cond_recognized_marker_number_all ■ rm_define.cond_recognized_marker_number_[zero,..., nine] ■ rm_define.cond_recognized_marker_letter_all ■ rm_define.cond_recognized_marker_letter_[A,..., Z] ■ rm_define.cond_recognized_pose_all ■ rm_define.cond_recognized_pose_victory ■...
  • Page 94 3 claps. Python API: Function: vision_ctrl.cond_wait(condition_enum) Parameters: ● condition_enum(enum): ■ rm_define.cond_sound_recognized_applause_twice ■ rm_define.cond_sound_recognized_applause_thrice (1) Objective: Obtains information for an identified Vision Marker, returned as N,ID,X,Y,W,and H parameters. (2) Type: Information block (list-type data) (3) Example: Recognize Vision Markers When a Vision Marker appears in the robot’s field of view, you will be able to observe Vision Marker parameters in the FPV page.
  • Page 95 Note: 1) The vision marker format is as follows: The first item is the number of markers the robot has detected. The second item is a group of 5 values: Vision Marker ID, X-axis of the center point, Y-axis of the center point, W-width and H-height. The same format is used for all following items, as shown below: 2) Descriptions for returned ID values identified by the robot: ID=0: emit sounds...
  • Page 96 ID=4: left arrow ID=5: right arrow ID=6: forward arrow ID=8: red heart ID=10-19: 0-9 ID=20-45: A-Z Python API: Function: vision_ctrl.get_marker_detection_info() Return value: ● detection_info(list) (1) Objective: Obtains an identified person or robot’s information in terms of the parameters N, X, Y, W, and (2) Type: Information acquisition block (list-type data) (3) Example: Identify another S1 robot When another S1 robot appears in the robot’s field of view, information about the robot will display in the...
  • Page 97 Note: The format of object information is as follows: The first item is the number of objects the robot has identified. The second item is a group of 4 numbers: X- axis of the center point, Y-axis of the center point, W-width and H-height. The same format is used for all following items, as shown below: Python API:...
  • Page 98 Note: 1) The format for gesture information is as follows: The first item is the number of gestures the robot has identified. The second item is a group of 5 numbers: gesture ID, X-axis of the center point, Y-axis of the center point, W-width and H-height. The same format is used for all following items, as shown below: 2) Descriptions for ID values: ID=4: V...
  • Page 99 (2) Type: Information (table type data) (3) Example: Single line information Obtain the returned line information after a blue line appears in the robot's FOV. You can observe the real time line data changes through the FPV window. Note: 1) The single line information format that is identifiable by the robot is as follows: The first item "N"...
  • Page 100 The first data set, N: Number of points The fixed value is 10 or 0 with 10 indicating line detection and 0 indicating the opposite. The second data set, I: line type 4 cases : "0", indicates no line is identified; "1", indicates one line within the FOV;...
  • Page 101 The sixth data set C1: The curvature of the first point. C=k/R. The value ranges from 0 to 10. 0 indicates that the line is a straight line and the radian increases correspondingly as the value increases from 1 to 10. When the circumscribed circle is larger, it proves that the radian of the line near this point is larger.
  • Page 102 Note: The multi-line information format identified by the robot is as follows: The first item n (number of lines), from clockwise, the (Coordinate X, ordinate Y, actual tangent angle θ, curvature C) of ten points that are equidistant from each other on the first line (from the nearest to the farthest), the (X, Y, θ, C) of ten points on the second line ..., the (X, Y, θ, C) of ten points on the numbered n line.
  • Page 103 In dark environments, you can turn on the Blaster Trajectory Light and turn the robot to face the brighter area. Python API: Function: vision_ctrl.get_env_brightness() Return value: ● brightness_value(int) (1) Objective:Obtains information for sight position in terms of the parameters X and Y . (2) Type: information block (list) (3) Example: Follow visual markers This will convert the difference between the sight position and a Vision Marker in the robot’s field of view...
  • Page 104 Note: Sign position format: X represents X-coordinate,and Y represents Y- coordinate. Python API:...
  • Page 105 Function: media_ctrl.get_sight_bead_position() Return value: ● sight_bead_position(list)
  • Page 106 (1) Objective: Sets armor sensitivity; the larger the value, the higher the armor sensitivity. For testing armor sensitivity with hard objects or by tapping, the recommended values are 6 and 8, respectively. (2) Type: Settings block (3) Response to tapping Tap anywhere on the EP’s armor to play the corresponding sound effect.
  • Page 107 (3) Example: Configure HP level The gimbal LEDs indicate the current HP level of the robot; 8 LEDs indicates full HP. When any point on the armor is hit, the robot’s HP reduces by 1; when the HP level drops to 0, all LEDs will turn off and the robot will stop moving.
  • Page 108 Python API: Function: def armor_hit_detection_all(msg) def armor_hit_detection_bottom_right(msg) def armor_hit_detection_bottom_left(msg) def armor_hit_detection_bottom_front(msg) def armor_hit_detection_bottom_back(msg) def armor_hit_detection_top_right(msg) def armor_hit_detection_top_left(msg) Type: Event callback (1) Objective: Displays information for the last armor section hit; the ID value indicates the specific section that was hit, and the running time shows the time it was hit (2) Type: Information block (variable-type) (3) Example: Configure hit section indicator If the gimbal is the last armor section hit, all LEDs on the gimbal will flash red.
  • Page 109 Note: The returned value indicates the section of the armor that has been hit: ID=1: Chassis rear ID=2: Chassis front ID=3: Chassis left side ID=4: Chassis right side ID=5: Gimbal left side ID=6: Gimbal right side Python API: Function: armor_ctrl.get_last_hit_index() Return value: ●...
  • Page 110 Python API: Function: armor_ctrl.check_condition(condition_enum) Parameters: ● condition_enum(enum): ■ rm_define.cond_armor_hit ■ rm_define.cond_armor_bottom_front_hit ■ rm_define.cond_armor_bottom_back_hit ■ rm_define.cond_armor_bottom_left_hit ■ rm_define.cond_armor_bottom_right_hit ■ rm_define.cond_armor_top_left_hit ■ rm_define.cond_armor_top_right_hit...
  • Page 111 (1) Objective: Executes the next command when the specified armor section is hit; otherwise, continues to wait (2) Type: Execution block, Blocking block (3) Example: Configure hit defense Note: In this program, if the left side of the chassis is not hit, the program will wait and remain on this block, and the block will remain highlighted.
  • Page 112 (1) Description: Run the program in this module when the infrared sensors on both sides of the robot's gimbal are attacked by infrared beams. (2) Type: Execution (3) Example: Health light bar The gimbal LED indicator can indicate the current hit points of the robot, and the maximum hit points is 8. When the robot is attacked by infrared beams, the robot loses 1 hit point;...
  • Page 113 Note: The event trigger module has a higher priority, which means that no matter which step the main function reaches, as long as the trigger condition is met, the robot will immediately jump out of the main function and start running the programs in the event module. (1) Description: Execute the next instruction only after the infrared sensors on both sides of the gimbal are attacked by infrared beams;...
  • Page 114 Note: For this function, if no infrared beam attack is detected by the infrared sensor on the robot's gimbal, the program will wait on this module and the module will remain highlighted at this time.
  • Page 115 (1) Description: Check whether the infrared sensors on both sides of the robot's gimbal have been attacked by infrared beams. Returns "True" if yes; otherwise, returns "False". (2) Return value: Boolean (3) Example: Number of hits If the robot is attacked by an infrared beam, a "hit" sound is played and the number of hits is accumulated.
  • Page 117 (1) Description: Turn on or turn off the distance measuring function of a specified infrared distance sensor (No.). (2) Type: Setting (3) Example: Distance measuring using infrared beams Measure the distance between the infrared distance sensor and your palm. Move your palm forward and backward and observe the real time distance change through the FPV window. Note:...
  • Page 118 The distance measuring function of the infrared distance sensor is achieved mainly by the Time-of-Flight (ToF) camera. The sensor fires out a modulated light pulse (such as infrared beams shot by the infrared distance sensor) which then reflects off the object. The ToF camera measures the distance between the sensor and the measured object by calculating the time (flight time) the light pulse takes to reflect off the object.
  • Page 119 ≥ (1) Description: Execute the next instruction when the distance measured by the specified infrared distance sensor (No.) meets the condition; otherwise, it will stay still and wait. (2) Type: Execution, Blocking (3) Example: Long-distance shooting Hold a visual tag and back away from the robot. When the infrared distance sensor detects that the "target" is already 3 meters away from the robot, the robot will fire a long range shot by zooming in with the camera.
  • Page 120 (1) Description: Returns "True" when the distance measured by the specified infrared distance sensor (No.) meets the condition; otherwise, returns "False". (2) Return value: Boolean (3) Example: I retreat as you advance In order to maintain an appropriate distance with the palm, the robot has mastered the "I retreat as you advance, I advance as you retreat"...
  • Page 121 Move your palm forward and backward and observe the real time distance change through the FPV window. Note: The distance that the infrared distance sensor can read ranges from 10 centimeters to 10 meters.
  • Page 122 (1) Description: Execute the program in this module when the I/O pin level of the specified port of the specified sensor adaptor meets the conditions. (2) Type: Event (3) Example: Use a button to control the opening or closing of the gripper. Connect a button to sensor adaptor No.(1).
  • Page 123 1) The output level of the button can be high or low. When the button is "pressed" and "released", the output level changes, and the I/O pin of the sensor adaptor receives the level signal change so as to control the opening or closing of the gripper.
  • Page 124 detects high and low electrical levels. Trigger Infrared VCC(5V) obstacle High or low avoidance electrical level OUT(TTL) sensor VCC(5V) Vibration High or low sensor electrical level OUT(TTL) VCC(5V) High or low Tilt sensor electrical level OUT(TTL) VCC(5V) High or low Sound sensor electrical level OUT(TTL)
  • Page 125 meets the conditions; otherwise, returns "False". (2) Return value: Boolean (3) Example: Lighting effect upon touch Connect a touch sensor to sensor adaptor No.1 and after the finger touches the sensor, the gimbal displays a blue marquee lighting effect. Note: The touch sensor used in this function design will output a high electrical level if a finger touches it, and a low level when it is not touched, but the situation for different types of touch sensors varies.
  • Page 126 Note: 1) The sensor adaptor ADC is a 10-bit ADC which can take data of up to 1024 unique values, so the ADC range is from 0 to 1023. 2) ADC collects the analog voltage value. Devices such as pressure sensors, potentiometers, and others have ADC output.
  • Page 127 VCC(5V) High or low Tracking electrical level sensor OUT(AD) +ADC OUT(TTL) VCC(5V) High or low Smoke sensor electrical level OUT(AD) +ADC OUT(TTL) (1) Description: Obtain the duration from when the pulse of the specified I/O pin of the specified sensor adaptor jumps till it is obtained.
  • Page 128 (1) Objective: Obtains the current angle value of a mobile device (2) Type: Information block (variable-type) (3) Example: Dynamic rotation control Rotate the mobile device to the left or right and observe whether the EP’s gimbal rotates accordingly. Note: 1) The EP defaults to Chassis Lead Mode. To control the gimbal separately you will need to first set the robot to Free Mode.
  • Page 129 (1) Objective: Obtains the exact rate of acceleration for a mobile device (2) Type: Information block (variable-type) (3) Example: Dynamic forward control Wave your mobile device up and down to control the robot’s motion in a forward direction. Note: 1) The faster the robot’s velocity changes, the higher the rate of acceleration that will be obtained. 2) Mobile device refers to devices such as smartphones and tablets.
  • Page 130 (1) Description: Choose notes and play them in a piano tone. (2) Type: Execution, non-blocking (3) Example: Pink Memory Control the robot to play the notes of the song "Pink Memory".
  • Page 132 (1) Objective: Sets the EP to emit a sound and executes the next command (2) Type: Execution block, Non-blocking block (3) Example: Emit scanning tone This will set the robot to emit a “scanning” sound when the chassis is translating forward and the gimbal is rotating around the Yaw-axis.
  • Page 133 (1) Objective: Ensures the next command will not be executed until a specified sound has been emitted (2) Type: Execution block, Blocking block (3) Example: Remote control photograph When the EP identifies a “take photo” gesture, it will take a photo after playing the “start countdown” chime. If it does not identify a “take photo”...
  • Page 134 Parameters: ● sound_enum(enum): ■ rm_define.media_sound_attacked ■ rm_define.media_sound_shoot ■ rm_define.media_sound_scanning ■ rm_define.media_sound_recognize_success ■ rm_define.media_sound_gimbal_rotate ■ rm_define.media_sound_count_down (1) Objective: Sets the robot to emit a specified shutter sound when it takes photos. (Photos will appear in an album). (2) Type: Execution block (3) Example: Capture moving person Note: Users will need to insert an SD card with an available memory of more than 2G to operate the "take photo"...
  • Page 135 (1) Objective: Starts/stops recording; recorded videos will be saved in the SD card (2) Type: Execution block (3) Example: Video recording Note: Users will need to insert an SD card with an available memory of more than 2G to operate the “(start) video recording”...
  • Page 136 (1) Objective: Executes the next command after waiting for a specified duration (2) Type: Execution block (3) Example: Complete a square This will command the EP to translate in the following order to complete a square every two seconds by moving as translating: “right→forward→left→backward.”...
  • Page 137 (1) Objective: Configures a program to repeat the same command several times (finite loop block) (2) Type: Execution block (3) Example: Translate along a zigzag line This will control the robot to translate along a zigzag line. (1) Objective: Sets an internal program to repeat continuously (infinite loop) (2) Type: Execution block (3) Example: Rotate chassis left and right...
  • Page 138 (1) Objective: Runs an internal program when the condition is “True” (2) Type: Conditional statement block (3) Example: Rotate and revolve This will control the robot to revolve while rotating...
  • Page 139 Note: The difference between conditional statement blocks and event blocks is that event blocks have higher priority while running the program when certain conditional statements are met regardless of the main function’s status, whereas conditional statement blocks will not run unless the main function preceding it and corresponding conditions are met.
  • Page 140 (3) Example: Limit the number of shots This will control the robot to gradually increase the number of shots (with the maximum shots being "8 beads/time"), then restart from "1 bead/time" again. (1) Objective: Repeats a program until the condition is “True,” and then executes the next command (2) Type: Conditional statement block (3) Example: Complete different paths This will control the robot to complete paths based on the following shapes: triangle, square, pentagon, and...
  • Page 141 Note: Strategize and plan the criteria for each path to obtain the ideal number of loops. (1) Objective: Stops a running program for the current block and exits (2) Type: Execution block (3) Example: Stop a running program This will control the chassis to translate backward for 0.5 second and then stop the program when it hits an obstacle.
  • Page 142 (1) Objective: Adds two numbers (2) Type: Variable-type block (3) Example: Perform basic arithmetic calculations This will calculate 【 (66÷2 ) +3】×2-5=? You can check the result using the FPV window: Note: Arithmetic calculations cannot be performed on lists. (1) Objective: Subtracts one number from another (2) Type: Variable-type block (3) Example: Calculate an arithmetic progression This will calculate an arithmetic progression according to the formula An=A1+ (n-1) *d, with the first calculate...
  • Page 143 You can check the result using the FPV window: Note: Arithmetic calculations cannot be performed on lists. (1) Objective: Multiply two numbers...
  • Page 144 (2) Type: Variable-type block (3) Example: Generate reverse display This allows you to rotate the gimbal manually and observe how the value changes in the FPV window. Because this is the reverse display, when the gimbal is rotating on the right side of the chassis, the value will always be negative;...
  • Page 145 Note: Arithmetic calculations cannot be performed on lists. (1) Objective: Selects a random value from a specified range (2) Type: Information block (variable-type) (3) Example: Play a number guessing game Guess a number to enter and compare it to the random value generated by the robot. If your answer is greater than or equal to the robot's number, the gimbal will celebrate with a lighting effect;...
  • Page 146 Note: If the values you enter within the specified range are all integers, the output will always be an integer. If any of the values you enter within the specified range is a decimal (whether it is the first, last, or any in between), the output will also be a decimal.
  • Page 147 (1) Objective: Obtains the remainder of the first value divided by the second value (2) Type: Information block (variable-type data) (3) Example: Find the lowest common multiple The robot will find the lowest common multiple of 12 and 15.
  • Page 148 You can check the result using the FPV window. (LCM=60) Note: LCM is short for the lowest common multiple. (1) Objective: Performs mathematical operations for a variety of functions, such as calculating absolute value, floor and ceiling functions, square root, and sine angle (2) Type: Information block (variable-type) (3) Examples: Perform calculation, Rotate gimbal ①...
  • Page 149 You can check results using the FPV window.
  • Page 150 ② Rotate gimbal This will use the center angle and radius to calculate and control gimbal rotation. (1) Objective: Returns “True” when two values are equal; otherwise, “False” is returned (2) Returned value: Boolean (3) Example: Set flag bits Initially, the gimbal displays a solid default color. All LEDs on the gimbal will turn solid red when the users clap two times, and solid yellow when the user claps three times.
  • Page 151 Note: In programming, flag bits distinguish various states in order to make the robot execute different commands. (1) Objective: Returns “True” when two values are not equal; otherwise, “False” is returned (2) Returned Value: Boolean (3) Example: Indicate successful identification of one person If no person or multiple people appear in the robot's field of view, the “scanning”...
  • Page 152 Note: “!=” is the symbol for “unequal to” in programming language and has the same meaning as “≠”in mathematical language. (1) Objective: Returns “True” if the first value is less than the second value; otherwise, “False” is returned. (2) Returned value: Boolean (3) Example: Light all platform LED lights in sequence This will light up all gimbal LEDs in sequence.
  • Page 153 Note: This is often used with conditional statements. (1) Objective: Returns the condition “True” if the first value is less than or equal to the second value; otherwise, “False” is returned. (2) Returned value: Boolean (3) Example: Accelerate rotation If the chassis is rotating at a rate less than or equal to 540, it will increase by 60 degrees per second while rotating to the right for 3 seconds at a time until the maximum value of 600 degrees per second is achieved and acceleration stops.
  • Page 154 (1) Objective: Returns the condition “True” if the first value is larger than the second value; otherwise, “False” is returned. (2) Returned value: Boolean (3) Example: Calculate cumulative sum (1-10000) This will calculate the accumulated sum of 1+2+3…+10000; you can check the result using the FPV window (displayed as sum=50005000).
  • Page 155 (1) Objective: Returns the condition “True” if the first value is greater than or equal to the second value; otherwise, “False” is returned. (2) Returned value: Boolean (3) Example: Show where the armor was last hit If the gimbal armor was hit last, all gimbal LEDs will blink red; if the chassis armor was hit last, all chassis LEDs will blink red.
  • Page 156 returned. (2) Returned value: Boolean (3) Example: Clap to summon the robot When a person stands one meter away from the robot and claps twice, the robot will approach. Both “Person” and “Clap two times” are essential conditions, and thus use “AND." Note: "and,”...
  • Page 157 Note: "and,” “or,” and “not" are logical operations, and the returned result will be a Boolean value: “True,” or “False.” Boolean values: (1) Objective: Returns “False” if a condition is met; otherwise, “True” is returned. (2) Returned value: Boolean (3) Example: Set either-or conditions If any point of the gimbal armor is attacked, all gimbal LEDs will blink red;...
  • Page 158 Note: "and,” “or,” and “not" are logical operations, and the returned result will be a Boolean value: “True,” or “False.” Boolean values: (1) Description: Scale the set value according to the proportional relationship. (2) Type: Information (3) Example: Ratio conversion The data collected by the sensor is actually a 10-bit voltage value with 1024 discrete voltage levels with the value range of 0 to 1023.
  • Page 160 (1) Objective: Creates a name for a new variable (2) Type: Settings block (3) Example: Name a new variable Each variable name must be unique and simple to understand. For example, we often name the variable for a marker in the sequence as Flag, and the variable used to store value as Number.
  • Page 161 Note: Right-click on a variable to rename or delete it. (1) Objective: Assigns value to a variable (2) Type: Execution block (3) Example: Configure a digital clock...
  • Page 162 You can check details about the time using the FPV window. The minute and second values will change continuously. Note: 1) It is important to know the difference between a variable and a list; a variable stores one type of data, while a list stores a string containing a sequence of characters.
  • Page 163 (1) Objective: Changes current variable value; positive values indicate an increase while negative values indicate a decrease. (2) Type: Execution block (3) Examples: Decrease variable value by 1, Translate in a figure-8 pattern ① Decrease variable value by 1 Assign a value to the variable, then configure the change in value. In the FPV window, you can see that the initial variable value is 2.
  • Page 164 When you set the waiting time to 2 seconds and decrease the value by 1, the variable value becomes 1. ② Translate in a figure-8 pattern The screenshot below shows an alternative configuration for setting the robot to translate in figure-8 pattern.
  • Page 165 (1) Objective: Creates and names a list (2) Type: Settings block (3) Example: Name a new list...
  • Page 166 List names need to begin with an underscore or a letter and can only contain numbers, uppercase and lowercase letters, and underscores. Note: After a list is created, assign and adjust the corresponding values using the blocks available. (1) Objective: Obtains all items in a list (2) Type: Information block (list) (3) Example: Duplicate a list Ensure that the data in the new list "CopyList"...
  • Page 167 You can check specific details using the FPV window. (1) Objective: Adds an item to the end of a list (2) Type: Execution block (3) Example: Display multiples of 5 The configuration below allows you to obtain and display all multiples (≥0) of 5. In the FPV window, a multiple of 5 is added to the list every 0.5 seconds.
  • Page 168 Note: The input value can be a number, a variable, or variable-type data, but cannot be a list or a list-type data. (1) Objective: Assigns values to a list (2) Type: Execution block (3) Example: Recognize a person...
  • Page 169 In the FPV window, the list is configured to recognize a person and generate relevant information. Note: 1) List values can be numbers, lists, or list-type data, but cannot be variables or variable-type data.
  • Page 170 2) You cannot perform arithmetic operations directly on a list. (1) Objective: Deletes an item from a list (2) Type: Execution block (3) Example: Delete the number of people...
  • Page 171 In the FPV window, the list length changes from 5 to 4 after deleting the first item. Before: After:...
  • Page 172 Note: 1) The user needs to know the serial number of the item before deleting it. 2) After deleting an item, the number of items decreases and their serial numbers change accordingly. (1) Objective: Deletes all items or the last item from a list (2) Type: Execution block (3) Example: Clear list(All Items) In the FPV window, the list length changes from 5 to 0.
  • Page 173 Before: After: (1) Objective: Inserts an item at a specific location in a list and shifts subsequent items down the list (2) Type: Execution block (3) Example: Insert program runtime timer...
  • Page 174 Apply the red tape and observe the FPV window. You can see that the program runtime is inserted as the first item of the list, the original items are shifted down the list, and the total number of items increases by Before: After:...
  • Page 175 (1) Objective: Replaces an item on the list (2) Type: Execution block (3) Example: Replace a value This will make every value in List_B be greater than the corresponding value in List_A by 1.
  • Page 176 Note: The item must contain a value before it can be replaced. For example, if List_B is empty, you will not have any items to replace it with. (1) Objective: Returns a specific item on a list (2) Type: Information block (variable-type) (3) Example: Specify an item on a list...
  • Page 177 In the FPV window below, data2 = 7 and data3 = 5. (1) Objective: Obtains the location of the data’s first occurrence in the current item (2) Type: Information block (variable-type) (3) Example: Read the index value Create a list of {5, 1, 2, 1, 7}, and set the index number for the first ”1” to “2.”...
  • Page 178 You can check the result using the FPV window: (1) Objective: Obtains the total number of items for a list (2) Type: Information block (variable-type) (3) Example: Calculate the number of items...
  • Page 179 You can check value changes using the FPV window. The length value starts at 2 and becomes 0 after deleting all items. Before: After:...
  • Page 180 (1) Objective: Returns “True” when a list contains a specific value; otherwise, “False” is returned (2) Returned value: Boolean (3) Example: List containing a specified value If there is a specific value set for a list, the gimbal LEDs will start to scroll. Note: The condition “True”...
  • Page 181 (1) Objective: Creates and names a PID controller (2) Type: Settings block (3) Example: Name controller Note: After the controller is created, there will be three modules available to configure error settings, adjust parameters, and obtain output information. Python API: Class: rm_ctrl.PIDCtrl() (1) Objective: Sets the PID controller error, which is the difference between the target and returned values (2) Type: Settings block...
  • Page 182 Leaning Upside Down Skewed Moving Too Fast Obstructed Case Impact No Impact No Impact Impacted Impacted Impacted Fail to identify Note: Before running the program, make sure that the Vision Marker is aligned to the robot's field of view. Python API: Class: rm_ctrl.PIDCtrl() Function:...
  • Page 183 (1) Objective: Adjusts the PID parameters; Kp is the proportional coefficient, Ki is the integral coefficient, and Kd is the differential coefficient. (2) Type: Settings block (3) Example: Follow Vision Marker Modify parameters of Kp, Ki, and Kd to optimize the closed-loop control system. Note:...
  • Page 184 Function Features Weakness The larger the proportional Cannot eliminate the Amplifty or weaken the error coefficient, the more responsive steady-state error of Proportional signal. Proportional the system becomes. But may the system, lowering Control(P) coefficient determines the oscillate and destabilize the system the relative stability of strength of control.
  • Page 185 Python API: Class: rm_ctrl.PIDCtrl() ● Function: ■ get_output() ● Return value ■ output(float)
  • Page 186 (1) Objective: Packages a program that needs to appear multiple times into a function, making it convenient to use (2) Type: Function block (3) Example: Launch counterattack If the armor pieces on either side of the chassis are attacked, the gimbal will turn to the side where it was attacked to aim a counterattack.
  • Page 187 2) After a function has been created, the packaged block will appear for use: 3) Using functions helps make the whole program more concise and clear.

Table of Contents