trajectory_follower.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017, 2018 Jarek Potiuk (low bandwidth trajectory follower)
3  *
4  * Copyright 2017, 2018 Simon Rasmussen (refactor)
5  *
6  * Copyright 2015, 2016 Thomas Timm Andersen (original version)
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #pragma once
22 
23 #include <inttypes.h>
24 #include <array>
25 #include <atomic>
26 #include <cstddef>
27 #include <cstring>
28 #include <string>
29 #include <thread>
30 #include <vector>
31 #include "ur_modern_driver/log.h"
35 
37 {
38 private:
39  std::atomic<bool> running_;
40  std::array<double, 6> last_positions_;
43 
45  std::string program_;
46 
47  template <typename T>
48  size_t append(uint8_t *buffer, T &val)
49  {
50  size_t s = sizeof(T);
51  std::memcpy(buffer, &val, s);
52  return s;
53  }
54 
55  bool execute(std::array<double, 6> &positions, bool keep_alive);
56  double interpolate(double t, double T, double p0_pos, double p1_pos, double p0_vel, double p1_vel);
57 
58 public:
59  TrajectoryFollower(URCommander &commander, std::string &reverse_ip, int reverse_port, bool version_3);
60 
61  bool start();
62  bool execute(std::array<double, 6> &positions);
63  bool execute(std::vector<TrajectoryPoint> &trajectory, std::atomic<bool> &interrupt);
64  void stop();
65 
66  virtual ~TrajectoryFollower(){};
67 };
bool execute(std::array< double, 6 > &positions, bool keep_alive)
XmlRpcServer s
URCommander & commander_
double interpolate(double t, double T, double p0_pos, double p1_pos, double p0_vel, double p1_vel)
size_t append(uint8_t *buffer, T &val)
std::atomic< bool > running_
std::array< double, 6 > last_positions_
TrajectoryFollower(URCommander &commander, std::string &reverse_ip, int reverse_port, bool version_3)


ur_modern_driver
Author(s): Thomas Timm Andersen, Simon Rasmussen
autogenerated on Fri Jun 26 2020 03:37:01