bitrl & cuberl Documentation
Simulation engine for reinforcement learning agents
Loading...
Searching...
No Matches
chrono_robot_pose.h
Go to the documentation of this file.
1#ifndef CHRONO_ROBOT_POSE_H
2#define CHRONO_ROBOT_POSE_H
3
4#include "bitrl/bitrl_config.h"
5
6#ifdef BITRL_CHRONO
7#include "bitrl/bitrl_types.h"
8#include <chrono/physics/ChBody.h>
9#include <string>
10namespace bitrl
11{
12namespace rb::bitrl_chrono
13{
14
20class CHRONO_RobotPose
21{
22public:
23
28 explicit CHRONO_RobotPose(std::shared_ptr<chrono::ChBody> robot_ptr=nullptr);
29
34 void set_body(std::shared_ptr<chrono::ChBody> robot_ptr){robot_ptr_ = robot_ptr;}
35
39 const chrono::ChVector3d& position() const {return robot_ptr_ -> GetPos();}
40
44 const chrono::ChVector3d& velocity()const {return robot_ptr_ -> GetLinVel();}
45
49 const chrono::ChVector3d& acceleration()const {return robot_ptr_ -> GetLinAcc();}
50
54 const chrono::ChMatrix33d& rotation_matrix() const {return robot_ptr_ -> GetRotMat();}
55
59 chrono::ChVector3d to_world_coords(chrono::ChVector3d point){return robot_ptr_ -> GetFrameRefToAbs().TransformPointLocalToParent(point);}
60
64 chrono::ChVector3d to_local_coords(chrono::ChVector3d point){return robot_ptr_ -> GetFrameRefToAbs().TransformPointParentToLocal(point);}
65private:
66
70 std::shared_ptr<chrono::ChBody> robot_ptr_;
71
72};
73
74inline
75CHRONO_RobotPose::CHRONO_RobotPose(std::shared_ptr<chrono::ChBody> robot_ptr)
76 :
77robot_ptr_(robot_ptr)
78{}
79}
80}
81
82#endif
83
84#endif //CHRONO_ROBOT_STATE_H
Definition bitrl_consts.h:14