Download
latest Releases : 2.0.0-RELESE
2.0.0-RELESE | Download page |
Number of Projects
RT-Component | 153.5 |
RT-Middleware | 35 |
Tools | 22 |
Documentation | 2 |
Choreonoid
Motion editor/Dynamics simulator
OpenHRP3
Dynamics simulator
OpenRTP
Integrated Development Platform
AIST RTC collection
RT-Components collection by AIST
TORK
Tokyo Opensource Robotics Association
DAQ-Middleware
Middleware for DAQ (Data Aquisition) by KEK
Introduction
This document describes the procedure for creating RT-Components for controlling the Raspberry Pi mouse on the simulator.
Downloading materials
Please download the materials first.
The seminar may be held in an environment where you cannot connect to the Internet. In that case, it is stored in the distributed USB memory.
Simulator
The simulator is developed using a physics engine called Open Dynamics Engine (ODE): http and a drawing library (drawstuff) that comes with ODE. It works if OpenGL works, so it should work in most environments.
You can simulate the following robot Raspberry Pi mouse.
Not only the dynamic calculation and contact response of the Raspberry Pi mouse on the simulator, but also the data of the distance sensor reproduces the values close to those of a real robot.
Raspberry Pi mouse specifications
The Raspberry Pi mouse is an independent two-wheel drive mobile robot sold by RT corp..
RT-Component to be developed
An RT-Component to control the robot on the simulator by connecting with the RaspberryPiMouseSimulator Component.
Creating the RobotController Component
An RT-Component which can operate the robot on the simulator with the GUI (slider) and automatically stops when the sensor value exceeds a certain level will be created.
Development process
The development process is as follows.
Confirmation of development environment
The following development environment is assumed. Setup the development environment on Linux (assuming Ubuntu 18.04 here).
Installation of dependent libraries
Installation of OpenRTM-aist
For ubuntu 18.04 (64bit)
Installation of CMake
Installation of cmake-gui
Installation of Code::Blocks
Code::Blocks is a integrated development environment which supports C/C++ languages. Please install it with the following commands.
If you want to get the latest version, enter the following command.
Installation of Premake
Required for building ODE.
Build RaspberryPiMouseSimulator component
Build the simulator components manually. Enter the following command.
The seminar may be held in an environment where you cannot connect to the Internet. In that case, start the script in the distributed USB memory.
Component specifications
The RobotController has an outport that outputs the target speed, an import that inputs the sensor value, and configuration parameters that set the target speed and the sensor value to stop.
About TimedVelocity2D type
We use the TimedVelocity2D type, which is a data type that stores the moving speed of a moving robot on a two-dimensional plane.
This data type can store the velocity vx along the X axis, the velocity vy along the Y axis, and the velocity va around the Z axis.
vx、vy、va represents the velocity in the robot center coordinate system.
vx is the velocity in the X direction, vy is the velocity in the Y direction, and va is the angular velocity around the Z axis.
For a robot with two wheels mounted on the left and right, such as a Raspberry Pi mouse, vy would be 0 assuming no skidding.
The robot is operated by specifying the straight-ahead speed vx and the rotation speed va.
About distance sensor data
The data of the distance sensor of the Raspberry Pi mouse is designed to output a larger value as the distance to the object gets closer.
The simulator reproduces this value and outputs it. The RobotController component implements a process that automatically stops when this value exceeds a certain level.
RobotController component template generation
RTCBuilder is used to generate the template for the RobotController component.
Start RTCBuilder
In Eclipse, the folder where you do various tasks is called a "workspace", and as a general rule, all products are stored under this folder. You can create a workspace in any folder that you can access, but this tutorial assumes the following workspace.
First, start Eclipse with the following command.
You will first be asked for the location of the workspace, so specify the workspace above.
Then, the following Welcome page will be displayed.
The Welcome page is no longer needed, so click the x button in the upper left to close it.
Click the [Open Perspective] button in the upper right.
Select RTC Builder to start RTC Builder. The RTCBuilder icon for Hammer and RT appears in the menu bar.
Create a new project
You need to create a new project in RTCBuilder to create the RobotController component.
Click the Open New RTCBuilder Editor icon in the upper left.
Enter the project name (here, RobotController) to be created in the Project Name field and click the [Finish] button.
A project with the specified name will be generated and added to the Package Explorer.
he RTC profile XML (RTC.xml) with default values is automatically generated in the generated project.
Launch RTC Profile Editor
When RTC.xml is generated, the RTCBuilder editor should open as the workspace associated with this project. If it doesn't start, double-click RTC.xml in Package Explorer.
Profile information input and code generation
First, select the Basics tab on the far left and enter the basic information. In addition to the RobotController component specifications (name) you decided earlier, enter the outline, version, etc. Items with red labels are required items. Others can be the default.
Then select the Activity tab and specify the action callback to use.
For RobotController component uses the onActivated(), onDeactivated(), onExecute() callbacks. As shown in the figure below, after clicking onAtcivated in (1), check [ON] with the radio button in (2). Just double-clicking the onActivated label toggles [ON] and [OFF]. Follow the same procedure for onDeactivated and onExecute.
In addition, select the DataPort tab and enter the DataPort information. Enter the following based on the specifications you decided above. The variable name and display position are optional and can be left as they are.
Then select the Configuration tab and enter the Configuration information based on the specifications you just decided. Constraints and widgets are used to change values in the GUI, such as sliders, spin buttons, and radio buttons, when displaying component configuration parameters in RTSystemEditor.
The straight speed speed_x and the rotation speed speed_r make it easier to operate with the slider.
Next, select the Language / Environment tab and select the programming language. Here, select C++ (language). In addition, defaults etc. are not set for the language and environment, and if you forget to specify it, an error will occur at the time of code generation, so be sure to specify the language.
Finally, click the Generate Code button on the Basic tab to generate a template for the component.
The generated code set are generated in the workspace folder specified when eclipse is started. You can see your current workspace in File> Switch Workspace ...
Generating the files needed to build with CMake
The code generated by RTCBuilder includes CMakeLists.txt to generate various files required for building by CMake. By using CMake, Visual Studio project files, solution files, Makefiles, etc. can be automatically generated from CMakeLists.txt.
Operation of CMake (cmake-gui)
Use CMake to configure the build environment. First, start CMake (cmake-gui).
At the top of the window, there are text boxes like the one below, so specify the source code location (where CMakeList.txt is) and the build directory, respectively.
The source code location is where the RobotController component source was generated and where CMakeList.txt resides. The default is <workspace directory>/RobotController.
This directory is set by dragging and dropping from Explorer to cmake-gui without any manual input.
The build directory is the place to store project files, object files, and binaries for building. The location is arbitrary, but in this case it is recommended that you specify a subdirectory of RobotController with a descriptive name, such as <workspace directory>/RobotController/build.
Once specified, click the [Configure] button below. Then a dialog like the one below will be opened, so specify the type of project you want to generate. This time, specify CodeBlocks -- Unix Makefiles. If you don't use Code::Blocks, use Unix Makefiles.
If you don't use cmake-gui, you can generate a Makefiles with the following command.
Click the [Finish] button in the dialog to start Configure. If there are no problems, Configuring done will be output in the log window at the bottom, so click the [Generate] button. If Generating done is displayed, the output of the project file, solution file, etc. is completed.
Note that CMake generates a cache file at the stage of Configure, so if you change the settings or change the environment due to trouble etc., delete the cache with [File]> [Delete Cache] and start over from Configure.
Editing headers and sources
Then double-click RobotController.cbp in the build directory you specified earlier to start Code::Blocks.
Edit the header (include/RobotController/RobotController.h) and the source code (src/RobotController.cpp) respectively. Click RobotController.h, RobotController.cpp from the Project explorer of Code::Blocks to open the edit screen.
Code::Blocks may become unstable in a 64-bit environment. In that case, disabling the code completion plugin may work.
Please select [Plugins]>[Manage plugins...].
Select [code completion] and click the [Disable] button.
If it doesn't work, try this procedure.
アクティビティ処理の実装
Implementation of activity processing
In the RobotController component, the configuration parameters (speed_x, speed_y) are operated with sliders and the values are output from the outport (out) as the target speed. The value input from import (in) is stored in the variable, and if the value exceeds a certain value, it stops.
The following figure shows the processing contents of onActivated(), onExecute(), and onDeactivated().
Editing the header file (RobotController.h)
Declare the variable sensor_data to temporarily store the sensor value.
Editing the source file (RobotController.cpp)
Implement onActivated(), onDeactivated(), onExecute() as shown below.
Building on Code::Blocks
Run build
Please click [Build] button oon the Code::Blocks to build the project.
Checking the operation of RobotController component
Connect the created RobotController to the simulator component and check the operation.
Start NameService
Start the name service to register the component reference as follows.
Launch the RobotController component
Please start the RobotController component. Run the RobotControllerComp file in the RobotController/build/src folder.
Launching the simulator component
After moved to the directory where the RaspberryPiMouseSimulator component is installed ({the directory where the install_raspimouse_simulator.sh script is run}/RasPiMouseSimulatorRTC/build), launch with the following command.
Component connection
As shown in the figure below, connect the RobotController component and RaspberryPiMouseSimulator component by using RTSystemEditor.
Activate component
Click the All Activate icon at the top of RTSystemEditor to activate all components. If activated successfully, the component will be displayed in yellow-green as shown below.
Operation check
You can change the configuration from the [Edit] button in the configuration view as shown below.
Check if you can operate the [Raspberry Pi] mouse on the simulator by operating the slider.
Operation check on the actual machine
If you have prepared an actual Raspberry Pi mouse on the seminar, you can check the operation on the actual robot, so if you have time to spare, please try it.
The procedure is as follows.
Turn on the power
The Raspberry Pi mouse has two power switches, one is the Raspberry Pi power switch and the other is the motor power switch.
Turn on the power switch on the inside to start the Raspberry Pi.
Turning off the power
When turning off the Raspberry Pi, do not turn it off directly from the power switch. Press the button in the middle of the three buttons for a few seconds to start shutting down. The Raspbian shutdown will be completed in about 10 seconds, so turn off the power switch after that.
Connect to an access point
Please refer to the following page for how to connect to the access point.
If the network is switched, the component registration to the name server and the port connection may fail, so close all the name server and components once. If you start it after switching the network, there is no problem, so you do not need to stop it.
To restart the Name Server on the RT System Editor, click the "Start Name Service" button again.
Connecting to the Name-Server
Then add 192.168.11.1 with the [Add Name Server] button in the RTSystemEditor.
Then you will see the following two RTCs.
RaspberryPiMouseRTC is an RT-Component for controlling Raspberry Mouse, which is being developed in the Robot System Design Laboratory of Meijo University.
Port connection
Connect the RaspberryPiMouseRTC and RobotController components in the RTSystemEditor as follows.
Turn on the motor
Please turn on the power switch of the motor before operation. Be sure to turn off the power of the motor frequently.
Activation
Then activate the RTC and you will be able to operate the Raspberry Pi mouse.