diff --git a/clover/launch/led.launch b/clover/launch/led.launch index 3e9238979..bfd111348 100644 --- a/clover/launch/led.launch +++ b/clover/launch/led.launch @@ -21,7 +21,7 @@ - + diff --git a/clover/src/led.cpp b/clover/src/led.cpp index 8d437c055..4dc325a78 100644 --- a/clover/src/led.cpp +++ b/clover/src/led.cpp @@ -309,19 +309,19 @@ int main(int argc, char **argv) nh_priv.param("notify/low_battery/threshold", low_battery_threshold, 3.7); nh_priv.param("notify/error/ignore", error_ignore, {}); - ros::service::waitForService("set_leds"); // cannot work without set_leds service - set_leds_srv = nh.serviceClient("set_leds", true); + ros::service::waitForService("led/set_leds"); // cannot work without set_leds service + set_leds_srv = nh.serviceClient("led/set_leds", true); // wait for leds count info - handleState(*ros::topic::waitForMessage("state", nh)); + handleState(*ros::topic::waitForMessage("led/state", nh)); - auto state_sub = nh.subscribe("state", 1, &handleState); + auto state_sub = nh.subscribe("led/state", 1, &handleState); - auto set_effect = nh.advertiseService("set_effect", &setEffect); + auto set_effect = nh.advertiseService("led/set_effect", &setEffect); - auto mavros_state_sub = nh.subscribe("/mavros/state", 1, &handleMavrosState); - auto battery_sub = nh.subscribe("/mavros/battery", 1, &handleBattery); - auto rosout_sub = nh.subscribe("/rosout_agg", 1, &handleLog); + auto mavros_state_sub = nh.subscribe("mavros/state", 1, &handleMavrosState); + auto battery_sub = nh.subscribe("mavros/battery", 1, &handleBattery); + auto rosout_sub = nh.subscribe("rosout_agg", 1, &handleLog); timer = nh.createTimer(ros::Duration(0), &proceed, false, false); diff --git a/clover/src/simple_offboard.cpp b/clover/src/simple_offboard.cpp index b8f570332..133e4c4c2 100644 --- a/clover/src/simple_offboard.cpp +++ b/clover/src/simple_offboard.cpp @@ -95,7 +95,7 @@ AttitudeTarget att_raw_msg; Thrust thrust_msg; TwistStamped rates_msg; TransformStamped target, setpoint; -geometry_msgs::TransformStamped body; +geometry_msgs::TransformStamped body, initial_pose; // State PoseStamped nav_start; @@ -158,9 +158,9 @@ inline void publishBodyFrame() q.setRPY(0, 0, tf::getYaw(local_position.pose.orientation)); tf::quaternionTFToMsg(q, body.transform.rotation); - body.transform.translation.x = local_position.pose.position.x; - body.transform.translation.y = local_position.pose.position.y; - body.transform.translation.z = local_position.pose.position.z; + body.transform.translation.x = local_position.pose.position.x + initial_pose.transform.translation.x; + body.transform.translation.y = local_position.pose.position.y + initial_pose.transform.translation.y; + body.transform.translation.z = local_position.pose.position.z + initial_pose.transform.translation.z; body.header.frame_id = local_position.header.frame_id; body.header.stamp = local_position.header.stamp; transform_broadcaster->sendTransform(body); @@ -882,6 +882,9 @@ int main(int argc, char **argv) nh_priv.param("default_speed", default_speed, 0.5f); nh_priv.param("body_frame", body.child_frame_id, "body"); nh_priv.getParam("reference_frames", reference_frames); + nh.param("initial_pose/x", initial_pose.transform.translation.x, 0.0); + nh.param("initial_pose/y", initial_pose.transform.translation.y, 0.0); + nh.param("initial_pose/z", initial_pose.transform.translation.z, 0.0); // Default reference frames std::map default_reference_frames; diff --git a/clover_description/urdf/clover/clover4.xacro b/clover_description/urdf/clover/clover4.xacro index 5df65aa89..995b61dc5 100644 --- a/clover_description/urdf/clover/clover4.xacro +++ b/clover_description/urdf/clover/clover4.xacro @@ -7,6 +7,7 @@ + @@ -15,12 +16,7 @@ - - - - - - + @@ -35,6 +31,11 @@ z="-0.002"/> + + + + + diff --git a/clover_description/urdf/clover/clover4_base.xacro b/clover_description/urdf/clover/clover4_base.xacro index 0a2009d06..5225717e9 100644 --- a/clover_description/urdf/clover/clover4_base.xacro +++ b/clover_description/urdf/clover/clover4_base.xacro @@ -25,7 +25,7 @@ - + diff --git a/clover_description/urdf/clover/clover4_gazebo.xacro b/clover_description/urdf/clover/clover4_gazebo.xacro index b9738b34d..99ff268a9 100644 --- a/clover_description/urdf/clover/clover4_gazebo.xacro +++ b/clover_description/urdf/clover/clover4_gazebo.xacro @@ -51,13 +51,13 @@ /mag /baro INADDR_ANY - 4560 + $(arg mavlink_tcp_port) 14560 false /dev/ttyACM0 921600 INADDR_ANY - 14550 + 14560 INADDR_ANY 14540 false diff --git a/clover_description/urdf/leds/led_strip.xacro b/clover_description/urdf/leds/led_strip.xacro index f7c0fb360..cc7dfa24b 100644 --- a/clover_description/urdf/leds/led_strip.xacro +++ b/clover_description/urdf/leds/led_strip.xacro @@ -44,7 +44,7 @@ - + ${led_count} false @@ -66,7 +66,7 @@ --> - + ${led_count} diff --git a/clover_description/urdf/sensors/distance_sensor.urdf.xacro b/clover_description/urdf/sensors/distance_sensor.urdf.xacro index 4b539a29e..a0532043d 100644 --- a/clover_description/urdf/sensors/distance_sensor.urdf.xacro +++ b/clover_description/urdf/sensors/distance_sensor.urdf.xacro @@ -54,7 +54,7 @@ - + /rangefinder/range rangefinder infrared diff --git a/roswww_static/CHANGELOG.rst b/roswww_static/CHANGELOG.rst deleted file mode 100644 index c90411fde..000000000 --- a/roswww_static/CHANGELOG.rst +++ /dev/null @@ -1,8 +0,0 @@ -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Changelog for package roswww_static -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -0.21.1 (2020-11-17) -------------------- -* First release of roswww_static package to ROS -* Contributors: Oleg Kalachev diff --git a/roswww_static/CMakeLists.txt b/roswww_static/CMakeLists.txt index bb9e1fc72..6215b967e 100644 --- a/roswww_static/CMakeLists.txt +++ b/roswww_static/CMakeLists.txt @@ -1,12 +1,202 @@ -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.0.2) project(roswww_static) +## Compile as C++11, supported in ROS Kinetic and newer +# add_compile_options(-std=c++11) + +## Find catkin macros and libraries +## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) +## is used, also find other catkin packages find_package(catkin REQUIRED) -catkin_package() +## System dependencies are found with CMake's conventions +# find_package(Boost REQUIRED COMPONENTS system) + + +## Uncomment this if the package has a setup.py. This macro ensures +## modules and global scripts declared therein get installed +## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html +# catkin_python_setup() + +################################################ +## Declare ROS messages, services and actions ## +################################################ + +## To declare and build messages, services or actions from within this +## package, follow these steps: +## * Let MSG_DEP_SET be the set of packages whose message types you use in +## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...). +## * In the file package.xml: +## * add a build_depend tag for "message_generation" +## * add a build_depend and a exec_depend tag for each package in MSG_DEP_SET +## * If MSG_DEP_SET isn't empty the following dependency has been pulled in +## but can be declared for certainty nonetheless: +## * add a exec_depend tag for "message_runtime" +## * In this file (CMakeLists.txt): +## * add "message_generation" and every package in MSG_DEP_SET to +## find_package(catkin REQUIRED COMPONENTS ...) +## * add "message_runtime" and every package in MSG_DEP_SET to +## catkin_package(CATKIN_DEPENDS ...) +## * uncomment the add_*_files sections below as needed +## and list every .msg/.srv/.action file to be processed +## * uncomment the generate_messages entry below +## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...) + +## Generate messages in the 'msg' folder +# add_message_files( +# FILES +# Message1.msg +# Message2.msg +# ) + +## Generate services in the 'srv' folder +# add_service_files( +# FILES +# Service1.srv +# Service2.srv +# ) + +## Generate actions in the 'action' folder +# add_action_files( +# FILES +# Action1.action +# Action2.action +# ) -install(DIRECTORY launch DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}) +## Generate added messages and services with any dependencies listed here +# generate_messages( +# DEPENDENCIES +# std_msgs # Or other packages containing msgs +# ) -catkin_install_python(PROGRAMS main.py - DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} +################################################ +## Declare ROS dynamic reconfigure parameters ## +################################################ + +## To declare and build dynamic reconfigure parameters within this +## package, follow these steps: +## * In the file package.xml: +## * add a build_depend and a exec_depend tag for "dynamic_reconfigure" +## * In this file (CMakeLists.txt): +## * add "dynamic_reconfigure" to +## find_package(catkin REQUIRED COMPONENTS ...) +## * uncomment the "generate_dynamic_reconfigure_options" section below +## and list every .cfg file to be processed + +## Generate dynamic reconfigure parameters in the 'cfg' folder +# generate_dynamic_reconfigure_options( +# cfg/DynReconf1.cfg +# cfg/DynReconf2.cfg +# ) + +################################### +## catkin specific configuration ## +################################### +## The catkin_package macro generates cmake config files for your package +## Declare things to be passed to dependent projects +## INCLUDE_DIRS: uncomment this if your package contains header files +## LIBRARIES: libraries you create in this project that dependent projects also need +## CATKIN_DEPENDS: catkin_packages dependent projects also need +## DEPENDS: system dependencies of this project that dependent projects also need +catkin_package( +# INCLUDE_DIRS include +# LIBRARIES roswww_static +# CATKIN_DEPENDS other_catkin_pkg +# DEPENDS system_lib ) + +########### +## Build ## +########### + +## Specify additional locations of header files +## Your package locations should be listed before other locations +include_directories( +# include +# ${catkin_INCLUDE_DIRS} +) + +## Declare a C++ library +# add_library(${PROJECT_NAME} +# src/${PROJECT_NAME}/roswww_static.cpp +# ) + +## Add cmake target dependencies of the library +## as an example, code may need to be generated before libraries +## either from message generation or dynamic reconfigure +# add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + +## Declare a C++ executable +## With catkin_make all packages are built within a single CMake context +## The recommended prefix ensures that target names across packages don't collide +# add_executable(${PROJECT_NAME}_node src/roswww_static_node.cpp) + +## Rename C++ executable without prefix +## The above recommended prefix causes long target names, the following renames the +## target back to the shorter version for ease of user use +## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node" +# set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "") + +## Add cmake target dependencies of the executable +## same as for the library above +# add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + +## Specify libraries to link a library or executable target against +# target_link_libraries(${PROJECT_NAME}_node +# ${catkin_LIBRARIES} +# ) + +############# +## Install ## +############# + +# all install targets should use catkin DESTINATION variables +# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html + +## Mark executable scripts (Python etc.) for installation +## in contrast to setup.py, you can choose the destination +# catkin_install_python(PROGRAMS +# scripts/my_python_script +# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} +# ) + +## Mark executables for installation +## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_executables.html +# install(TARGETS ${PROJECT_NAME}_node +# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} +# ) + +## Mark libraries for installation +## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html +# install(TARGETS ${PROJECT_NAME} +# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} +# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} +# RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} +# ) + +## Mark cpp header files for installation +# install(DIRECTORY include/${PROJECT_NAME}/ +# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} +# FILES_MATCHING PATTERN "*.h" +# PATTERN ".svn" EXCLUDE +# ) + +## Mark other files for installation (e.g. launch and bag files, etc.) +# install(FILES +# # myfile1 +# # myfile2 +# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} +# ) + +############# +## Testing ## +############# + +## Add gtest based cpp test target and link libraries +# catkin_add_gtest(${PROJECT_NAME}-test test/test_roswww_static.cpp) +# if(TARGET ${PROJECT_NAME}-test) +# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME}) +# endif() + +## Add folders to be run by python nosetests +# catkin_add_nosetests(test) diff --git a/roswww_static/README.md b/roswww_static/README.md deleted file mode 100644 index c2eea67f6..000000000 --- a/roswww_static/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# roswww_static - -roswww_static creates a static web directory for your ROS-powered system with symlinks to all the `www` subdirectories found in your ROS packages. This way you can use any external web server (e. g. [nginx](https://nginx.org/), [Monkey](https://github.com/monkey/monkey), [Caddy](https://caddyserver.com)) to serve you static data, in compatible with `roswww` manner. - -Note: you should configure your web server to make it follow symlinks. - -## Instructions - -* Run `main.py` node and it will generate the symlinks and index file. -* Point your static web server path to `~/.ros/www`. - -You can rerun `main.py` if the list of installed packages changes. - -## Parameters - -* `index` – path for index page, otherwise packages list would be generated. -* `default_package` – if set then the index page would redirect to this package's page. diff --git a/roswww_static/assets/SwarmCloverBlocks.png b/roswww_static/assets/SwarmCloverBlocks.png new file mode 100644 index 000000000..e0eb49311 Binary files /dev/null and b/roswww_static/assets/SwarmCloverBlocks.png differ diff --git a/roswww_static/assets/Swarm_in_Blocks_w.svg b/roswww_static/assets/Swarm_in_Blocks_w.svg new file mode 100644 index 000000000..97f62faea --- /dev/null +++ b/roswww_static/assets/Swarm_in_Blocks_w.svg @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/roswww_static/assets/background_swarm_in_blocks.png b/roswww_static/assets/background_swarm_in_blocks.png new file mode 100644 index 000000000..a36d5acf4 Binary files /dev/null and b/roswww_static/assets/background_swarm_in_blocks.png differ diff --git a/roswww_static/assets/coex.svg b/roswww_static/assets/coex.svg new file mode 100644 index 000000000..288c23c9f --- /dev/null +++ b/roswww_static/assets/coex.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + diff --git a/roswww_static/assets/favicon.ico b/roswww_static/assets/favicon.ico new file mode 100644 index 000000000..aa3b461d2 Binary files /dev/null and b/roswww_static/assets/favicon.ico differ diff --git a/roswww_static/assets/formations.gif b/roswww_static/assets/formations.gif new file mode 100644 index 000000000..004a0e56e Binary files /dev/null and b/roswww_static/assets/formations.gif differ diff --git a/roswww_static/assets/github.svg b/roswww_static/assets/github.svg new file mode 100644 index 000000000..b610a1c25 --- /dev/null +++ b/roswww_static/assets/github.svg @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + diff --git a/roswww_static/assets/semearLOGO.svg b/roswww_static/assets/semearLOGO.svg new file mode 100644 index 000000000..55076c159 --- /dev/null +++ b/roswww_static/assets/semearLOGO.svg @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + diff --git a/roswww_static/bottom.txt b/roswww_static/bottom.txt new file mode 100644 index 000000000..70259ab01 --- /dev/null +++ b/roswww_static/bottom.txt @@ -0,0 +1,55 @@ + + + + + + + + + Bottom + + + +
+
+ + + + +
+
+ + + \ No newline at end of file diff --git a/roswww_static/index.txt b/roswww_static/index.txt new file mode 100644 index 000000000..b3b1d98dd --- /dev/null +++ b/roswww_static/index.txt @@ -0,0 +1,125 @@ + + + + Swarm in Blocks + + + + + + + + + + + +
+
+ + + +
+ +
+
+

+ Clover Blocks
+

+ +

+ + + +
+

Basic Blockly Functionalities

+

Single-copter Manipulation

+

Traditional Build-in Functions

+
+
+
+
+
+

+ Swarm Clover Blocks
+

+ +

+ + + +
+

Multi-copter Facilities

+

Improved Built-in Functions

+

Basic Full Automation

+
+
+
+ +
+
+

+ Clover Kit Tools
+

+ +

+ + + +
+

Topics and Documentation

+

Cameras Acess

+

Web Terminal and Blockly

+
+
+
+
+ + +
+
+

+ It's never been easier to

+

+ Swarm

+
+

Online block programming optimized for swarm manipulation

+ +
+
+ +
+
+ Swarm_Clover_Blocks + quatro clover montando uma formação +
+
+ + +
+
+

+ An Atena Team Implementation

+
+ +
+ +
diff --git a/roswww_static/main.py b/roswww_static/main.py index 0b1685099..d50db943e 100755 --- a/roswww_static/main.py +++ b/roswww_static/main.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python3 # Copyright (C) 2020 Copter Express Technologies # @@ -15,11 +15,12 @@ import shutil import rospy import rospkg - -rospy.init_node('roswww_static') +import errno rospack = rospkg.RosPack() +local_dir = os.path.dirname(os.path.abspath(__file__)) + www = rospkg.get_ros_home() + '/www' index_file = rospy.get_param('~index_file', None) default_package = rospy.get_param('~default_package', None) @@ -29,15 +30,57 @@ packages = rospack.list() -index = '

Packages list

\n
    \n' - +#* procura dos pacotes +names = list() +others = list() for name in packages: path = rospack.get_path(name) if os.path.exists(path + '/www'): rospy.loginfo('found www path for %s package', name) os.symlink(path + '/www', www + '/' + name) - index += '
  • {name}
  • '.format(name=name) + if name == 'clover' or name == 'clover_blocks' or name == 'swarm_clover_blocks': + continue + else: + others.append(name) + +#* index.html (e bottom.html) + +# cabeçalho +f = open(os.path.join(local_dir,'index.txt'), 'r') +index = '' +for line in f: + index += str(line) + +# caso em que há outros packages além dos 3 padrões (sem formatação) +if len(others) > 0: + index += '

    Other Packages Avaiable

    \n' + for others in others: + index += '
    {name}\n'.format(name=other) + +# finaliza o index +index += '\n\n' +f.close() + +# bottom +f = open(os.path.join(local_dir,'bottom.txt'), 'r') +bottom = '' +for line in f: + bottom += str(line) +f.close() + + +#* style.css + +f = open(os.path.join(local_dir,'style.txt'), 'r') +style = '' +for line in f: + style += str(line) +f.close() + + +#* Escreve nos arquivos +#* index.html if default_package is not None: redirect_html = ''.format(name=default_package) open(www + '/index.html', 'w').write(redirect_html) @@ -46,3 +89,38 @@ os.symlink(index_file, www + '/index.html') else: open(www + '/index.html', 'w').write(index) + +#* bottom.html +if default_package is not None: + redirect_html = ''.format(name=default_package) + open(www + '/bottom.html', 'w').write(redirect_html) +elif index_file is not None: + rospy.loginfo('symlinking bottom file') + os.symlink(index_file, www + '/bottom.html') +else: + open(www + '/bottom.html', 'w').write(bottom) + +#* style.css +if default_package is not None: + redirect_html = ''.format(name=default_package) + open(www + '/style.css', 'w').write(redirect_html) +elif index_file is not None: + rospy.loginfo('symlinking style file') + os.symlink(index_file, www + '/style.html') +else: + open(www + '/style.css', 'w').write(style) + + +#* copy assests folder +src = os.path.join(local_dir,'assets') +dst = rospkg.get_ros_home() + '/www/assets' +os.mkdir(dst) +try: + if os.path.exists(dst): + shutil.rmtree(dst) + shutil.copytree(src, dst) +except OSError as e: + if e.errno == errno.ENOTDIR: + shutil.copy(src, dst) + else: + print('Directory not copied. Error: %s' % e) \ No newline at end of file diff --git a/roswww_static/style.txt b/roswww_static/style.txt new file mode 100644 index 000000000..6482a5435 --- /dev/null +++ b/roswww_static/style.txt @@ -0,0 +1,71 @@ +/* Style the body */ + +body { + font-family: Arial, Verdana, Helvetica, sans-serif; + margin: 0; +} + +.subtitle{ + font-weight: bold; + font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; + font-size:30px; + margin-top: 20px; + margin-bottom: 30px; + color: rgb(0, 0, 0) +} + +/* Header/Logo Title */ +.header { + width: 100%; + height: 40%; + min-height: 250px; + background-image: url('./assets/background_swarm_in_blocks.png'); + background-size: cover; + background-position: center; +} + +.w3-container { + background-color: rgb(235, 235, 235); + transition: all 1250ms cubic-bezier(0.19, 1, 0.22, 1); + border-radius: 1em; + transition-duration: 0.7s; + min-height:400px; + font-family: 'Dejavu Sans'; +} + +.w3-container:hover { + background-color: rgb(235, 235, 235); + box-shadow: 4 0.6em 0.6em -0.4em var(--hover); + transform: translateY(-0.35em); + box-shadow: 0 0 4px 4px #fff, /* inner white */ + 0 0 4px 4px #f0f, /* middle magenta */ + 0 0 4px 4px #0ff; /* outer cyan */ +} + +.container > img { + height: 340px; + width: auto; +} + +.eazy2 { + display: inline-block; + font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; + text-shadow: 1px 1px 1px rgba(146, 71, 216, 0.918); +} + +.Swarm { + margin-left: 3px; + font-size: 45px; + display: inline-block; + font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; + text-shadow: 1.4px 1.4px 1.4px rgba(27, 27, 27, 0.918); + color: rgb(146, 71, 216); +} + +.bottom{ + margin: 10px 20; + text-align: center; + padding:15px; + transition-duration: 0.3s; +} +