Skip to content
This repository was archived by the owner on Oct 25, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
259 commits
Select commit Hold shift + click to select a range
6d95807
Alot of changes at once.. Create super simple working A*
atussak Nov 10, 2017
3fccb8b
Make separate file for Node class
atussak Nov 16, 2017
8b20973
Change graph to have higher resolution. Add functionality for adding …
atussak Nov 17, 2017
1f165ba
Add function to make plan with fewer points.
atussak Jan 9, 2018
5897557
Implement first try at obstacle avoidance
Jan 9, 2018
c40839f
Improve function to have even fewer points in plan
atussak Jan 9, 2018
b03b069
Fix spelling lol
Jan 10, 2018
2f1ab4e
Move to rosparam
Jan 10, 2018
8231634
Add rosparam support, but it does not work yet
Jan 11, 2018
3aa700a
Make outline for ROS action.
atussak Jan 11, 2018
3a17d90
Merge branch 'develop' into improvePathPlanner
atussak Jan 11, 2018
c47ab0f
Implement action for path planner
atussak Jan 11, 2018
8b660b0
Fix drone-to-obstacle angle calculation
Jan 12, 2018
c23361c
Fix bugs in path planner node
atussak Jan 12, 2018
1d9be29
Add function to confirm existing plan
atussak Jan 13, 2018
8fa9a64
Angle and distance calculation fix
Jan 13, 2018
4bf8bfa
Obstacle was avoided in gazebo
Jan 18, 2018
ef9132f
Make resolution of field optional.
atussak Jan 18, 2018
711b325
Start handling of drone outside field.
atussak Jan 22, 2018
48d1795
More seperation into to functions
Jan 29, 2018
2a09967
Add callback for refreshing obstacle coordinates.
atussak Feb 1, 2018
dfdaca4
Change from CB function parameter to global variable.
atussak Feb 1, 2018
520ef9c
Write error message for drone or target outside field.
atussak Feb 5, 2018
412d943
Create namespace for path planner
atussak Feb 6, 2018
f51f8d7
Make namespace more specific
atussak Feb 8, 2018
daeb06b
Subscribe to setpoint
atussak Feb 8, 2018
8f6d11d
Minor changes
atussak Feb 8, 2018
c7c5d3a
Merge branch 'develop' into improvePathPlanner
atussak Feb 8, 2018
b46c532
Minor changes
Feb 8, 2018
01a4157
Add em pty config file.
atussak Feb 8, 2018
bd8a147
Copy relevant code from config to planner_config
atussak Feb 8, 2018
ad97e77
Merge branch 'develop' into feature/obstaclesim
HaavardM Feb 10, 2018
886c0f6
Update config.cpp
HaavardM Feb 10, 2018
85a830f
Merge branch 'develop' into feature/obstaclesim
HaavardM Feb 10, 2018
3a1eae3
Commentpath planner node.
atussak Feb 13, 2018
5ded976
Start implementation of path planner config
atussak Feb 13, 2018
c8bee9d
Merge branch 'develop' into improvePathPlanner
HaavardM Feb 13, 2018
8a9f4d3
Add note, pluss minor changes
Feb 13, 2018
6d0281d
Merge branch 'feature/obstaclesim' of github.com:AscendNTNU/control_f…
Feb 13, 2018
609bf42
Fix mind blowing bug
Feb 13, 2018
d694d9a
Fix bug in angle calculation.
Feb 15, 2018
eff0ac0
Fix bugs
Feb 15, 2018
3c78390
Undo commit
Feb 15, 2018
4ada387
Really undo commit
Feb 15, 2018
5ec30a9
Add launch file.
atussak Feb 15, 2018
64f6b49
Add publisher for plan.
atussak Feb 15, 2018
dd4251d
Merge branch 'improvePathPlanner' of github.com:AscendNTNU/control_fs…
atussak Feb 15, 2018
5d1e2e3
Merge branch 'develop' into improvePathPlanner
HaavardM Feb 15, 2018
51e4b11
Update node.hpp
HaavardM Feb 15, 2018
859f341
Update path_planner.cpp
HaavardM Feb 15, 2018
4c418ca
Change destination margin and add exact destination to plan
atussak Feb 16, 2018
f15a730
Make service for goal point
atussak Feb 16, 2018
e50cb9c
Merge branch 'improvePathPlanner' of github.com:AscendNTNU/control_fs…
atussak Feb 16, 2018
6f0be7b
Update test_path_planner_node.cpp
HaavardM Feb 16, 2018
bfae13c
Update node.cpp
HaavardM Feb 16, 2018
c2dd60c
Minor improvements
atussak Feb 17, 2018
31844ea
Merge branch 'improvePathPlanner' of github.com:AscendNTNU/control_fs…
atussak Feb 17, 2018
8dafc49
Merge branch 'develop' into improvePathPlanner
HaavardM Feb 17, 2018
cf0ff93
Simplify code
atussak Feb 18, 2018
9933532
Merge branch 'improvePathPlanner' of github.com:AscendNTNU/control_fs…
atussak Feb 18, 2018
861cced
Change from closed list to closed variable for each node
atussak Feb 18, 2018
6e56b1d
Change to euclidian heuristic
atussak Feb 18, 2018
b09f81d
Remove unneccesary code
atussak Feb 18, 2018
2a0bbda
Fix bug with nodes being eachothers parents!
atussak Feb 19, 2018
fcbda36
Use current pos instead of setpoint to check if plan is safe
atussak Feb 19, 2018
f464fca
Remove setpoint subscriber
atussak Feb 19, 2018
df6e3cf
Merge branch 'develop' into improvePathPlanner
HaavardM Feb 20, 2018
6cb3f9e
Add function for removing passed points in plan
atussak Feb 20, 2018
7bb9937
Merge branch 'improvePathPlanner' of github.com:AscendNTNU/control_fs…
atussak Feb 20, 2018
1c37e32
Prototype drone speed based avoidance zone
Feb 22, 2018
855dd87
Fix some big bugs
marvrez Feb 23, 2018
3f64f11
Prepare for unit testing
Feb 23, 2018
069cc4c
Merge branch 'develop' into feature/obstaclesim
HaavardM Feb 25, 2018
7128652
Publish time along with plan
atussak Feb 25, 2018
3d21580
Fix small bug
atussak Feb 25, 2018
c87179c
Move misplaced define to path planner file :mushroom:
atussak Feb 25, 2018
7d3ef23
Change constexpr to member variables of class
atussak Feb 25, 2018
0ef8d6d
Fix bugs :snail:
atussak Feb 25, 2018
438e185
Start work on goto state
HaavardM Feb 25, 2018
eb21aa1
Merge branch 'improvePathPlanner' into imrpvement/pathplannergoto
HaavardM Feb 25, 2018
9f2ea1f
Add tuning parameters to launch file
atussak Feb 25, 2018
9e13b03
Implements path following
HaavardM Feb 25, 2018
275bb60
Refactor type names
HaavardM Feb 25, 2018
798ac51
Add unit test for path planner indexing
atussak Feb 25, 2018
121db34
Adds ros params
HaavardM Feb 25, 2018
572c5b9
Remove uneccesary semicolon
HaavardM Feb 25, 2018
5ec81a6
Merge pull request #93 from AscendNTNU/improvement/pathplannergoto
HaavardM Feb 25, 2018
d1c0dc1
Send request type in client call
atussak Feb 25, 2018
394411c
Add request types in callback function
atussak Feb 25, 2018
ab196a5
Remove unneccesary code
atussak Feb 25, 2018
aee4c45
Merge branch 'improvePathPlanner' of github.com:AscendNTNU/control_fs…
atussak Feb 25, 2018
a745ee3
Adds on warn callback
HaavardM Feb 27, 2018
f247824
Merge branch 'develop' into improvePathPlanner
atussak Mar 1, 2018
6f0ece6
Add initializing loop
atussak Mar 1, 2018
66e4c73
Simplify iterator incrementing
atussak Mar 1, 2018
dc39620
Merge branch 'improvePathPlanner' of github.com:AscendNTNU/control_fs…
atussak Mar 1, 2018
4407629
Start unit testing
Mar 1, 2018
666a7fc
Merge branch 'feature/obstaclesim' of github.com:AscendNTNU/control_f…
Mar 1, 2018
bd688d6
Add safety check for iterator
atussak Mar 1, 2018
4675079
Simplify iterator code
atussak Mar 1, 2018
5d73a89
Remove unused inlcude
atussak Mar 1, 2018
5a19823
Print error messages
atussak Mar 1, 2018
a135a86
Improve isdestination and isstart
atussak Mar 1, 2018
14f1d11
Stamp even though new plan is not made
atussak Mar 1, 2018
e754f20
dont publish plan more thannecessary
atussak Mar 1, 2018
8a97d39
Fix timeout bug
HaavardM Mar 1, 2018
b51c990
Merge pull request #95 from AscendNTNU/improvement/obstacleinterface
HaavardM Mar 6, 2018
10c14cd
Return plan with specific end coordinate
atussak Mar 7, 2018
be369a6
Merge branch 'improvePathPlanner' of github.com:AscendNTNU/control_fs…
atussak Mar 7, 2018
95ca690
Adds sim test launch
HaavardM Mar 7, 2018
ad04307
Fix define
atussak Mar 7, 2018
1c6ca20
Get obstacles from obstacle state handler
atussak Mar 7, 2018
46a5be6
Remove old obstacles in refresh obstacles function
atussak Mar 7, 2018
6aed979
Only get obstacles if a plan is requested
atussak Mar 7, 2018
dfad330
Update current point as long as plan is requested
atussak Mar 7, 2018
00527be
Remove print
atussak Mar 7, 2018
db9c5ac
Fix bug
atussak Mar 7, 2018
0cc7765
Do not remove endpoint from plan
atussak Mar 7, 2018
682298f
Add ros info
atussak Mar 7, 2018
180e50c
Publish all points in simple plan
atussak Mar 7, 2018
268ca39
Remove printing
atussak Mar 7, 2018
a6281b1
Remove printing
atussak Mar 7, 2018
43b6c58
Make printing smarter
atussak Mar 7, 2018
149b9a4
Fix stupid print..
atussak Mar 7, 2018
dc343ae
Do not send start
atussak Mar 7, 2018
3d9684f
Update published points when plan is updated
atussak Mar 7, 2018
596e578
Change print layout
atussak Mar 7, 2018
9045bf3
Print simple plan after point is removed
atussak Mar 7, 2018
f9a3f6c
Fix bug and remove debug printing
atussak Mar 7, 2018
c89e5c4
Not needed to check if starting point is on obstacle
atussak Mar 7, 2018
5045fec
Setup for publishing to mission_debugger
Mar 7, 2018
a476aea
Fix merge conflict
Mar 7, 2018
62c91ad
Merge branch 'develop' into feature/obstaclesim
HaavardM Mar 7, 2018
d1987dc
Add unsafe zones for planning a path
atussak Mar 8, 2018
2977e9f
Add separate function for update the obstacles list
atussak Mar 8, 2018
e32aba2
Make sure iterator doesnt go outside list
atussak Mar 8, 2018
ec420e4
Dont make plan if end or start point is unsafe for planning
atussak Mar 8, 2018
d55023f
Add function for checking if line can be simplified
atussak Mar 8, 2018
6e111cf
Remove print
atussak Mar 8, 2018
5e96ca1
Add struct for obstacle data
atussak Mar 8, 2018
65edcca
Remoce unused include
atussak Mar 8, 2018
fa0e27e
Change to from obstacle_coordinates name to obstacles
atussak Mar 8, 2018
90f59d3
Add direction to the obstacles list
atussak Mar 8, 2018
a6809fd
integrate with go_to_state
Mar 8, 2018
f45d135
Merge branch 'feature/obstaclesim' of github.com:AscendNTNU/control_f…
Mar 8, 2018
72f980c
integrate with go_to_state
Mar 8, 2018
d01a35a
Readd polygon publisher
Mar 8, 2018
c49be24
Fix polygon bug
Mar 8, 2018
5db27c7
Start functionality for escaping an unsafe zone
atussak Mar 8, 2018
2cc80ed
Merge branch 'develop' into improvePathPlanner
HaavardM Mar 8, 2018
e8daf97
Merge branch 'develop' into feature/obstaclesim
Mar 8, 2018
c575842
Use obstacle math for finding escape direction for drone
atussak Mar 8, 2018
0a2f955
Integrate with obstacle_math lib
Mar 8, 2018
a3fd413
Debugging
atussak Mar 8, 2018
532b872
Debug printing
atussak Mar 8, 2018
f89eb21
Change simple plan when escaping
atussak Mar 8, 2018
72790d3
Fix comments
atussak Mar 8, 2018
06639e8
Merge branch 'develop' into feature/obstaclesim
HaavardM Mar 8, 2018
402683e
Start integration with posholdstate
Mar 8, 2018
f91a612
Merge branch 'feature/obstaclesim' of github.com:AscendNTNU/control_f…
Mar 8, 2018
5c7b0b2
Update unit test
HaavardM Mar 8, 2018
f1396c9
Add loopState to positionhold
Mar 8, 2018
ab4c12f
Merge branch 'feature/obstaclesim' of github.com:AscendNTNU/control_f…
Mar 8, 2018
e7fc569
Fix position hold init and loop
marvrez Mar 8, 2018
8ff4e7e
Change position on obstacle avoidance in poshold
Mar 9, 2018
0013744
Fix merge conflict
Mar 9, 2018
9a7b10f
Add variable for turning debug printing on and off
atussak Mar 9, 2018
26619d5
Implement responsibility flag, take 1
Mar 11, 2018
f741328
Merge branch 'develop' into improvePathPlanner
HaavardM Mar 11, 2018
d6aafd6
Add debug printing
atussak Mar 12, 2018
bb97002
FIX FATAL BUG
atussak Mar 12, 2018
fd4652b
Merge branch 'improvePathPlanner' of github.com:AscendNTNU/control_fs…
atussak Mar 12, 2018
a1a5e41
Use at instead of []
atussak Mar 12, 2018
a97488b
Debug printing
atussak Mar 12, 2018
18ef1de
Debug printing
atussak Mar 12, 2018
6217aa2
Debug printing + return from fct if point in unsafe zone
atussak Mar 12, 2018
1414ee3
Change land detector
Mar 12, 2018
ea2a667
Merge branch 'improvePathPlanner' of https://github.com/AscendNTNU/co…
Mar 12, 2018
338faed
Fix bug
atussak Mar 12, 2018
a89fb52
Merge branch 'improvePathPlanner' of https://github.com/AscendNTNU/co…
Mar 12, 2018
358fca1
Merge branch 'develop' into feature/obstaclesim
HaavardM Mar 13, 2018
61d313b
Always take responsibility on state end, fix poshold
HaavardM Mar 13, 2018
a40cc0c
implement obstacle avoidance in land_state
Mar 14, 2018
d3d9e69
Logic error, land should be checked and aborted in stateBegin!
Mar 14, 2018
2938c5d
Revert "Logic error, land should be checked and aborted in stateBegin!"
Mar 14, 2018
59b7e82
Add min/max config params to obstacle avoidance
Mar 15, 2018
1a388e4
Add defaults for new params
Mar 15, 2018
b1519b0
Remove stateEnd since it is no longer needed
Mar 15, 2018
f133374
Disable obstacle avoidance in land state.
Mar 15, 2018
c9a7bc8
Merge messed up commits from detached state into feature/obstaclesim
Mar 15, 2018
fa2ad6f
add debug printout, move is_ready_ to be protected in state_interface
Mar 15, 2018
5d5580d
Merge branch 'develop' into feature/obstaclesim
HaavardM Mar 15, 2018
4d22640
Allow empty data fields if no obstacle detected
HaavardM Mar 22, 2018
0b85e77
Merge branch 'feature/obstaclesim' of github.com:AscendNTNU/control_f…
HaavardM Mar 22, 2018
69b1380
Merge branch 'develop' into feature/obstaclesim
HaavardM Apr 5, 2018
7ee9796
Fix merge issues
HaavardM Apr 5, 2018
b0d5498
Update position_hold_state.cpp
HaavardM Apr 5, 2018
1f1d4f5
Update land_state.cpp
HaavardM Apr 5, 2018
ba79612
Fix merge issues
HaavardM Apr 5, 2018
fdaa360
Fix alignment issues
HaavardM Apr 5, 2018
bb20dff
Fix config file merge issue
HaavardM Apr 5, 2018
b3c221a
Merge branch 'feature/obstaclesim' of github.com:AscendNTNU/control_f…
HaavardM Apr 5, 2018
7460b6d
Fix state interface
Apr 5, 2018
fd79aab
Fix position hold
Apr 5, 2018
9df347e
Merge branch 'develop' into feature/obstaclesim
Apr 5, 2018
1e66e2a
Fix position hold
Apr 5, 2018
73e0afd
Merge branch 'develop' into feature/obstaclesim
HaavardM Apr 5, 2018
a21bab9
start OA interactGB integration
Apr 5, 2018
5e64264
Merge branch 'feature/obstaclesim' of github.com:AscendNTNU/control_f…
Apr 5, 2018
f19ec2f
start OA interactGB integration
Apr 5, 2018
18e2062
manflight, blindhover integration
Apr 5, 2018
d1316c7
Merge branch 'feature/obstaclesim' of github.com:AscendNTNU/control_f…
Apr 5, 2018
2b5561d
Fix bug in position hold init
Apr 5, 2018
1dad0ea
Merge remote-tracking branch 'origin/develop' into feature/obstaclesim
Apr 5, 2018
7cb7137
Circular zones, local position maybe?
Apr 6, 2018
1b7b3c5
Fix bugs and clarify
Apr 6, 2018
e2e010c
Fix bugs and clarify again
Apr 6, 2018
5bc165c
Fix local/global position bug
Apr 6, 2018
b6c6819
Fix polygon publishing
Apr 6, 2018
d2c12be
Merge branch 'develop' into feature/obstaclesim
HaavardM Apr 7, 2018
eee1aa1
Optimize with drone_direction, 1st try
Apr 10, 2018
00cd85f
Avoid obstacles using heuristic instead of 'removing' the nodes from …
atussak Apr 11, 2018
ed2bba8
Small fixes for nicer code
atussak Apr 11, 2018
a853370
Merge branch 'improvePathPlanner' of https://github.com/AscendNTNU/co…
Apr 11, 2018
c143cea
Make plan even though end or start point is close to/on an obstacle
atussak Apr 11, 2018
4c7cd30
Merge branch 'develop' into improvePathPlanner
HaavardM Apr 11, 2018
51fcd0c
Remove unused code
atussak Apr 12, 2018
28b86b7
Split up into functions
Apr 12, 2018
4662f24
Merge branch 'improvePathPlanner' of https://github.com/AscendNTNU/co…
Apr 12, 2018
172caf8
Change to local pose
atussak Apr 12, 2018
0406f9f
Merge branch 'improvePathPlanner' of https://github.com/AscendNTNU/co…
Apr 12, 2018
ec9b678
Upgrade area
Apr 12, 2018
d92a46e
Fix misplaced bracket
Apr 12, 2018
af0bfcd
Expand the unsafe zone to include the next positions of the obstacles
atussak Apr 12, 2018
001b3c8
Smarter debugging
atussak Apr 12, 2018
4e26302
Obstacles moving counter clockwise
atussak Apr 12, 2018
6898426
Merge branch 'improvePathPlanner' of https://github.com/AscendNTNU/co…
Apr 12, 2018
2e7f4d7
Be more strict on area in front of an obstacle
Apr 12, 2018
ab0ba77
Obstacle zone should be smaller than unsafe zone
atussak Apr 13, 2018
c3f0a8f
Remove old variable
atussak Apr 13, 2018
77d3dca
Fix merge conflict
atussak Apr 13, 2018
25b534a
Add unsafe zone
Apr 13, 2018
84fbdce
Merge branch 'develop' into improvePathPlanner
HaavardM Apr 14, 2018
7fbf8c8
Changes for running pathplanner on drone irl
atussak Apr 18, 2018
415f5e0
account for drone direction
Apr 18, 2018
a30a3a2
account for drone direction
Apr 18, 2018
bee2fa9
remove debug prints
Apr 19, 2018
8983862
merge and fail
Apr 19, 2018
f98ef4f
Merge branch 'develop' into test_pathplanner_obstacleavoidance
HaavardM Apr 29, 2018
96d64c0
Merge branch 'develop' into test_pathplanner_obstacleavoidance
HaavardM Apr 30, 2018
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ cmake-build-debug/
*.out
tags
.vscode
*.swp

18 changes: 18 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,26 @@ target_link_libraries(control_fsm_lib
add_executable(control_fsm_main src/nodes/control_fsm_main)
add_executable(action_interface_client src/nodes/action_interface_client.cpp)

add_library(path_planner_lib src/path_planner/path_planner src/path_planner/node)

add_executable(path_planner_node src/nodes/path_planner_node)

add_executable(test_path_planner_node src/nodes/test_path_planner_node)

## Specify libraries to link a library or executable target against

target_link_libraries(control_fsm_main control_fsm_lib)
target_link_libraries(action_interface_client ${catkin_LIBRARIES})

target_link_libraries(path_planner_node
${catkin_LIBRARIES}
control_tools_lib
path_planner_lib)

target_link_libraries(test_path_planner_node
${catkin_LIBRARIES}
control_tools_lib)

## Add cmake target dependencies of the executable
## same as for the library above
add_dependencies(control_fsm_main ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
Expand All @@ -87,6 +102,9 @@ add_dependencies(action_interface_client ${${PROJECT_NAME}_EXPORTED_TARGETS} ${c
if(CATKIN_ENABLE_TESTING)
find_package(rostest REQUIRED)
add_rostest_gtest(utest test/launch_test.test test/utest.cpp)
target_link_libraries(utest control_fsm_lib path_planner_lib)
target_link_libraries(utest control_fsm_lib)
target_link_libraries(utest ${catkin_LIBRARIS})
roslaunch_add_file_check(launch)
endif()

37 changes: 25 additions & 12 deletions control_fsm_default_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
#When is a destination reached
dest_reached_margin: 0.2,
#Topic for publishing error messages
fsm_error_topic: control/fsm/on_error,
fsm_error_topic: control/fsm/on_error,
#Topic for publishing info messages
fsm_info_topic: control/fsm/on_info,
fsm_info_topic: control/fsm/on_info,
#Topic for publishing current state
fsm_state_changed_topic: control/fsm/state_changed,
#Topic for publishing warning messages
fsm_warn_topic: control/fsm/on_warn,
fsm_warn_topic: control/fsm/on_warn,
#Altitude for optimal gb detection
gb_search_altitude: 1.0,
#Time to wait before automatic landing
Expand All @@ -38,31 +38,44 @@
#Topic for action server
action_server_topic: /control/fsm/action_server,
#When is message considered old?
message_timeout: 2.0,
message_timeout: 2.0,
#For what distances is it uneccesary to adjust yaw
no_yaw_correct_dist: 0.2,
#Safety distance
obstacle_too_close_dist: 2.0,
no_yaw_correct_dist: 0.2,
#Safety distance
obstacle_too_close_dist: 2.0,
#Require all data streams to enable FSM
require_all_streams: true,
#Require obstacle detection
require_obs_detection: true,
#Require obstacle detection
require_obs_detection: true,
#Safe altitude for hovering
safe_hover_alt: 1.0,
#Margin to determine if we're close enough to setpoint
setp_reached_margin: 0.2,
#Buffersize for status messages
status_msg_buffer_size: 10,
#Takeoff altitude
takeoff_altitude: 1.0,
takeoff_altitude: 1.0,
#Margin to determine if we're close enough to yaw setpoint
yaw_reached_margin: 0.02,
#Altitude for goto in landxy
land_xy_goto_alt: 1.0,
#Minimum flying altitude
min_in_air_alt: 0.5,
#Topic for recieving obstacle state data
obstacle_state_topic: perception/obstacles,
obstacle_state_topic: perception/obstacles/lidar,
#Margin to determine if velocity is reached
velocity_reached_margin: 0.1,
velocity_reached_margin: 0.2,
#Path planner client topic
path_planner_client_topic: /path_planner_service,
#Path planner plan topic
path_planner_plan_topic: /control/planner/plan,
#Path planner timeout
path_plan_timeout: 1.0,
#Obstacle avoidance clearance
obstacle_clearance_max: 1.1,
obstacle_clearance_min: 1.0,
#Obstacle avoidance checkradius
obstacle_clearance_checkradius: 40.0,
#Frame ID for global frame
global_frame_id: map,
#Frame ID for local frame
Expand Down
3 changes: 2 additions & 1 deletion include/control/fsm/control_fsm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ class ControlFSM {

///Handles loss of offboard mode
void handleManual();

protected:
/**
* @brief Changes the current running state
Expand All @@ -133,6 +132,8 @@ class ControlFSM {
* @param event Which event triggered the transition request
*/
void transitionTo(StateInterface& state, StateInterface* caller_p, const EventData& event);



public:
///Constructor sets default/starting state
Expand Down
24 changes: 22 additions & 2 deletions include/control/fsm/go_to_state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,24 @@
#define GO_TO_STATE_HPP
#include "state_interface.hpp"
#include <ros/ros.h>
#include <ascend_msgs/PathPlannerPlan.h>
#include <ascend_msgs/PointArrayStamped.h>
#include <memory>
#include <functional>

///Moves drone to XYZ
class GoToState : public StateInterface {
private:

///Get nodehandle, constructed on first use!
static ros::NodeHandle& getNodeHandler();
///Path planner ROS service client
ros::ServiceClient path_planner_client_;
///Path planner plan sub
ros::Subscriber path_planner_sub_;
///When was plan requested
ros::Time path_requested_stamp_;
///Last recieved plan
ascend_msgs::PointArrayStamped::ConstPtr last_plan_;

struct {
ros::Time started;
bool enabled = false;
Expand All @@ -18,7 +28,17 @@ class GoToState : public StateInterface {

///Current command
EventData cmd_;

///Is state active flag
bool is_active_ = false;

///Obstacle avoidance kicked in flag
bool obstacle_avoidance_kicked_in_ = false;

///Plan callback
void planCB(ascend_msgs::PointArrayStamped::ConstPtr msg_p);


///Local target to reach
tf2::Vector3 local_target_;
public:
Expand Down
3 changes: 3 additions & 0 deletions include/control/fsm/land_state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@
class LandState : public StateInterface {
private:
EventData cmd_;

bool obstacle_avoidance_kicked_in_ = false;
public:
LandState();
void handleEvent(ControlFSM& fsm, const EventData& event) override;
void stateBegin(ControlFSM& fsm, const EventData& event) override;
void stateInit(ControlFSM& fsm) override;
void loopState(ControlFSM& fsm) override;
std::string getStateName() const override { return "Land"; }
ascend_msgs::ControlFSMState getStateMsg() const override;
Expand Down
1 change: 1 addition & 0 deletions include/control/fsm/position_hold_state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class PositionHoldState : public StateInterface {
PositionHoldState();
void handleEvent(ControlFSM& fsm, const EventData& event) override;
void stateBegin(ControlFSM& fsm, const EventData& event) override;
void stateInit(ControlFSM& fsm) override;
std::string getStateName() const override { return "Position hold"; }
ascend_msgs::ControlFSMState getStateMsg() const override;
const mavros_msgs::PositionTarget* getSetpointPtr() override;
Expand Down
30 changes: 15 additions & 15 deletions include/control/fsm/state_interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@

/** @page fsm_description FSM design
* @brief Describes the design pattern
*
*
* All states inherits the StateInterface class, and the
* FSM use polymorphism to switch between different states.
*
* On transition between states, the StateInterface::stateBegin method will be called in the new state.
* FSM use polymorphism to switch between different states.
*
* On transition between states, the StateInterface::stateBegin method will be called in the new state.
* The active states StateInterface::loopState method will always run in a loop.
* The StateInterface::stateEnd method will be called before the fsm transition to another state.
*
* Transitioning between states is done with the ControlFSM::transtionTo method.
*
* FSM is not async so do not run any blocking code
*
* Transitioning between states is done with the ControlFSM::transtionTo method.
*
* FSM is not async so do not run any blocking code
* in any of these methods.
* EventData is passed by reference and is NOT guaranteed to remain in scope.
* DO NOT store event data by reference.
Expand All @@ -34,7 +34,7 @@ class ControlFSM;
///Abstract interface class inherited by all states
/*
NOTE:
FSM is not async so do not run any blocking code
FSM is not async so do not run any blocking code
in any of these methods.
EventData is passed by reference and is NOT guaranteed to remain in scope.
DO NOT store event data by reference.
Expand Down Expand Up @@ -85,22 +85,22 @@ class StateInterface {

///Handles loss of offboard mode - must be implemented by state
virtual void handleManual(ControlFSM& fsm) = 0;

///Runs on current state AFTER transition
/**stateBegin is only implemented if needed by state.*/
virtual void stateBegin(ControlFSM& fsm, const EventData& event) {}

///Runs on current state BEFORE transition
/**stateEnd is only implemented if needed by state*/
virtual void stateEnd(ControlFSM& fsm, const EventData& event) {}

///Runs state specific code
/**loopState is only implemented if needed by state*/
virtual void loopState(ControlFSM& fsm) {}

///Should return name of the state - used for debugging purposes
virtual std::string getStateName() const = 0;

///Get state message
virtual ascend_msgs::ControlFSMState getStateMsg() const = 0;

Expand All @@ -110,10 +110,10 @@ class StateInterface {

///Static interface returning iterator to first state
static std::list<StateInterface*>::const_iterator cbegin() { return getAllStatesVector()->cbegin(); }

///Static interface returning iterator to last + 1 state
static std::list<StateInterface*>::const_iterator cend() { return getAllStatesVector()->cend(); }

///Returns number of instanciated states
static size_t getNumStates() { return getAllStatesVector()->size(); }
};
Expand Down
41 changes: 41 additions & 0 deletions include/control/planner/node.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#ifndef NODE_HPP
#define NODE_HPP

class Node{
private:
float x;
float y;

// heuristic, use diagonal distance
float g;
float h;
// Sum of g and h
float f;

float parent_x = -1;
float parent_y = -1;
public:
Node(){}
Node(float x, float y, float g, float h):x(x), y(y), g(g), h(h){f = g+h;}

float getX() const {return x;}
float getY() const {return y;}
float getF() const {return f;}
float getG() const {return g;}
float getParentX() const {return parent_x;}
float getParentY() const {return parent_y;}

void setG(float g) {this->g = g;}
void setParentX(float parent_x){this->parent_x = parent_x;}
void setParentY(float parent_y){this->parent_y = parent_y;}
void updateF(float new_g);

bool obstacle = false;
bool closed = false;
bool unsafe = false;

// Implemented only for the closed list priority queue
friend bool operator< (const Node &lhs, const Node &rhs);
};

#endif // NODE_HPP
Loading