NASA Astrobee Robot Software  0.19.1
Flight software for the Astrobee robots operating inside the International Space Station.
trajectory.h
Go to the documentation of this file.
1 /* Copyright (c) 2017, United States Government, as represented by the
2  * Administrator of the National Aeronautics and Space Administration.
3  *
4  * All rights reserved.
5  *
6  * The Astrobee platform is licensed under the Apache License, Version 2.0
7  * (the "License"); you may not use this file except in compliance with the
8  * License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15  * License for the specific language governing permissions and limitations
16  * under the License.
17  */
18 
19 #ifndef TRAJ_OPT_BASIC_TRAJECTORY_H_
20 #define TRAJ_OPT_BASIC_TRAJECTORY_H_
21 
22 // package includes
24 #include <traj_opt_basic/types.h>
25 
26 // library includes
27 #include <boost/smart_ptr/shared_ptr.hpp>
28 
29 // STL includes
30 #include <iostream>
31 #include <vector>
32 
33 namespace traj_opt {
34 
35 class Trajectory {
36  public:
37  virtual ~Trajectory() {}
38  virtual bool evaluate(decimal_t t, uint derr, VecD &out) const = 0;
39  virtual decimal_t getTotalTime() const = 0;
40  virtual decimal_t getCost() = 0;
41  // execute time
42  decimal_t getExecuteTime() const;
43 
44  // returns a matrix (dim X num_derivatives + 1) of the trajectory evalutated
45  // at time t
46  bool getCommand(decimal_t t, uint num_derivatives, MatD &data);
47 
48  void setDim(uint ndim) { dim_ = ndim; }
49  void setExecuteTime(decimal_t t) { exec_t = t; }
50 
51  virtual TrajData serialize() = 0;
52 
53  protected:
54  decimal_t exec_t{-1.0}; // duration of execute time
55  int dim_{0};
56 };
57 } // namespace traj_opt
58 #endif // TRAJ_OPT_BASIC_TRAJECTORY_H_
traj_opt::Trajectory::getCost
virtual decimal_t getCost()=0
types.h
traj_opt::Trajectory::dim_
int dim_
Definition: trajectory.h:55
traj_opt::MatD
Eigen::Matrix< decimal_t, Eigen::Dynamic, Eigen::Dynamic > MatD
Definition: types.h:51
traj_opt::Trajectory
Definition: trajectory.h:35
traj_data.h
traj_opt::Trajectory::getCommand
bool getCommand(decimal_t t, uint num_derivatives, MatD &data)
Definition: trajectory.cpp:31
traj_opt::TrajData
Definition: traj_data.h:61
traj_opt::Trajectory::setExecuteTime
void setExecuteTime(decimal_t t)
Definition: trajectory.h:49
traj_opt::decimal_t
double decimal_t
Definition: types.h:35
traj_opt::Trajectory::exec_t
decimal_t exec_t
Definition: trajectory.h:54
traj_opt
Definition: msg_traj.h:27
traj_opt::Trajectory::setDim
void setDim(uint ndim)
Definition: trajectory.h:48
traj_opt::Trajectory::evaluate
virtual bool evaluate(decimal_t t, uint derr, VecD &out) const =0
traj_opt::Trajectory::serialize
virtual TrajData serialize()=0
traj_opt::Trajectory::getTotalTime
virtual decimal_t getTotalTime() const =0
traj_opt::Trajectory::getExecuteTime
decimal_t getExecuteTime() const
Definition: trajectory.cpp:24
traj_opt::VecD
Eigen::Matrix< decimal_t, Eigen::Dynamic, 1 > VecD
Definition: types.h:49
traj_opt::Trajectory::~Trajectory
virtual ~Trajectory()
Definition: trajectory.h:37