robocadSim

Welcome to the robocadSim v1.3.4 - v1.3.6.1 documentation page. Here you will find lots of information about how to program robocadSim’ virtual robots.

Getting started

Where to begin?

First you need to download robocadSim and run it. Latest version.

I hope you have already chosen the language with which you will program your robot and the IDE for it.

You can read how to start using libraries for the selected language here.

Write a program, turn on the robot and run the code!

Robot documentation

Here You can choose the robot you are programming. Read the documentation about all functions in the selected language and see some helpful examples. Good luck!

RE21

Some info here

RE21mini

Everything about RE21mini

Functions for RE21mini

ReadButtons

ReadButtons function is used to get buttons values from a robot.

Location and name: RobocadSim.RE21mini.read_buttons()

Inputs:

---

Output:

bool map that includes:

  • EMS button value

  • Start button value

  • Limit button value

Example:

1
2
3
4
5
from robocadSimPy import RobocadSim


robot = RobocadSim.RE21mini()
ems_button, start_button, limit_button = robot.read_buttons()

Additional info:

---

Location and name: “RE21mini.h”.RE21mini.ReadButtons()

Inputs:

---

Output:

bool* that includes:

  • EMS button value

  • Start button value

  • Limit button value

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#include "RE21mini.h"
#include <iostream>

int main()
{
    RE21mini robot;
    bool* all_buttons = robot.ReadButtons();
    bool ems_button = all_buttons[0];
    bool start_button = all_buttons[1];
    bool limit_button = all_buttons[2];
}

Additional info:

---

Location and name: RobocadSim.RE21mini.ReadButtons()

Inputs:

---

Output:

bool[] that includes:

  • EMS button value

  • Start button value

  • Limit button value

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
using System;
using RobocadSim;

namespace TestLib
{
    class Program
    {
        static void Main(string[] args)
        {
            RE21mini robot = new RE21mini();
            bool[] allButtons = robot.ReadButtons();
            bool emsButton = allButtons[0];
            bool startButton = allButtons[1];
            bool limitButton = allButtons[2];
        }
    }
}

Additional info:

---

ReadButtonsVoid

ReadButtonsVoid function is used to write buttons values from a robot into variables.

Location and name: RobocadSim.RE21mini.read_buttons_void()

Inputs:

---

Output:

---

Example:

1
2
3
4
5
6
7
8
from robocadSimPy import RobocadSim


robot = RobocadSim.RE21mini()
robot.read_buttons_void()
ems_button = robot.button_ems
start_button = robot.button_start
limit_button = robot.button_limit

Additional info:

---

Location and name: “RE21mini.h”.RE21mini.ReadButtonsVoid()

Inputs:

---

Output:

---

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#include "RE21mini.h"
#include <iostream>

int main()
{
    RE21mini robot;
    robot.ReadButtonsVoid();
    bool ems_button = robot.buttonEMS;
    bool start_button = robot.buttonStart;
    bool limit_button = robot.buttonLimit;
}

Additional info:

---

Location and name: RobocadSim.RE21mini.ReadButtonsVoid()

Inputs:

---

Output:

---

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
using System;
using RobocadSim;

namespace TestLib
{
    class Program
    {
        static void Main(string[] args)
        {
            RE21mini robot = new RE21mini();
            robot.ReadButtonsVoid();
            bool emsButton = robot.buttonEMS;
            bool startButton = robot.buttonStart;
            bool limitButton = robot.buttonLimit;
        }
    }
}

Additional info:

---

ReadCamera

ReadCamera function is used to get camera image from a robot.

Location and name: RobocadSim.RE21mini.read_camera()

Inputs:

---

Output:

numpy.ndarray of image from robot

Example:

1
2
3
4
5
6
from robocadSimPy import RobocadSim
import cv2


robot = RobocadSim.RE21mini()
image = robot.read_camera()

Additional info:

---

Location and name: “RE21mini.h”.RE21mini.ReadCamera()

Inputs:

---

Output:

Mat of image from robot

Example:

1
2
3
4
5
6
7
8
#include "RE21mini.h"
#include <iostream>

int main()
{
    RE21mini robot;
    Mat image = robot.ReadCamera();
}

Additional info:

---

Location and name: RobocadSim.RE21mini.ReadCamera()

Inputs:

---

Output:

Mat of image from robot

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
using System;
using RobocadSim;
using Emgu.CV;

namespace TestLib
{
    class Program
    {
        static void Main(string[] args)
        {
            RE21mini robot = new RE21mini();
            Mat image = robot.ReadCamera();
        }
    }
}

Additional info:

---

ReadCameraBytes

ReadCameraBytes function is used to get camera bytes from a robot.

Location and name: RobocadSim.RE21mini.read_camera_bytes()

Inputs:

---

Output:

bytes of image from robot

Example:

1
2
3
4
5
from robocadSimPy import RobocadSim


robot = RobocadSim.RE21mini()
image_bytes = robot.read_camera_bytes()

Additional info:

---

Location and name: “RE21mini.h”.RE21mini.ReadCameraBytes()

Inputs:

---

Output:

char* of image from robot

Example:

1
2
3
4
5
6
7
8
#include "RE21mini.h"
#include <iostream>

int main()
{
    RE21mini robot;
    char* imageBytes = robot.ReadCameraBytes();
}

Additional info:

---

Location and name: RobocadSim.RE21mini.ReadCameraBytes()

Inputs:

---

Output:

byte[] of image from robot

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
using System;
using RobocadSim;

namespace TestLib
{
    class Program
    {
        static void Main(string[] args)
        {
            RE21mini robot = new RE21mini();
            byte[] imageBytes = robot.ReadCameraBytes();
        }
    }
}

Additional info:

---

ReadCameraBytesVoid

ReadCameraBytesVoid function is used to write camera bytes from a robot into variables.

Location and name: RobocadSim.RE21mini.read_camera_bytes_void()

Inputs:

---

Output:

---

Example:

1
2
3
4
5
6
from robocadSimPy import RobocadSim


robot = RobocadSim.RE21mini()
robot.read_camera_bytes_void()
image_bytes = robot.bytes_from_camera

Additional info:

---

Location and name: “RE21mini.h”.RE21mini.ReadCameraBytesVoid()

Inputs:

---

Output:

---

Example:

1
2
3
4
5
6
7
8
9
#include "RE21mini.h"
#include <iostream>

int main()
{
    RE21mini robot;
    robot.ReadCameraBytesVoid();
    char* imageBytes = robot.bytesFromCamera;
}

Additional info:

---

Location and name: RobocadSim.RE21mini.ReadCameraBytesVoid()

Inputs:

---

Output:

---

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
using System;
using RobocadSim;

namespace TestLib
{
    class Program
    {
        static void Main(string[] args)
        {
            RE21mini robot = new RE21mini();
            robot.ReadCameraBytesVoid();
            byte[] imageBytes = robot.bytesFromCamera;
        }
    }
}

Additional info:

---

ReadCameraVoid

ReadCameraVoid function is used to write camera image from a robot into variables.

Location and name: RobocadSim.RE21mini.read_camera_void()

Inputs:

---

Output:

---

Example:

1
2
3
4
5
6
7
from robocadSimPy import RobocadSim
import cv2


robot = RobocadSim.RE21mini()
robot.read_camera_void()
image = robot.image_from_camera

Additional info:

---

Location and name: “RE21mini.h”.RE21mini.ReadCameraVoid()

Inputs:

---

Output:

---

Example:

1
2
3
4
5
6
7
8
9
#include "RE21mini.h"
#include <iostream>

int main()
{
    RE21mini robot;
    robot.ReadCameraVoid();
    Mat image = robot.imageFromCamera;
}

Additional info:

---

Location and name: RobocadSim.RE21mini.ReadCameraVoid()

Inputs:

---

Output:

---

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
using System;
using RobocadSim;
using Emgu.CV;

namespace TestLib
{
    class Program
    {
        static void Main(string[] args)
        {
            RE21mini robot = new RE21mini();
            robot.ReadCameraVoid();
            Mat image = robot.imageFromCamera;
        }
    }
}

Additional info:

---

ReadEncs

ReadEncs function is used to get encoder values from a robot.

Location and name: RobocadSim.RE21mini.read_encs()

Inputs:

---

Output:

float map that includes:

  • Right motor’ encoder value

  • Left motor’ encoder value

  • Back motor’ encoder value

  • Lift motor’ encoder value

Example:

1
2
3
4
5
from robocadSimPy import RobocadSim


robot = RobocadSim.RE21mini()
right_enc, left_enc, back_enc, lift_enc = robot.read_encs()

Additional info:

  • You should use Transfunction with encoders for a more convenient representation of values

Location and name: “RE21mini.h”.RE21mini.ReadEncs()

Inputs:

---

Output:

float* that includes:

  • Right motor’ encoder value

  • Left motor’ encoder value

  • Back motor’ encoder value

  • Lift motor’ encoder value

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#include "RE21mini.h"
#include <iostream>

int main()
{
    RE21mini robot;
    float* all_encs = robot.ReadEncs();
    float right_enc = all_encs[0];
    float left_enc = all_encs[1];
    float back_enc = all_encs[2];
    float lift_enc = all_encs[3];
}

Additional info:

  • You should use Transfunction with encoders for a more convenient representation of values

Location and name: RobocadSim.RE21mini.ReadEncs()

Inputs:

---

Output:

float[] that includes:

  • Right motor’ encoder value

  • Left motor’ encoder value

  • Back motor’ encoder value

  • Lift motor’ encoder value

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
using System;
using RobocadSim;

namespace TestLib
{
    class Program
    {
        static void Main(string[] args)
        {
            RE21mini robot = new RE21mini();
            float[] allEncs = robot.ReadEncs();
            float rightEnc = allEncs[0];
            float leftEnc = allEncs[1];
            float backEnc = allEncs[2];
            float liftEnc = allEncs[3];
        }
    }
}

Additional info:

  • You should use Transfunction with encoders for a more convenient representation of values

ReadEncsVoid

ReadEncsVoid function is used to write encoder values from a robot into variables.

Location and name: RobocadSim.RE21mini.read_encs_void()

Inputs:

---

Output:

---

Example:

1
2
3
4
5
6
7
8
9
from robocadSimPy import RobocadSim


robot = RobocadSim.RE21mini()
robot.read_encs_void()
right_enc = robot.right_motor_enc
left_enc = robot.left_motor_enc
back_enc = robot.back_motor_enc
lift_enc = robot.lift_motor_enc

Additional info:

  • You should use Transfunction with encoders for a more convenient representation of values

Location and name: “RE21mini.h”.RE21mini.ReadEncsVoid()

Inputs:

---

Output:

---

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#include "RE21mini.h"
#include <iostream>

int main()
{
    RE21mini robot;
    robot.ReadEncsVoid();
    float right_enc = robot.rightMotorEnc;
    float left_enc = robot.leftMotorEnc;
    float back_enc = robot.backMotorEnc;
    float lift_enc = robot.liftMotorEnc;
}

Additional info:

  • You should use Transfunction with encoders for a more convenient representation of values

Location and name: RobocadSim.RE21mini.ReadEncsVoid()

Inputs:

---

Output:

---

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
using System;
using RobocadSim;

namespace TestLib
{
    class Program
    {
        static void Main(string[] args)
        {
            RE21mini robot = new RE21mini();
            robot.ReadEncsVoid();
            float rightEnc = robot.encRight;
            float leftEnc = robot.encLeft;
            float backEnc = robot.encBack;
            float liftEnc = robot.encLift;
        }
    }
}

Additional info:

  • You should use Transfunction with encoders for a more convenient representation of values

ReadSensors

ReadSensors function is used to get sensors values from a robot.

Location and name: RobocadSim.RE21mini.read_sensors()

Inputs:

---

Output:

float map that includes:

  • Right US value

  • Left US value

  • Right IR value

  • Left IR value

  • Gyroscope value

Example:

1
2
3
4
5
from robocadSimPy import RobocadSim


robot = RobocadSim.RE21mini()
right_us, left_us, right_ir, left_ir, gyro = robot.read_sensors()

Additional info:

---

Location and name: “RE21mini.h”.RE21mini.ReadSensors()

Inputs:

---

Output:

float* that includes:

  • Right US value

  • Left US value

  • Right IR value

  • Left IR value

  • Gyroscope value

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#include "RE21mini.h"
#include <iostream>

int main()
{
    RE21mini robot;
    float* all_sens = robot.ReadSensors();
    float right_us = all_sens[0];
    float left_us = all_sens[1];
    float right_ir = all_sens[2];
    float left_ir = all_sens[3];
    float gyro = all_sens[4];
}

Additional info:

---

Location and name: RobocadSim.RE21mini.ReadSensors()

Inputs:

---

Output:

float[] that includes:

  • Right US value

  • Left US value

  • Right IR value

  • Left IR value

  • Gyroscope value

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
using System;
using RobocadSim;

namespace TestLib
{
    class Program
    {
        static void Main(string[] args)
        {
            RE21mini robot = new RE21mini();
            float[] allSens = robot.ReadSensors();
            float rightUS = allSens[0];
            float leftUS = allSens[1];
            float rightIR = allSens[2];
            float leftIR = allSens[3];
            float gyro = allSens[4];
        }
    }
}

Additional info:

---

ReadSensorsVoid

ReadSensorsVoid function is used to write sensors values from a robot into variables.

Location and name: RobocadSim.RE21mini.read_sensors_void()

Inputs:

---

Output:

---

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
from robocadSimPy import RobocadSim


robot = RobocadSim.RE21mini()
robot.read_sensors_void()
right_us = robot.right_us
left_us = robot.left_us
right_ir = robot.right_ir
left_ir = robot.left_ir
gyro = robot.navX

Additional info:

---

Location and name: “RE21mini.h”.RE21mini.ReadSensorsVoid()

Inputs:

---

Output:

---

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#include "RE21mini.h"
#include <iostream>

int main()
{
    RE21mini robot;
    robot.ReadSensorsVoid();
    float right_us = robot.rightUS;
    float left_us = robot.leftUS;
    float right_ir = robot.rightIR;
    float left_ir = robot.leftIR;
    float gyro = robot.navX;
}

Additional info:

---

Location and name: RobocadSim.RE21mini.ReadSensorsVoid()

Inputs:

---

Output:

---

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
using System;
using RobocadSim;

namespace TestLib
{
    class Program
    {
        static void Main(string[] args)
        {
            RE21mini robot = new RE21mini();
            robot.ReadSensorsVoid();
            float rightUS = robot.rightUS;
            float leftUS = robot.leftUS;
            float rightIR = robot.rightIR;
            float leftIR = robot.leftIR;
            float gyro = robot.navX;
        }
    }
}

Additional info:

---

WriteMotors

WriteMotors function is used to set speed values to a robot.

Location and name: RobocadSim.RE21mini.write_motors()

Inputs:

  • float speed to right motor

  • float speed to left motor

  • float speed to back motor

Output:

---

Example:

1
2
3
4
5
from robocadSimPy import RobocadSim


robot = RobocadSim.RE21mini()
robot.write_motors(10, -10, 0)

Additional info:

  • Range of speed is from -50 to 50

Location and name: “RE21mini.h”.RE21mini.WriteMotors()

Inputs:

  • float speed to right motor

  • float speed to left motor

  • float speed to back motor

Output:

---

Example:

1
2
3
4
5
6
7
8
#include "RE21mini.h"
#include <iostream>

int main()
{
    RE21mini robot;
    robot.WriteMotors(10, -10, 0);
}

Additional info:

  • Range of speed is from -50 to 50

Location and name: RobocadSim.RE21mini.WriteMotors()

Inputs:

  • float speed to right motor

  • float speed to left motor

  • float speed to back motor

Output:

---

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
using System;
using RobocadSim;

namespace TestLib
{
    class Program
    {
        static void Main(string[] args)
        {
            RE21mini robot = new RE21mini();
            robot.WriteMotors(10, -10, 0);
        }
    }
}

Additional info:

  • Range of speed is from -50 to 50

WriteMotorsVoid

WriteMotorsVoid function is used to set speed values to a robot from variables.

Location and name: RobocadSim.RE21mini.write_motors_void()

Inputs:

---

Output:

---

Example:

1
2
3
4
5
6
7
8
from robocadSimPy import RobocadSim


robot = RobocadSim.RE21mini()
robot.right_motor_speed = 10
robot.left_motor_speed = -10
robot.back_motor_speed = 0
robot.write_motors_void()

Additional info:

  • Range of speed is from -50 to 50

Location and name: “RE21mini.h”.RE21mini.WriteMotorsVoid()

Inputs:

---

Output:

---

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#include "RE21mini.h"
#include <iostream>

int main()
{
    RE21mini robot;
    robot.rightMotorSpeed = 10;
    robot.leftMotorSpeed = -10;
    robot.backMotorSpeed = 0;
    robot.WriteMotorsVoid();
}

Additional info:

  • Range of speed is from -50 to 50

Location and name: RobocadSim.RE21mini.WriteMotorsVoid()

Inputs:

---

Output:

---

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
using System;
using RobocadSim;

namespace TestLib
{
    class Program
    {
        static void Main(string[] args)
        {
            RE21mini robot = new RE21mini();
            robot.speedRight = 10;
            robot.speedLeft = -10;
            robot.speedBack = 0;
            robot.WriteMotorsVoid();
        }
    }
}

Additional info:

  • Range of speed is from -50 to 50

WriteOMS

WriteOMS function is used to set speed and angle values to a robot.

Location and name: RobocadSim.RE21mini.write_oms()

Inputs:

  • float speed to lift motor

  • float angle to big servo motor

  • float direction of small servo motor

Output:

---

Example:

1
2
3
4
5
from robocadSimPy import RobocadSim


robot = RobocadSim.RE21mini()
robot.write_oms(10, 1600, 1400)

Additional info:

  • Range of speed is from -50 to 50

  • Range of angles for big servo motor is from 1490 to 1750

  • Range of values for small servo motor is from 1400 to 1600

Location and name: “RE21mini.h”.RE21mini.WriteOMS()

Inputs:

  • float speed to lift motor

  • float angle to big servo motor

  • float direction of small servo motor

Output:

---

Example:

1
2
3
4
5
6
7
8
#include "RE21mini.h"
#include <iostream>

int main()
{
    RE21mini robot;
    robot.WriteOMS(10, 1600, 1400);
}

Additional info:

  • Range of speed is from -50 to 50

  • Range of angles for big servo motor is from 1490 to 1750

  • Range of values for small servo motor is from 1400 to 1600

Location and name: RobocadSim.RE21mini.WriteOMS()

Inputs:

  • float speed to lift motor

  • float angle to big servo motor

  • float direction of small servo motor

Output:

---

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
using System;
using RobocadSim;

namespace TestLib
{
    class Program
    {
        static void Main(string[] args)
        {
            RE21mini robot = new RE21mini();
            robot.WriteOMS(10, 1600, 1400);
        }
    }
}

Additional info:

  • Range of speed is from -50 to 50

  • Range of angles for big servo motor is from 1490 to 1750

  • Range of values for small servo motor is from 1400 to 1600

WriteOMSVoid

WriteOMSVoid function is used to set speed and angle values to a robot from variables.

Location and name: RobocadSim.RE21mini.write_oms_void()

Inputs:

---

Output:

---

Example:

1
2
3
4
5
6
7
8
from robocadSimPy import RobocadSim


robot = RobocadSim.RE21mini()
robot.lift_motor_speed = 10
robot.angle_for_big = 1600
robot.dir_for_small = 1400
robot.write_oms_void()

Additional info:

  • Range of speed is from -50 to 50

  • Range of angles for big servo motor is from 1490 to 1750

  • Range of values for small servo motor is from 1400 to 1600

Location and name: “RE21mini.h”.RE21mini.WriteOMSVoid()

Inputs:

---

Output:

---

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#include "RE21mini.h"
#include <iostream>

int main()
{
    RE21mini robot;
    robot.liftMotorSpeed = 10;
    robot.bigServoAngle = 1600;
    robot.smallServoDir = 1400;
    robot.WriteOMSVoid();
}

Additional info:

  • Range of speed is from -50 to 50

  • Range of angles for big servo motor is from 1490 to 1750

  • Range of values for small servo motor is from 1400 to 1600

Location and name: RobocadSim.RE21mini.WriteOMSVoid()

Inputs:

---

Output:

---

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
using System;
using RobocadSim;

namespace TestLib
{
    class Program
    {
        static void Main(string[] args)
        {
            RE21mini robot = new RE21mini();
            robot.speedLift = 10;
            robot.angleBig = 1600;
            robot.dirSmall = 1400;
            robot.WriteOMSVoid();
        }
    }
}

Additional info:

  • Range of speed is from -50 to 50

  • Range of angles for big servo motor is from 1490 to 1750

  • Range of values for small servo motor is from 1400 to 1600

WriteReset

WriteReset function is used to set reset values to a robot.

Location and name: RobocadSim.RE21mini.write_reset()

Inputs:

  • bool reset right motor encoder

  • bool reset left motor encoder

  • bool reset back motor encoder

  • bool reset lift motor encoder

  • bool reset gyroscope

Output:

---

Example:

1
2
3
4
5
from robocadSimPy import RobocadSim


robot = RobocadSim.RE21mini()
robot.write_reset(True, True, True, False, False)

Additional info:

  • You should write Your own gyro reset (cause my doesn’t work well :) )

Location and name: “RE21mini.h”.RE21mini.WriteReset()

Inputs:

  • bool reset right motor encoder

  • bool reset left motor encoder

  • bool reset back motor encoder

  • bool reset lift motor encoder

  • bool reset gyroscope

Output:

---

Example:

1
2
3
4
5
6
7
8
#include "RE21mini.h"
#include <iostream>

int main()
{
    RE21mini robot;
    robot.WriteReset(true, true, true, false, false);
}

Additional info:

  • You should write Your own gyro reset (cause my doesn’t work well :) )

Location and name: RobocadSim.RE21mini.WriteReset()

Inputs:

  • bool reset right motor encoder

  • bool reset left motor encoder

  • bool reset back motor encoder

  • bool reset lift motor encoder

  • bool reset gyroscope

Output:

---

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
using System;
using RobocadSim;

namespace TestLib
{
    class Program
    {
        static void Main(string[] args)
        {
            RE21mini robot = new RE21mini();
            robot.WriteReset(true, true, true, false, false);
        }
    }
}

Additional info:

  • You should write Your own gyro reset (cause my doesn’t work well :) )

WriteResetVoid

WriteResetVoid function is used to set reset values to a robot from variables.

Location and name: RobocadSim.RE21mini.write_reset_void()

Inputs:

---

Output:

---

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
from robocadSimPy import RobocadSim


robot = RobocadSim.RE21mini()
robot.reset_right_enc = True
robot.reset_left_enc = True
robot.reset_back_enc = True
robot.reset_lift_enc = False
robot.reset_gyro = False
robot.write_reset_void()

Additional info:

  • You should write Your own gyro reset (cause my doesn’t work well :) )

Location and name: “RE21mini.h”.RE21mini.WriteResetVoid()

Inputs:

---

Output:

---

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#include "RE21mini.h"
#include <iostream>

int main()
{
    RE21mini robot;
    robot.resetRightEnc = true;
    robot.resetLeftEnc = true;
    robot.resetBackEnc = true;
    robot.resetLiftEnc = false;
    robot.resetGyro = false;
    robot.WriteResetVoid();
}

Additional info:

  • You should write Your own gyro reset (cause my doesn’t work well :) )

Location and name: RobocadSim.RE21mini.WriteResetVoid()

Inputs:

---

Output:

---

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
using System;
using RobocadSim;

namespace TestLib
{
    class Program
    {
        static void Main(string[] args)
        {
            RE21mini robot = new RE21mini();
            robot.resetEncRight = true;
            robot.resetEncLeft = true;
            robot.resetEncBack = true;
            robot.resetEncLift = false;
            robot.resetGyro = false;
            robot.WriteResetVoid();
        }
    }
}

Additional info:

  • You should write Your own gyro reset (cause my doesn’t work well :) )

Field documentation

Here You can choose a field and read some info about it.

Field E21

Here You can read some info about E21 field.

Traffic lights on E21 field

There are 2 traffic lights on the field and they can burn with such colors:

  • Red color

  • Yellow color

  • Green color

Red:

If a red light is on at a traffic light, robot should stop in front of it or in front of a black line. And continue movement when a green light is on at a traffic light:

_images/red_light_example_1.png
Yellow:

If a yellow light is on at a traffic light, robot should stop in front of it or in front of a black line. And continue movement when a green light is on at a traffic light. But if robot already crossed the line when the yellow light came on, it can complete movement:

_images/yellow_light_example_1.png
Green:

If a green light is on at a traffic light, robot can continue its movement:

_images/green_light_example_1.png

Signs on E21 field

There are 4 signs on the field and they may be:

  • Turn Left sign

  • Turn Right sign

  • Move Forward sign

  • Stop sign

Turn Left:

For example, if You have Turn Left sign at the start (green rect) You should move like that:

_images/left_example_1.png

or like that:

_images/left_example_2.png

and check next sign (red rect) if You need it.

Turn Right:

For example, if there is Turn Right sign at the Distant village (green rect) You should move like that:

_images/right_example_1.png

or like that:

_images/right_example_2.png

and check next sign (red rect) if You need it.

Move Forward:

For example, if there is Move Forward sign at the start (green rect) You should move like that:

_images/forward_example_1.png

and check next sign (red rect) if You need it.

Stop:

For example, if there is Stop sign at the start (green rect) You should stop in front of the sign (or line) and wait for 2 seconds. After that You can continue Your movement wherever You want. Example:

_images/stop_example_1.png
All signs:

Here is an example of movement when robot has to go to the Pine village and take containers from there:

_images/all_signs_example_1.png _images/all_signs_example_2.png

Funcad documentation

Here You can find some info about Funcad.

FromAxisToMotors

FromAxisToMotors function is used to remake input axis values into motors values for tricycle robot.

Location and name: Funcad.Funcad.from_axis_to_motors()

Inputs:

  • float speed to X axis

  • float speed to Y axis

  • float speed to Z axis

Output:

numpy.ndarray that includes:

  • Speed to right motor

  • Speed to left motor

  • Speed to back motor

Example:

1
2
3
4
5
from robocadSimPy import Funcad


funcad = Funcad.Funcad()
out = funcad.from_axis_to_motors(5, -5, 3)  # [ 2.273672 -9.273672  4.      ]

Additional info:

---

Location and name: “Funcad.h”.Funcad.from_axis_to_motors()

Inputs:

  • float speed to X axis

  • float speed to Y axis

  • float speed to Z axis

Output:

float* that includes:

  • Speed to right motor

  • Speed to left motor

  • Speed to back motor

Example:

1
2
3
4
5
6
7
8
#include "Funcad.h"
#include <iostream>

int main()
{
    Funcad funcad;
    float* out = funcad.from_axis_to_motors(5, -5, 3); // 2.2735 -9.2735 4
}

Additional info:

---

Location and name: RobocadSim.Funcad.FromAxisToMotors()

Inputs:

  • float speed to X axis

  • float speed to Y axis

  • float speed to Z axis

Output:

System.Numerics.Vector3 that includes:

  • Speed to right motor

  • Speed to left motor

  • Speed to back motor

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
using System;
using RobocadSim;

namespace TestLib
{
    class Program
    {
        static void Main(string[] args)
        {
            Funcad funcad = new Funcad();
            Vector3 vec = funcad.FromAxisToMotors(5, -5, 3); // 2,273672  -9,273672  4
        }
    }
}

Additional info:

---

FromMotorsToAxis

FromMotorsToAxis function is used to remake input motors values into axis values for tricycle robot.

Location and name: Funcad.Funcad.from_motors_to_axis()

Inputs:

  • float speed to right motor

  • float speed to left motor

  • float speed to back motor

Output:

numpy.ndarray that includes:

  • Speed to X axis

  • Speed to Y axis

  • Speed to Z axis

Example:

1
2
3
4
5
from robocadSimPy import Funcad


funcad = Funcad.Funcad()
out = funcad.from_motors_to_axis(5, -5, 0)  # [8.66 0.   0.  ]

Additional info:

---

Location and name: “Funcad.h”.Funcad.from_motors_to_axis()

Inputs:

  • float speed to right motor

  • float speed to left motor

  • float speed to back motor

Output:

float* that includes:

  • Speed to X axis

  • Speed to Y axis

  • Speed to Z axis

Example:

1
2
3
4
5
6
7
8
#include "Funcad.h"
#include <iostream>

int main()
{
    Funcad funcad;
    float* out = funcad.from_motors_to_axis(5, -5, 0); // 8.66 0 0
}

Additional info:

---

Location and name: RobocadSim.Funcad.FromMotorsToAxis()

Inputs:

  • float speed to right motor

  • float speed to left motor

  • float speed to back motor

Output:

System.Numerics.Vector3 that includes:

  • Speed to X axis

  • Speed to Y axis

  • Speed to Z axis

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
using System;
using RobocadSim;

namespace TestLib
{
    class Program
    {
        static void Main(string[] args)
        {
            Funcad funcad = new Funcad();
            Vector3 vec = funcad.FromMotorsToAxis(5, -5, 0); // 8.66 0 0
        }
    }
}

Additional info:

---

InRangeBool

InRangeBool function is used to check that input value is in range.

Location and name: Funcad.Funcad.in_range_bool()

Inputs:

  • float input value

  • float lower threshold

  • float upper threshold

Output:

bool is in range

Example:

1
2
3
4
5
from robocadSimPy import Funcad


funcad = Funcad.Funcad()
out = funcad.in_range_bool(5, 0, 12)  # True

Additional info:

---

Location and name: “Funcad.h”.Funcad.in_range_bool()

Inputs:

  • float input value

  • float lower threshold

  • float upper threshold

Output:

bool is in range

Example:

1
2
3
4
5
6
7
8
#include "Funcad.h"
#include <iostream>

int main()
{
    Funcad funcad;
    bool out = funcad.in_range_bool(5, 0, 12); // true
}

Additional info:

---

Location and name: RobocadSim.Funcad.InRangeBool()

Inputs:

  • float input value

  • float lower threshold

  • float upper threshold

Output:

bool is in range

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
using System;
using RobocadSim;

namespace TestLib
{
    class Program
    {
        static void Main(string[] args)
        {
            Funcad funcad = new Funcad();
            bool output = funcad.InRangeBool(5, 0, 12); // true
        }
    }
}

Additional info:

---

TransfunctionCoda

TransfunctionCoda function is used to rearrange input value. Created by subsystems developer Coda.

Location and name: Funcad.Funcad.transfunc_coda()

Inputs:

  • float value to remake

  • list input array

  • list output array

Output:

float remaded input

Example:

1
2
3
4
5
from robocadSimPy import Funcad


funcad = Funcad.Funcad()
out = funcad.transfunc_coda(5, [2, 10], [20, 100])  # out will be 50

Additional info:

---

Location and name: “Funcad.h”.Funcad.transfunc_coda()

Inputs:

  • float value to remake

  • float* input array

  • float* output array

  • int size of input or output array

Output:

float remaded input

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
#include "Funcad.h"
#include <iostream>

int main()
{
    Funcad funcad;
    float in_arr[] = { 2, 10 };
    float out_arr[] = { 20, 100 };
    float out = funcad.transfunc_coda(5, in_arr, out_arr, 2); // out will be 50
}

Additional info:

---

Location and name: RobocadSim.Funcad.TransfunctionCoda()

Inputs:

  • float value to remake

  • List<float> input array

  • List<float> output array

Output:

float remaded input

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
using System;
using RobocadSim;

namespace TestLib
{
    class Program
    {
        static void Main(string[] args)
        {
            Funcad funcad = new Funcad();
            float[] inArr = { 2, 10 };
            List<float> inList = new List<float>(inArr);
            float[] outArr = { 20, 100 };
            List<float> outList = new List<float>(outArr);
            float outVal = funcad.TransfunctionCoda(5, inList, outList); // out will be 50
        }
    }
}

Additional info:

---

Libraries documentation

Here You can choose the favourite programming language and read about how to install the library into Your project.

Python library

Here is some info about how to download robocadSim Python library. I am going to use PyCharm 2020.

First way:

  1. Open Your project in PyChram -> click on File -> Settings

_images/first_step_py.png
  1. Click on Project: Python -> Project Interpreter -> Install (Plus button)

_images/second_step_py.png
  1. Write robocadSimPy in Search Line -> select robocadSimPy -> click Install Package

_images/third_step_py.png
  1. Now You can use robocadSim Python library in Your project!

Second way:

  1. Win + R -> write cmd here -> press Enter

_images/fourth_step_py.jpg
  1. Write here pip install robocadSimPy or pip3 install robocadSimPy -> press Enter

_images/sixth_step_py.jpg _images/fifth_step_py.jpg
  1. Now You can use robocadSim Python library in Your project!

C# library

Here is some info about how to use robocadSim C# library in your project. I am going to use Visual Studio 2019.

You need emgu-cv installed in your project if You use robocadSim version < v1.3.7. (How to install example).

First way:

  1. Right click on Your project name in Solution explorer -> click on Manage NuGet Packages

_images/fourth_step_cs.jpg
  1. Click on Browse -> write there robocadSim and click Enter -> choose robocadSimCS created by crackanddie or Abdrakov corp. and click on install button

_images/fifth_step_cs.jpg

Second way:

  1. Click on Your project name in Solution explorer -> right click on Dependencies -> Add reference…

_images/first_step_cs.png
  1. Click on Browse…

_images/second_step_cs.png
  1. Select RobocadSim.dll in ./Lib/cs/ and click Add

_images/third_step_cs.png
  1. Now You can use robocadSim C# library in Your project!

C++ library

Here is some info about how to use robocadSim C++ library in your project. I am going to use Visual Studio 2019.

  1. You need open-cv installed in your project. (How to install example).

  2. Right click on Your project name in Solution explorer -> Properties

_images/first_step_cpp.png
  1. Click on Configuration Properties -> C/C++ -> General -> Additional Include Directories -> Edit

_images/second_step_cpp.png
  1. Create a new line and paste here path to C++ header files (./robocadSim/Lib/cpp/robocadSimLibCpp) -> click OK

_images/third_step_cpp.png
  1. Go to Linker -> General -> Additional Library Directories -> Edit

_images/fourth_step_cpp.png
  1. Create new line and paste here path to .lib file (./robocadSim/Lib/cpp/x64/Release) -> click OK

_images/fifth_step_cpp.png
  1. Go to Linker -> Input -> Additional dependencies -> Edit

_images/sixth_step_cpp.png
  1. Paste here robocadSimLibCpp.lib line -> click OK

_images/seventh_step_cpp.png
  1. Now You can use robocadSim C++ library in Your project!

If You can’t use some header files:

  1. Copy .dll file in robocadSim release folder (./robocadSim/Lib/cpp/x64/Release)

  2. Paste it to the path: path_to_your_project/your_project_name/your_project_name/

robocadSim documentation

Here You can find some info about robocadSim program.

Hot Keys and Keys

Keys:

  • Esc: open “pause” menu

Hot Keys:

  • LeftCtrl + E: open power panel

  • LeftCtrl + D: open control panel

Be our sponsor

If you want to help the project financially, then you can send money to any of these accounts:

  • PayPal: paypal.me/crackanddie

  • Qiwi: qiwi.com/p/79656098785

  • Visa: 4000 7934 7377 7474

Thanks!

Need Help

If You are have any troubles please contact me:

License

MIT License

Copyright (c) 2020 Airat

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.