-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
141 changed files
with
19,184 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
**/config/generated/ | ||
**/include/generated/ | ||
*~ | ||
|
||
Makefile | ||
cmake_install.cmake | ||
/CMakeCache.txt | ||
CMakeFiles/ | ||
|
||
*.a |
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,58 @@ | ||
cmake_minimum_required(VERSION 2.6) | ||
|
||
project(ros_lite) | ||
|
||
add_definitions("-std=c++11") | ||
|
||
include_directories( | ||
${CMAKE_CURRENT_SOURCE_DIR}/source/appl/roslite/config/posix/include | ||
) | ||
|
||
add_subdirectory(source/appl/roslite) | ||
add_subdirectory(source/appl/ros_src) | ||
|
||
foreach(cluster_id RANGE 1 2) | ||
add_executable( | ||
cluster-${cluster_id} | ||
${CMAKE_CURRENT_SOURCE_DIR}/source/appl/ros_src/generated/init_threads.cpp | ||
${CMAKE_CURRENT_SOURCE_DIR}/source/appl/roslite/src/generated/init.cpp | ||
) | ||
target_include_directories( | ||
cluster-${cluster_id} | ||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/source/appl/roslite/include | ||
) | ||
target_compile_definitions( | ||
cluster-${cluster_id} | ||
PUBLIC ROSLITE_TARGET_CLUSTER_ID=${cluster_id} | ||
) | ||
target_link_libraries( | ||
cluster-${cluster_id} | ||
ros_node-${cluster_id} | ||
roslite-${cluster_id} | ||
pthread | ||
) | ||
endforeach(cluster_id) | ||
|
||
include(${CMAKE_CURRENT_SOURCE_DIR}/source/appl/ros_bridge/generated/ros_bridge_generated.cmake) | ||
|
||
add_executable( | ||
ros_bridge | ||
${CMAKE_CURRENT_SOURCE_DIR}/source/appl/ros_bridge/ros_bridge.cpp | ||
${CMAKE_CURRENT_SOURCE_DIR}/source/appl/ros_bridge/generated/ros_bridge_generated.cpp | ||
${CMAKE_CURRENT_SOURCE_DIR}/source/appl/ros_src/generated/init_threads.cpp | ||
) | ||
target_include_directories( | ||
ros_bridge | ||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/source/appl | ||
PRIVATE ${ros_INCLUDE_DIRS} | ||
) | ||
target_compile_definitions( | ||
ros_bridge | ||
PUBLIC ROSLITE_TARGET_CLUSTER_ID=0 | ||
) | ||
target_link_libraries( | ||
ros_bridge | ||
roslite-0 | ||
pthread | ||
${ros_LIBRARIES} | ||
) |
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
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,4 @@ | ||
colorful==0.4.4 | ||
Jinja2==2.10 | ||
MarkupSafe==1.1.0 | ||
PyYAML==3.13 |
10 changes: 10 additions & 0 deletions
10
source/appl/ros_bridge/generated/ros_bridge_generated.cmake
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,10 @@ | ||
# [note] Auto-generated file | ||
# [note] 2019-03-20T08:43:51Z | ||
# [note] based on source/appl/ros_src/map/roslite_map_two_listenres.map | ||
|
||
find_package(roscpp) | ||
list(APPEND ros_LIBRARIES ${roscpp_LIBRARIES}) | ||
|
||
find_package(std_msgs) | ||
list(APPEND ros_INCLUDE_DIRS ${std_msgs_INCLUDE_DIRS}) | ||
list(APPEND ros_LIBRARIES ${std_msgs_LIBRARIES}) |
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 @@ | ||
// [note] Auto-generated file | ||
// [note] 2019-03-20T08:43:51Z | ||
// [note] based on source/appl/ros_src/map/roslite_map_two_listenres.map | ||
|
||
#include <ros/ros.h> | ||
#include <roslite/include/ros/ros.h> | ||
#include "../ros_bridge.h" | ||
|
||
#include <std_msgs/String.h> | ||
#include <roslite/include/std_msgs/String.h> | ||
ros::Publisher ros_pub__chatter; | ||
roslite::Subscriber roslite_sub__chatter; | ||
void roslite__chatter_Callback(const roslite_std_msgs::String::ConstPtr& roslite_msg) { | ||
ros_pub__chatter.publish(roslite_msg->ToRosMsgPtr()); | ||
} | ||
|
||
|
||
#include <std_msgs/String.h> | ||
#include <roslite/include/std_msgs/String.h> | ||
roslite::Publisher roslite_pub__chatter; | ||
ros::Subscriber ros_sub__chatter; | ||
void ros__chatter_Callback(const ros::MessageEvent<std_msgs::String const>& ros_msg) { | ||
if (ros_msg.getPublisherName() == ROS_BRIDGE_NODE_NAME_FULL_PATH) { | ||
// Ignore message from myself. | ||
return; | ||
} | ||
roslite_pub__chatter.publish(*roslite_std_msgs::String::FromRosMsgPtr(ros_msg.getMessage())); | ||
} | ||
|
||
|
||
int rosl_bridge_generated_main(ros::NodeHandle ros_nh, roslite::NodeHandle roslite_nh) | ||
{ | ||
roslite_sub__chatter = roslite_nh.subscribe("/chatter", 10, roslite__chatter_Callback); | ||
ros_pub__chatter = ros_nh.advertise<std_msgs::String>("/chatter", 10); | ||
|
||
ros_sub__chatter = ros_nh.subscribe("/chatter", 10, ros__chatter_Callback); | ||
roslite_pub__chatter = roslite_nh.advertise<roslite_std_msgs::String>("/chatter", 10); | ||
|
||
while (ros::ok() && roslite::ok()) { | ||
ros::spinOnce(); | ||
roslite::spinOnce(); | ||
roslite_thread_delay(1); | ||
} | ||
|
||
ros_pub__chatter.shutdown(); | ||
|
||
ros_sub__chatter.shutdown(); | ||
} |
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,23 @@ | ||
#include <ros/ros.h> | ||
#include <roslite/include/ros/ros.h> | ||
#include "ros_bridge.h" | ||
|
||
int rosl_bridge_generated_main(ros::NodeHandle ros_nh, roslite::NodeHandle roslite_nh); | ||
|
||
void ros_bridge_main() | ||
{ | ||
char *argv = (char *)"ros_bridge"; | ||
int argc = 1; | ||
|
||
ros::init(argc, &argv, ROS_BRIDGE_NODE_NAME); | ||
roslite::init(argc, &argv, "/ros_bridge"); | ||
|
||
ros::NodeHandle ros_nh; | ||
roslite::NodeHandle roslite_nh; | ||
|
||
rosl_bridge_generated_main(ros_nh, roslite_nh); | ||
|
||
ros::shutdown(); | ||
|
||
exit(0); | ||
} |
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,4 @@ | ||
#pragma once | ||
|
||
#define ROS_BRIDGE_NODE_NAME "roslite_bridge" | ||
#define ROS_BRIDGE_NODE_NAME_FULL_PATH "/" ROS_BRIDGE_NODE_NAME |
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,8 @@ | ||
cmake_minimum_required(VERSION 2.6) | ||
|
||
include_directories( | ||
${CMAKE_CURRENT_SOURCE_DIR}/../roslite/include | ||
${CMAKE_CURRENT_SOURCE_DIR}/../roslite/config/posix/include | ||
) | ||
|
||
include(${CMAKE_CURRENT_SOURCE_DIR}/generated/roslite_app.cmake) |
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,75 @@ | ||
// [note] Auto-generated file | ||
// [note] 2019-03-20T08:43:51Z | ||
// [note] based on source/appl/ros_src/map/roslite_map_two_listenres.map | ||
|
||
|
||
|
||
#if ROSLITE_TARGET_CLUSTER_ID == 0 | ||
#include "roslite/include/ros/init.h" | ||
#include "roslite/include/ros/thread.h" | ||
#include "roslite/include/ros/debug.h" | ||
#else | ||
#include "ros/init.h" | ||
#include "ros/thread.h" | ||
#include "ros/debug.h" | ||
#endif | ||
|
||
extern void ros_bridge_main(); | ||
|
||
extern int talker_main(int argc, char **argv); | ||
extern int listener_main(int argc, char **argv); | ||
extern int listener2_main(int argc, char **argv); | ||
|
||
static void | ||
thread_func(uint32_t stacd, uintptr_t exinf) | ||
{ | ||
void (*func)() = (void (*)())exinf; | ||
func(); | ||
} | ||
|
||
static void | ||
create_thread(uint32_t stack_size, void (*func)()) | ||
{ | ||
roslite_thread_attr_t attr; | ||
roslite_thread_attr_init(&attr); | ||
roslite_erid_t tid = roslite_thread_create(&attr, thread_func, (uintptr_t)func); | ||
ROSLITE_CHECK_SIMPLE(tid); | ||
|
||
roslite_er_t ret = roslite_thread_start((roslite_id_t)tid, 0); | ||
ROSLITE_CHECK_SIMPLE(ret); | ||
} | ||
|
||
extern "C" void | ||
create_init_threads(){ | ||
|
||
#if ROSLITE_TARGET_CLUSTER_ID == 0 | ||
#else | ||
/* Initialize servers in clusters */ | ||
// roslite_rpc_client_init(); | ||
// roslite_async_init(); | ||
|
||
/* Synchronize all PE0 of all booted cluster */ | ||
// roslite_rpc_barrier_all(); | ||
#endif | ||
|
||
roslite_debug_printf("--------- cluster start: cluster_id=%d ---------\n", ROSLITE_TARGET_CLUSTER_ID); | ||
|
||
ROSLITE_NAMESPACE::generated_init(); | ||
|
||
#if ROSLITE_TARGET_CLUSTER_ID == 0 | ||
create_thread(1024 * 10, ros_bridge_main); | ||
#elif ROSLITE_TARGET_CLUSTER_ID == 1 | ||
ROSLITE_NAMESPACE::createAndStartNodeThread(talker_main); | ||
#elif ROSLITE_TARGET_CLUSTER_ID == 2 | ||
ROSLITE_NAMESPACE::createAndStartNodeThread(listener_main); | ||
#elif ROSLITE_TARGET_CLUSTER_ID == 3 | ||
ROSLITE_NAMESPACE::createAndStartNodeThread(listener2_main); | ||
#endif | ||
|
||
#if ROSLITE_TARGET_CLUSTER_ID != 17 | ||
// TODO | ||
// roslite_rpc_barrier_all(); /* Synchronize all PE0 of all booted cluster */ | ||
roslite_debug_printf("--------- cluster end ---------\n"); | ||
#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,71 @@ | ||
# [note] Auto-generated file | ||
# [note] 2019-03-20T08:43:51Z | ||
# [note] based on source/appl/ros_src/map/roslite_map_two_listenres.map | ||
|
||
#/**************************************************************************** | ||
#[ roslite_app.cmake ] - cmake rules for roslite application | ||
#****************************************************************************/ | ||
|
||
|
||
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/nodes/talker talker_SOURCE) | ||
add_library( | ||
ros_node-1-talker OBJECT | ||
${talker_SOURCE} | ||
) | ||
target_compile_definitions( | ||
ros_node-1-talker | ||
PUBLIC ROSLITE_TARGET_CLUSTER_ID=1 | ||
PUBLIC talker_MAIN=1 | ||
) | ||
|
||
add_library( | ||
ros_node-1 STATIC | ||
$<TARGET_OBJECTS:ros_node-1-talker> | ||
) | ||
|
||
target_compile_definitions( | ||
ros_node-1 | ||
PUBLIC ROSLITE_TARGET_CLUSTER_ID=1 | ||
) | ||
|
||
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/nodes/listener listener_SOURCE) | ||
add_library( | ||
ros_node-2-listener OBJECT | ||
${listener_SOURCE} | ||
) | ||
target_compile_definitions( | ||
ros_node-2-listener | ||
PUBLIC ROSLITE_TARGET_CLUSTER_ID=2 | ||
PUBLIC listener_MAIN=1 | ||
) | ||
|
||
add_library( | ||
ros_node-2 STATIC | ||
$<TARGET_OBJECTS:ros_node-2-listener> | ||
) | ||
|
||
target_compile_definitions( | ||
ros_node-2 | ||
PUBLIC ROSLITE_TARGET_CLUSTER_ID=2 | ||
) | ||
|
||
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/nodes/listener2 listener2_SOURCE) | ||
add_library( | ||
ros_node-3-listener2 OBJECT | ||
${listener2_SOURCE} | ||
) | ||
target_compile_definitions( | ||
ros_node-3-listener2 | ||
PUBLIC ROSLITE_TARGET_CLUSTER_ID=3 | ||
PUBLIC listener2_MAIN=1 | ||
) | ||
|
||
add_library( | ||
ros_node-3 STATIC | ||
$<TARGET_OBJECTS:ros_node-3-listener2> | ||
) | ||
|
||
target_compile_definitions( | ||
ros_node-3 | ||
PUBLIC ROSLITE_TARGET_CLUSTER_ID=3 | ||
) |
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,12 @@ | ||
- name: arrays_talker | ||
cluster: 1 | ||
publish: [/chatter] | ||
publish_type: ["test::Arrays"] | ||
subscribe: [] | ||
subscribe_type: [] | ||
- name: arrays_listener | ||
cluster : 2 | ||
publish: [] | ||
publish_type: [] | ||
subscribe: [/chatter] | ||
subscribe_type: ["test::Arrays"] |
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,30 @@ | ||
- name: comp_talker1 | ||
cluster: 1 | ||
publish: [/chatter1] | ||
publish_type: ["std_msgs::String"] | ||
subscribe: [/chatter6] | ||
subscribe_type: ["std_msgs::String"] | ||
- name: comp_talker2 | ||
cluster: 1 | ||
publish: [/chatter2, /chatter3] | ||
publish_type: ["std_msgs::String", "std_msgs::String"] | ||
subscribe: [] | ||
subscribe_type: [] | ||
- name: comp_listener1 | ||
cluster : 2 | ||
publish: [/chatter4] | ||
publish_type: ["std_msgs::String"] | ||
subscribe: [/chatter1] | ||
subscribe_type: ["std_msgs::String"] | ||
- name: comp_listener2 | ||
cluster : 2 | ||
publish: [/chatter5] | ||
publish_type: ["std_msgs::String"] | ||
subscribe: [/chatter1, /chatter2] | ||
subscribe_type: ["std_msgs::String", "std_msgs::String"] | ||
- name: comp_ender | ||
cluster : 1 | ||
publish: [] | ||
publish_type: [] | ||
subscribe: [/chatter4, /chatter5] | ||
subscribe_type: ["std_msgs::String", "std_msgs::String"] |
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,21 @@ | ||
- name: talker | ||
cluster: 1 | ||
cpu: 0 | ||
publish: [/chatter] | ||
publish_type: ["std_msgs::String"] | ||
subscribe: [] | ||
subscribe_type: [] | ||
- name: listener | ||
cluster: 2 | ||
cpu: 1 | ||
publish: [] | ||
publish_type: [] | ||
subscribe: [/chatter] | ||
subscribe_type: ["std_msgs::String"] | ||
- name: listener2 | ||
cluster: 3 | ||
cpu: 2 | ||
publish: [] | ||
publish_type: [] | ||
subscribe: [/chatter] | ||
subscribe_type: ["std_msgs::String"] |
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,2 @@ | ||
# Copy of std_msgs/String.msg to avoid having tests require a dependency on std_msgs. | ||
string data |
Oops, something went wrong.