Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reference trajectory #21

Draft
wants to merge 5 commits into
base: humble-devel
Choose a base branch
from
Draft
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
32 changes: 25 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
Expand Down Expand Up @@ -31,8 +28,29 @@
*.out
*.app

# Python
*.pyc
# Colcon output
build
log
install

# Visual Studio Code files
.vscode

# Eclipse project files
.cproject
.project
.pydevproject

# Python artifacts
__pycache__/
*.py[cod]
.ipynb_checkpoints

sphinx_doc/_build

# CLion artifacts
.idea
cmake-build-debug/

# VS Code
*.vscode
# doxygen docs
doc/html/
52 changes: 52 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
cmake_minimum_required(VERSION 3.5)
project(trajectory_tracking_control)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(Eigen3 REQUIRED)

include_directories(
include
${Eigen3_INCLUDE_DIRS}
)

add_library(
trajectory_controller_lib
src/controller_node.cpp
src/trajectory_generator.cpp
)

target_compile_definitions(trajectory_controller_lib
PRIVATE "MINIMAL_COMPOSITION_DLL")
ament_target_dependencies(trajectory_controller_lib rclcpp std_msgs)

add_executable(control_node src/controller_node.cpp)

target_link_libraries(
control_node
trajectory_controller_lib
)

ament_target_dependencies(control_node rclcpp)

install(TARGETS
control_node
DESTINATION lib/${PROJECT_NAME}
)

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

ament_package()
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This repository is available under Apache-2.0 license.
24 changes: 24 additions & 0 deletions include/trajectory_tracking_control/trajectory_generator.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*

*/

#ifndef TRAJECTORY_TRACKING_CONTROL_TRAJECTORY_GENERATOR_HPP_
#define TRAJECTORY_TRACKING_CONTROL_TRAJECTORY_GENERATOR_HPP_

#include <eigen3/Eigen/Core> // MatrixXd

namespace trajectory_tracking_control {

using Eigen::MatrixXd;

class TrajectoryGenerator {
public:
void makeConstantTrajectory(double t_sampling, MatrixXd &ref_states_matrix);

private:
// void displayConstantTrajectoryInfo(double x_offset, double y_offset, double x_amp, double y_amp, double freq);
};

} // namespace trajectory_tracking_control

#endif // TRAJECTORY_TRACKING_CONTROL_TRAJECTORY_GENERATOR_HPP_
34 changes: 34 additions & 0 deletions launch/map.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import launch
import os

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


def generate_launch_description():
# Parameters
lifecycle_nodes = ['map_server']
use_sim_time = True
autostart = True

map_file = os.path.join(get_package_share_directory(
"trajectory_tracking_control"), "maps", "map.yaml")

return launch.LaunchDescription([
Node(package="nav2_map_server",
executable="map_server",
name="map_server",
output="screen",
parameters=[{"use_sim_time": use_sim_time},
{"yaml_filename": map_file}],
emulate_tty=True),
Node(
package='nav2_lifecycle_manager',
executable='lifecycle_manager',
name='lifecycle_manager',
output='screen',
emulate_tty=True,
parameters=[{'use_sim_time': True},
{'autostart': autostart},
{'node_names': lifecycle_nodes}])
])
18 changes: 18 additions & 0 deletions launch/rviz.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import launch
import os

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


def generate_launch_description():
rviz_file = os.path.join(get_package_share_directory(
"trajectory_tracking_control"), "rviz", "my.rviz")

return launch.LaunchDescription([
Node(package="rviz2",
executable="rviz2",
name="rviz2",
arguments=['-d', rviz_file],
output="screen")
])
5 changes: 5 additions & 0 deletions maps/map.pgm

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions maps/map.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
image: map.pgm
resolution: 0.050000
origin: [-10.000000, -10.000000, 0.000000]
negate: 0
occupied_thresh: 0.65
free_thresh: 0.196

24 changes: 24 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0"?>
<?xml-model
href="http://download.ros.org/schema/package_format3.xsd"
schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>trajectory_tracking_control</name>
<version>0.0.0</version>
<description>Package description</description>
<maintainer email="[email protected]">user</maintainer>
<license>License declaration</license>

<buildtool_depend>ament_cmake</buildtool_depend>
<depend>rclcpp</depend>
<depend>std_msgs</depend>

<exec_depend>ros2launch</exec_depend>

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

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
156 changes: 156 additions & 0 deletions rviz/my.rviz
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
Panels:
- Class: rviz_common/Displays
Help Height: 78
Name: Displays
Property Tree Widget:
Expanded:
- /Global Options1
- /Status1
- /Map1
- /Map1/Update Topic1
Splitter Ratio: 0.5
Tree Height: 719
- Class: rviz_common/Selection
Name: Selection
- Class: rviz_common/Tool Properties
Expanded:
- /2D Goal Pose1
- /Publish Point1
Name: Tool Properties
Splitter Ratio: 0.5886790156364441
- Class: rviz_common/Views
Expanded:
- /Current View1
Name: Views
Splitter Ratio: 0.5
- Class: rviz_common/Time
Experimental: false
Name: Time
SyncMode: 0
SyncSource: ""
Visualization Manager:
Class: ""
Displays:
- Alpha: 0.5
Cell Size: 1
Class: rviz_default_plugins/Grid
Color: 160; 160; 164
Enabled: true
Line Style:
Line Width: 0.029999999329447746
Value: Lines
Name: Grid
Normal Cell Count: 0
Offset:
X: 0
Y: 0
Z: 0
Plane: XY
Plane Cell Count: 10
Reference Frame: <Fixed Frame>
Value: true
- Alpha: 0.699999988079071
Class: rviz_default_plugins/Map
Color Scheme: map
Draw Behind: false
Enabled: true
Name: Map
Topic:
Depth: 5
Durability Policy: Volatile
Filter size: 10
History Policy: Keep Last
Reliability Policy: Reliable
Value: /map
Update Topic:
Depth: 5
Durability Policy: Transient Local
History Policy: Keep Last
Reliability Policy: Reliable
Value: /map_updates
Use Timestamp: false
Value: true
Enabled: true
Global Options:
Background Color: 48; 48; 48
Fixed Frame: map
Frame Rate: 30
Name: root
Tools:
- Class: rviz_default_plugins/Interact
Hide Inactive Objects: true
- Class: rviz_default_plugins/MoveCamera
- Class: rviz_default_plugins/Select
- Class: rviz_default_plugins/FocusCamera
- Class: rviz_default_plugins/Measure
Line color: 128; 128; 0
- Class: rviz_default_plugins/SetInitialPose
Covariance x: 0.25
Covariance y: 0.25
Covariance yaw: 0.06853891909122467
Topic:
Depth: 5
Durability Policy: Volatile
History Policy: Keep Last
Reliability Policy: Reliable
Value: /initialpose
- Class: rviz_default_plugins/SetGoal
Topic:
Depth: 5
Durability Policy: Volatile
History Policy: Keep Last
Reliability Policy: Reliable
Value: /goal_pose
- Class: rviz_default_plugins/PublishPoint
Single click: true
Topic:
Depth: 5
Durability Policy: Volatile
History Policy: Keep Last
Reliability Policy: Reliable
Value: /clicked_point
Transformation:
Current:
Class: rviz_default_plugins/TF
Value: true
Views:
Current:
Class: rviz_default_plugins/Orbit
Distance: 10
Enable Stereo Rendering:
Stereo Eye Separation: 0.05999999865889549
Stereo Focal Distance: 1
Swap Stereo Eyes: false
Value: false
Focal Point:
X: 0
Y: 0
Z: 0
Focal Shape Fixed Size: true
Focal Shape Size: 0.05000000074505806
Invert Z Axis: false
Name: Current View
Near Clip Distance: 0.009999999776482582
Pitch: 0.785398006439209
Target Frame: <Fixed Frame>
Value: Orbit (rviz)
Yaw: 0.785398006439209
Saved: ~
Window Geometry:
Displays:
collapsed: false
Height: 1016
Hide Left Dock: false
Hide Right Dock: false
QMainWindow State: 000000ff00000000fd0000000400000000000001560000035afc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d0000035a000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f0000035afc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000003d0000035a000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000009ba0000003efc0100000002fb0000000800540069006d00650100000000000009ba000002fb00fffffffb0000000800540069006d00650100000000000004500000000000000000000007490000035a00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
Selection:
collapsed: false
Time:
collapsed: false
Tool Properties:
collapsed: false
Views:
collapsed: false
Width: 2490
X: 70
Y: 473
Loading
Loading