forked from ROBOTIS-GIT/turtlebot3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added the firmware (turtlebot3_core package) for OpenCR embedded board
- Loading branch information
1 parent
5eb4481
commit 4f483cf
Showing
153 changed files
with
13,226 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,3 +57,4 @@ build-*/ | |
*.pyc | ||
*.dat | ||
*.txt.user | ||
*.gch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
/* | ||
* Software License Agreement (BSD License) | ||
* | ||
* Copyright (c) 2011, Willow Garage, Inc. | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* | ||
* * Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* * Redistributions in binary form must reproduce the above | ||
* copyright notice, this list of conditions and the following | ||
* disclaimer in the documentation and/or other materials provided | ||
* with the distribution. | ||
* * Neither the name of Willow Garage, Inc. nor the names of its | ||
* contributors may be used to endorse or promote prducts derived | ||
* from this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#ifndef ROS_ARDUINO_HARDWARE_H_ | ||
#define ROS_ARDUINO_HARDWARE_H_ | ||
|
||
#if ARDUINO>=100 | ||
#include <Arduino.h> // Arduino 1.0 | ||
#else | ||
#include <WProgram.h> // Arduino 0022 | ||
#endif | ||
|
||
#if defined(__MK20DX128__) || defined(__MK20DX256__) | ||
#if defined(USE_TEENSY_HW_SERIAL) | ||
#define SERIAL_CLASS HardwareSerial // Teensy HW Serial | ||
#else | ||
#include <usb_serial.h> // Teensy 3.0 and 3.1 | ||
#define SERIAL_CLASS usb_serial_class | ||
#endif | ||
#elif defined(_SAM3XA_) | ||
#include <UARTClass.h> // Arduino Due | ||
#define SERIAL_CLASS UARTClass | ||
#elif defined(USE_USBCON) | ||
// Arduino Leonardo USB Serial Port | ||
#define SERIAL_CLASS Serial_ | ||
#else | ||
#include <HardwareSerial.h> // Arduino AVR | ||
#define SERIAL_CLASS USBSerial // UARTClass (Bluetooth Device) | ||
#endif | ||
|
||
class ArduinoHardware { | ||
public: | ||
ArduinoHardware(SERIAL_CLASS* io , long baud= 57600){ | ||
iostream = io; | ||
baud_ = baud; | ||
} | ||
ArduinoHardware() | ||
{ | ||
#if defined(USBCON) and !(defined(USE_USBCON)) | ||
/* Leonardo support */ | ||
iostream = &Serial2; | ||
#elif defined(USE_TEENSY_HW_SERIAL) | ||
iostream = &Serial2; | ||
#else | ||
iostream = &Serial; | ||
#endif | ||
baud_ = 57600; | ||
} | ||
ArduinoHardware(ArduinoHardware& h){ | ||
this->iostream = iostream; | ||
this->baud_ = h.baud_; | ||
} | ||
|
||
void setBaud(long baud){ | ||
this->baud_= baud; | ||
} | ||
|
||
int getBaud(){return baud_;} | ||
|
||
void init(){ | ||
#if defined(USE_USBCON) | ||
// Startup delay as a fail-safe to upload a new sketch | ||
delay(3000); | ||
#endif | ||
iostream->begin(baud_); | ||
} | ||
|
||
int read(){return iostream->read();}; | ||
void write(uint8_t* data, int length){ | ||
for(int i=0; i<length; i++) | ||
iostream->write(data[i]); | ||
} | ||
|
||
unsigned long time(){return millis();} | ||
|
||
protected: | ||
SERIAL_CLASS* iostream; | ||
long baud_; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
* Software License Agreement (BSD License) | ||
* | ||
* Copyright (c) 2011, Willow Garage, Inc. | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* | ||
* * Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* * Redistributions in binary form must reproduce the above | ||
* copyright notice, this list of conditions and the following | ||
* disclaimer in the documentation and/or other materials provided | ||
* with the distribution. | ||
* * Neither the name of Willow Garage, Inc. nor the names of its | ||
* contributors may be used to endorse or promote prducts derived | ||
* from this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#include <math.h> | ||
#include "ros/duration.h" | ||
|
||
namespace ros | ||
{ | ||
void normalizeSecNSecSigned(int32_t &sec, int32_t &nsec) | ||
{ | ||
int32_t nsec_part = nsec; | ||
int32_t sec_part = sec; | ||
|
||
while (nsec_part > 1000000000L) | ||
{ | ||
nsec_part -= 1000000000L; | ||
++sec_part; | ||
} | ||
while (nsec_part < 0) | ||
{ | ||
nsec_part += 1000000000L; | ||
--sec_part; | ||
} | ||
sec = sec_part; | ||
nsec = nsec_part; | ||
} | ||
|
||
Duration& Duration::operator+=(const Duration &rhs) | ||
{ | ||
sec += rhs.sec; | ||
nsec += rhs.nsec; | ||
normalizeSecNSecSigned(sec, nsec); | ||
return *this; | ||
} | ||
|
||
Duration& Duration::operator-=(const Duration &rhs){ | ||
sec += -rhs.sec; | ||
nsec += -rhs.nsec; | ||
normalizeSecNSecSigned(sec, nsec); | ||
return *this; | ||
} | ||
|
||
Duration& Duration::operator*=(double scale){ | ||
sec *= scale; | ||
nsec *= scale; | ||
normalizeSecNSecSigned(sec, nsec); | ||
return *this; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#ifndef _ROS_geometry_msgs_Accel_h | ||
#define _ROS_geometry_msgs_Accel_h | ||
|
||
#include <stdint.h> | ||
#include <string.h> | ||
#include <stdlib.h> | ||
#include "ros/msg.h" | ||
#include "geometry_msgs/Vector3.h" | ||
|
||
namespace geometry_msgs | ||
{ | ||
|
||
class Accel : public ros::Msg | ||
{ | ||
public: | ||
geometry_msgs::Vector3 linear; | ||
geometry_msgs::Vector3 angular; | ||
|
||
Accel(): | ||
linear(), | ||
angular() | ||
{ | ||
} | ||
|
||
virtual int serialize(unsigned char *outbuffer) const | ||
{ | ||
int offset = 0; | ||
offset += this->linear.serialize(outbuffer + offset); | ||
offset += this->angular.serialize(outbuffer + offset); | ||
return offset; | ||
} | ||
|
||
virtual int deserialize(unsigned char *inbuffer) | ||
{ | ||
int offset = 0; | ||
offset += this->linear.deserialize(inbuffer + offset); | ||
offset += this->angular.deserialize(inbuffer + offset); | ||
return offset; | ||
} | ||
|
||
const char * getType(){ return "geometry_msgs/Accel"; }; | ||
const char * getMD5(){ return "9f195f881246fdfa2798d1d3eebca84a"; }; | ||
|
||
}; | ||
|
||
} | ||
#endif |
48 changes: 48 additions & 0 deletions
48
turtlebot3_core/libraries/ros_lib/geometry_msgs/AccelStamped.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#ifndef _ROS_geometry_msgs_AccelStamped_h | ||
#define _ROS_geometry_msgs_AccelStamped_h | ||
|
||
#include <stdint.h> | ||
#include <string.h> | ||
#include <stdlib.h> | ||
#include "ros/msg.h" | ||
#include "std_msgs/Header.h" | ||
#include "geometry_msgs/Accel.h" | ||
|
||
namespace geometry_msgs | ||
{ | ||
|
||
class AccelStamped : public ros::Msg | ||
{ | ||
public: | ||
std_msgs::Header header; | ||
geometry_msgs::Accel accel; | ||
|
||
AccelStamped(): | ||
header(), | ||
accel() | ||
{ | ||
} | ||
|
||
virtual int serialize(unsigned char *outbuffer) const | ||
{ | ||
int offset = 0; | ||
offset += this->header.serialize(outbuffer + offset); | ||
offset += this->accel.serialize(outbuffer + offset); | ||
return offset; | ||
} | ||
|
||
virtual int deserialize(unsigned char *inbuffer) | ||
{ | ||
int offset = 0; | ||
offset += this->header.deserialize(inbuffer + offset); | ||
offset += this->accel.deserialize(inbuffer + offset); | ||
return offset; | ||
} | ||
|
||
const char * getType(){ return "geometry_msgs/AccelStamped"; }; | ||
const char * getMD5(){ return "d8a98a5d81351b6eb0578c78557e7659"; }; | ||
|
||
}; | ||
|
||
} | ||
#endif |
51 changes: 51 additions & 0 deletions
51
turtlebot3_core/libraries/ros_lib/geometry_msgs/AccelWithCovariance.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#ifndef _ROS_geometry_msgs_AccelWithCovariance_h | ||
#define _ROS_geometry_msgs_AccelWithCovariance_h | ||
|
||
#include <stdint.h> | ||
#include <string.h> | ||
#include <stdlib.h> | ||
#include "ros/msg.h" | ||
#include "geometry_msgs/Accel.h" | ||
|
||
namespace geometry_msgs | ||
{ | ||
|
||
class AccelWithCovariance : public ros::Msg | ||
{ | ||
public: | ||
geometry_msgs::Accel accel; | ||
float covariance[36]; | ||
|
||
AccelWithCovariance(): | ||
accel(), | ||
covariance() | ||
{ | ||
} | ||
|
||
virtual int serialize(unsigned char *outbuffer) const | ||
{ | ||
int offset = 0; | ||
offset += this->accel.serialize(outbuffer + offset); | ||
for( uint32_t i = 0; i < 36; i++){ | ||
offset += serializeAvrFloat64(outbuffer + offset, this->covariance[i]); | ||
} | ||
return offset; | ||
} | ||
|
||
virtual int deserialize(unsigned char *inbuffer) | ||
{ | ||
int offset = 0; | ||
offset += this->accel.deserialize(inbuffer + offset); | ||
for( uint32_t i = 0; i < 36; i++){ | ||
offset += deserializeAvrFloat64(inbuffer + offset, &(this->covariance[i])); | ||
} | ||
return offset; | ||
} | ||
|
||
const char * getType(){ return "geometry_msgs/AccelWithCovariance"; }; | ||
const char * getMD5(){ return "ad5a718d699c6be72a02b8d6a139f334"; }; | ||
|
||
}; | ||
|
||
} | ||
#endif |
Oops, something went wrong.