User Tools

Site Tools


alros

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
alros [2018/08/28 22:30]
keitaronishimura
alros [2018/08/28 22:32] (current)
keitaronishimura
Line 1: Line 1:
 ===== Integrating ROS 1 & 2 into AL ===== ===== Integrating ROS 1 & 2 into AL =====
-**Author** [[unlv_nishimura|Keitaro Nishimura]] **Date:** Last modified on <08/27/18>+**Author** [[unlv_nishimura|Keitaro Nishimura]] **Date:** Last modified on <08/29/18>
  
 \\ \\
-This tutorial will teach students how to enable ros integration with the ALs directly so as to bypass shared memory. ​ This tutorial shows the reader how to make AL into a ROS node and takes approximately 1~2 hrs to complete.  +This page is just marker for an internal document ​that exists ​for lab use only. If you are a member ​of the lab please ​contact ​the student ​in charge ​of HUBO research ​for this document
-\\ +
-<fc red> +
-Please note that once an AL has been rosified it will no longer build through Qt.  +
-</​fc>​ +
-==== Motivation and Audience ==== +
-This tutorial'​s motivation is to teach readers how to "​rosify"​ an AL. Readers of this tutorial are assumed to have the following background and interests:​ +
-<fc blue> +
-\\   +
-  *Knowledge and experience with Hubo and PODO +
-\\ +
-  *Knowledge and experience with ROS 1 or 2 +
-\\   +
-  *Knowledge and experience with CPP   +
-</​fc>​ +
-\\ +
-The rest of this tutorial is presented as follows: +
-\\ +
-    *[[alros#​Parts List and Source|Parts List and Source]] +
-    *[[alros#​Download ROS 1 and or 2|Download ROS 1 and or 2]] +
-    *[[alros#​Adding AL to ROS Workspace|Adding AL to ROS Workspace]] +
-    *[[alros#​Building and Running AL ROS Node|Building and Running AL ROS Node]] +
-    *[[alros#​Final Words|Final Words]] +
- +
-==== Parts List and Source ==== +
- +
-You will need an intel nuc running Ubuntu 16.04 with Xenomai and PODO installed. If you do not have that please follow this tutorial to install Ubuntu 16.04, Xenomai, and PODO. +
-\\ +
-*[[Installing Xenomai3, PODO3, and QT]] +
-==== Download ROS 1 and or 2 ==== +
-\\ +
-You now need to install either ROS 1 or 2 onto the intel nuc. Don't forget to initialize your workspace! +
-===ROS 1=== +
-ROS 1 should be used if you are communicating with other machines running on Ubuntu or if you want to have the widest compatibility with existing ROS packages. ROS Kinetic will be used for this tutorialPlease follow the instructions in the linked installation tutorial for [[http://​wiki.ros.org/​kinetic/​Installation/​Ubuntu|ROS Kinetic]].  +
-\\ +
-===ROS 2=== +
-If you need to communicate with Windows or OSX based machines you will need to install ROS 2. As of writing this tutorial, it is still early in its development with only version 1.0 available. I would not recommend someone to learn ROS 2 before mastering ​the basics of ROS 1. It is possible that the following link is not the most current installation tutorial so please ​double check before proceeding.  +
-\\ +
-[[https://​github.com/​ros2/​ros2/​wiki/​Linux-Development-Setup|ROS 2 Installation for Linux]] ​  +
-\\ +
-This is the link to the ROS 2 installation tutorials for Windows and OSX: +
-\\ +
-[[https://​github.com/​ros2/​ros2/​wiki/​Windows-Development-Setup|ROS 2 Installation for Windows]] ​  +
-\\ +
-[[https://​github.com/​ros2/​ros2/​wiki/​OSX-Development-Setup|ROS 2 Installation for OSX]]   +
-==== Adding AL to ROS Workspace ==== +
-Once you have the version of ROS you need installed make a new package within your workspace. Once you have it named you will need to make a symbolic link to the AL you want to rosify. This can be done by using the following terminal command. +
-\\ +
----- +
-<fc purple>​ +
-ln -s /​path/​to/​file /​path/​to/​symlink +
-</​fc>​ +
-----   +
-\\ +
-This creates a "​shortcut"​ for catkin or ament to find the AL code within its workspace. An example of how to use this command is as follows: +
-\\ +
----- +
-<fc purple>​ +
-ln -s ~/​Desktop/​podo_nrl/​src/​ALPrograms/​ManualMove ~/​catkin_ws/​src/​test_AL/​src +
-</​fc>​ +
----- +
-\\ +
-This command connected the directory "​src"​ within our test package "​test_AL"​ to the "​ManualMove"​ directory within PODO.  +
-==== Building and Running AL ROS Node ==== +
-Now in order to build to PODO code with catkin or ament we will need to add all of it's dependencies to the CMakeLists.txt file. The package.xml does not need to change. An example of a rosified AL's cmakelist is shown bellow. +
-\\ +
-<code text> +
-cmake_minimum_required(VERSION 2.8.3) +
-project(mpcwalk) +
- +
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "​${CMAKE_SOURCE_DIR}/​cmake/​Modules/"​) +
-set(CMAKE_INCLUDE_CURRENT_DIR ON) +
-set(CMAKE_AUTOMOC ON) +
-## Add support ​for C++11, supported in ROS Kinetic and newer +
-# add_definitions(-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(Qt5Core REQUIRED) +
- +
-find_package(catkin REQUIRED COMPONENTS +
-  geometry_msgs +
-  message_runtime +
-  roscpp +
-  std_msgs +
-+
- +
-find_library(COPPERPLATE copperplate /​usr/​include/​xenomai/​) +
-find_library(COBALT cobalt /​usr/​include/​xenomai/​) +
-find_library(ALCHEMY alchemy /​usr/​include/​xenomai) +
- +
- +
-include_directories( src src/​BasicFiles src/​JoyStick src/​solver +
-/​opt/​Qt5.5.1/​5.5/​gcc_64/​include +
-  ${catkin_INCLUDE_DIRS} +
-+
- +
- ​add_executable(mpcwalk +
-  src/​main.cpp +
- src/​StateMachine.cpp +
- src/​solver/​ldl.cpp +
- src/​solver/​matrix_support.cpp +
- src/​solver/​solver.cpp +
- src/​solver/​util.cpp +
- src/​JoyStick/​RBJoystick.cpp +
- src/​ManualCAN.cpp +
- src/​BasicFiles/​BasicSetting.h +
- src/​BasicFiles/​BasicJoint.h +
- src/​StateMachine.h +
- src/​Definitions.h +
- src/​solver/​solver.h +
- src/​JoyStick/​joystickvariable.h +
- src/​JoyStick/​joystickclass.h +
- src/​ManualCAN.h +
-+
- +
- +
-## Add cmake target dependencies of the executable +
-## same as for the library above +
- ​add_dependencies(mpcwalk ${${PROJECT_NAME}_EXPORTED_TARGETS} +
- ​${catkin_EXPORTED_TARGETS}  +
- +
-+
-qt5_use_modules(mpcwalk Core Gui Widgets Network)  +
-## Specify libraries to link a library or executable target against +
- ​target_link_libraries(mpcwalk ${ALCHEMY} ${COPPERPLATE} ${COBALT} rt pcan pthread +
- /​home/​nishkei/​new_podo_nrl/​new_podo_nrl/​share/​Libs/​libik_math4.a +
- /​home/​nishkei/​new_podo_nrl/​new_podo_nrl/​share/​Libs/​libKINE_DRC_HUBO4.a +
-          ${catkin_LIBRARIES} +
- ) +
- +
-target_include_directories(mpcwalk +
- PRIVATE /​usr/​include/​xenomai /​usr/​include/​xenomai/​cobalt +
-~/​new_podo_nrl/​new_podo_nrl/​share/​Headers  +
-${catkin_INCLUDE_DIRS}) +
- +
- +
-set_target_properties(mpcwalk PROPERTIES LINK_FLAGS "​${CMAKE_EXE_LINKER_FLAGS} /​usr/​lib/​xenomai/​bootstrap.o -Wl,​--wrap=main -Wl,​--dynamic-list=/​usr/​lib/​dynlist.ld"​) +
- +
-if (${CMAKE_CXX_COMPILER_ID} STREQUAL "​GNU"​) +
- add_definitions("​-fmessage-length=0 -Wall -Wextra -std=c++11"​) +
-endif () +
- +
-</​code>​ +
-\\ +
-Make sure that the following set and find_package functions are at the top and unchanged:​ +
-<code text> +
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "​${CMAKE_SOURCE_DIR}/​cmake/​Modules/"​) +
-set(CMAKE_INCLUDE_CURRENT_DIR ON) +
-set(CMAKE_AUTOMOC ON) +
- +
-find_package(Qt5Core REQUIRED) +
-</​code>​ +
-\\ +
-Double check that the directories for the following find_library and include_directories functions are correct. You may not have or need some of the directories within the include_directories function: +
-<code text> +
-find_library(COPPERPLATE copperplate /​usr/​include/​xenomai/​) +
-find_library(COBALT cobalt /​usr/​include/​xenomai/​) +
-find_library(ALCHEMY alchemy /​usr/​include/​xenomai) +
- +
-include_directories( src src/​BasicFiles src/​JoyStick src/​solver +
-/​opt/​Qt5.5.1/​5.5/​gcc_64/​include +
-  ${catkin_INCLUDE_DIRS} +
-+
-</​code>​ +
-\\ +
-You will need to tell catkin where every file within the AL directory is in the add_executable function: +
-<code text> +
- ​add_executable(mpcwalk +
-  src/​main.cpp +
- src/​StateMachine.cpp +
- src/​solver/​ldl.cpp +
- src/​solver/​matrix_support.cpp +
- src/​solver/​solver.cpp +
- src/​solver/​util.cpp +
- src/​JoyStick/​RBJoystick.cpp +
- src/​ManualCAN.cpp +
- src/​BasicFiles/​BasicSetting.h +
- src/​BasicFiles/​BasicJoint.h +
- src/​StateMachine.h +
- src/​Definitions.h +
- src/​solver/​solver.h +
- src/​JoyStick/​joystickvariable.h +
- src/​JoyStick/​joystickclass.h +
- src/​ManualCAN.h +
-+
-</​code>​ +
-\\ +
-Make sure that this function is unchanged:​ +
-<code text> +
-qt5_use_modules(mpcwalk Core Gui Widgets Network) +
-</​code>​ +
-\\ +
-Double check the paths for the libraries needed by the AL. You will need everything else though: +
-<code text> +
- ​target_link_libraries(mpcwalk ${ALCHEMY} ${COPPERPLATE} ${COBALT} rt pcan pthread +
- /​home/​nishkei/​new_podo_nrl/​new_podo_nrl/​share/​Libs/​libik_math4.a +
- /​home/​nishkei/​new_podo_nrl/​new_podo_nrl/​share/​Libs/​libKINE_DRC_HUBO4.a +
-          ${catkin_LIBRARIES} +
- ) +
-</​code>​ +
-\\ +
-Make sure that the paths are correct for your machine but other than that leave these functions untouched:​ +
-<code text> +
-target_include_directories(mpcwalk +
- PRIVATE /​usr/​include/​xenomai /​usr/​include/​xenomai/​cobalt +
-~/​new_podo_nrl/​new_podo_nrl/​share/​Headers  +
-${catkin_INCLUDE_DIRS}) +
- +
- +
-set_target_properties(mpcwalk PROPERTIES LINK_FLAGS "​${CMAKE_EXE_LINKER_FLAGS} /​usr/​lib/​xenomai/​bootstrap.o -Wl,​--wrap=main -Wl,​--dynamic-list=/​usr/​lib/​dynlist.ld"​) +
- +
-if (${CMAKE_CXX_COMPILER_ID} STREQUAL "​GNU"​) +
- add_definitions("​-fmessage-length=0 -Wall -Wextra -std=c++11"​) +
-endif () +
-</​code>​ +
-\\ +
-Once you have made the appropriate changes to the CMakeLists.txt file you will be able to build the AL through ROS. +
-==== Final Words ==== +
-\\ +
-This tutorial showed students how to bring an AL into the ROS environment to further expand research and the capabilities of the DRC-HUBO robot. However, this has only been tested with Ubuntu 16.04 and ROS Kinetic and ROS 2 Ardent. Further testing with different version of Ubuntu, ROS 1 and ROS 2 is needed.+
alros.txt · Last modified: 2018/08/28 22:32 by keitaronishimura