Skip to content

Commit 17edc8b

Browse files
author
Linar Ismagilov
committed
2 parents 8f2f964 + 0e78374 commit 17edc8b

File tree

355 files changed

+4327
-1148
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

355 files changed

+4327
-1148
lines changed

examples/Esp8266/HelloWorld.ino

Lines changed: 0 additions & 75 deletions
This file was deleted.

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ sentence=Use an Arduino as a ROS publisher/subscriber
66
paragraph=Works with http://wiki.ros.org/rosserial, requires a rosserial node to connect
77
category=Communication
88
url=https://github.com/frankjoshua/rosserial_arduino_lib
9-
architectures=avr
9+
architectures=*
1010
includes=ros.h

readme.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
Use an Arduino as a ROS publisher/subscriber
22

33
Works with http://wiki.ros.org/rosserial, requires a rosserial node to connect
4+
5+
This fork exists for the purpose of implementing MKR1000 support.

scripts/esp8266_pstr_fix.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/usr/bin/python3
2+
3+
import sys
4+
import re
5+
from pathlib import Path
6+
import fileinput
7+
8+
""" This script is intended to fix the issue with flash strings on ESP866 described """
9+
""" in issue #8 (https://github.com/frankjoshua/rosserial_arduino_lib/issues/8) """
10+
""" It can also be used on the raw output of the rosserial_arduino library creation """
11+
""" routines to add flash strings as appropriate. """
12+
""" Written by Pierce Nichols (rocketgeek@gmail.com) 9/28/29 """
13+
14+
gettype_pattern = re.compile(r'^\s*const char \* getType\(\)\{\s*return\s*(PSTR|)\s*\(\s*"([\w/_]*)"\s*\);\s*\};\s*$')
15+
getmd5_pattern = re.compile(r'^\s*const char \* getMD5\(\)\{\s*return\s*(PSTR|)\s*\(\s*"([0-9a-f]*)"\s*\);\s*\};\s*$')
16+
getprogmem_pattern = re.compile(r'^\s*static const char ([A-Z]*)\[\] PROGMEM = "([\w/_]*)"\s*;\s*$')
17+
code_start = ' const char * '
18+
code_end = '");};'
19+
code_gettype = 'getType() { return '
20+
code_md5 = 'getMD5() { return '
21+
code_norm = ' ("'
22+
code_pstr = ' PSTR("'
23+
pm_start = ' static const char '
24+
pm_progmem = '[] PROGMEM = "'
25+
pm_norm = '[] = "'
26+
pm_end = '";'
27+
28+
def process_header (path_to_header):
29+
for line in fileinput.input(path_to_header, inplace=True):
30+
line = line.rstrip('\r\n')
31+
gt_match = gettype_pattern.search(line)
32+
md_match = getmd5_pattern.search(line)
33+
pm_match = getprogmem_pattern.search(line)
34+
if (gt_match):
35+
print(" #ifdef ESP8266")
36+
print(code_start + code_gettype + code_norm + gt_match.group(2) + code_end)
37+
print(" #else")
38+
print(code_start + code_gettype + code_pstr + gt_match.group(2) + code_end)
39+
print(" #endif")
40+
elif (md_match):
41+
print(" #ifdef ESP8266")
42+
print(code_start + code_md5 + code_norm + md_match.group(2) + code_end)
43+
print(" #else")
44+
print(code_start + code_md5 + code_pstr + md_match.group(2) + code_end)
45+
print(" #endif")
46+
elif (pm_match):
47+
print("#ifdef ESP8266")
48+
print(pm_start + pm_match.group(1) + pm_norm + pm_match.group(2) + pm_end)
49+
print("#else")
50+
print(pm_start + pm_match.group(1) + pm_progmem + pm_match.group(2) + pm_end)
51+
print("#endif")
52+
else:
53+
print(line)
54+
55+
rootpath = sys.argv[1] # First argument is the root of the directory tree to fix
56+
p = Path(rootpath) # Turn it into a path
57+
header_list = list(p.glob('**/*.h')) # Grab a list of all the header files in this directory tree
58+
for header in header_list:
59+
process_header(header)

src/MKR1000Hardware.h

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/*
2+
* Software License Agreement (BSD License)
3+
*
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions
7+
* are met:
8+
*
9+
* * Redistributions of source code must retain the above copyright
10+
* notice, this list of conditions and the following disclaimer.
11+
* * Redistributions in binary form must reproduce the above
12+
* copyright notice, this list of conditions and the following
13+
* disclaimer in the documentation and/or other materials provided
14+
* with the distribution.
15+
* * Neither the name of Willow Garage, Inc. nor the names of its
16+
* contributors may be used to endorse or promote prducts derived
17+
* from this software without specific prior written permission.
18+
*
19+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22+
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23+
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25+
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29+
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30+
* POSSIBILITY OF SUCH DAMAGE.
31+
*/
32+
33+
#ifndef MKR1000HARDWARE_H
34+
#define MKR1000HARDWARE_H
35+
36+
#include <WiFi101.h>
37+
38+
class MKR1000Hardware {
39+
public:
40+
MKR1000Hardware()
41+
{
42+
}
43+
44+
void setConnection(IPAddress &server, int port = 11411) {
45+
this->server = server;
46+
this->serverPort = port;
47+
}
48+
49+
IPAddress getLocalIP() {
50+
return WiFi.localIP();
51+
}
52+
53+
void init() {
54+
this->tcp.connect(this->server, this->serverPort);
55+
}
56+
57+
int read() {
58+
if (this->tcp.connected()) {
59+
return tcp.read();
60+
} else {
61+
this->tcp.connect(this->server, this->serverPort);
62+
}
63+
return -1;
64+
};
65+
66+
void write(const uint8_t* data, size_t length) {
67+
tcp.write(data, length);
68+
}
69+
70+
unsigned long time() {return millis();}
71+
72+
protected:
73+
WiFiClient tcp;
74+
IPAddress server;
75+
uint16_t serverPort = 11411;
76+
};
77+
78+
#endif // MKR1000HARDWARE_H

src/actionlib/TestAction.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,18 @@ namespace actionlib
4848
return offset;
4949
}
5050

51-
const char * getType(){ return PSTR( "actionlib/TestAction" ); };
52-
const char * getMD5(){ return PSTR( "991e87a72802262dfbe5d1b3cf6efc9a" ); };
51+
#ifdef ESP8266
52+
const char * getType() { return ("actionlib/TestAction");};
53+
#else
54+
const char * getType() { return PSTR("actionlib/TestAction");};
55+
#endif
56+
#ifdef ESP8266
57+
const char * getMD5() { return ("991e87a72802262dfbe5d1b3cf6efc9a");};
58+
#else
59+
const char * getMD5() { return PSTR("991e87a72802262dfbe5d1b3cf6efc9a");};
60+
#endif
5361

5462
};
5563

5664
}
57-
#endif
65+
#endif

src/actionlib/TestActionFeedback.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,18 @@ namespace actionlib
4848
return offset;
4949
}
5050

51-
const char * getType(){ return PSTR( "actionlib/TestActionFeedback" ); };
52-
const char * getMD5(){ return PSTR( "6d3d0bf7fb3dda24779c010a9f3eb7cb" ); };
51+
#ifdef ESP8266
52+
const char * getType() { return ("actionlib/TestActionFeedback");};
53+
#else
54+
const char * getType() { return PSTR("actionlib/TestActionFeedback");};
55+
#endif
56+
#ifdef ESP8266
57+
const char * getMD5() { return ("6d3d0bf7fb3dda24779c010a9f3eb7cb");};
58+
#else
59+
const char * getMD5() { return PSTR("6d3d0bf7fb3dda24779c010a9f3eb7cb");};
60+
#endif
5361

5462
};
5563

5664
}
57-
#endif
65+
#endif

src/actionlib/TestActionGoal.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,18 @@ namespace actionlib
4848
return offset;
4949
}
5050

51-
const char * getType(){ return PSTR( "actionlib/TestActionGoal" ); };
52-
const char * getMD5(){ return PSTR( "348369c5b403676156094e8c159720bf" ); };
51+
#ifdef ESP8266
52+
const char * getType() { return ("actionlib/TestActionGoal");};
53+
#else
54+
const char * getType() { return PSTR("actionlib/TestActionGoal");};
55+
#endif
56+
#ifdef ESP8266
57+
const char * getMD5() { return ("348369c5b403676156094e8c159720bf");};
58+
#else
59+
const char * getMD5() { return PSTR("348369c5b403676156094e8c159720bf");};
60+
#endif
5361

5462
};
5563

5664
}
57-
#endif
65+
#endif

src/actionlib/TestActionResult.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,18 @@ namespace actionlib
4848
return offset;
4949
}
5050

51-
const char * getType(){ return PSTR( "actionlib/TestActionResult" ); };
52-
const char * getMD5(){ return PSTR( "3d669e3a63aa986c667ea7b0f46ce85e" ); };
51+
#ifdef ESP8266
52+
const char * getType() { return ("actionlib/TestActionResult");};
53+
#else
54+
const char * getType() { return PSTR("actionlib/TestActionResult");};
55+
#endif
56+
#ifdef ESP8266
57+
const char * getMD5() { return ("3d669e3a63aa986c667ea7b0f46ce85e");};
58+
#else
59+
const char * getMD5() { return PSTR("3d669e3a63aa986c667ea7b0f46ce85e");};
60+
#endif
5361

5462
};
5563

5664
}
57-
#endif
65+
#endif

src/actionlib/TestFeedback.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,18 @@ namespace actionlib
5454
return offset;
5555
}
5656

57-
const char * getType(){ return PSTR( "actionlib/TestFeedback" ); };
58-
const char * getMD5(){ return PSTR( "49ceb5b32ea3af22073ede4a0328249e" ); };
57+
#ifdef ESP8266
58+
const char * getType() { return ("actionlib/TestFeedback");};
59+
#else
60+
const char * getType() { return PSTR("actionlib/TestFeedback");};
61+
#endif
62+
#ifdef ESP8266
63+
const char * getMD5() { return ("49ceb5b32ea3af22073ede4a0328249e");};
64+
#else
65+
const char * getMD5() { return PSTR("49ceb5b32ea3af22073ede4a0328249e");};
66+
#endif
5967

6068
};
6169

6270
}
63-
#endif
71+
#endif

src/actionlib/TestGoal.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,18 @@ namespace actionlib
5454
return offset;
5555
}
5656

57-
const char * getType(){ return PSTR( "actionlib/TestGoal" ); };
58-
const char * getMD5(){ return PSTR( "18df0149936b7aa95588e3862476ebde" ); };
57+
#ifdef ESP8266
58+
const char * getType() { return ("actionlib/TestGoal");};
59+
#else
60+
const char * getType() { return PSTR("actionlib/TestGoal");};
61+
#endif
62+
#ifdef ESP8266
63+
const char * getMD5() { return ("18df0149936b7aa95588e3862476ebde");};
64+
#else
65+
const char * getMD5() { return PSTR("18df0149936b7aa95588e3862476ebde");};
66+
#endif
5967

6068
};
6169

6270
}
63-
#endif
71+
#endif

src/actionlib/TestRequestAction.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,18 @@ namespace actionlib
4848
return offset;
4949
}
5050

51-
const char * getType(){ return PSTR( "actionlib/TestRequestAction" ); };
52-
const char * getMD5(){ return PSTR( "dc44b1f4045dbf0d1db54423b3b86b30" ); };
51+
#ifdef ESP8266
52+
const char * getType() { return ("actionlib/TestRequestAction");};
53+
#else
54+
const char * getType() { return PSTR("actionlib/TestRequestAction");};
55+
#endif
56+
#ifdef ESP8266
57+
const char * getMD5() { return ("dc44b1f4045dbf0d1db54423b3b86b30");};
58+
#else
59+
const char * getMD5() { return PSTR("dc44b1f4045dbf0d1db54423b3b86b30");};
60+
#endif
5361

5462
};
5563

5664
}
57-
#endif
65+
#endif

0 commit comments

Comments
 (0)