Line |
Branch |
Exec |
Source |
1 |
|
|
// |
2 |
|
|
// Copyright (c) 2017 CNRS |
3 |
|
|
// Authors: Florent Lamiraux |
4 |
|
|
// |
5 |
|
|
|
6 |
|
|
// Redistribution and use in source and binary forms, with or without |
7 |
|
|
// modification, are permitted provided that the following conditions are |
8 |
|
|
// met: |
9 |
|
|
// |
10 |
|
|
// 1. Redistributions of source code must retain the above copyright |
11 |
|
|
// notice, this list of conditions and the following disclaimer. |
12 |
|
|
// |
13 |
|
|
// 2. Redistributions in binary form must reproduce the above copyright |
14 |
|
|
// notice, this list of conditions and the following disclaimer in the |
15 |
|
|
// documentation and/or other materials provided with the distribution. |
16 |
|
|
// |
17 |
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
18 |
|
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
19 |
|
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
20 |
|
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
21 |
|
|
// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
22 |
|
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
23 |
|
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
24 |
|
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
25 |
|
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
26 |
|
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
27 |
|
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH |
28 |
|
|
// DAMAGE. |
29 |
|
|
|
30 |
|
|
#ifndef HPP_CORE_STEERING_METHOD_CAR_LIKE_HH |
31 |
|
|
#define HPP_CORE_STEERING_METHOD_CAR_LIKE_HH |
32 |
|
|
|
33 |
|
|
#include <hpp/core/config.hh> |
34 |
|
|
#include <hpp/core/fwd.hh> |
35 |
|
|
#include <hpp/core/steering-method.hh> |
36 |
|
|
#include <hpp/core/steering-method/fwd.hh> |
37 |
|
|
#include <hpp/util/debug.hh> |
38 |
|
|
#include <hpp/util/pointer.hh> |
39 |
|
|
|
40 |
|
|
namespace hpp { |
41 |
|
|
namespace core { |
42 |
|
|
namespace steeringMethod { |
43 |
|
|
/// \addtogroup steering_method |
44 |
|
|
/// \{ |
45 |
|
|
|
46 |
|
|
/// Abstract class that implements various type of trajectories for |
47 |
|
|
/// carlike vehicles |
48 |
|
|
/// |
49 |
|
|
class HPP_CORE_DLLAPI CarLike : public SteeringMethod { |
50 |
|
|
public: |
51 |
|
4 |
virtual ~CarLike() {} |
52 |
|
|
|
53 |
|
|
/// Set the wheels |
54 |
|
|
void setWheelJoints(const std::vector<JointPtr_t> wheels) { |
55 |
|
|
wheels_ = wheels; |
56 |
|
|
} |
57 |
|
|
|
58 |
|
|
void turningRadius(const value_type& rho); |
59 |
|
|
|
60 |
|
|
inline value_type turningRadius() const { return rho_; } |
61 |
|
|
|
62 |
|
|
protected: |
63 |
|
|
/// Constructor |
64 |
|
|
CarLike(const ProblemConstPtr_t& problem); |
65 |
|
|
|
66 |
|
|
/// Constructor |
67 |
|
|
CarLike(const ProblemConstPtr_t& problem, const value_type turningRadius, |
68 |
|
|
JointPtr_t xyJoint, JointPtr_t rzJoint, |
69 |
|
|
std::vector<JointPtr_t> wheels); |
70 |
|
|
|
71 |
|
|
/// Copy constructor |
72 |
|
|
CarLike(const CarLike& other); |
73 |
|
|
|
74 |
|
|
/// Store weak pointer to itself |
75 |
|
3 |
void init(CarLikeWkPtr_t weak) { |
76 |
|
3 |
core::SteeringMethod::init(weak); |
77 |
|
3 |
weak_ = weak; |
78 |
|
3 |
} |
79 |
|
|
|
80 |
|
|
DeviceWkPtr_t device_; |
81 |
|
|
/// Turning radius |
82 |
|
|
value_type rho_; |
83 |
|
|
JointPtr_t xy_, rz_; |
84 |
|
|
size_type xyId_, rzId_; |
85 |
|
|
std::vector<JointPtr_t> wheels_; |
86 |
|
|
|
87 |
|
|
private: |
88 |
|
|
CarLikeWkPtr_t weak_; |
89 |
|
|
}; // CarLike |
90 |
|
|
std::vector<JointPtr_t> getWheelsFromParameter(const ProblemConstPtr_t& problem, |
91 |
|
|
const JointPtr_t& rz); |
92 |
|
|
|
93 |
|
|
/// \} |
94 |
|
|
} // namespace steeringMethod |
95 |
|
|
} // namespace core |
96 |
|
|
} // namespace hpp |
97 |
|
|
#endif // HPP_CORE_STEERING_METHOD_CAR_LIKE_HH |
98 |
|
|
|