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
191 commits
Select commit Hold shift + click to select a range
7d188a4
Begins implementation of ground robot states
HaavardM Feb 11, 2018
4104689
Merge branch 'develop' into feature/landgbstate
HaavardM Feb 17, 2018
bad65dc
Merge branch 'develop' into feature/landgbstate
HaavardM Feb 19, 2018
a4248d9
Add ground robot handler
HaavardM Feb 19, 2018
7012251
Fix bug and add param
HaavardM Feb 19, 2018
4789d59
Fix typo
HaavardM Feb 19, 2018
319675a
Adds gb_id test
HaavardM Feb 19, 2018
c72b204
Remove track_gb state, and add manual flight transition
HaavardM Feb 19, 2018
aa8ef1c
Adds first draft of the local state machine design.
oestby Feb 22, 2018
711e601
Adds struct for controlling local state.
oestby Feb 22, 2018
20bdbf4
Adds a local state machine for the gb interact class.
oestby Feb 24, 2018
8aa4085
Merge branch 'develop' into feature/landgbstate
HaavardM Feb 25, 2018
204f501
Removes some if statements that might be unnecessary.
oestby Feb 25, 2018
9033fd6
Merge pull request #94 from AscendNTNU/feature/landgbstate
oestby Feb 25, 2018
5362bca
Merge branch 'develop' into feature/landgbstate
HaavardM Feb 25, 2018
5aa77f2
Removes some errors using math funcitons.
oestby Feb 25, 2018
b9389a2
Fixes usage of geometry_msgs and typos.
oestby Feb 25, 2018
971d7eb
Adds workaround for passing 'this' into non member function.
oestby Feb 25, 2018
6994b4c
This commit adds the workaround.
oestby Feb 25, 2018
ed9045e
Adds missing semicolons and dummy variables.
oestby Feb 25, 2018
96f6561
Moves state transitions from free functions to members.
oestby Feb 26, 2018
d0d4fa7
See last commit.
oestby Feb 26, 2018
54d85b8
Adds more control to the transitions.
oestby Feb 26, 2018
cd03bb1
Renames dummy variable.
oestby Feb 26, 2018
aac97c8
Removes unused function arguments.
oestby Feb 26, 2018
b3cef7b
Adding a few consts and a fixes getting drone pose.
oestby Feb 26, 2018
65462f5
Adds state transitions to interactgb
HaavardM Feb 27, 2018
dbab428
Implemented the basic for the interception algorithm
chrisabr Mar 4, 2018
525ff66
Merge branch 'feature/landgbstate' of https://github.com/AscendNTNU/c…
chribrom Mar 5, 2018
082ff75
Merge with branch such that ground bot handler is included
chribrom Mar 5, 2018
842bbe6
Made such that the messages are taken in as parameters to the functio…
chribrom Mar 5, 2018
360f114
Merge branch 'feature/landgbstate' into feature/landgbstate-ism
HaavardM Mar 6, 2018
7cfa148
Removes trailing underscores.
oestby Mar 6, 2018
a886b0e
Adds const reference to function parameters.
oestby Mar 6, 2018
5ca3ee3
Revert "Adds const reference to function parameters."
oestby Mar 6, 2018
fe1c197
Adds const references, style and some improvements.
oestby Mar 6, 2018
42481cb
Merge branch 'feature/landgbstate-ism' of github.com:AscendNTNU/contr…
oestby Mar 6, 2018
3bdff97
Adds a typedefs and shortens lines.
oestby Mar 6, 2018
fd1e2b7
Adds even shorter line!
oestby Mar 6, 2018
a5f607b
Fixes gb_pose
oestby Mar 6, 2018
17271ff
Removes unneded line.
oestby Mar 6, 2018
c13ee9f
Adds some fixes to GRstate usage and semicolon.
oestby Mar 6, 2018
5f0317d
Changing typedefs to using.
oestby Mar 6, 2018
812f1a0
Adds check for the landdetector.
oestby Mar 6, 2018
e5b55f0
Update intercept_groundbot.hpp
HaavardM Mar 7, 2018
cd507f6
Refactor to LandGBState
HaavardM Mar 7, 2018
7c4a0cd
Merge branch 'feature/landgbstate' of github.com:AscendNTNU/control_f…
HaavardM Mar 7, 2018
0bfff70
Fix merge error
HaavardM Mar 7, 2018
2791456
Merge branch 'feature/landgbstate' into feature/landgbstate-ism
HaavardM Mar 8, 2018
0eed0cc
Merge branch 'feature/landgbstate' into bearingGuidance
HaavardM Mar 8, 2018
0a2ea4f
Cleanup
chrisabr Mar 8, 2018
62055c3
Removed some prints
chrisabr Mar 8, 2018
b8a4db5
Change of one of the parameters, way to large!
chrisabr Mar 8, 2018
9a714a6
The algorithm now takes a reference in and returns a bool if data is …
chrisabr Mar 8, 2018
f507832
Converter from mocap to AIWorld message
chrisabr Mar 8, 2018
9d8e68b
Merge branch 'feature/landgbstate-ism' of github.com:AscendNTNU/contr…
oestby Mar 8, 2018
851c2b1
Adds constexpr.
oestby Mar 8, 2018
77c86c8
Corrects bracketstyle.
oestby Mar 8, 2018
167ad64
Complete refactor and modify command handling
HaavardM Mar 9, 2018
8bfc50f
Improve position hold cmd transitions
HaavardM Mar 9, 2018
febab9a
Merge branch 'feature/landgbstate' into feature/landgbstate-ism
HaavardM Mar 9, 2018
8daaf39
TAKEOFF CMD should not get special treatment
HaavardM Mar 9, 2018
8ed3b51
Merge branch 'feature/landgbstate' into bearingGuidance
HaavardM Mar 9, 2018
fffa948
Start implementing Chris's algorithm in FSM
HaavardM Mar 9, 2018
74f015b
Add new params to config
HaavardM Mar 9, 2018
c971f75
Merge branch 'develop' into feature/landgbstate
HaavardM Mar 9, 2018
387b3b3
Adds outline of new functionpointer state machine
oestby Mar 10, 2018
99e536c
Merge branch 'feature/landgbstate-ism' of github.com:AscendNTNU/contr…
oestby Mar 10, 2018
ff353a6
Functions are now working with the new statemachine
oestby Mar 10, 2018
0203a04
Adds the other functions, comments and a state variable
oestby Mar 10, 2018
c8b7391
Fixes name errors and unused code.
oestby Mar 10, 2018
c5a3446
Fixes landdetector usage.
oestby Mar 10, 2018
f2bacd5
Merge branch 'feature/landgbstate' into feature/landgbstate-ism
HaavardM Mar 10, 2018
0bf6dba
Moves some checks that were illogical.
oestby Mar 10, 2018
a060d9d
Removes const from setpoint pointers.
oestby Mar 10, 2018
78862f8
Adds a const.
oestby Mar 10, 2018
c65eda0
Corrects transition logic.
oestby Mar 10, 2018
6fa528c
Names.
oestby Mar 10, 2018
51b86ee
Removes redundant if statement.
oestby Mar 10, 2018
12d5c6b
Gives the state functions direct access to setpoint_.
oestby Mar 10, 2018
3c585f8
Renames the INVALID state to ABORT state.
oestby Mar 10, 2018
482c49c
All functions should return correctly for now.
oestby Mar 10, 2018
67657fc
Merge branch 'feature/landgbstate-ism' of github.com:AscendNTNU/contr…
oestby Mar 10, 2018
87788bc
Merge branch 'feature/landgbstate' into bearingGuidance
HaavardM Mar 11, 2018
73e54e6
Merge pull request #98 from AscendNTNU/bearingGuidance
chrisabr Mar 11, 2018
a3822ed
Add documentation and namespace
HaavardM Mar 11, 2018
f8a3012
Newlines
oestby Mar 11, 2018
36fc3b9
Merges feature/landgb into feature/landgb-ism
oestby Mar 11, 2018
1233188
Take data from mocap and convert it to fake ai data
chribrom Mar 11, 2018
6d6955f
Adds altitude setpoint in recovery state.
oestby Mar 11, 2018
2becd24
Aborting landing if interception is invalid.
oestby Mar 11, 2018
cdfdbcf
Adds some comments and refractoring.
oestby Mar 11, 2018
0c75c3e
Fixes some setpoint errors.
oestby Mar 11, 2018
aef0e5a
Fixes passing arguments to intercept funciton.
oestby Mar 11, 2018
1c4ccca
Merge branch 'develop' into feature/landgbstate
HaavardM Mar 11, 2018
cc10640
Changes how altitude setpoints are set.
oestby Mar 11, 2018
538bcc7
Merge branch 'feature/landgbstate' into feature/landgbstate-ism
HaavardM Mar 11, 2018
fcef789
Fix build error and use position setpoint in recovery
HaavardM Mar 11, 2018
bb4c294
Merge branch 'develop' into feature/landgbstate
HaavardM Mar 11, 2018
d152631
Merge branch 'feature/landgbstate' into feature/landgbstate-ism
HaavardM Mar 11, 2018
28f5ef0
Fix merge issues
HaavardM Mar 11, 2018
4d77367
Cleanup
HaavardM Mar 11, 2018
dd05441
Merge pull request #97 from AscendNTNU/feature/landgbstate-ism
HaavardM Mar 11, 2018
6c8a9a8
Comment cleanup
HaavardM Mar 11, 2018
6979039
Removed typedef from struct
Mar 12, 2018
eb9e57e
Reset wrong_measurements when returning true
Mar 12, 2018
9cf5e12
Merge pull request #104 from AscendNTNU/gb_cleanup
HaavardM Mar 12, 2018
eba07ad
Merge branch 'feature/landgbstate' of github.com:AscendNTNU/control_f…
HaavardM Mar 12, 2018
6d20278
Adds landgb to debug and action server
HaavardM Mar 12, 2018
d9e1c79
Merge branch 'feature/landgbstate' into fsm_snakelab
chrisabr Mar 12, 2018
6983966
Merge pull request #105 from AscendNTNU/fsm_snakelab
HaavardM Mar 12, 2018
2005289
Merge branch 'develop' into feature/landgbstate
HaavardM Mar 12, 2018
119c41a
Timestamp landing data
Mar 12, 2018
7fb7d25
Merge branch 'feature/landgbstate' into fsm_snakelab
HaavardM Mar 12, 2018
ba3a405
Merge pull request #106 from AscendNTNU/fsm_snakelab
HaavardM Mar 12, 2018
4ac7b30
Merge branch 'feature/landgbstate' of https://github.com/AscendNTNU/c…
HaavardM Mar 12, 2018
091e61b
If close enough visible and downward tracked true
Mar 12, 2018
22e7a57
Merge branch 'feature/landgbstate' into fsm_snakelab
HaavardM Mar 12, 2018
6718aa0
Stupid!
Mar 12, 2018
e2b6384
Merge branch 'fsm_snakelab' of https://github.com/AscendNTNU/control_…
Mar 12, 2018
a99f70b
Merge pull request #107 from AscendNTNU/fsm_snakelab
HaavardM Mar 12, 2018
7b0bee1
Merge branch 'feature/landgbstate' of https://github.com/AscendNTNU/c…
HaavardM Mar 12, 2018
837f9d8
Dont f*ck copy paste
Mar 12, 2018
a867ca5
Check ground robot handler in preflight
HaavardM Mar 12, 2018
d60362b
Merge branch 'feature/landgbstate' of https://github.com/AscendNTNU/c…
HaavardM Mar 12, 2018
4f95d66
Adds debug message
HaavardM Mar 12, 2018
3bf6609
Add debug messages
HaavardM Mar 12, 2018
3414b7a
Merge branch 'feature/landgbstate' of https://github.com/AscendNTNU/c…
HaavardM Mar 12, 2018
b921c42
Set land detector topic
HaavardM Mar 12, 2018
fbbcded
Adds debug message.
oestby Mar 12, 2018
8b28475
Merges and adds correct debug message.
oestby Mar 12, 2018
3aad4b7
; != : STUPID
oestby Mar 12, 2018
8a7ccec
Fixes stupid.
oestby Mar 12, 2018
aceaaf8
Merge pull request #109 from AscendNTNU/landgbstate/debug-msg
HaavardM Mar 12, 2018
b18735f
Constexpr land height = 0.18
Mar 12, 2018
da42d16
Merge branch 'feature/landgbstate' into fsm_snakelab
HaavardM Mar 12, 2018
7a219e0
Merge pull request #110 from AscendNTNU/fsm_snakelab
HaavardM Mar 12, 2018
1d8633b
Double z gain, should go faster now!
Mar 12, 2018
f4bfa3d
Merge branch 'feature/landgbstate' into fsm_snakelab
HaavardM Mar 12, 2018
10d7836
Merge pull request #113 from AscendNTNU/fsm_snakelab
HaavardM Mar 12, 2018
efcdf99
Add constant downward speed
Mar 12, 2018
8d4148d
Merge branch 'feature/landgbstate' into fsm_snakelab
HaavardM Mar 12, 2018
46c75b1
Stupid!
Mar 12, 2018
ee084ca
Merge branch 'fsm_snakelab' of https://github.com/AscendNTNU/control_…
Mar 12, 2018
75d5636
Merge pull request #114 from AscendNTNU/fsm_snakelab
HaavardM Mar 12, 2018
736d676
Recover will now go to safe hover altitude before transition.
oestby Mar 12, 2018
b304c84
Stupid.
oestby Mar 12, 2018
123ed95
Update config
HaavardM Mar 12, 2018
aa6cf79
Merge branch 'feature/landgbstate' into landgbstate/recover-height-fix
HaavardM Mar 12, 2018
93a5531
Code cleanup and add timeout check
HaavardM Mar 13, 2018
d3f9551
Merge branch 'feature/landgbstate' into landgbstate/recover-height-fix
HaavardM Mar 14, 2018
207cc71
Merge pull request #115 from AscendNTNU/landgbstate/recover-height-fix
HaavardM Mar 14, 2018
ee23503
Adds framework of the init state and funciton.
oestby Apr 5, 2018
1beb608
Adds working servicecall to the transform service.
oestby Apr 5, 2018
338b8c9
Gb estimator class
Apr 5, 2018
1faf79a
Add gb estimation node
HaavardM Apr 5, 2018
e40f65c
Merge branch 'gb_estimator' into feature/gbposeestimation
HaavardM Apr 5, 2018
e565b9d
Adds ground robot id to the service call.
oestby Apr 5, 2018
c4e601a
Now transforms back to local frame before transition to poshold
oestby Apr 5, 2018
e8b5db0
Adds transform_gb_service to config
oestby Apr 5, 2018
14862bf
dds gbposeestimation
HaavardM Apr 5, 2018
8d7e2e3
Fixes merge conflict.
oestby Apr 5, 2018
ee7a31c
Fixes build issues.
oestby Apr 5, 2018
c899f8e
Merge pull request #121 from AscendNTNU/landgbstate-merge
oestby Apr 5, 2018
9b7e8a9
Merge pull request #122 from AscendNTNU/feature/landgbstate
oestby Apr 5, 2018
8e51981
Merge branch 'develop' into feature/landgbstate
HaavardM Apr 5, 2018
889d24f
Merge branch 'feature/landgbstate' into feature/gbposeestimation
HaavardM Apr 5, 2018
4aaf1cd
Delays the GBFRAME transform and removes the now unused init state.
oestby Apr 6, 2018
a24ac0f
Merge branch 'feature/landgbstate' into feature/ism-transform-service
oestby Apr 6, 2018
6e9ef8f
Merge branch 'develop' into feature/landgbstate
HaavardM Apr 6, 2018
ebee472
Merge branch 'feature/landgbstate' into feature/gbposeestimation
HaavardM Apr 8, 2018
8cf3a9b
Adds warning messages and possible aborts if the transforms are unava…
oestby Apr 8, 2018
7506463
Merge branch 'feature/ism-transform-service' of github.com:AscendNTNU…
oestby Apr 8, 2018
c18929a
Merge branch 'feature/landgbstate' into feature/ism-transform-service
HaavardM Apr 8, 2018
0f28971
Adds a setup state to do the transform to GB frame
oestby Apr 8, 2018
41bcc94
Adds more verbose error messages.
oestby Apr 8, 2018
9a90eff
Merge branch 'feature/ism-transform-service' of github.com:AscendNTNU…
oestby Apr 8, 2018
6fd504d
Sets blind hover flags if the transforms should fail.
oestby Apr 8, 2018
ed71282
Oops
oestby Apr 8, 2018
c20bb6f
Moves the blindhover setpoint flagging to a better place
oestby Apr 8, 2018
b6b45fa
Update land_gb_state.cpp
HaavardM Apr 8, 2018
be6e2e6
Merge pull request #120 from AscendNTNU/feature/ism-transform-service
HaavardM Apr 8, 2018
437bac1
Merge branch 'feature/landgbstate' into feature/gbposeestimation
HaavardM Apr 8, 2018
317cf05
Merge pull request #125 from AscendNTNU/feature/gbposeestimation
HaavardM Apr 8, 2018
528feae
Merge branch 'develop' into feature/landgbstate
HaavardM Apr 18, 2018
3e405b6
Fix estimator bugs
HaavardM Apr 18, 2018
99b33c6
Merge branch 'develop' into feature/landgbstate
HaavardM Apr 30, 2018
c7ef6f0
Removes GB transform and adds new low altitude state
oestby Apr 30, 2018
07acf1e
Merge branch 'feature/landgbstate' of github.com:AscendNTNU/control_f…
oestby Apr 30, 2018
0df0321
Adds the low altitude state implementation and removes CMake stuff
oestby Apr 30, 2018
57723eb
Merge pull request #141 from AscendNTNU/landgbstate/low-alt-rework
chrisabr May 8, 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
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,22 @@ 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_executable(fake_snake_data src/nodes/mocapConverter.cpp)

## 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(fake_snake_data ${catkin_LIBRARIES})

## 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})
add_dependencies(control_fsm_lib ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
add_dependencies(control_tools_lib ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
add_dependencies(action_interface_client ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
add_dependencies(fake_snake_data ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

if(CATKIN_ENABLE_TESTING)
find_package(rostest REQUIRED)
add_rostest_gtest(utest test/launch_test.test test/utest.cpp)
Expand Down
12 changes: 12 additions & 0 deletions control_fsm_default_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
distance_sensor_topic: /mavros/distance_sensor/hrlv_ez4_pub,
#Topic for recieving mavros state
mavros_state_topic: /mavros/state,
#Topic for recieving ground robot states
ground_robot_state_topic: /ai/world_observation,
#Topic for debug server
debug_server_topic: /control/fsm/debug_server,
#Topic for action server
Expand Down Expand Up @@ -63,6 +65,16 @@
obstacle_state_topic: perception/obstacles,
#Margin to determine if velocity is reached
velocity_reached_margin: 0.1,
#TODO Add description
land_gb_tracking_xy: 2.0,
#TODO Add description
land_gb_tracking_z: 0.04,
#TODO Add description
land_gb_interception_xy: 2.0,
#TODO Add description
land_gb_interception_z: 0.01,
#TODO Add description
land_gb_max_distance: 2.0,
#Frame ID for global frame
global_frame_id: map,
#Frame ID for local frame
Expand Down
9 changes: 3 additions & 6 deletions include/control/fsm/control_fsm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
#include "takeoff_state.hpp"
#include "blind_hover_state.hpp"
#include "position_hold_state.hpp"
#include "track_gb_state.hpp"
#include "interact_gb_state.hpp"
#include "land_gb_state.hpp"
#include "go_to_state.hpp"
#include "land_state.hpp"
#include "manual_flight_state.hpp"
Expand All @@ -33,8 +32,7 @@ class ControlFSM {
friend class TakeoffState;
friend class BlindHoverState;
friend class PositionHoldState;
friend class TrackGBState;
friend class InteractGBState;
friend class LandGBState;
friend class GoToState;
friend class LandState;
friend class ManualFlightState;
Expand All @@ -46,8 +44,7 @@ class ControlFSM {
static TakeoffState TAKEOFF_STATE;
static BlindHoverState BLIND_HOVER_STATE;
static PositionHoldState POSITION_HOLD_STATE;
static TrackGBState TRACK_GB_STATE;
static InteractGBState INTERACT_GB_STATE;
static LandGBState LAND_GB_STATE;
static GoToState GO_TO_STATE;
static LandState LAND_STATE;
static ManualFlightState MANUAL_FLIGHT_STATE;
Expand Down
20 changes: 14 additions & 6 deletions include/control/fsm/event_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ enum class RequestType {
POSHOLD,
GOTO, //GOTO XYZ
LAND,
TRACKGB, //Track/follow ground robot
INTERGB, //Interact with ground robot (tap)
LANDGB, //Interact with ground robot (tap)
MANUALFLIGHT
};

Expand All @@ -43,7 +42,7 @@ enum class CommandType {
LANDXY, //Request part of command to land at XY
GOTOXYZ, //Reqeust part of going to specified XYZ
TAKEOFF,
//LANDGB //Request part of interacting with ground robot
LANDGB //Request part of interacting with ground robot
};

///Defines a position goal
Expand Down Expand Up @@ -93,7 +92,8 @@ class EventData {
PositionGoal setpoint_target;
///If event is a command, what type?
CommandType command_type = CommandType::NONE; //No command as default

///Ground robot id
int gb_id = -1;
///Setter function for complete callback
void setOnCompleteCallback(std::function<void()> callback) { on_complete_ = std::move(callback); }
///Setter function for error callback
Expand All @@ -114,6 +114,10 @@ class EventData {
bool isValidRequest() const { return (event_type == EventType::REQUEST && request != RequestType::NONE); }
///Chekcs if this event is a specific valid request type
bool isValidRequest(RequestType type) const { return isValidRequest() && request == type; }
///Clear event
void clear() { *this = EventData(); }
///On aborted
void abort() { eventError("ABORTED"); clear();}
};

class TakeoffCMDEvent : public EventData {
Expand Down Expand Up @@ -147,13 +151,17 @@ class GoToXYZCMDEvent : public EventData {
///Wrapper class for LandGB CMD events
class LandGBCMDEvent : public EventData {
public:
//TODO Implement event type
explicit LandGBCMDEvent(int gb) {
gb_id = gb;
event_type = EventType::COMMAND;
command_type = CommandType::LANDGB;
}
};

///Wrapper class for requests events
class RequestEvent : public EventData {
public:
RequestEvent(RequestType r) {
explicit RequestEvent(RequestType r) {
event_type = EventType::REQUEST;
request = r;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
#include "state_interface.hpp"

///Interacts with a ground robot
class InteractGBState : public StateInterface {
class LandGBState : public StateInterface {
private:
EventData cmd_;
public:
InteractGBState();
LandGBState();
void handleEvent(ControlFSM& fsm, const EventData& event) override;
void stateBegin(ControlFSM& fsm, const EventData& event) override;
void loopState(ControlFSM& fsm) override;
std::string getStateName() const override { return "InteractWithGroundRobot"; }
std::string getStateName() const override { return "LandGB"; }
const mavros_msgs::PositionTarget* getSetpointPtr() override;
ascend_msgs::ControlFSMState getStateMsg() const override;
void handleManual(ControlFSM &fsm) 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 @@ -16,6 +16,7 @@ class PositionHoldState : public StateInterface {
ascend_msgs::ControlFSMState getStateMsg() const override;
const mavros_msgs::PositionTarget* getSetpointPtr() override;
void handleManual(ControlFSM &fsm) override;
void processCommand(ControlFSM& fsm, const EventData& cmd);
};

#endif
19 changes: 0 additions & 19 deletions include/control/fsm/track_gb_state.hpp

This file was deleted.

14 changes: 14 additions & 0 deletions include/control/tools/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ class Config {
static std::string land_detector_type;
/// \fsmparam Topic for recieving obstacle positions
static std::string obstacle_state_topic;
/// \fsmparam Topic for recieving ground robot state
static std::string ground_robot_state_topic;
/// \fsmparam Topic for recieving debug service requests
static std::string debug_server_topic;
/// \fsmparam Topic for action server
Expand All @@ -91,6 +93,18 @@ class Config {
static bool require_obstacle_detection;
/// \fsmparam When is data considered old?
static double valid_data_timeout;
//"Tracking speed" in the x-y plane
static double tracking_param_xy;
//Tracking speed in the z direction
static double tracking_param_z;
//Variable that control the change of the speed when intercepting, xy-plane
static double interception_param_xy;
//Variable that control the change of the speed when intercepting, z-direction
static double interception_param_z;
// \fsmparam Variable to tweak the low boundry of interception algorithm
static double interception_low_alt_boundry;
// Maximal distance away from the roomba to run interception algorithm
static double max_distance;
/// \fsmparam Frame id for global frame
static std::string global_frame_id;
/// \fsmparam Frame id for local frame
Expand Down
17 changes: 17 additions & 0 deletions include/control/tools/gb_estimator.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <ros/ros.h>
namespace control {

class GbEstimator{
private:
float current_pos_x;
float current_pos_y;
float gb_speed;
ros::Time last_time_stamp;
bool valid;

public:
GbEstimator(float gb_x, float gb_y);
GbEstimator();
void update(const float *gb_direction, float *gb_position);
};
}
47 changes: 47 additions & 0 deletions include/control/tools/ground_robot_handler.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//
// Created by haavard on 19.02.18.
//

#ifndef CONTROL_FSM_GROUND_ROBOT_HANDLER_HPP
#define CONTROL_FSM_GROUND_ROBOT_HANDLER_HPP

#include <ros/ros.h>
#include <ascend_msgs/AIWorldObservation.h>

#include <utility>

namespace control {
class GroundRobotHandler {
using MsgType = ascend_msgs::AIWorldObservation;
public:
using GBVectorType = boost::array<ascend_msgs::GRState, 10>;
private:
///Shared instance
static std::unique_ptr<GroundRobotHandler> shared_instance_p_;
///ROS nodehandle
ros::NodeHandle n_;
///ROS subscriber to ground robot data
ros::Subscriber gb_sub_;
///Last recieved message
MsgType::ConstPtr last_gb_msg_p_;

///Callback for recieving ros data
void gbCB(MsgType::ConstPtr msg_p) { last_gb_msg_p_ = std::move(msg_p); }
///Get valid shared instance
static const GroundRobotHandler* getSharedInstancePtr();
///Constructor
GroundRobotHandler();
///Get ground robots from instance
const GBVectorType& getGroundRobots() const;

public:
static GBVectorType getCurrentGroundRobots() { return getSharedInstancePtr()->getGroundRobots(); }
///Check if ready
static bool isReady();



};
}

#endif //CONTROL_FSM_GROUND_ROBOT_HANDLER_HPP
21 changes: 21 additions & 0 deletions include/control/tools/intercept_groundbot.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef INTERCEPT_GROUNDBOT_HPP
#define INTERCEPT_GROUNDBOT_HPP

#include "control/tools/intercept_groundbot.hpp"

namespace control {
namespace gb {
/** Calculate setpoint to intercept a ground robot
* @param quad_position Drones current pose
* @param roomba_position Tracked ground robot
* @setpoint Setpoint to be modified
* @return true if setpoint is modified (all ok), false if not
*/
bool interceptGB(const geometry_msgs::PoseStamped& quad_position,
const ascend_msgs::GRState& roomba_position,
mavros_msgs::PositionTarget& setpoint);
}
}


#endif
10 changes: 5 additions & 5 deletions include/control/tools/obstacle_state_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ class ObstacleStateHandler {
void onMsgRecievedCB(ascend_msgs::DetectedRobotsGlobalPositions::ConstPtr msg_p);
///Private constructor
ObstacleStateHandler();
public:
///Get shared pointer to shared instance
static const ObstacleStateHandler* getSharedObstacleHandlerPtr();
///Get last obstacles from shared instance
static const ascend_msgs::DetectedRobotsGlobalPositions& getCurrentObstacles();
///Returns obstacles from instance
const ascend_msgs::DetectedRobotsGlobalPositions& getObstacles() const;
///Is shared instance ready?
static bool isInstanceReady();
///is current instance ready
bool isReady() const;
public:
///Get last obstacles from shared instance
static const ascend_msgs::DetectedRobotsGlobalPositions& getCurrentObstacles();
///Is shared instance ready?
static bool isInstanceReady();
};
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion launch/testdrone.launch
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<arg name="node_name" value="$(arg fsm_name)"/>
</include>
<param name="$(arg fsm_name)/require_obs_detection" value="false"/>
<param name="$(arg fsm_name)/land_detector_topic" value="/land_detector"/>
<param name="$(arg fsm_name)/land_detector_topic" value="land_detector"/>
<param name="$(arg fsm_name)/land_detector_type" value="landing_gear"/>

</launch>
19 changes: 14 additions & 5 deletions src/fsm/action_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,20 @@ void ActionServer::startLandXY(GoalSharedPtr goal_p, ControlFSM* fsm_p) {
}

void ActionServer::startLandGB(GoalSharedPtr goal_p, ControlFSM* fsm_p) {
//TODO Implement when landgb procedure is decided
ROS_WARN("[Control ActionServer] LandGB not implemented!!");
ascend_msgs::ControlFSMResult result;
action_is_running_ = false;
as_.setAborted(result);
LandGBCMDEvent land_xy_event(goal_p->target_id);
//Set callback to run on complete
land_xy_event.setOnCompleteCallback([this]() {
onActionComplete();
});
//Set callback to run on complete
land_xy_event.setOnFeedbackCallback([this](const std::string& msg) {
onActionFeedback(msg);
});
land_xy_event.setOnErrorCallback([this](const std::string& msg) {
onActionError(msg);
});
fsm_p->handleEvent(land_xy_event);
action_is_running_ = true;
}

void ActionServer::startTakeoff(GoalSharedPtr goal_p, ControlFSM* fsm_p) {
Expand Down
8 changes: 6 additions & 2 deletions src/fsm/control_fsm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
#include <control/tools/config.hpp>
#include <control/tools/logger.hpp>
#include <control/tools/obstacle_state_handler.hpp>
#include <control/tools/ground_robot_handler.hpp>

BeginState ControlFSM::BEGIN_STATE;
IdleState ControlFSM::IDLE_STATE;
TakeoffState ControlFSM::TAKEOFF_STATE;
BlindHoverState ControlFSM::BLIND_HOVER_STATE;
PositionHoldState ControlFSM::POSITION_HOLD_STATE;
TrackGBState ControlFSM::TRACK_GB_STATE;
InteractGBState ControlFSM::INTERACT_GB_STATE;
LandGBState ControlFSM::LAND_GB_STATE;
GoToState ControlFSM::GO_TO_STATE;
LandState ControlFSM::LAND_STATE;
ManualFlightState ControlFSM::MANUAL_FLIGHT_STATE;
Expand Down Expand Up @@ -134,6 +134,10 @@ bool ControlFSM::isReady() {
if (!LandDetector::isReady()) {
control::handleWarnMsg("Preflight Check: No valid land detector data!");
return false;
}
if(!control::GroundRobotHandler::isReady()) {
control::handleWarnMsg("Preflight Check: No valid ground robot data!");
return false;
}
} catch(const std::exception& e) {
///Critical bug -
Expand Down
Loading