Skip to content

Commit

Permalink
Added support for online update of actuator/light origin frame. Reimp…
Browse files Browse the repository at this point in the history
…lemented parsing of actuators for better extension capabilities.
  • Loading branch information
patrykcieslak committed Jan 15, 2021
1 parent 938bbf2 commit 897f56e
Show file tree
Hide file tree
Showing 6 changed files with 205 additions and 164 deletions.
2 changes: 1 addition & 1 deletion Library/include/actuators/Light.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ namespace sf
std::vector<Renderable> Render();

//! A method returning actuator frame in the world frame.
Transform getActuatorFrame();
Transform getActuatorFrame() const;

//! A method returning the type of the actuator.
ActuatorType getType();
Expand Down
10 changes: 8 additions & 2 deletions Library/include/actuators/LinkActuator.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// Stonefish
//
// Created by Patryk Cieślak on 23/11/2018.
// Copyright (c) 2018-2020 Patryk Cieslak. All rights reserved.
// Copyright (c) 2018-2021 Patryk Cieslak. All rights reserved.
//

#ifndef __Stonefish_LinkActuator__
Expand Down Expand Up @@ -52,8 +52,14 @@ namespace sf
//! A method implementing the rendering of the actuator.
virtual std::vector<Renderable> Render();

//! A method used to set the actuator origin frame.
/*!
\param origin a transformation from teh body origin to the actuator origin
*/
void setRelativeActuatorFrame(const Transform& origin);

//! A method returning actuator frame in the world frame.
virtual Transform getActuatorFrame();
virtual Transform getActuatorFrame() const;

protected:
SolidEntity* attach;
Expand Down
16 changes: 12 additions & 4 deletions Library/include/core/ScenarioParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,21 +173,21 @@ namespace sf
*/
virtual bool ParseJoint(XMLElement* element, Robot* robot);

//! A method used to parse a single robot sensor description.
//! A method used to parse a single robot actuator description.
/*!
\param element a pointer to the XML node
\param robot a pointer to the robot object
\return success
*/
virtual bool ParseSensor(XMLElement* element, Robot* robot);
virtual bool ParseActuator(XMLElement* element, Robot* robot);

//! A method used to parse a single robot actuator description.
//! A method used to parse a single robot sensor description.
/*!
\param element a pointer to the XML node
\param robot a pointer to the robot object
\return success
*/
virtual bool ParseActuator(XMLElement* element, Robot* robot);
virtual bool ParseSensor(XMLElement* element, Robot* robot);

//! A method used to parse a description of a sensor attached to single body or world.
/*!
Expand All @@ -197,6 +197,14 @@ namespace sf
*/
virtual bool ParseSensor(XMLElement* element, Entity* ent = nullptr);

//! A method used to parse a description of an actuator.
/*!
\param element a pointer to the XML node
\param namePrefix a string added at the beginning of the actuator name
\return pointer to actuator
*/
virtual Actuator* ParseActuator(XMLElement* element, const std::string& namePrefix);

//! A method used to parse a description of a sensor.
/*!
\param element a pointer to the XML node
Expand Down
2 changes: 1 addition & 1 deletion Library/src/actuators/Light.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ ActuatorType Light::getType()
return ActuatorType::LIGHT;
}

Transform Light::getActuatorFrame()
Transform Light::getActuatorFrame() const
{
if(attach != nullptr)
return attach->getOTransform() * o2a; //Solid
Expand Down
9 changes: 7 additions & 2 deletions Library/src/actuators/LinkActuator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,13 @@ LinkActuator::LinkActuator(std::string uniqueName) : Actuator(uniqueName)
attach = nullptr;
o2a = I4();
}

Transform LinkActuator::getActuatorFrame()

void LinkActuator::setRelativeActuatorFrame(const Transform& origin)
{
o2a = origin;
}

Transform LinkActuator::getActuatorFrame() const
{
if(attach != nullptr)
return attach->getOTransform() * o2a;
Expand Down
Loading

0 comments on commit 897f56e

Please sign in to comment.