Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion create_container_intel.bash
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ $DOCKER_COMMAND -it -d\
--privileged \
-v /dev/bus/usb/:/dev/bus/usb \
-v /dev:/dev \
-v "$PWD/docker_ws:/home/ws/src" \
-v "$PWD/workspace:/home/ws" \
-v "/media/saveasmtz/pacman/rosbags:/home/ws/src/tests" \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /run/dbus:/run/dbus:ro \
Expand Down
73 changes: 50 additions & 23 deletions workspace/src/sdv_control/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,25 @@ set(DEPENDENCIES
add_subdirectory(libs/vanttec_controllers)
ament_python_install_package(scripts)

add_executable(vel_pid_node src/control/regulators/first_order/vel_pid_node.cpp)
target_include_directories(vel_pid_node PUBLIC
add_library(tf2_lib SHARED
${CMAKE_CURRENT_SOURCE_DIR}/src/simulation/sdc1_broadcaster.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/simulation/tf2_6dof_broadcaster_ros2.cpp
)
ament_target_dependencies(tf2_lib ${DEPENDENCIES})

install(TARGETS tf2_lib
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
)

add_executable(sdc1_vel_pid_node src/control/regulators/first_order/sdc1_vel_pid_node.cpp)
target_include_directories(sdc1_vel_pid_node PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> libs/vanttec_controllers)
target_compile_features(vel_pid_node PUBLIC c_std_99 cxx_std_17)
ament_target_dependencies(vel_pid_node ${DEPENDENCIES})
target_link_libraries(vel_pid_node vanttec_controllers)
target_compile_features(sdc1_vel_pid_node PUBLIC c_std_99 cxx_std_17)
ament_target_dependencies(sdc1_vel_pid_node ${DEPENDENCIES})
target_link_libraries(sdc1_vel_pid_node vanttec_controllers)

add_executable(stanley_controller_node src/control/guidance_laws/stanley_controller_node.cpp)
target_include_directories(stanley_controller_node PUBLIC
Expand All @@ -56,35 +68,50 @@ target_compile_features(stanley_controller_node PUBLIC c_std_99 cxx_std_17)
ament_target_dependencies(stanley_controller_node ${DEPENDENCIES})
target_link_libraries(stanley_controller_node vanttec_controllers)

add_executable(sdv_kinematic_sim src/model/sdv_kinematic_sim_node.cpp)
target_include_directories(sdv_kinematic_sim PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> libs/vanttec_controllers)
target_compile_features(sdv_kinematic_sim PUBLIC c_std_99 cxx_std_17)
ament_target_dependencies(sdv_kinematic_sim ${DEPENDENCIES})
target_link_libraries(sdv_kinematic_sim vanttec_controllers)
# add_executable(sdv_kinematic_sim src/model/sdv_kinematic_sim_node.cpp)
# target_include_directories(sdv_kinematic_sim PUBLIC
# $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
# $<INSTALL_INTERFACE:include> libs/vanttec_controllers)
# target_compile_features(sdv_kinematic_sim PUBLIC c_std_99 cxx_std_17)
# ament_target_dependencies(sdv_kinematic_sim ${DEPENDENCIES})
# target_link_libraries(sdv_kinematic_sim vanttec_controllers)

add_executable(velocity_regulator_node src/control/regulators/first_order/velocity_regulator_node.cpp)
target_include_directories(velocity_regulator_node PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> libs/vanttec_controllers)
target_compile_features(velocity_regulator_node PUBLIC c_std_99 cxx_std_17)
ament_target_dependencies(velocity_regulator_node ${DEPENDENCIES})
target_link_libraries(velocity_regulator_node vanttec_controllers)
# add_executable(velocity_regulator_node src/control/regulators/first_order/velocity_regulator_node.cpp)
# target_include_directories(velocity_regulator_node PUBLIC
# $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
# $<INSTALL_INTERFACE:include> libs/vanttec_controllers)
# target_compile_features(velocity_regulator_node PUBLIC c_std_99 cxx_std_17)
# ament_target_dependencies(velocity_regulator_node ${DEPENDENCIES})
# target_link_libraries(velocity_regulator_node vanttec_controllers)

add_executable(car_tf2_broadcast_node src/model/car_tf2_broadcast_node.cpp)
# Include directories for project headers and other package headers
target_include_directories(car_tf2_broadcast_node
PUBLIC
# $<BUILD_INTERFACE:${VANTTEC_CONTROLLER_PATHS}>
$<BUILD_INTERFACE:${sdv_msgs_INCLUDE_DIRS}>
$<INSTALL_INTERFACE:include>
)
target_compile_features(car_tf2_broadcast_node PUBLIC c_std_99 cxx_std_17) # Require C99 and C++17
ament_target_dependencies(car_tf2_broadcast_node ${DEPENDENCIES})
target_link_libraries(car_tf2_broadcast_node vanttec_controllers tf2_lib)
set_target_properties(car_tf2_broadcast_node PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
)

install(TARGETS
vel_pid_node
sdc1_vel_pid_node
stanley_controller_node
sdv_kinematic_sim
velocity_regulator_node
# sdv_kinematic_sim
# velocity_regulator_node
car_tf2_broadcast_node
DESTINATION lib/${PROJECT_NAME})

install(DIRECTORY
config
launch
rviz
DESTINATION share/${PROJECT_NAME})

# Install Python executables
install(PROGRAMS
scripts/path_publisher_node.py
Expand Down
16 changes: 8 additions & 8 deletions workspace/src/sdv_control/config/car_params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@
ros__parameters:
frequency: 100
init_pose: [0.0, 0.0, 0.0] # x, y, psi
init_pose: [-63.0, -99.0, 3.1415] # x, y, psi
# init_pose: [-63.0, -99.0, 3.1415] # x, y, psi
parent_frame: "odom"
child_frame: "base_link"

# PID Controller for the VTec SDV
vel_pid_node:
ros__parameters:
Kp: 1.0
Ki: 0.01
Kd: 0.2
U_MAX: 1.0
U_MIN: -1.0
Kp: 10.
Ki: 0.0
Kd: 10.
U_MAX: 180.0
U_MIN: -180.0
enable_ramp: true
ramp_rate: 0.3
ramp_rate: 0.1

# First Order Feedback Linearization 1-DOF PID Controller for the VTec SDC1
sdc1_vel_pid_node:
ros__parameters:
Kp: 1.0
Ki: 0.01
Kd: 0.2 #0.01
D_MAX: 180
D_MAX: 90

# First Order Feedback Linearization 1-DOF ASMC Controller for the VTec SDC1
sdc1_vel_asmc_node:
Expand Down
14 changes: 7 additions & 7 deletions workspace/src/sdv_control/launch/control_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def generate_launch_description():

is_sim = DeclareLaunchArgument(
'is_simulation',
default_value = 'false',
default_value = 'true',
description = 'Defines if the application will run in simulation or in real life'
)

Expand Down Expand Up @@ -165,16 +165,16 @@ def generate_launch_description():
msg="Running in real robot mode."
),

# rviz,
rviz,
# aitsmc_node,
# asmc_node,
pid_node,
# tf2_node,
# sdv_description_launch,
# sdv_loc_launch,
tf2_node,
sdv_description_launch,
sdv_loc_launch,

# sdv_can_launch,

waypoint_handler,
car_guidance_node,
# waypoint_handler,
# car_guidance_node,
])
49 changes: 49 additions & 0 deletions workspace/src/sdv_control/launch/dynamic_model_sim_launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import os
from launch import LaunchDescription
from launch_ros.actions import Node
from ament_index_python.packages import get_package_share_directory

from launch.actions import IncludeLaunchDescription, LogInfo, DeclareLaunchArgument
from launch.substitutions import PathJoinSubstitution, LaunchConfiguration
from launch.launch_description_sources import PythonLaunchDescriptionSource

from launch_ros.substitutions import FindPackageShare

from launch.substitutions import FindExecutable
from launch.actions import ExecuteProcess
import os

from launch_ros.actions import Node
from ament_index_python.packages import get_package_share_directory
from ament_index_python.packages import get_package_share_path

from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.actions import IncludeLaunchDescription, LogInfo
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import PathJoinSubstitution
from launch.conditions import IfCondition, UnlessCondition
from launch.substitutions import Command, LaunchConfiguration

from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageShare
def generate_launch_description():
dynamic_model = Node(
package="sdv_control",
executable="sdv_dynamic_sim_node",
)

rviz = IncludeLaunchDescription(
PythonLaunchDescriptionSource([
PathJoinSubstitution([
FindPackageShare('sdv_description'),
'launch',
'rviz_launch.py'
])
]),
)

return LaunchDescription([
rviz,
dynamic_model,
])
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import os

from ament_index_python.packages import get_package_share_directory

from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription, LogInfo, DeclareLaunchArgument
from launch.substitutions import PathJoinSubstitution, LaunchConfiguration
from launch.launch_description_sources import PythonLaunchDescriptionSource

from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageShare

from launch.conditions import IfCondition, UnlessCondition

def generate_launch_description():

car_params = os.path.join(
get_package_share_directory('sdv_control'),
'config',
'car_params.yaml'
)

pid_node = Node(
package='sdv_control',
executable='vel_pid_node',
parameters=[car_params],
output='screen',
emulate_tty=True,
arguments=[('__log_level:=debug')],
)

foxglove_bridge = Node(
name="foxglove_bridge",
package="foxglove_bridge",
executable="foxglove_bridge")

can_node = Node(
package='sdv_can',
executable='sdv_can_node',
)

dynamic_model_sim_launch = IncludeLaunchDescription(
PythonLaunchDescriptionSource([
PathJoinSubstitution([
FindPackageShare('sdv_control'),
'launch',
'dynamic_model_sim_launch.py'
])
])
)

return LaunchDescription([
pid_node,
foxglove_bridge,
# can_node,
dynamic_model_sim_launch,
])
70 changes: 0 additions & 70 deletions workspace/src/sdv_control/launch/model_launch.py

This file was deleted.

2 changes: 1 addition & 1 deletion workspace/src/sdv_control/libs/vanttec_controllers
Submodule vanttec_controllers updated 50 files
+1 −0 .gitignore
+14 −2 CMakeLists.txt
+49 −9 README.md
+16 −16 src/controllers/control_laws/PID/first_order/pid.cpp
+13 −19 src/controllers/control_laws/PID/first_order/pid.hpp
+41 −39 src/controllers/control_laws/PID/second_order/pid.cpp
+21 −29 src/controllers/control_laws/PID/second_order/pid.hpp
+26 −0 src/controllers/feedback_linearization/PID/first_order/fblin_pid.cpp
+7 −8 src/controllers/feedback_linearization/PID/first_order/fblin_pid.hpp
+1 −1 src/controllers/feedback_linearization/PID/second_order/fblin_6dof_pid.cpp
+0 −0 src/controllers/feedback_linearization/PID/second_order/fblin_6dof_pid.hpp
+0 −35 src/controllers/feedback_linearization/PID_based/first_order/fblin_pid.cpp
+0 −0 src/controllers/feedback_linearization/SMC/AITSMC/first_order/fblin_aitsmc.cpp
+0 −0 src/controllers/feedback_linearization/SMC/AITSMC/first_order/fblin_aitsmc.hpp
+0 −0 src/controllers/feedback_linearization/SMC/ASMC/first_order/fblin_asmc.cpp
+0 −0 src/controllers/feedback_linearization/SMC/ASMC/first_order/fblin_asmc.hpp
+0 −0 src/controllers/feedback_linearization/SMC/ASMC/tochecksecond_order/6dof_asmc.cpp
+0 −0 src/controllers/feedback_linearization/SMC/ASMC/tochecksecond_order/6dof_asmc.hpp
+0 −0 src/controllers/feedback_linearization/SMC/tocheckANTSMC/6dof_antsmc.cpp
+0 −0 src/controllers/feedback_linearization/SMC/tocheckANTSMC/6dof_antsmc.hpp
+4 −4 src/controllers/feedback_linearization/base/fb_lin_control.cpp
+11 −9 src/controllers/feedback_linearization/base/fb_lin_control.hpp
+0 −0 src/controllers/feedback_linearization/model_based/SDCs/path_following/DELETE
+0 −0 src/controllers/feedback_linearization/model_based/SDCs/regulators/vtec_sdc1_aitsmc.cpp
+0 −0 src/controllers/feedback_linearization/model_based/SDCs/regulators/vtec_sdc1_aitsmc.hpp
+0 −0 src/controllers/feedback_linearization/model_based/SDCs/regulators/vtec_sdc1_asmc.cpp
+0 −0 src/controllers/feedback_linearization/model_based/SDCs/regulators/vtec_sdc1_asmc.hpp
+34 −0 src/controllers/feedback_linearization/model_based/SDCs/regulators/vtec_sdc1_pid.cpp
+29 −0 src/controllers/feedback_linearization/model_based/SDCs/regulators/vtec_sdc1_pid.hpp
+0 −0 src/controllers/feedback_linearization/model_based/SDCs/trajectory_trackers/DELETE
+1 −1 src/controllers/feedback_linearization/model_based/UUVs/trajectory_trackers/vtec_u4_6dof_in_pid_tracker.cpp
+1 −1 src/controllers/feedback_linearization/model_based/UUVs/trajectory_trackers/vtec_u4_6dof_in_pid_tracker.hpp
+0 −50 src/controllers/feedback_linearization/model_based_controllers/SDCs/regulators/vtec_sdc1_pid.cpp
+0 −33 src/controllers/feedback_linearization/model_based_controllers/SDCs/regulators/vtec_sdc1_pid.hpp
+17 −39 src/dynamic_models/ground_vehicles/car_like/base/car_3dof_dynamic_model.cpp
+11 −12 src/dynamic_models/ground_vehicles/car_like/base/car_3dof_dynamic_model.hpp
+7 −7 src/dynamic_models/ground_vehicles/car_like/vehicles/vtec_sdc1.cpp
+2 −3 src/dynamic_models/ground_vehicles/car_like/vehicles/vtec_sdc1.hpp
+0 −31 src/simulation/base/tf2_6dof_broadcaster_ros2.cpp
+0 −54 src/simulation/base/tf2_6dof_broadcaster_ros2.hpp
+0 −68 src/simulation/car_tfs/sdc1_broadcaster.cpp
+0 −37 src/simulation/car_tfs/sdc1_broadcaster.hpp
+0 −0 src/simulation/tf2_6dof_broadcaster.cpp
+0 −0 src/simulation/tf2_6dof_broadcaster.hpp
+0 −34 src/utils/utils.cpp
+13 −0 src/utils/utils.hpp
+21 −11 tests/controllers/control_laws/pid_first_order_test.cpp
+76 −0 tests/controllers/feedback_linearization/fblin_pid_test.cpp
+51 −0 tests/controllers/feedback_linearization/fblin_test.cpp
+51 −0 tests/controllers/feedback_linearization/vtec_sdc1_pid_test.cpp
7 changes: 7 additions & 0 deletions workspace/src/sdv_control/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<maintainer email="aa@mail.com">root</maintainer>
<license>TODO: License declaration</license>

<buildtool_depend>ament_cmake</buildtool_depend>
<buildtool_depend>ament_cmake_ros</buildtool_depend>
<buildtool_depend>ament_cmake_python</buildtool_depend>

Expand All @@ -23,6 +24,12 @@
<depend>rclcpp</depend>
<depend>rclpy</depend>

<exec_depend>launch</exec_depend>
<exec_depend>launch_ros</exec_depend>
<exec_depend>visualization_msgs</exec_depend>
<exec_depend>tf2_geometry_msgs</exec_depend>
<exec_depend>ros2launch</exec_depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>

Expand Down
Loading