wbc
wbc_types_conversions.h
Go to the documentation of this file.
1#pragma once
2
3#include <wbc/core/RobotModelConfig.hpp>
4
5namespace wbc_py{
6wbc::ActiveContacts toActiveContacts(const base::NamedVector<wbc::ActiveContact> &contacts_in){
7 wbc::ActiveContacts contacts_out;
8 contacts_out.elements = contacts_in.elements;
9 contacts_out.names = contacts_in.names;
10 return contacts_out;
11}
12
13base::NamedVector<wbc::ActiveContact> fromActiveContacts(const wbc::ActiveContacts& contacts_in){
14 base::NamedVector<wbc::ActiveContact> contacts_out;
15 contacts_out.names = contacts_in.names;
16 contacts_out.elements = contacts_in.elements;
17 return contacts_out;
18}
19
20class RobotModelConfig : public wbc::RobotModelConfig{
21public:
22 base::NamedVector<wbc::ActiveContact> getActiveContacts(){
23 return fromActiveContacts(contact_points);
24 }
25 void setActiveContacts(base::NamedVector<wbc::ActiveContact> contacts_in){
26 contact_points = toActiveContacts(contacts_in);
27 }
28};
29
30wbc::RobotModelConfig toRobotModelConfig(RobotModelConfig cfg_in){
31 RobotModelConfig cfg = cfg_in;
32 return cfg;
33}
34
35RobotModelConfig fromRobotModelConfig(wbc::RobotModelConfig cfg_in){
37 cfg.file_or_string = cfg_in.file_or_string;
38 cfg.submechanism_file = cfg_in.submechanism_file;
39 cfg.floating_base = cfg_in.floating_base;
40 cfg.contact_points = cfg_in.contact_points;
41 return cfg;
42}
43}
Definition wbc_types_conversions.h:20
void setActiveContacts(base::NamedVector< wbc::ActiveContact > contacts_in)
Definition wbc_types_conversions.h:25
base::NamedVector< wbc::ActiveContact > getActiveContacts()
Definition wbc_types_conversions.h:22
Definition base_types_conversion.h:14
base::NamedVector< wbc::ActiveContact > fromActiveContacts(const wbc::ActiveContacts &contacts_in)
Definition wbc_types_conversions.h:13
wbc::RobotModelConfig toRobotModelConfig(RobotModelConfig cfg_in)
Definition wbc_types_conversions.h:30
wbc::ActiveContacts toActiveContacts(const base::NamedVector< wbc::ActiveContact > &contacts_in)
Definition wbc_types_conversions.h:6
RobotModelConfig fromRobotModelConfig(wbc::RobotModelConfig cfg_in)
Definition wbc_types_conversions.h:35