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

ROS2 Trapezoidal planner + mobility testing #704

Merged
merged 39 commits into from
Apr 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
8f7ed31
initial work on trapezoidal, CMake and package.xml
joris997 Feb 19, 2023
81012f6
added trapezoidal launch.py file
joris997 Feb 20, 2023
42fba4e
added trapezoidal header file, using rclcpp::Time
joris997 Feb 20, 2023
e1db1ff
removed log files from most recent push
joris997 Feb 20, 2023
03dc426
changed ff_nodelet to ff_component
joris997 Feb 20, 2023
cfa00c7
removed more nodelet dependencies in package.xml and CMake
joris997 Feb 20, 2023
e262be6
removed comma in launch.py to avoid lint error?
joris997 Feb 20, 2023
af5cf7f
converted planner_trapezoid.cpp to ros2, only chaning import and rclc…
joris997 Feb 20, 2023
7035294
changed nodelet into component and rewrote core class methods, trapez…
joris997 Feb 26, 2023
f9959f2
trying to pass lint_check_cpp
joris997 Feb 26, 2023
1583e02
many minor errors, still some issues with importing config_client and…
joris997 Feb 26, 2023
8056eac
updates to actionlib, now need to pull upstream choreographer
joris997 Mar 4, 2023
42a8801
Merge branch 'ros2' into ros2-mobility
joris997 Mar 4, 2023
06479a9
upstream update
joris997 Mar 6, 2023
f557f40
push with updated CMakeLists (as general as possible) and added ament…
joris997 Mar 6, 2023
3087a00
Merge branch 'ros2' of https://github.com/nasa/astrobee into ros2-mob…
marinagmoreira Mar 21, 2023
2f94f1b
trapezoidal planner compiling
marinagmoreira Mar 22, 2023
73e521a
converting mobility - still issues
marinagmoreira Mar 22, 2023
bd45e12
mapper compiling
marinagmoreira Mar 24, 2023
01c97c1
fixing runtime errors
marinagmoreira Mar 24, 2023
fafd956
choreographer comms with control + teleop tool; control crshing
marinagmoreira Mar 24, 2023
4613305
fixing pinv
marinagmoreira Mar 28, 2023
e7e0241
debugging progress
marinagmoreira Mar 28, 2023
8c48c1b
disabling intra process communication
marinagmoreira Mar 28, 2023
c411669
fixing sim update rate
marinagmoreira Mar 29, 2023
428ce1f
adding use_sim_time
marinagmoreira Mar 29, 2023
d1a4a2b
adding _ to vars, and initializing them - was giving a ROS2 error whe…
marinagmoreira Mar 29, 2023
0adadc5
changing time method
marinagmoreira Mar 29, 2023
150d967
add check to ff_timer
marinagmoreira Mar 29, 2023
d9b34a1
uncommenting the ConfigClient code
marinagmoreira Mar 29, 2023
1a6ac4b
fixing config client build
marinagmoreira Mar 30, 2023
dfbc76a
comments from review
marinagmoreira Mar 31, 2023
b6c361b
removing old launchfiles
marinagmoreira Mar 31, 2023
bf51ab4
fixes from reviews
marinagmoreira Mar 31, 2023
1f05987
fixes from comments3
marinagmoreira Mar 31, 2023
68e0767
delete diagnostics
marinagmoreira Mar 31, 2023
d58d21d
fixing cmake dependencies + converting plangen
marinagmoreira Mar 31, 2023
6a20b7d
Merge branch 'ros2' of https://github.com/nasa/astrobee into ros2-mob…
marinagmoreira Mar 31, 2023
23c0eb7
moving logger out of planner.h
marinagmoreira Mar 31, 2023
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 @@ -89,6 +89,7 @@ astrobee/zones/*.bin
/*-rootfs
/*-kernel
/*-logs
/log
/qped.sublime-workspace
*.egg
*.egg-info
Expand Down
2 changes: 1 addition & 1 deletion astrobee/config/management/sys_monitor.config
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ nodelet_info={
{name="llp_disk_monitor", manager="llp_monitors", type="disk_monitor/DiskMonitor"},
{name="localization_manager", manager="mlp_localization", type="localization_manager/LocalizationManagerNodelet"},
{name="localization_node", manager="mlp_vision", type="localization_node/LocalizationNodelet"},
{name="mapper", manager="mlp_mapper", type="mapper/MapperNodelet"},
{name="mapper", manager="mlp_mapper", type="mapper/MapperComponent"},
{name="marker_tracking", manager="mlp_vision", type="marker_tracking_node/MarkerTrackingNodelet"},
{name="mlp_cpu_mem_monitor", manager="mlp_monitors", type="cpu_mem_monitor/CpuMemMonitor"},
{name="mlp_disk_monitor", manager="mlp_monitors", type="disk_monitor/DiskMonitor"},
Expand Down
10 changes: 4 additions & 6 deletions astrobee/launch/robot/LLP.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,18 @@ def generate_launch_description():
name='llp_gnc',
namespace='',
package='rclcpp_components',
executable='component_container',
executable='component_container_mt',
composable_node_descriptions=[
ComposableNode(
package='ctl',
plugin='ctl::CtlComponent',
name='ctl',
extra_arguments=[{'use_intra_process_comms': True}]
),
extra_arguments=[{'use_intra_process_comms': False, 'use_sim_time': True}]),
ComposableNode(
package='fam',
plugin='fam::FamComponent',
name='fam',
extra_arguments=[{'use_intra_process_comms': True}]
)
extra_arguments=[{'use_intra_process_comms': False, 'use_sim_time': True}]),
]
),
ComposableNodeContainer(
Expand Down Expand Up @@ -195,7 +193,7 @@ def generate_launch_description():
package='light_flow',
plugin='light_flow::LightFlowComponent',
name='light_flow',
extra_arguments=[{'use_intra_process_comms': True}]),
extra_arguments=[{'use_intra_process_comms': False, 'use_sim_time': True}]),
]
),
])
2 changes: 1 addition & 1 deletion astrobee/launch/robot/MLP.launch
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@

<!-- Mobility -->
<include file="$(find ff_util)/launch/ff_nodelet.launch">
<arg name="class" value="mapper/MapperNodelet" />
<arg name="class" value="mapper/MapperComponent" />
<arg name="name" value="mapper" />
<arg name="manager" value="mlp_mapper" />
<arg name="spurn" value="$(arg spurn)" />
Expand Down
43 changes: 21 additions & 22 deletions astrobee/launch/robot/MLP.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ def generate_launch_description():
package='localization_manager',
plugin='localization_manager::LocalizationManagerComponent',
name='localization_manager',
),
extra_arguments=[{'use_intra_process_comms': False, 'use_sim_time': True}]),
ComposableNode(
package='ground_truth_localizer',
plugin='ground_truth_localizer::GroundTruthLocalizerComponent',
name='ground_truth_localizer'
),
name='ground_truth_localizer',
extra_arguments=[{'use_intra_process_comms': False, 'use_sim_time': True}]),
# ComposableNode(
# package='image_sampler',
# plugin='image_sampler::ImageSampler',
Expand All @@ -81,11 +81,11 @@ def generate_launch_description():
executable='component_container',
condition=UnlessCondition(LaunchConfiguration("gtloc")),
composable_node_descriptions=[
# ComposableNode(
# package='localization_manager',
# plugin='localization_manager::LocalizationManagerNodelet',
# name='localization_manager',
# extra_arguments=[{'use_intra_process_comms': True}]),
ComposableNode(
package='localization_manager',
plugin='localization_manager::LocalizationManagerNodelet',
name='localization_manager',
extra_arguments=[{'use_intra_process_comms': False, 'use_sim_time': True}]),
# ComposableNode(
# package='image_sampler',
# plugin='image_sampler::ImageSampler',
Expand Down Expand Up @@ -222,11 +222,11 @@ def generate_launch_description():
package='rclcpp_components',
executable='component_container',
composable_node_descriptions=[
# ComposableNode(
# package='mapper',
# plugin='mapper::MapperNodelet',
# name='mapper',
# extra_arguments=[{'use_intra_process_comms': True}]),
ComposableNode(
package='mapper',
plugin='mapper::MapperComponent',
name='mapper',
extra_arguments=[{'use_intra_process_comms': False, 'use_sim_time': True}]),
]
),
ComposableNodeContainer(
Expand Down Expand Up @@ -348,18 +348,17 @@ def generate_launch_description():
package='choreographer',
plugin='choreographer::ChoreographerComponent',
name='choreographer',
extra_arguments=[{'use_intra_process_comms': False}]),
# ComposableNode(
# package='planner_trapezoidal',
# plugin='planner_trapezoidal::PlannerTrapezoidalNodelet',
# name='planner_trapezoidal',
# extra_arguments=[{'use_intra_process_comms': True}]),
extra_arguments=[{'use_intra_process_comms': False, 'use_sim_time': True}]),
ComposableNode(
package='planner_trapezoidal',
plugin='planner_trapezoidal::PlannerTrapezoidalComponent',
name='planner_trapezoidal',
extra_arguments=[{'use_intra_process_comms': False, 'use_sim_time': True}]),
ComposableNode(
package='framestore',
plugin='mobility::FrameStore',
name='framestore',
# extra_arguments=[{'use_intra_process_comms': True}]
),
extra_arguments=[{'use_intra_process_comms': False, 'use_sim_time': True}]),
]
),
ComposableNodeContainer(
Expand Down Expand Up @@ -424,7 +423,7 @@ def generate_launch_description():
package='states',
plugin='states::StatesComponent',
name='states',
extra_arguments=[{'use_intra_process_comms': True}]),
extra_arguments=[{'use_intra_process_comms': False, 'use_sim_time': True}]),
]
),
])
Expand Down
2 changes: 1 addition & 1 deletion communications/ff_msgs/action/Motion.action
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ ff_msgs/ControlState[] segment
ff_msgs/MotionState state

# Control progress
# ff_msgs/ControlFeedback progress # TODO(@mgouveia): ROS2 does not allow this
ff_msgs/ControlFeedback progress


# Planner progress
Expand Down
28 changes: 28 additions & 0 deletions communications/ff_msgs/msg/ControlFeedback.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright (c) 2017, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration.
#
# All rights reserved.
#
# The Astrobee platform is licensed under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# The state of the arm behavior


uint32 index # Index being processed

ff_msgs/ControlState setpoint # Current setpoint

float32 error_position # Position error
float32 error_attitude # Attitude error
float32 error_velocity # Velocity error
float32 error_omega # Omega error
2 changes: 1 addition & 1 deletion gnc/ctl/src/ctl_component.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class CtlComponent : public ff_util::FreeFlyerComponent {
explicit CtlComponent(const rclcpp::NodeOptions & options) : ff_util::FreeFlyerComponent(options, NODE_CTL) {}
~CtlComponent() {}
// This is called when the nodelet is loaded into the nodelet manager
void Initialize(NodeHandle nh) {
void Initialize(NodeHandle &nh) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C++ is the worst language

// this used to be multi-threaded, but don't think it needs to be
ctl_.reset(new ctl::Ctl(nh, GetName()));
}
Expand Down
2 changes: 1 addition & 1 deletion gnc/fam/src/fam_component.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class FamComponent : public ff_util::FreeFlyerComponent {
explicit FamComponent(const rclcpp::NodeOptions & options) : ff_util::FreeFlyerComponent(options, NODE_FAM) {}
~FamComponent() {}
// This is called when the nodelet is loaded into the nodelet manager
void Initialize(NodeHandle nh) {
void Initialize(NodeHandle &nh) {
// this used to be multi-threaded, but don't think it needs to be
fam_.reset(new fam::Fam(nh));
}
Expand Down
19 changes: 19 additions & 0 deletions gnc/pmc/include/pmc/shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#define PMC_SHARED_H_

#include <Eigen/Dense>
#include <limits>

namespace pmc {

Expand Down Expand Up @@ -74,6 +75,24 @@ class PMCConstants {

float Lookup(int table_size, const float lookup[], const float breakpoints[], float value);

template <class MatT>
Eigen::Matrix<typename MatT::Scalar, MatT::ColsAtCompileTime, MatT::RowsAtCompileTime> pseudoInverse(
const MatT& mat, typename MatT::Scalar tolerance = typename MatT::Scalar{std::numeric_limits<double>::epsilon()}) {
typedef typename MatT::Scalar Scalar;
auto svd = mat.jacobiSvd(Eigen::ComputeFullU | Eigen::ComputeFullV);
const auto& singularValues = svd.singularValues();
Eigen::Matrix<Scalar, MatT::ColsAtCompileTime, MatT::RowsAtCompileTime> singularValuesInv(mat.cols(), mat.rows());
singularValuesInv.setZero();
for (unsigned int i = 0; i < singularValues.size(); ++i) {
if (singularValues(i) > tolerance) {
singularValuesInv(i, i) = Scalar {1} / singularValues(i);
} else {
singularValuesInv(i, i) = Scalar {0};
}
}
return svd.matrixV() * singularValuesInv * svd.matrixU().adjoint();
}

} // end namespace pmc

#endif // PMC_SHARED_H_
4 changes: 1 addition & 3 deletions gnc/pmc/src/fam.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,7 @@ void Fam::UpdateCOM(const Eigen::Vector3f & com) {
thrust2force_ = -fam_nozzle_orientations.transpose();
Eigen::Matrix<float, 6, 12> thrust2forcetorque;
thrust2forcetorque << thrust2force_, thrust2torque_;
forcetorque2thrust_ = Eigen::MatrixXf::Identity(12, 6);
Eigen::JacobiSVD<Eigen::MatrixXf> svd(thrust2forcetorque, Eigen::ComputeThinU | Eigen::ComputeThinV);
forcetorque2thrust_ = svd.solve(forcetorque2thrust_);
forcetorque2thrust_ = pseudoInverse(thrust2forcetorque);
}

void Fam::CalcThrustMatrices(const Eigen::Vector3f & force, const Eigen::Vector3f & torque,
Expand Down
12 changes: 11 additions & 1 deletion mobility/choreographer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,27 @@ rclcpp_components_register_nodes(choreographer "choreographer::ChoreographerComp
## Install ##
#############

ament_export_dependencies(
config_reader
msg_conversions
ff_common
ff_util
jsonloader
)

ament_export_include_directories(include)

# Mark libraries for installation
install(TARGETS ${PROJECT_NAME}
EXPORT choreographer
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)

# Mark cpp header files for installation
install(DIRECTORY include/${PROJECT_NAME}/
install(DIRECTORY include/${PROJECT_NAME}
DESTINATION include
FILES_MATCHING PATTERN "*.h"
PATTERN ".svn" EXCLUDE
Expand Down
Loading