Skip to content

Commit

Permalink
Merge pull request #1737 from drdanz/cleanup_pre_const
Browse files Browse the repository at this point in the history
Cleanup
  • Loading branch information
drdanz authored Jun 8, 2018
2 parents 66568f5 + 2d6f91f commit a6a49f0
Show file tree
Hide file tree
Showing 319 changed files with 2,682 additions and 2,190 deletions.
14 changes: 7 additions & 7 deletions doc/cmd_yarpdev.dox
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ them for network visibility. This is useful in cases where you
wish to control devices on remote machines.

The devices available to "yarpdev" depend on the options set
when compiling YARP. To choose the devices you want compiled,
run "ccmake ." (on UNIX) or "cmake" (on Windows) on the
root directory of the YARP source code and select the
"YARP_COMPILE_DEVICE_PLUGINS" option.
After you configure, new "ENABLE_*"
options will appear that permit you to choose what devices you want
to try and compile. Often this will require that you install
when compiling YARP.
The most important devices are enabled by default.
To disable all device plugins, you can set to `OFF` the
`YARP_COMPILE_DEVICE_PLUGINS` option in CMake.
You can select and deselect each device using the relative `ENABLE_*`
options in CMake.
Often this will require that you install
particular libraries or operating system device drivers.


Expand Down
13 changes: 10 additions & 3 deletions doc/release/v3_0_0.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,15 @@ Important Changes
`IPositionDirectRaw::setPositionsRaw(const int, const int*, const double*)`.
* `IPositionDirect::setPositions(const int, const int*, double*)` became
`IPositionDirect::setPositions(const int, const int*, const double*)`(#1351).
* The file `yarp/dev/ControlBoardInterfacesImpl.inl` was renamed
`yarp/dev/ControlBoardInterfacesImpl-inl.h`

#### `YARP_sig`

* The file `yarp/sig/IplImage.h` is deprecated, use opencv headers instead.
* Added the `yarp::sig::PointCloud` class. See the documentation for details.
* if libjpeg is found, namespace yarp::sig::file implements a write method to save jpeg images.
* if libjpeg is found, namespace yarp::sig::file implements a write method to
save jpeg images.

#### `YARP_manager`

Expand Down Expand Up @@ -312,8 +315,12 @@ New Features

#### IMotorEncoders interface bindings

* `IMotorEncoders` interface methods can be used to directly monitor the motor shaft position and speed or even to control the motor positions individually when estimating coupled motors friction parameters.
* Added bindings for the interface IMotorEncoders. The change extends the `yarp::dev::PolyDriver` and the `yarp::dev::IMotorEncoders` classes.
* `IMotorEncoders` interface methods can be used to directly monitor the motor
shaft position and speed or even to control the motor positions individually
when estimating coupled motors friction parameters.
* Added bindings for the interface IMotorEncoders.
The change extends the `yarp::dev::PolyDriver` and the
`yarp::dev::IMotorEncoders` classes.


Bug Fixes
Expand Down
10 changes: 5 additions & 5 deletions example/game/game_client/keyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ using namespace yarp;
static String dir = "right";
static String msg = "";
static int mode = 0;
static Semaphore mutex(1);
static Mutex mutex();

String getPreparation() {
mutex.wait();
mutex.lock();
String result = msg;
mutex.post();
mutex.unlock();
return result;
}

Expand Down Expand Up @@ -121,11 +121,11 @@ String getCommand() {
default:
//cprintf("KEY is %d\n", key);
if (mode==0) {
mutex.wait();
mutex.lock();
if (key>=32 && key<=126) {
msg += ((char)key);
}
mutex.post();
mutex.unlock();
}
mode = 0;
break;
Expand Down
26 changes: 13 additions & 13 deletions example/game/game_client/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ String pad(const String& src, int len = 70) {
return result;
}

Semaphore broadcastMutex(1);
Mutex broadcastMutex();
String broadcast = "";

class BroadcastHandler : public TypedReaderCallback<Bottle> {
public:
virtual void onRead(Bottle& bot) {
broadcastMutex.wait();
broadcastMutex.lock();
broadcast = bot.toString().c_str();
broadcastMutex.post();
broadcastMutex.unlock();
}
} handler;

Expand All @@ -54,9 +54,9 @@ class UpdateThread : public Thread {
Port p;
String name;
PortReaderBuffer<Bottle> reader;
Semaphore mutex;
Mutex mutex;

UpdateThread() : mutex(1) {
UpdateThread() : mutex() {
}

void setName(const char *name) {
Expand Down Expand Up @@ -87,13 +87,13 @@ class UpdateThread : public Thread {
void show() {
int xx = 0;
int yy = 1;
mutex.wait();
mutex.lock();
Bottle send("look");
Property prop;
p.write(send,prop);
gotoxy(0,0);
Bottle& map = prop.findGroup("look").findGroup("map");
broadcastMutex.wait();
broadcastMutex.lock();
String prep = getPreparation().c_str();
if (prep.length()>0) {
long int t = (long int)Time::now();
Expand All @@ -106,7 +106,7 @@ class UpdateThread : public Thread {
pad("").c_str(),
pad(prep).c_str(),
pad(broadcast).c_str());
broadcastMutex.post();
broadcastMutex.unlock();
int i;
for (i=1; i<map.size(); i++) {
cprintf(" %s\n", map.get(i).asString().c_str());
Expand Down Expand Up @@ -135,13 +135,13 @@ class UpdateThread : public Thread {
}

gotoxy(xx,yy);
mutex.post();
mutex.unlock();
}

void apply(const String& str) {
Bottle send, recv;
send.fromString(str.c_str());
mutex.wait();
mutex.lock();
p.write(send,recv);
if (recv.get(0).asString()=="error") {
cprintf("PROBLEM:\n");
Expand All @@ -150,7 +150,7 @@ class UpdateThread : public Thread {
refresh();
Time::delay(2);
}
mutex.post();
mutex.unlock();
//show();
}

Expand All @@ -159,9 +159,9 @@ class UpdateThread : public Thread {
Time::delay(0.25);
show();
}
mutex.wait();
mutex.lock();
p.close();
mutex.post();
mutex.unlock();
}

} update_thread;
Expand Down
30 changes: 15 additions & 15 deletions example/game/game_clientmt/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class MyPlayer: public PeriodicThread

void doInit()
{
mutex.wait();
mutex.lock();

printf("Connecting with game server\n");
Network::connect(port.getName(), SERVER_NAME);
Expand All @@ -64,30 +64,30 @@ class MyPlayer: public PeriodicThread

randengine.seed(0);

mutex.post();
mutex.unlock();
}

// void doLoop()
void run()
{
mutex.wait();
mutex.lock();

look();
rndMove();
if(shooterF)
rndShoot();

mutex.post();
mutex.unlock();
}

void doRelease()
{
mutex.wait();
mutex.lock();

printf("Disconnecting\n");
Network::disconnect(port.getName(), SERVER_NAME);

mutex.post();
mutex.unlock();
}

void look()
Expand Down Expand Up @@ -159,38 +159,38 @@ class MyPlayer: public PeriodicThread

void getWorld(Bottle &w)
{
mutex.wait();
mutex.lock();

w=world;

mutex.post();
mutex.unlock();
}

int getLife()
{
int ret;
mutex.wait();
mutex.lock();
ret=myLife;
mutex.post();
mutex.unlock();

return ret;
}

int getX()
{
int ret;
mutex.wait();
mutex.lock();
ret=myX;
mutex.post();
mutex.unlock();
return ret;
}

int getY()
{
int ret;
mutex.wait();
mutex.lock();
ret=myY;
mutex.post();
mutex.unlock();
return ret;
}

Expand All @@ -206,7 +206,7 @@ class MyPlayer: public PeriodicThread

double prev;
double now;
Semaphore mutex;
Mutex mutex;
};

int main(int argc, char **argv)
Expand Down
10 changes: 5 additions & 5 deletions example/game/game_server/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <stdio.h>
#include <assert.h>

#include <yarp/os/Semaphore.h>
#include <yarp/os/Mutex.h>
#include <yarp/os/Time.h>

#include "Thing.h"
Expand Down Expand Up @@ -38,9 +38,9 @@ class GameHelper {
Matrix game_matrix;
DMatrix transient_matrix;
Things game_things;
yarp::os::Semaphore game_mutex;
yarp::os::Mutex game_mutex;

GameHelper() : game_mutex(1) {
GameHelper() : game_mutex() {
}
};

Expand Down Expand Up @@ -214,11 +214,11 @@ void Game::load() {
}

void Game::wait() {
SYS(system_resource).game_mutex.wait();
SYS(system_resource).game_mutex.lock();
}

void Game::post() {
SYS(system_resource).game_mutex.post();
SYS(system_resource).game_mutex.unlock();
}


Expand Down
18 changes: 9 additions & 9 deletions example/game/game_server/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include <stdlib.h>

#include <yarp/os/Semaphore.h>
#include <yarp/os/Mutex.h>
#include "Thing.h"
#include "Login.h"

Expand All @@ -25,7 +25,7 @@ class Replier {

class Player : public Replier {
public:
Player() : mutex(1) {
Player() : mutex() {

}

Expand All @@ -37,27 +37,27 @@ class Player : public Replier {

// this sets a callback, to pass messages back to the user
void setReplier(Replier *n_replier) {
mutex.wait();
mutex.lock();
replier = n_replier;
mutex.post();
mutex.unlock();
}

// anything that needs to be said is said via the replier callback
virtual void send(const char *msg) {
mutex.wait();
mutex.lock();
if (replier!=NULL) {
replier->send(msg);
}
mutex.post();
mutex.unlock();
}

// anything that needs to be broadcast is done via the replier callback
virtual void broadcast(const char *msg) {
mutex.wait();
mutex.lock();
if (replier!=NULL) {
replier->broadcast(msg);
}
mutex.post();
mutex.unlock();
}

// request a move for the player
Expand Down Expand Up @@ -95,7 +95,7 @@ class Player : public Replier {
private:

Replier *replier;
yarp::os::Semaphore mutex;
yarp::os::Mutex mutex;

ID id;
Login login;
Expand Down
Loading

0 comments on commit a6a49f0

Please sign in to comment.