Skip to content

Commit db6acae

Browse files
committed
Capacitor Can run now
1 parent b2ab87c commit db6acae

File tree

4 files changed

+81
-1
lines changed

4 files changed

+81
-1
lines changed

execution/super_capacitor/CMakeLists.txt

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,38 @@ ament_target_dependencies(super_capacitor
3939
meta_hardware
4040
)
4141

42-
pluginlib_export_plugin_description_file(super_capacitor_base plugins.xml)
42+
# ament_export_libraries(
43+
# super_capacitor
44+
# )
45+
# ament_export_targets(
46+
# export_${PROJECT_NAME}
47+
# )
48+
49+
50+
51+
pluginlib_export_plugin_description_file(super_capacitor plugins.xml)
52+
53+
install(DIRECTORY launch
54+
DESTINATION share/${PROJECT_NAME}/
55+
)
56+
57+
# install(TARGETS super_capacitor
58+
# LIBRARY DESTINATION lib
59+
# )
60+
install(
61+
TARGETS super_capacitor
62+
EXPORT export_${PROJECT_NAME}
63+
ARCHIVE DESTINATION lib
64+
LIBRARY DESTINATION lib
65+
RUNTIME DESTINATION bin
66+
)
67+
68+
ament_export_libraries(
69+
super_capacitor
70+
)
71+
ament_export_targets(
72+
export_${PROJECT_NAME}
73+
)
4374

4475
if(BUILD_TESTING)
4576
find_package(ament_lint_auto REQUIRED)
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Copyright 2021 Open Source Robotics Foundation, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
16+
from launch import LaunchDescription
17+
from launch.actions import DeclareLaunchArgument, ExecuteProcess, IncludeLaunchDescription
18+
from launch.launch_description_sources import PythonLaunchDescriptionSource
19+
from launch.substitutions import Command, FindExecutable, LaunchConfiguration, PathJoinSubstitution
20+
from launch.conditions import IfCondition, UnlessCondition
21+
22+
from launch_ros.actions import Node
23+
from launch_ros.substitutions import FindPackageShare
24+
25+
# Necessary dirty work that lets us import modules from the meta_bringup package
26+
import os
27+
import sys
28+
from ament_index_python.packages import get_package_share_directory
29+
sys.path.append(os.path.join(get_package_share_directory('super_capacitor'), 'launch'))
30+
31+
def generate_launch_description():
32+
# Launch Arguments
33+
34+
node_capacitor_controller = Node(
35+
package='super_capacitor',
36+
executable='super_capacitor_node',
37+
output = "both",
38+
emulate_tty=True
39+
)
40+
41+
return LaunchDescription([
42+
node_capacitor_controller
43+
])

execution/super_capacitor/package.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
<depend>device_interface</depend>
1919
<depend>meta_hardware</depend>
2020

21+
<exec_depend>ros2launch</exec_depend>
22+
2123
<export>
2224
<build_type>ament_cmake</build_type>
2325
</export>

execution/super_capacitor/src/super_capacitor_controller.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,8 @@ void SuperCapacitorController::pub_state() {
7575
if (state.contains("cap_energy_percentage")) msg.cap_energy_percentage = state.at("cap_energy_percentage");
7676
if (state.contains("cap_state")) msg.cap_state = state.at("cap_state");
7777
state_pub_->publish(msg);
78+
}
79+
80+
SuperCapacitorController::~SuperCapacitorController() {
81+
// Destructor implementation
7882
}

0 commit comments

Comments
 (0)