32 #ifndef GENERICPRINTABLES_HPP_
33 #define GENERICPRINTABLES_HPP_
35 #include <scl/data_structs/SRobotIO.hpp>
36 #include <scl/data_structs/SRigidBody.hpp>
37 #include <scl/data_structs/SRobotParsed.hpp>
38 #include <scl/control/data_structs/SControllerBase.hpp>
39 #include <scl/control/task/data_structs/STaskBase.hpp>
40 #include <scl/control/task/data_structs/SControllerMultiTask.hpp>
44 #include <sutil/CRegisteredPrintables.hpp>
65 void printToStream<scl::SRobotParsed>(
70 ostr<<
"\n Name: "<<arg_data.name_;
71 ostr<<
"("<<arg_data.getType()<<
")";
72 ostr<<
"\n Dof: "<<arg_data.dof_;
73 ostr<<
"\n Jlim_max : "<<arg_data.gc_pos_limit_max_.transpose();
74 ostr<<
"\n Jlim_min : "<<arg_data.gc_pos_limit_min_.transpose();
75 ostr<<
"\n Actuator_force_max : "<<arg_data.actuator_forces_max_.transpose();
76 ostr<<
"\n Actuator_force_min : "<<arg_data.actuator_forces_min_.transpose();
77 ostr<<
"\n Flag_gc_pos_limits : "<<arg_data.flag_apply_gc_pos_limits_;
78 ostr<<
"\n Flag_gc_damping : "<<arg_data.flag_apply_gc_damping_;
79 ostr<<
"\n Flag_force_limits : "<<arg_data.flag_apply_actuator_force_limits_;
80 ostr<<
"\n Flag_vel_limits : "<<arg_data.flag_apply_actuator_vel_limits_;
81 ostr<<
"\n Flag_accel_limits : "<<arg_data.flag_apply_actuator_acc_limits_;
86 void printToStream<scl::SRobotIO>(
91 ostr<<
"\n Name: "<<arg_data.name_;
92 ostr<<
"("<<arg_data.getType()<<
")";
93 ostr<<
"\nDof: "<<arg_data.dof_;
94 ostr<<
"\nHas been init: "<<arg_data.has_been_init_;
95 ostr<<
"\n q: "<<arg_data.sensors_.q_.transpose();
96 ostr<<
"\n dq: "<<arg_data.sensors_.dq_.transpose();
97 ostr<<
"\nddq: "<<arg_data.sensors_.ddq_.transpose();
98 ostr<<
"\nMeasured force: "<<arg_data.sensors_.force_gc_measured_.transpose();
99 ostr<<
"\n Command force: "<<arg_data.actuators_.force_gc_commanded_.transpose();
106 void printToStream<scl::SRigidBody>(
111 ostr<<
"\n Name: "<<arg_data.name_;
112 ostr<<
"("<<arg_data.getType()<<
")";
113 ostr<<
"\n Init : "<<arg_data.has_been_init_;
114 ostr<<
"\n Id : "<<arg_data.link_id_;
115 ostr<<
"\n Parent : "<<arg_data.parent_name_;
116 ostr<<
"\n Robot : "<<arg_data.robot_name_;
117 ostr<<
"\n Joint : "<<arg_data.joint_name_;
118 ostr<<
"\n Jtype : "<<arg_data.joint_type_;
119 ostr<<
"\n Jlim : ["<<arg_data.joint_limit_lower_<<
", "<<arg_data.joint_limit_upper_<<
"]";
120 ostr<<
"\n Com : "<<arg_data.com_.transpose();
121 ostr<<
"\n Inertia: "<<arg_data.inertia_;
122 ostr<<
"\n PosPar : "<<arg_data.pos_in_parent_.transpose();
123 ostr<<
"\n OriPar : [w xyz] ["<<arg_data.ori_parent_quat_.w()
124 <<
", "<<arg_data.ori_parent_quat_.x()
125 <<
", "<<arg_data.ori_parent_quat_.y()
126 <<
", "<<arg_data.ori_parent_quat_.z()<<
"]";
131 void printToStream<scl::STaskBase>(
136 ostr<<
"\n Name: "<<arg_data.name_;
137 ostr<<
"("<<arg_data.getType()<<
")";
138 ostr<<
". Parent("<<arg_data.parent_controller_->name_<<
")";
139 ostr<<
"\n Init/Active : "<<arg_data.has_been_init_<<
"/"<<arg_data.has_been_activated_;
140 ostr<<
"\n Priority : "<<arg_data.priority_;
141 ostr<<
"\n F_task : "<<arg_data.force_task_.transpose();
142 ostr<<
"\n F_gc : "<<arg_data.force_gc_.transpose();
147 void printToStream<scl::SControllerMultiTask>(
152 ostr<<
"\n Name: "<<arg_data.name_;
153 ostr<<
"("<<arg_data.getType()<<
")";
154 ostr<<
"\n Init : "<<arg_data.has_been_init_;
158 for(it = arg_data.tasks_.begin(), ite = arg_data.tasks_.end();
165 ostr<<
"\n === Task #"<<i<<
":"; i++;
166 printToStream<scl::STaskBase>(ostr, task);
171 void printToStream<Eigen::Vector3d >(
173 const Eigen::Vector3d& arg_eigvec
175 { ostr<<arg_eigvec.transpose()<<std::flush; }
185 bool addRobotPrintables()
190 std::cout<<
"\n\n*** Robot printables ***"
191 <<
"\n\nscl>> print <printable name>"
192 <<
"\n\n"<<std::setw(10)<<
"Printable information"<<std::setw(45)<<
"Printable name\n";
206 {
throw(std::runtime_error(std::string(
"Could not add a printable: Robot: ")+
209 { std::cout<<
"\n"<<std::setw(10)<<
"Printable: Robot: "<<std::setw(51)<<rob.
name_+std::string(
"Parsed"); }
219 {
throw(std::runtime_error(std::string(
"Could not add a printable: Robot: ")+
222 { std::cout<<
"\n"<<std::setw(10)<<
"Printable: "<<rob.
name_<<
" "<<l.
getType()<<std::setw(40)<<l.
name_; }
235 {
throw(std::runtime_error(std::string(
"Could not add a printable: Robot: ")+
238 { std::cout<<
"\n"<<std::setw(10)<<
"Printable: Robot: "<<std::setw(51)<<io.
name_; }
252 {
throw(std::runtime_error(std::string(
"Could not add a printable: Task Controller: ")+
255 { std::cout<<
"\n"<<std::setw(10)<<
"Printable: Task Controller: "<<std::setw(41)<<ctrl->
name_; }
262 itctt!=itctte; ++itctt)
266 assert(S_NULL != task);
273 {
throw(std::runtime_error(std::string(
"Could not add a printable: Task Controller: ")+
276 { std::cout<<
"\n"<<std::setw(10)<<
"Printable: Task: "<<std::setw(52)<<task->
name_; }
282 std::stringstream ss; ss<<
"ui"<<i;
283 std::string name(ss.str());
286 {
throw(std::runtime_error(std::string(
"Could not add a printable: ")+name)); }
288 { std::cout<<
"\n"<<std::setw(10)<<
"Printable: UI-point "<<std::setw(49)<<name; }
290 std::cout<<std::endl<<std::endl;
292 catch(std::exception &e)
294 std::cout<<
"addRobotPrintables() : Error: "<<e.what();
Definition: STaskBase.hpp:69
Definition: SRobotIO.hpp:107
Definition: SControllerMultiTask.hpp:54
Definition: SRobotParsed.hpp:51
Definition: SRigidBody.hpp:94
#define SCL_NUM_UI_POINTS
Definition: SDatabase.hpp:170
Definition: CMappedList.hpp:277
virtual const std::string & getType() const
Definition: SObject.hpp:60
static SDataStruct * getData()
Definition: CSingleton.hpp:87
sutil::CMappedTree< std::string, SRigidBody > rb_tree_
Definition: SRobotParsed.hpp:56
std::string name_
Definition: SObject.hpp:69
Definition: CMappedTree.hpp:66
Definition: CMappedList.hpp:381
bool add(const std::string &arg_name, const ObjectType &arg_obj)
Definition: CRegisteredPrintables.hpp:102