bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
chrono_robot_pose.h
Go to the documentation of this file.
1#ifndef BITSIM_RIGID_BODIES_CHRONO_ROBOTS_CHRONO_ROBOT_POSE_H
2#define BITSIM_RIGID_BODIES_CHRONO_ROBOTS_CHRONO_ROBOT_POSE_H
3
4#include "bitsim/bitsim_config.h"
5
6#ifdef BITSIM_CHRONO
7#include <chrono/physics/ChBody.h>
8namespace bitsim
9{
11{
12
19{
20 public:
25 explicit CHRONO_RobotPose(std::shared_ptr<chrono::ChBody> robot_ptr = nullptr);
26
31 void set_body(std::shared_ptr<chrono::ChBody> robot_ptr) { robot_ptr_ = robot_ptr; }
32
36 const chrono::ChVector3d &position() const { return robot_ptr_->GetPos(); }
37
41 const chrono::ChVector3d &velocity() const { return robot_ptr_->GetLinVel(); }
42
46 const chrono::ChVector3d &acceleration() const { return robot_ptr_->GetLinAcc(); }
47
51 const chrono::ChMatrix33d &rotation_matrix() const { return robot_ptr_->GetRotMat(); }
52
56 chrono::ChVector3d to_world_coords(chrono::ChVector3d point)
57 {
58 return robot_ptr_->GetFrameRefToAbs().TransformPointLocalToParent(point);
59 }
60
64 chrono::ChVector3d to_local_coords(chrono::ChVector3d point)
65 {
66 return robot_ptr_->GetFrameRefToAbs().TransformPointParentToLocal(point);
67 }
68
69 private:
73 std::shared_ptr<chrono::ChBody> robot_ptr_;
74};
75
76inline CHRONO_RobotPose::CHRONO_RobotPose(std::shared_ptr<chrono::ChBody> robot_ptr)
77 : robot_ptr_(robot_ptr)
78{
79}
80} // namespace rb::bitsim_chrono
81} // namespace bitsim
82
83#endif
84
85#endif // BITSIM_RIGID_BODIES_CHRONO_ROBOTS_CHRONO_ROBOT_POSE_H
chrono::ChVector3d to_local_coords(chrono::ChVector3d point)
Transform the world point to local coordinates.
Definition chrono_robot_pose.h:64
const chrono::ChVector3d & velocity() const
Definition chrono_robot_pose.h:41
CHRONO_RobotPose(std::shared_ptr< chrono::ChBody > robot_ptr=nullptr)
Constructor. Initialize by passing a pointer to the chrono::ChBody to monitor.
Definition chrono_robot_pose.h:76
const chrono::ChVector3d & acceleration() const
Definition chrono_robot_pose.h:46
void set_body(std::shared_ptr< chrono::ChBody > robot_ptr)
Definition chrono_robot_pose.h:31
const chrono::ChVector3d & position() const
Return the position vector. This is the position of the CoM of the body.
Definition chrono_robot_pose.h:36
const chrono::ChMatrix33d & rotation_matrix() const
Return the rotation matrix.
Definition chrono_robot_pose.h:51
chrono::ChVector3d to_world_coords(chrono::ChVector3d point)
Return the transformation of the local to the world coordinats.
Definition chrono_robot_pose.h:56
Definition chrono_robot_pose.h:11
Definition dc_motor_backend_base.h:9