Skip to content

Commit

Permalink
Refactor the rqt libraries for spinal&neuron
Browse files Browse the repository at this point in the history
  • Loading branch information
tongtybj committed Jun 9, 2022
1 parent 88a6f95 commit 3a44850
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 14 deletions.
34 changes: 28 additions & 6 deletions aerial_robot_nerve/spinal/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
cmake_minimum_required(VERSION 2.8.3)
cmake_minimum_required(VERSION 3.0.2)
project(spinal)


## Compile as C++11, supported in ROS Kinetic and newer
add_compile_options(-std=c++11)
add_compile_options(-std=c++14)

find_package(catkin REQUIRED COMPONENTS
roscpp
std_srvs
std_msgs
message_generation
rospy
rqt_gui
rqt_gui_py
)

catkin_python_setup()

add_message_files(
FILES
PMatrixPseudoInverseUnit.msg
Expand Down Expand Up @@ -63,8 +64,7 @@ set(SPINAL_DIRS mcu_project/Jsk_Lib)
catkin_package(
INCLUDE_DIRS ${SPINAL_DIRS}
LIBRARIES spinal_flight_controller spinal_math
CATKIN_DEPENDS roscpp rospy rqt_gui rqt_gui_py
# DEPENDS system_lib
CATKIN_DEPENDS roscpp std_srvs std_msgs rospy rqt_gui rqt_gui_py message_runtime
)

include_directories(
Expand All @@ -87,3 +87,25 @@ add_library(spinal_flight_controller
${SPINAL_DIRS}/flight_control/attitude/attitude_control.cpp)
target_link_libraries(spinal_flight_controller ${catkin_LIBRARIES} spinal_math)
add_dependencies(spinal_flight_controller ${PROJECT_NAME}_generate_messages_cpp)

install(DIRECTORY ${SPINAL_DIRS}
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION})

install(DIRECTORY bin
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
USE_SOURCE_PERMISSIONS
)


install(DIRECTORY scripts resource
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
USE_SOURCE_PERMISSIONS
)

install(FILES rqt_gui_plugin.xml
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)

install(TARGETS spinal_math spinal_flight_controller
DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
)
1 change: 1 addition & 0 deletions aerial_robot_nerve/spinal/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<build_depend>rospy</build_depend>
<build_depend>rqt_gui</build_depend>
<build_depend>rqt_gui_py</build_depend>

<run_depend>roscpp</run_depend>
<run_depend>std_srvs</run_depend>
<run_depend>std_msgs</run_depend>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions aerial_robot_nerve/spinal/rqt_gui_plugin.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<library path="src">
<class name="BoardConfigurator" type="board_configurator.board_configurator.BoardConfigurator" base_class_type="rqt_gui_py::Plugin">
<class name="BoardConfigurator" type="spinal.board_configurator.BoardConfigurator" base_class_type="rqt_gui_py::Plugin">
<description>
Configurator for aerial robot boards
</description>
Expand All @@ -13,7 +13,7 @@
<statustip>Configurator for aerial robot boards</statustip>
</qtgui>
</class>
<class name="ServoMonitor" type="servo_monitor.servo_monitor.ServoMonitor" base_class_type="rqt_gui_py::Plugin">
<class name="ServoMonitor" type="spinal.servo_monitor.ServoMonitor" base_class_type="rqt_gui_py::Plugin">
<description>
Servo monitor for transformable aerial robot hardware
</description>
Expand All @@ -28,7 +28,7 @@
</qtgui>
</class>

<class name="ImuCalibration" type="imu_calibration.imu_calibration.ImuCalibrator" base_class_type="rqt_gui_py::Plugin">
<class name="ImuCalibration" type="spinal.imu_calibration.ImuCalibrator" base_class_type="rqt_gui_py::Plugin">
<description>
IMU calibration
</description>
Expand Down
11 changes: 11 additions & 0 deletions aerial_robot_nerve/spinal/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env python

from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup

d = generate_distutils_setup(
packages=['spinal'],
package_dir={'': 'src'}
)

setup(**d)
Empty file.
Empty file.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ def __init__(self, context):

self._widget = QWidget()

ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'BoardConfigurator.ui')
rp = rospkg.RosPack()
ui_file = os.path.join(
rp.get_path('spinal'), 'resource', 'board_configurator.ui')

loadUi(ui_file, self._widget)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ def __init__(self, limit=100, unit='[mG]'):
self.setObjectName('ImuCalibWidget')

rp = rospkg.RosPack()
#ui_file = os.path.join(rp.get_path('spinal'), '', 'plot3d.ui')
ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'imu_calib.ui')
ui_file = os.path.join(
rp.get_path('spinal'), 'resource', 'imu_calibration.ui')

loadUi(ui_file, self)
self.mag_data_plot = MatDataPlot3D(self, limit, unit)
Expand Down Expand Up @@ -307,7 +307,7 @@ def update_imu_calib_data(self):
self.mag_table_data = []
self.att_table_data = []

for i in range(len(res.data) / self.calib_data_len):
for i in range(len(res.data) // self.calib_data_len):
gyro_data = []
gyro_data.extend([None])
gyro_data.append("{0:.5f}".format(res.data[i * self.calib_data_len + 0]) + ', ' + "{0:.5f}".format(res.data[i * self.calib_data_len + 1]) + ', ' + "{0:.5f}".format(res.data[i * self.calib_data_len + 2])) # bias
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ def __init__(self, context):

self._widget = QWidget()

ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'ServoMonitor.ui')
rp = rospkg.RosPack()
ui_file = os.path.join(rp.get_path('spinal'), 'resource', 'servo_monitor.ui')

loadUi(ui_file, self._widget)

Expand Down

0 comments on commit 3a44850

Please sign in to comment.