From 4e60a84e6a725d82080e27ac8594834897fd1cff Mon Sep 17 00:00:00 2001 From: "david.park" Date: Thu, 7 Apr 2022 10:24:51 +0900 Subject: [PATCH 1/3] Maintanance: Slave Begin --- .../libraries/turtlebot3_ros2/src/turtlebot3/turtlebot3.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arduino/opencr_arduino/opencr/libraries/turtlebot3_ros2/src/turtlebot3/turtlebot3.cpp b/arduino/opencr_arduino/opencr/libraries/turtlebot3_ros2/src/turtlebot3/turtlebot3.cpp index f7ca61ae9..502953f39 100644 --- a/arduino/opencr_arduino/opencr/libraries/turtlebot3_ros2/src/turtlebot3/turtlebot3.cpp +++ b/arduino/opencr_arduino/opencr/libraries/turtlebot3_ros2/src/turtlebot3/turtlebot3.cpp @@ -245,6 +245,9 @@ void TurtleBot3Core::begin(const char* model_name) ret = controllers.init(max_linear_velocity, max_angular_velocity); DEBUG_PRINTLN(ret==true?"RC100 Controller setup completed.":"RC100 Controller setup failed."); + + // Port begin (Success USBSerialPortHandler::begin) + dxl_slave.begin(); // Init DXL Slave function dxl_slave.setPortProtocolVersion(PROTOCOL_VERSION_DXL_SLAVE); dxl_slave.setFirmwareVersion(FIRMWARE_VER); From 9bcec1cb135a4595d902ecfe72dbffe4e3a789f9 Mon Sep 17 00:00:00 2001 From: "david.park" Date: Mon, 13 Jun 2022 13:32:58 +0900 Subject: [PATCH 2/3] Maintanance: Comment Edit --- .../libraries/turtlebot3_ros2/src/turtlebot3/turtlebot3.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arduino/opencr_arduino/opencr/libraries/turtlebot3_ros2/src/turtlebot3/turtlebot3.cpp b/arduino/opencr_arduino/opencr/libraries/turtlebot3_ros2/src/turtlebot3/turtlebot3.cpp index 502953f39..bf20d65bf 100644 --- a/arduino/opencr_arduino/opencr/libraries/turtlebot3_ros2/src/turtlebot3/turtlebot3.cpp +++ b/arduino/opencr_arduino/opencr/libraries/turtlebot3_ros2/src/turtlebot3/turtlebot3.cpp @@ -246,7 +246,7 @@ void TurtleBot3Core::begin(const char* model_name) DEBUG_PRINTLN(ret==true?"RC100 Controller setup completed.":"RC100 Controller setup failed."); - // Port begin (Success USBSerialPortHandler::begin) + // Port begin dxl_slave.begin(); // Init DXL Slave function dxl_slave.setPortProtocolVersion(PROTOCOL_VERSION_DXL_SLAVE); From f6b28ae6f24b5511db3ed869c1f6d6f8203cb74e Mon Sep 17 00:00:00 2001 From: "david.park" Date: Thu, 16 Jun 2022 13:12:38 +0900 Subject: [PATCH 3/3] Update: TPS example & Change range --- .../opencr/libraries/OLLO/OLLO.cpp | 8 ++--- .../OLLO_TPS_READ/OLLO_TPS_READ.ino | 30 +++++++++++++++++++ 2 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 arduino/opencr_arduino/opencr/libraries/OpenCR/examples/05. Sensors/OLLO_TPS_READ/OLLO_TPS_READ.ino diff --git a/arduino/opencr_arduino/opencr/libraries/OLLO/OLLO.cpp b/arduino/opencr_arduino/opencr/libraries/OLLO/OLLO.cpp index c49522266..681e8344a 100644 --- a/arduino/opencr_arduino/opencr/libraries/OLLO/OLLO.cpp +++ b/arduino/opencr_arduino/opencr/libraries/OLLO/OLLO.cpp @@ -254,7 +254,7 @@ int OLLO::read(int devNum, OlloDeviceIndex device_index){ // IR SENSOR, Button, return average_value; }else if(device_index == TEMPERATURE_SENSOR){ analogValue = analogRead(PORT1_ADC); - vvalue = (4095 - analogValue) * 10000 /analogValue; + vvalue = (1023 - analogValue) * 10000 /analogValue; for(scount = -20; scount < 140; scount++){ if(vvalue > gwTheRmistor[scount +20]){ return scount; @@ -291,7 +291,7 @@ int OLLO::read(int devNum, OlloDeviceIndex device_index){ // IR SENSOR, Button, } else if(device_index == TEMPERATURE_SENSOR){ analogValue = analogRead(PORT2_ADC); - vvalue = (4095 - analogValue) * 10000 /analogValue; + vvalue = (1023 - analogValue) * 10000 /analogValue; for(scount = -20; scount < 140; scount++){ if(vvalue > gwTheRmistor[scount +20]){ return scount; @@ -323,7 +323,7 @@ int OLLO::read(int devNum, OlloDeviceIndex device_index){ // IR SENSOR, Button, return average_value; }else if(device_index == TEMPERATURE_SENSOR){ analogValue = analogRead(PORT3_ADC); - vvalue = (4095 - analogValue) * 10000 /analogValue; + vvalue = (1023 - analogValue) * 10000 /analogValue; for(scount = -20; scount < 140; scount++){ if(vvalue > gwTheRmistor[scount +20]){ return scount; @@ -356,7 +356,7 @@ int OLLO::read(int devNum, OlloDeviceIndex device_index){ // IR SENSOR, Button, return average_value; }else if(device_index == TEMPERATURE_SENSOR){ analogValue = analogRead(PORT4_ADC);// 2014-04-17 shin - vvalue = (4095 - analogValue) * 10000 /analogValue; + vvalue = (1023 - analogValue) * 10000 /analogValue; for(scount = -20; scount < 140; scount++){ if(vvalue > gwTheRmistor[scount +20]){ return scount; diff --git a/arduino/opencr_arduino/opencr/libraries/OpenCR/examples/05. Sensors/OLLO_TPS_READ/OLLO_TPS_READ.ino b/arduino/opencr_arduino/opencr/libraries/OpenCR/examples/05. Sensors/OLLO_TPS_READ/OLLO_TPS_READ.ino new file mode 100644 index 000000000..2f299e1ef --- /dev/null +++ b/arduino/opencr_arduino/opencr/libraries/OpenCR/examples/05. Sensors/OLLO_TPS_READ/OLLO_TPS_READ.ino @@ -0,0 +1,30 @@ +/* OLLO TPS Sensor Read + + connect Temperature Sensor to OLLO ports + + Compatibility + CM900 X + OpenCM9.04 O + + created 16 Nov 2012 + by ROBOTIS CO,.LTD. + */ + +#include +OLLO myOLLO; + +#define YOUR_OLLO_PORT 3 + +void setup(){ + myOLLO.begin(YOUR_OLLO_PORT);// A Module needs to be connected to proper port (PORT 1 to 4) +} +void loop(){ + Serial.print("RAW Temperature = "); + Serial.print(myOLLO.read(YOUR_OLLO_PORT)); //read ADC value from YOUR_OLLO-PORT + Serial.print("\t Converted Temperature = "); + Serial.println(myOLLO.read(YOUR_OLLO_PORT, TEMPERATURE_SENSOR)); //read ADC value from YOUR_OLLO-PORT + delay(100); +} + + +