ダウンロード
最新バージョン : 2.1.0-RELESE
| 2.1.0-RELESE | ダウンロードページ |
OpenRTM@Github
OpenRTM-aist GitHubサイト
ROS
Robot Operating System
Choreonoid
モーションエディタ/シミュレータ
DAQ-Middleware
ネットワーク分散環境でデータ収集用ソフトウェアを容易に構築するためのソフトウェア・フレームワーク
産総研が提供するRTC集
東京オープンソースロボティクス協会
| 2.1.0-RELESE | ダウンロードページ |
OpenRTM-aist GitHubサイト
Robot Operating System
モーションエディタ/シミュレータ
ネットワーク分散環境でデータ収集用ソフトウェアを容易に構築するためのソフトウェア・フレームワーク
産総研が提供するRTC集
東京オープンソースロボティクス協会
After completing the above preparations, the NXT should be controllable from the PC using Python.
At this point, you could use RtcTemplate to generate a NXT component template and get stuck in coding. However, while NXT Python is a clean module, please read on a little before putting NXT Python directly into an RT-Component.
As you can see from the samples, NXT Python is organised into modules for locators, motors, sensors, etc. In order to provide fine control over motors and sensors, the access method is a little complex.
We will create a class that allows us to access the many NXT Python modules through a single interface. We will use the Facade software pattern.
Making such a class has the following benefits:
This is generally the case for RT-Components. Make good classes for robots and devices you wish to interact with, and even if the RTC itself changes or a new version is made, it will be easy to interact and maintenance will be greatly simplified.
Avoid creating low-level code like the following in your RTC's onExecute() method:
Ideally, create code like the following:
onExecute(ec_id) { // Pseudocode if (m_inport.isNew()) { retval = m_myrobot.set_actuator(m_inport.read()); if (retval == fatal_error) return RTC::RTC_ERROR; } if (myrobot.get_sensor(sensor_data) == true) { m_outport.write(sensor_data); } else { // Processing a read error if (fatal_error) return RTC::RTC_ERROR; } return RTC::RTC_OK; }Code like this calls a function to process data from the input port and write sensor data to the output port. This sort of abstract code is ideal.