Skip to content
Permalink
Browse files

osc pack/unpack (#80)

* Fixed osc and updated base_build.sh
* This may still have some problems, but Travis CI has been unresponsive, so I'm merging.
  • Loading branch information...
rozgo authored and jredmondson committed Feb 24, 2019
1 parent a2a4663 commit d886e9d16ea6386fb0c9c064a859f1b1e5e2a3d6
@@ -53,6 +53,7 @@ ACE_TAO/*
MPC/*
madara/
eigen/
oscpack/

#Ignore maven project files
target/
@@ -590,25 +590,6 @@ if [ $PREREQS -eq 1 ] && [ $MAC -eq 0 ]; then
sudo add-apt-repository -y ppa:webupd8team/java
fi

if [ ! -d $OSC_ROOT ]; then
echo "Downloading oscpack"
git clone https://github.com/jredmondson/oscpack.git $OSC_ROOT
else
echo "Updating oscpack"
cd $OSC_ROOT
git pull
fi

cd $OSC_ROOT
echo "Cleaning oscpack"
make clean
echo "Building oscpack"
if [ $CLANG -eq 1 ]; then
sudo make CXX=clang++-5.0 COPTS='-Wall -Wextra -fPIC' install
else
sudo make CXX=clang++-5.0 COPTS='-Wall -Wextra -fPIC' install
fi

if [ $ROS -eq 1 ]; then
ROS_FIRST_SETUP=0
if [ ! -d "/opt/ros/kinetic" ] ; then
@@ -1036,6 +1017,37 @@ else
echo "NOT CHECKING CAPNPROTO"
fi

# this is common to Mac and Linux, so it needs to be outside of the above
if [ $PREREQS -eq 1 ]; then
if [ ! -d $OSC_ROOT ]; then
echo "Downloading oscpack"
git clone https://github.com/jredmondson/oscpack.git $OSC_ROOT
else
echo "Updating oscpack"
cd $OSC_ROOT
git pull
fi

cd $OSC_ROOT
echo "Cleaning oscpack"
make clean
echo "Building oscpack"
if [ $MAC -eq 1 ]; then
if [ $CLANG -eq 1 ]; then
export CXX=clang++
fi
elif [ $CLANG -eq 1 ]; then
export CXX=clang++-5.0
fi

if [ ! -z "$CXX" ]; then
sudo make CXX=$CXX COPTS='-Wall -Wextra -fPIC' install
else
sudo make COPTS='-Wall -Wextra -fPIC' install
fi

fi

if [ $ZMQ -eq 1 ]; then
export ZMQ=1
cd $INSTALL_DIR
@@ -9,7 +9,7 @@
* Specialty options (must be compiled with more than just vrep feature)
* ros-p3dx : A ROS Pioneer 3DX robot
**/
.platform="vrep-quad";
.platform="osc";

/**
* The host information where VREP is running
@@ -4,8 +4,8 @@

$gams_root = $ENV{GAMS_ROOT};
$time = 3600;
$madara_debug = 0;
$gams_debug = 6;
$madara_debug = 1;
$gams_debug = 0;
$period = 1;
$num = 1;
$area = "small";
@@ -126,18 +126,20 @@ gams::platforms::OscPlatform::build_prefixes(void)
&& madara::utility::begins_with(self_->agent.prefix, "agent."))
{
// build the common prefix
xy_velocity_prefix_ = "/";
xy_velocity_prefix_ += self_->agent.prefix;
xy_velocity_prefix_[6] = '/';
std::string common_prefix = "/";
common_prefix += self_->agent.prefix;
common_prefix[6] = '/';

// build the common prefix
z_velocity_prefix_ = xy_velocity_prefix_;
position_prefix_ = xy_velocity_prefix_;
rotation_prefix_ = xy_velocity_prefix_;
xy_velocity_prefix_ = common_prefix;
z_velocity_prefix_ = common_prefix;
yaw_velocity_prefix_ = common_prefix;
position_prefix_ = common_prefix;
rotation_prefix_ = common_prefix;

// build the specialized prefixes
xy_velocity_prefix_ += "/velocity/xy";
z_velocity_prefix_ += "/velocity/z";
yaw_velocity_prefix_ += "/velocity/yaw";
position_prefix_ += "/pos";
rotation_prefix_ += "/rot";
}
@@ -212,6 +214,8 @@ int
gams::platforms::OscPlatform::sense(void)
{
utility::OscUdp::OscMap values;
values[position_prefix_] = std::vector<double>();
values[rotation_prefix_] = std::vector<double>();

madara_logger_ptr_log(gams::loggers::global_logger.get(),
gams::loggers::LOG_MINOR,
@@ -226,6 +230,16 @@ gams::platforms::OscPlatform::sense(void)
"gams::platforms::OscPlatform::sense: " \
"%s: leaving receive on OSC UDP with %zu values\n",
self_->agent.prefix.c_str(), values.size());

if (values[position_prefix_].size() != 3)
{
values.erase(position_prefix_);
}

if (values[rotation_prefix_].size() != 3)
{
values.erase(rotation_prefix_);
}

for (auto value: values)
{
@@ -459,6 +473,12 @@ gams::platforms::OscPlatform::orient(const pose::Orientation & target,
// convert from input reference frame to vrep reference frame, if necessary
pose::Orientation new_target(get_frame(), target);

utility::OscUdp::OscMap values;
std::vector<double> yaw_velocity;
yaw_velocity.push_back(0);
values[yaw_velocity_prefix_] = yaw_velocity;
osc_.send(values);

return 1;
}

@@ -180,6 +180,9 @@ namespace gams { namespace platforms
/// holds z velocity prefix for OSC messages
std::string z_velocity_prefix_;

/// holds yaw velocity prefix for OSC messages
std::string yaw_velocity_prefix_;

/// holds position prefix for OSC messages
std::string position_prefix_;

Oops, something went wrong.

0 comments on commit d886e9d

Please sign in to comment.
You can’t perform that action at this time.