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

Survey manager execute goals script #103

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
67f9c50
making spawn changes and adding double handed cargo
marinagmoreira Jun 22, 2023
719b744
Merge branch 'develop' of github.com:nasa/isaac into develop
marinagmoreira Jun 27, 2023
58176a9
Merge branch 'develop' of github.com:nasa/isaac into develop
marinagmoreira Jul 19, 2023
dfb9ad7
adding a proof of concept example of the executor
marinagmoreira Nov 9, 2023
796695b
running through isort
marinagmoreira Nov 9, 2023
e16eefe
Merge branch 'develop' of github.com:nasa/isaac into survey_manager_e…
marinagmoreira Nov 13, 2023
8456b90
committing before changing things around
marinagmoreira Nov 15, 2023
ad57def
Merge branch 'develop' of github.com:nasa/isaac into survey_manager_e…
marinagmoreira Nov 16, 2023
255143d
sockets working
marinagmoreira Nov 27, 2023
a7c09ca
fix lint
marinagmoreira Nov 27, 2023
e63ff36
adding example action node
marinagmoreira Dec 7, 2023
626a51f
update to scripts with new requirements
marinagmoreira Dec 11, 2023
1686c12
thread join safeguard
marinagmoreira Dec 12, 2023
30c761d
running isort
marinagmoreira Dec 12, 2023
c84eff2
Plansys2 on Astrobee Noetic (#107)
Bckempa Dec 12, 2023
4508014
bug fixes
marinagmoreira Dec 14, 2023
649ea5c
fixes
marinagmoreira Dec 14, 2023
2647bac
Update ci_pr.yml
marinagmoreira Dec 14, 2023
a881ffa
Merge branch 'survey_manager' of github.com:nasa/isaac into survey_ma…
marinagmoreira Dec 14, 2023
d7ea2f5
moving executor to different package hierarchy
marinagmoreira Dec 21, 2023
e58c7f4
Merge branch 'develop' of github.com:nasa/isaac into survey_manager_e…
marinagmoreira Jan 5, 2024
b8ae5aa
consolidating packages; action compiling
marinagmoreira Jan 5, 2024
2376fc6
tested action
marinagmoreira Jan 8, 2024
fb0c57c
submodule update
marinagmoreira Jan 9, 2024
adf0b81
move scripts into package
marinagmoreira Jan 9, 2024
d724113
changing static config to be more general
marinagmoreira Jan 9, 2024
a11b640
fixing config name + install data folder
marinagmoreira Jan 9, 2024
af52e73
restoring comms to readline
marinagmoreira Jan 10, 2024
362763b
getting details sorted
marinagmoreira Jan 10, 2024
d3d3228
making output more readable
marinagmoreira Jan 10, 2024
5e89aa4
installing script to be found in robot install
marinagmoreira Jan 12, 2024
8038c1f
adding move action starting correct process
marinagmoreira Jan 15, 2024
ab97e93
adding parameters for easy testing
marinagmoreira Jan 15, 2024
55d4402
fixes on command astrobee
marinagmoreira Jan 15, 2024
9a3e191
add remaining actions + documentation
marinagmoreira Jan 17, 2024
86b7990
running isort
marinagmoreira Jan 17, 2024
8d4f72a
Use exec and waitpid instead of reading output.
bcoltin Jan 18, 2024
6a18416
Change all action nodes to use the same class.
bcoltin Jan 18, 2024
8ef602d
install all nodes
marinagmoreira Jan 18, 2024
efd9ac7
adding remote option with no parameter adjusting, we'll do panoramas …
marinagmoreira Jan 19, 2024
903105c
reset progress after one action
marinagmoreira Jan 19, 2024
adf6eb2
adding inspection lib; fixing output
marinagmoreira Jan 20, 2024
4ad2bdd
fixing robot install
marinagmoreira Jan 20, 2024
64e8bf5
tested all 5 actions in the granite table
marinagmoreira Jan 20, 2024
12663c3
remote plansys2 submodules from doxygen
marinagmoreira Jan 20, 2024
8b61b23
splitting documentation
marinagmoreira Jan 20, 2024
49add14
addressing tons of comments on PR, lab tested
marinagmoreira Jan 20, 2024
c5c76a7
Merge branch 'develop' of github.com:nasa/isaac into survey_manager_e…
marinagmoreira Jan 20, 2024
a5ca4c8
more PR reviews
marinagmoreira Jan 20, 2024
d1522ba
more PR reviews
marinagmoreira Jan 20, 2024
29ff61b
more PR reviews
marinagmoreira Jan 20, 2024
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 astrobee/behaviors/inspection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ target_link_libraries(test_pano
#############

# Mark executables and/or libraries for installation
install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}
install(TARGETS pano_survey ${PROJECT_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
Expand Down
4 changes: 2 additions & 2 deletions astrobee/behaviors/inspection/src/inspection_node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ class InspectionNode : public ff_util::FreeFlyerNodelet {
ff_msgs::MotionResultConstPtr const& result) {
// Check for invalid results
if (result == nullptr) {
ROS_ERROR_STREAM("Invalid result received Motion");
ROS_INFO_STREAM("Invalid result received Motion");
return fsm_.Update(MOTION_FAILED);
}

Expand Down Expand Up @@ -607,7 +607,7 @@ class InspectionNode : public ff_util::FreeFlyerNodelet {
if (result != nullptr)
result_.anomaly_result.push_back(result->anomaly_result);
else
ROS_ERROR_STREAM("Invalid result received Image Analysis");
ROS_INFO_STREAM("Invalid result received Image Analysis");
return fsm_.Update(NEXT_INSPECT);
}

Expand Down
66 changes: 55 additions & 11 deletions astrobee/behaviors/inspection/tools/inspection_tool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ DEFINE_bool(anomaly, false, "Send the inspection command");
DEFINE_bool(geometry, false, "Send the inspection command");
DEFINE_bool(panorama, false, "Send the inspection command");
DEFINE_bool(volumetric, false, "Send the inspection command");
DEFINE_bool(remote, false, "Whether target command is remote robot");

// General parameters
DEFINE_string(camera, "sci_cam", "Camera to use");
Expand Down Expand Up @@ -113,6 +114,7 @@ DEFINE_double(deadline, -1.0, "Action deadline timeout");
// Match the internal states and responses with the message definition
using STATE = isaac_msgs::InspectionState;
bool stopflag_ = false;
std::string feedback_old = "";

bool has_only_whitespace_or_comments(const std::string & str) {
for (std::string::const_iterator it = str.begin(); it != str.end(); it++) {
Expand Down Expand Up @@ -185,7 +187,7 @@ geometry_msgs::PoseArray ReadPosesFile(std::string file) {
quat_robot.setRPY(euler_roll * DEG2RAD, euler_pitch * DEG2RAD, euler_yaw * DEG2RAD);

} else {
std::cout << "Ignoring invalid line: " << line << std::endl;
// std::cout << "Ignoring invalid line: " << line << std::endl;
continue;
}
}
Expand All @@ -209,6 +211,8 @@ void FeedbackCallback(isaac_msgs::InspectionFeedbackConstPtr const& feedback) {
+ " -> " + feedback->state.fsm_state
+ " (" + feedback->state.fsm_subevent
+ " -> " + feedback->state.fsm_substate + ")";
if (s == feedback_old) return;
feedback_old = s;
if (s.size() < 70) s.append(70 - s.size(), ' ');
std::cout << "\r" << s.substr(0, 70) << "|Input: " << std::flush;
}
Expand Down Expand Up @@ -307,10 +311,37 @@ void SendGoal(ff_util::FreeFlyerActionClient<isaac_msgs::InspectionAction> *clie
client->SendGoal(goal);
}

bool GetlineAsync(std::istream& is, std::string& str, char delim = '\n') {
static std::string linesofar;
char inchar;
int charsread = 0;
bool lineread = false;
str = "";

do {
charsread = is.readsome(&inchar, 1);
if (charsread == 1) {
// if the delimiter is read then return the string so far
if (inchar == delim) {
str = linesofar;
linesofar = "";
lineread = true;
} else { // otherwise add it to the string so far
linesofar.append(1, inchar);
}
}
} while (charsread != 0 && !lineread && !!stopflag_);

return lineread;
}

void GetInput(ff_util::FreeFlyerActionClient<isaac_msgs::InspectionAction> *client) {
while (!stopflag_ && ros::ok()) {
std::string line, val;
std::getline(std::cin, line);

if (!GetlineAsync(std::cin, line))
continue;

std::string s;
try {
switch (std::stoi(line)) {
Expand All @@ -327,7 +358,7 @@ void GetInput(ff_util::FreeFlyerActionClient<isaac_msgs::InspectionAction> *clie
SendGoal(client);
s = "\r Input: " + line + ") Pausing";
if (s.size() < 80) s.append(80 - s.size(), ' ');
std::cout << s << std::flush;
std::cout << s << std::endl;
break;
case 2:
FLAGS_pause = false;
Expand All @@ -344,7 +375,7 @@ void GetInput(ff_util::FreeFlyerActionClient<isaac_msgs::InspectionAction> *clie
SendGoal(client);
s = "\r Input: " + line + ") Pausing and repeating pose (needs resume)";
if (s.size() < 80) s.append(80 - s.size(), ' ');
std::cout << s << std::flush;
std::cout << s << std::endl;
break;
case 4:
FLAGS_pause = false;
Expand All @@ -354,7 +385,7 @@ void GetInput(ff_util::FreeFlyerActionClient<isaac_msgs::InspectionAction> *clie
SendGoal(client);
s = "\r Input: " + line + ") Pausing and skipping pose (needs resume)";
if (s.size() < 80) s.append(80 - s.size(), ' ');
std::cout << s << std::flush;
std::cout << s << std::endl;
break;
case 5:
FLAGS_pause = false;
Expand All @@ -365,7 +396,7 @@ void GetInput(ff_util::FreeFlyerActionClient<isaac_msgs::InspectionAction> *clie
SendGoal(client);
s = "\r Input: " + line + ") Pausing and saving (needs resume)";
if (s.size() < 80) s.append(80 - s.size(), ' ');
std::cout << s << std::flush;
std::cout << s << std::endl;
break;
default:
s = "\r Input: " + line + ") Invalid option";
Expand Down Expand Up @@ -424,20 +455,22 @@ int main(int argc, char *argv[]) {
// Create a node handle
ros::NodeHandle nh(std::string("/") + FLAGS_ns);
// Setup SWITCH action
client.SetConnectedTimeout(FLAGS_connect);
client.SetActiveTimeout(FLAGS_active);
if (!FLAGS_remote) {
client.SetConnectedTimeout(FLAGS_connect);
client.SetActiveTimeout(FLAGS_active);
client.SetConnectedCallback(std::bind(ConnectedCallback, &client));
}
client.SetResponseTimeout(FLAGS_response);
if (FLAGS_deadline > 0)
client.SetDeadlineTimeout(FLAGS_deadline);
client.SetFeedbackCallback(std::bind(FeedbackCallback,
std::placeholders::_1));
client.SetResultCallback(std::bind(ResultCallback,
std::placeholders::_1, std::placeholders::_2));
client.SetConnectedCallback(std::bind(ConnectedCallback, &client));
client.Create(&nh, ACTION_BEHAVIORS_INSPECTION);

// Configure panorama anomaly parameters
if (FLAGS_anomaly) {
if (FLAGS_anomaly && !FLAGS_remote) {
ff_util::ConfigClient cfg(&nh, NODE_INSPECTION);
cfg.Set<double>("target_distance", FLAGS_target_distance);
cfg.Set<double>("min_distance", FLAGS_min_distance);
Expand All @@ -456,7 +489,7 @@ int main(int argc, char *argv[]) {
}

// Configure panorama inspection parameters
if (FLAGS_panorama) {
if (FLAGS_panorama && !FLAGS_remote) {
ff_util::ConfigClient cfg(&nh, NODE_INSPECTION);

if (FLAGS_panorama_mode == "") {
Expand Down Expand Up @@ -503,6 +536,17 @@ int main(int argc, char *argv[]) {

// Start input thread
boost::thread inp(GetInput, &client);

if (FLAGS_remote) {
ros::Rate loop_rate(10);
ros::Time start_time = ros::Time::now();

// Spin for 3 seconds
while (ros::Time::now() - start_time < ros::Duration(3.0))
loop_rate.sleep();

SendGoal(&client);
}
// Synchronous mode
while (!stopflag_) {
ros::spinOnce();
Expand Down
66 changes: 63 additions & 3 deletions astrobee/survey_manager/survey_planner/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,83 @@
# License for the specific language governing permissions and limitations
# under the License.

cmake_minimum_required(VERSION 2.8.3)
cmake_minimum_required(VERSION 3.5)
project(survey_planner)

add_compile_options(-std=c++17)
set(CMAKE_CXX_STANDARD 17)

find_package(catkin REQUIRED)
SET(catkin2_DIR "${CMAKE_SOURCE_DIR}/../../../cmake")
find_package(catkin2 REQUIRED COMPONENTS
roscpp
ff_msgs
lifecycle
plansys2_executor
)

catkin_package(
CATKIN_DEPENDS
)

foreach( dir pddl launch)
###########
## Build ##
###########

# Specify additional locations of header files
# Your package locations should be listed before other locations
include_directories(
include
${catkin_INCLUDE_DIRS}
)

add_library(isaac_action_node src/isaac_action_node.cpp)
# Action for move
add_executable(move_action_node src/move_action_node.cpp)
target_link_libraries(move_action_node isaac_action_node ${catkin_LIBRARIES} )
# Action for dock
add_executable(dock_action_node src/dock_action_node.cpp)
target_link_libraries(dock_action_node isaac_action_node ${catkin_LIBRARIES} )
# Action for undock
add_executable(undock_action_node src/undock_action_node.cpp)
target_link_libraries(undock_action_node isaac_action_node ${catkin_LIBRARIES} )
# Action for panorama
add_executable(panorama_action_node src/panorama_action_node.cpp)
target_link_libraries(panorama_action_node isaac_action_node ${catkin_LIBRARIES} )
# Action for stereo
add_executable(stereo_action_node src/stereo_action_node.cpp)
target_link_libraries(stereo_action_node isaac_action_node ${catkin_LIBRARIES} )

#############
## Install ##
#############

# Allow other packages to use python scripts from this package
catkin_python_setup()

catkin_package()

catkin_install_python(PROGRAMS
tools/survey_planner/command_astrobee
tools/survey_planner/monitor_astrobee
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})

# Mark executables and/or libraries for installation
install(TARGETS isaac_action_node
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

# Install actions
install(TARGETS
move_action_node
dock_action_node
undock_action_node
panorama_action_node
stereo_action_node
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})

foreach( dir pddl launch data)
install( DIRECTORY ${dir}/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/${dir} )
endforeach(dir)
Loading