Skip to content

Commit

Permalink
Merge pull request #2493 from madratman/PR/clean_up_character_APIs
Browse files Browse the repository at this point in the history
[cleanup] remove all character (simChar*) apis
  • Loading branch information
madratman authored Mar 30, 2020
2 parents 00d69ed + 345028a commit 03d239b
Show file tree
Hide file tree
Showing 13 changed files with 2 additions and 705 deletions.
18 changes: 0 additions & 18 deletions AirLib/include/api/RpcLibClientBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,24 +100,6 @@ class RpcLibClientBase {
msr::airlib::Kinematics::State simGetGroundTruthKinematics(const std::string& vehicle_name = "") const;
msr::airlib::Environment::State simGetGroundTruthEnvironment(const std::string& vehicle_name = "") const;

//----------- APIs to control ACharacter in scene ----------/
void simCharSetFaceExpression(const std::string& expression_name, float value, const std::string& character_name = "");
float simCharGetFaceExpression(const std::string& expression_name, const std::string& character_name = "") const;
std::vector<std::string> simCharGetAvailableFaceExpressions();
void simCharSetSkinDarkness(float value, const std::string& character_name = "");
float simCharGetSkinDarkness(const std::string& character_name = "") const;
void simCharSetSkinAgeing(float value, const std::string& character_name = "");
float simCharGetSkinAgeing(const std::string& character_name = "") const;
void simCharSetHeadRotation(const msr::airlib::Quaternionr& q, const std::string& character_name = "");
msr::airlib::Quaternionr simCharGetHeadRotation(const std::string& character_name = "") const;
void simCharSetBonePose(const std::string& bone_name, const msr::airlib::Pose& pose, const std::string& character_name = "");
msr::airlib::Pose simCharGetBonePose(const std::string& bone_name, const std::string& character_name = "") const;
void simCharResetBonePose(const std::string& bone_name, const std::string& character_name = "");
void simCharSetFacePreset(const std::string& preset_name, float value, const std::string& character_name = "");
void simSetFacePresets(const std::unordered_map<std::string, float>& presets, const std::string& character_name = "");
void simSetBonePoses(const std::unordered_map<std::string, msr::airlib::Pose>& poses, const std::string& character_name = "");
std::unordered_map<std::string, msr::airlib::Pose> simGetBonePoses(const std::vector<std::string>& bone_names, const std::string& character_name = "") const;

std::vector<std::string> simSwapTextures(const std::string& tags, int tex_id = 0, int component_id = 0, int material_id = 0);

protected:
Expand Down
18 changes: 0 additions & 18 deletions AirLib/include/api/WorldSimApiBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,6 @@ class WorldSimApiBase {
virtual bool setObjectPose(const std::string& object_name, const Pose& pose, bool teleport) = 0;

virtual std::unique_ptr<std::vector<std::string>> swapTextures(const std::string& tag, int tex_id = 0, int component_id = 0, int material_id = 0) = 0;
//----------- APIs to control ACharacter in scene ----------/
virtual void charSetFaceExpression(const std::string& expression_name, float value, const std::string& character_name) = 0;
virtual float charGetFaceExpression(const std::string& expression_name, const std::string& character_name) const = 0;
virtual std::vector<std::string> charGetAvailableFaceExpressions() = 0;
virtual void charSetSkinDarkness(float value, const std::string& character_name) = 0;
virtual float charGetSkinDarkness(const std::string& character_name) const = 0;
virtual void charSetSkinAgeing(float value, const std::string& character_name) = 0;
virtual float charGetSkinAgeing(const std::string& character_name) const = 0;
virtual void charSetHeadRotation(const msr::airlib::Quaternionr& q, const std::string& character_name) = 0;
virtual msr::airlib::Quaternionr charGetHeadRotation(const std::string& character_name) const = 0;
virtual void charSetBonePose(const std::string& bone_name, const msr::airlib::Pose& pose, const std::string& character_name) = 0;
virtual msr::airlib::Pose charGetBonePose(const std::string& bone_name, const std::string& character_name) const = 0;
virtual void charResetBonePose(const std::string& bone_name, const std::string& character_name) = 0;
virtual void charSetFacePreset(const std::string& preset_name, float value, const std::string& character_name) = 0;
virtual void charSetFacePresets(const std::unordered_map<std::string, float>& presets, const std::string& character_name) = 0;
virtual void charSetBonePoses(const std::unordered_map<std::string, msr::airlib::Pose>& poses, const std::string& character_name) = 0;
virtual std::unordered_map<std::string, msr::airlib::Pose> charGetBonePoses(const std::vector<std::string>& bone_names, const std::string& character_name) const = 0;

};


Expand Down
93 changes: 0 additions & 93 deletions AirLib/src/api/RpcLibClientBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,99 +393,6 @@ const void* RpcLibClientBase::getClient() const
return &pimpl_->client;
}

//----------- APIs to control ACharacter in scene ----------/
void RpcLibClientBase::simCharSetFaceExpression(const std::string& expression_name, float value, const std::string& character_name)
{
pimpl_->client.call("simCharSetFaceExpression", expression_name, value, character_name);
}

float RpcLibClientBase::simCharGetFaceExpression(const std::string& expression_name, const std::string& character_name) const
{
return pimpl_->client.call("simCharGetFaceExpression", expression_name, character_name).as<float>();
}

std::vector<std::string> RpcLibClientBase::simCharGetAvailableFaceExpressions()
{
return pimpl_->client.call("simCharGetAvailableFaceExpressions").as<std::vector<std::string>>();
}

void RpcLibClientBase::simCharSetSkinDarkness(float value, const std::string& character_name)
{
pimpl_->client.call("simCharSetSkinDarkness", character_name, value);
}

float RpcLibClientBase::simCharGetSkinDarkness(const std::string& character_name) const
{
return pimpl_->client.call("simCharGetSkinDarkness", character_name).as<float>();
}

void RpcLibClientBase::simCharSetSkinAgeing(float value, const std::string& character_name)
{
pimpl_->client.call("simCharSetSkinAgeing", character_name, value);
}

float RpcLibClientBase::simCharGetSkinAgeing(const std::string& character_name) const
{
return pimpl_->client.call("simCharGetSkinAgeing", character_name).as<float>();
}

void RpcLibClientBase::simCharSetHeadRotation(const msr::airlib::Quaternionr& q, const std::string& character_name)
{
pimpl_->client.call("simCharSetHeadRotation", RpcLibAdapatorsBase::Quaternionr(q), character_name);
}

msr::airlib::Quaternionr RpcLibClientBase::simCharGetHeadRotation(const std::string& character_name) const
{
return pimpl_->client.call("simCharGetHeadRotation", character_name)
.as<RpcLibAdapatorsBase::Quaternionr>().to();
}

void RpcLibClientBase::simCharSetBonePose(const std::string& bone_name, const msr::airlib::Pose& pose, const std::string& character_name)
{
pimpl_->client.call("simCharSetBonePose", bone_name, RpcLibAdapatorsBase::Pose(pose), character_name);
}

msr::airlib::Pose RpcLibClientBase::simCharGetBonePose(const std::string& bone_name, const std::string& character_name) const
{
return pimpl_->client.call("simCharGetBonePose", bone_name, character_name)
.as<RpcLibAdapatorsBase::Pose>().to();
}

void RpcLibClientBase::simCharResetBonePose(const std::string& bone_name, const std::string& character_name)
{
pimpl_->client.call("simCharResetBonePose", bone_name, character_name);
}

void RpcLibClientBase::simCharSetFacePreset(const std::string& preset_name, float value, const std::string& character_name)
{
pimpl_->client.call("simCharSetFacePreset", preset_name, value, character_name);
}
void RpcLibClientBase::simSetFacePresets(const std::unordered_map<std::string, float>& presets, const std::string& character_name)
{
pimpl_->client.call("simSetFacePresets", presets, character_name);
}
void RpcLibClientBase::simSetBonePoses(const std::unordered_map<std::string, msr::airlib::Pose>& poses, const std::string& character_name)
{
std::unordered_map<std::string, RpcLibAdapatorsBase::Pose> r;
for (const auto& p : poses)
r[p.first] = RpcLibAdapatorsBase::Pose(p.second);

pimpl_->client.call("simSetBonePoses", r, character_name);
}
std::unordered_map<std::string, msr::airlib::Pose> RpcLibClientBase::simGetBonePoses(const std::vector<std::string>& bone_names, const std::string& character_name) const
{
std::unordered_map<std::string, RpcLibAdapatorsBase::Pose> t =
pimpl_->client.call("simGetBonePoses", bone_names, character_name)
.as<std::unordered_map<std::string, RpcLibAdapatorsBase::Pose>>();

std::unordered_map<std::string, msr::airlib::Pose> r;
for (const auto& p : t)
r[p.first] = p.second.to();

return r;
}


}} //namespace

#endif
Expand Down
63 changes: 0 additions & 63 deletions AirLib/src/api/RpcLibServerBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,69 +296,6 @@ RpcLibServerBase::RpcLibServerBase(ApiProvider* api_provider, const std::string&
getVehicleApi(vehicle_name)->cancelLastTask();
});

//----------- APIs to control ACharacter in scene ----------/
pimpl_->server.bind("simCharSetFaceExpression", [&](const std::string& expression_name, float value, const std::string& character_name) -> void {
getWorldSimApi()->charSetFaceExpression(expression_name, value, character_name);
});
pimpl_->server.bind("simCharGetFaceExpression", [&](const std::string& expression_name, const std::string& character_name) -> float {
return getWorldSimApi()->charGetFaceExpression(expression_name, character_name);
});
pimpl_->server.bind("simCharGetAvailableFaceExpressions", [&]() -> std::vector<std::string> {
return getWorldSimApi()->charGetAvailableFaceExpressions();
});
pimpl_->server.bind("simCharSetSkinDarkness", [&](float value, const std::string& character_name) -> void {
getWorldSimApi()->charSetSkinDarkness(value, character_name);
});
pimpl_->server.bind("simCharGetSkinDarkness", [&](const std::string& character_name) -> float {
return getWorldSimApi()->charGetSkinDarkness(character_name);
});
pimpl_->server.bind("simCharSetSkinAgeing", [&](float value, const std::string& character_name) -> void {
getWorldSimApi()->charSetSkinAgeing(value, character_name);
});
pimpl_->server.bind("simCharGetSkinAgeing", [&](const std::string& character_name) -> float {
return getWorldSimApi()->charGetSkinAgeing(character_name);
});
pimpl_->server.bind("simCharSetHeadRotation", [&](const RpcLibAdapatorsBase::Quaternionr& q, const std::string& character_name) -> void {
getWorldSimApi()->charSetHeadRotation(q.to(), character_name);
});
pimpl_->server.bind("simCharGetHeadRotation", [&](const std::string& character_name) -> RpcLibAdapatorsBase::Quaternionr {
msr::airlib::Quaternionr q = getWorldSimApi()->charGetHeadRotation(character_name);
return RpcLibAdapatorsBase::Quaternionr(q);
});
pimpl_->server.bind("simCharSetBonePose", [&](const std::string& bone_name, const RpcLibAdapatorsBase::Pose& pose, const std::string& character_name) -> void {
getWorldSimApi()->charSetBonePose(bone_name, pose.to(), character_name);
});
pimpl_->server.bind("simCharGetBonePose", [&](const std::string& bone_name, const std::string& character_name) -> RpcLibAdapatorsBase::Pose {
msr::airlib::Pose pose = getWorldSimApi()->charGetBonePose(bone_name, character_name);
return RpcLibAdapatorsBase::Pose(pose);
});
pimpl_->server.bind("simCharResetBonePose", [&](const std::string& bone_name, const std::string& character_name) -> void {
getWorldSimApi()->charResetBonePose(bone_name, character_name);
});
pimpl_->server.bind("simCharSetFacePreset", [&](const std::string& preset_name, float value, const std::string& character_name) -> void {
getWorldSimApi()->charSetFacePreset(preset_name, value, character_name);
});
pimpl_->server.bind("simSetFacePresets", [&](const std::unordered_map<std::string, float>& presets, const std::string& character_name) -> void {
getWorldSimApi()->charSetFacePresets(presets, character_name);
});
pimpl_->server.bind("simSetBonePoses", [&](const std::unordered_map<std::string, RpcLibAdapatorsBase::Pose>& poses, const std::string& character_name) -> void {
std::unordered_map<std::string, msr::airlib::Pose> r;
for (const auto& p : poses)
r[p.first] = p.second.to();

getWorldSimApi()->charSetBonePoses(r, character_name);
});
pimpl_->server.bind("simGetBonePoses", [&](const std::vector<std::string>& bone_names, const std::string& character_name)
-> std::unordered_map<std::string, RpcLibAdapatorsBase::Pose> {

std::unordered_map<std::string, msr::airlib::Pose> poses = getWorldSimApi()->charGetBonePoses(bone_names, character_name);
std::unordered_map<std::string, RpcLibAdapatorsBase::Pose> r;
for (const auto& p : poses)
r[p.first] = RpcLibAdapatorsBase::Pose(p.second);

return r;
});

pimpl_->server.bind("simSwapTextures", [&](const std::string tag, int tex_id, int component_id, int material_id) -> std::vector<string> {
return *getWorldSimApi()->swapTextures(tag, tex_id, component_id, material_id);
});
Expand Down
34 changes: 0 additions & 34 deletions PythonClient/airsim/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,40 +271,6 @@ def simPlotTransformsWithNames(self, poses, names, tf_scale = 5.0, tf_thickness
"""
self.client.call('simPlotTransformsWithNames', poses, names, tf_scale, tf_thickness, text_scale, text_color_rgba, duration)

#----------- APIs to control ACharacter in scene ----------/
def simCharSetFaceExpression(self, expression_name, value, character_name = ""):
self.client.call('simCharSetFaceExpression', expression_name, value, character_name)
def simCharGetFaceExpression(self, expression_name, character_name = ""):
return self.client.call('simCharGetFaceExpression', expression_name, character_name)
def simCharGetAvailableFaceExpressions(self):
return self.client.call('simCharGetAvailableFaceExpressions')
def simCharSetSkinDarkness(self, value, character_name = ""):
self.client.call('simCharSetSkinDarkness', value, character_name)
def simCharGetSkinDarkness(self, character_name = ""):
return self.client.call('simCharGetSkinDarkness', character_name)
def simCharSetSkinAgeing(self, value, character_name = ""):
self.client.call('simCharSetSkinAgeing', value, character_name)
def simCharGetSkinAgeing(self, character_name = ""):
return self.client.call('simCharGetSkinAgeing', character_name)
def simCharSetHeadRotation(self, q, character_name = ""):
self.client.call('simCharSetHeadRotation', q, character_name)
def simCharGetHeadRotation(self, character_name = ""):
return self.client.call('simCharGetHeadRotation', character_name)
def simCharSetBonePose(self, bone_name, pose, character_name = ""):
self.client.call('simCharSetBonePose', bone_name, pose, character_name)
def simCharGetBonePose(self, bone_name, character_name = ""):
return self.client.call('simCharGetBonePose', bone_name, character_name)
def simCharResetBonePose(self, bone_name, character_name = ""):
self.client.call('simCharResetBonePose', bone_name, character_name)
def simCharSetFacePreset(self, preset_name, value, character_name = ""):
self.client.call('simCharSetFacePreset', preset_name, value, character_name)
def simCharSetFacePresets(self, presets, character_name = ""):
self.client.call('simSetFacePresets', presets, character_name)
def simCharSetBonePoses(self, poses, character_name = ""):
self.client.call('simSetBonePoses', poses, character_name)
def simCharGetBonePoses(self, bone_names, character_name = ""):
return self.client.call('simGetBonePoses', bone_names, character_name)

def cancelLastTask(self, vehicle_name = ''):
self.client.call('cancelLastTask', vehicle_name)
def waitOnLastTask(self, timeout_sec = float('nan')):
Expand Down
77 changes: 0 additions & 77 deletions PythonClient/computer_vision/character_control.py

This file was deleted.

Loading

0 comments on commit 03d239b

Please sign in to comment.