installing rtcs for the educator vehicle (ev3)

✏️ Edit this page on GitHub

#contents

This page explains how to install the various RTCs used to control the Educator Vehicle.

EducatorVehicle

EducatorVehicle is a component for controlling the driving speed of the EV3 and outputting sensor data.

Enter the following commands in the cross-development environment.


git clone https://github.com/Nobu19800/EducatorVehicle
cd EducatorVehicle
cmake .
make

Transfer the generated src/EducatorVehicleComp to the EV3.

EducatorVehicle
InPort
Name Data Type Description
velocity2D RTC::TimedVelocity2D Target velocity
angle RTC::TimedDouble Motor M angle
lcd RTC::CameraImage Image data to be displayed on the LCD
sound RTC::TimedString Audio output
OutPort
Name Data Type Description
odometry RTC::TimedPose2D Current position and orientation
current_vel RTC::TimedVelocity2D Current velocity and angular velocity
ultrasonic RTC::RangeData Distance measured by the ultrasonic sensor
gyro RTC::TimedDouble Angle measured by the gyro sensor
color RTC::TimedString Color measured by the color sensor
light_reflect RTC::TimedDouble Reflected light intensity measured by the color sensor
touch RTC::TimedBoolean Touch sensor ON/OFF state. The right sensor corresponds to element 0, and the left sensor corresponds to element 1.
Configuration Parameters
Name Default Value Description
wheelRadius 0.028 Wheel radius
wheelDistance 0.054 Half the distance between the wheels
medium_motor_speed 1.6 Speed of Motor M

Touch Sensor Output

For the data received through touch, element 0 corresponds to the right touch sensor (Port 3), and element 1 corresponds to the left touch sensor (Port 1).

Audio Output

The following commands can be used as input to the sound port.

  • beep
    • Entering beep produces a beep sound.
  • tone
    • Enter tone, followed by a frequency and duration, as shown below, to play a tone at the specified frequency for the specified number of milliseconds.

tone,100,1000

  • Other strings
    • Any other string will be spoken using text-to-speech.

Images Displayed on the LCD

Image files can be converted by dragging and dropping them onto saveBinaryImage.exe.

The image data displayed on the LCD can be supplied after conversion using the following component.

When using Windows, start it using ImageConversionLCDComp.exe in the release folder.

ImageConversionLCD
InPort
Name Data Type Description
out RTC::CameraImage Image data before conversion
OutPort
Name Data Type Description
out RTC::CameraImage Converted image data

For example, by connecting it to the OpenRTM-aist sample component OpenCVCamera, camera images can be displayed on the EV3 LCD.

Alternatively, a specific image can be displayed.


ControlEducatorVehicle

ControlEducatorVehicle can be used to control the following mobile robot (modified Educator Vehicle). Refer to this page for assembly instructions.


Features:

  • Avoids obstacles when a touch sensor is pressed.
  • Stops when the reflected light intensity measured by the color sensor falls below a specified threshold.
  • Measures the distance to the ground using the ultrasonic sensor, stops when the measured value exceeds a threshold, rotates the ultrasonic sensor, and searches for drivable ground.

If the ultrasonic sensor is not used, it can also be used to control a standard Educator Vehicle.

Enter the following commands in the cross-development environment.


git clone https://github.com/Nobu19800/ControlEducatorVehicle
cd ControlEducatorVehicle
cmake .
make

Transfer the generated src/ControlEducatorVehicleComp to the EV3.

ControlEducatorVehicle
InPort
Name Data Type Description
target_velocity_in RTC::TimedVelocity2D Target velocity
current_pose RTC::TimedPose2D Current position and orientation
ultrasonic RTC::TimedRangeData Distance measured by the ultrasonic sensor
light_reflect RTC::TimedDouble Reflected light intensity measured by the color sensor
touch TimedBoolean Touch sensor ON/OFF state
OutPort
Name Data Type Description
target_velocity_out RTC::TimedVelocity2D Corrected target velocity
angle RTC::TimedDouble Motor M angle
Configuration Parameters
Name Default Value Description
sensor_height 0.2 Ultrasonic sensor threshold used to determine whether drivable ground exists
back_speed 0.1 Reverse movement speed
back_time 1.0 Duration of reverse movement
rotate_speed 0.8 Rotation speed
rotate_time 2.0 Rotation duration
medium_motor_range 1.6 Operating range of Motor M

Obstacle Avoidance Using Touch Sensor Input

When a touch sensor is activated, the robot first moves backward at the speed specified by back_speed for the duration specified by back_time, as shown in step ③.

It then rotates at the angular velocity specified by rotate_speed for the duration specified by rotate_time, as shown in step ④.

The direction of rotation is opposite to the side on which the activated touch sensor is located.

Measuring the Distance to the Ground Using the Ultrasonic Sensor

To perform the operation of measuring the distance to the ground, stopping, and rotating the ultrasonic sensor to search for drivable ground, the EV3 Education Vehicle must be assembled with the ultrasonic sensor mounted on a rotating mechanism.

The operation sequence is as follows.

Suppose the robot is driving on a desk and reaches the edge as shown in step ②.

If the distance measured by the ultrasonic sensor exceeds sensor_height, the robot stops.

Then, as shown in step ③, the ultrasonic sensor rotates 90 degrees to the right and checks whether the distance to the ground is less than sensor_height.

If the measured value is still greater than sensor_height, the sensor rotates 180 degrees to the left as shown in step ④ and checks again.

If a direction is found where the measured distance is less than sensor_height, the Education Vehicle rotates toward that direction.

Batch Installation

To install all of the RTCs described above at once, enter the following commands.


git clone https://github.com/Nobu19800/EducatorVehicle_script_ev3dev
cd EducatorVehicle_script_ev3dev
sh Component/install_rtc.sh