|
From: <jfa...@us...> - 2008-10-22 20:22:31
|
Revision: 5661
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=5661&view=rev
Author: jfaustwg
Date: 2008-10-22 20:22:26 +0000 (Wed, 22 Oct 2008)
Log Message:
-----------
Switching everything (hopefully) in personalrobots to use rosconsole instead of ros::node::log
Modified Paths:
--------------
pkg/trunk/audio/audio_capture/audio_capture.cpp
pkg/trunk/audio/audio_capture/audio_clip_writer.cpp
pkg/trunk/curltest/curlnode.cpp
pkg/trunk/deprecated/etherdrive_old/src/base_node/base_node.cpp
pkg/trunk/deprecated/etherdrive_old/src/etherdrive_node/etherdrive_node.cpp
pkg/trunk/deprecated/etherdrive_old/src/etherdrive_node_new/etherdrive_node.cpp
pkg/trunk/drivers/cam/axis_cam/src/axis_cam/axis_cam.cpp
pkg/trunk/drivers/cam/axis_cam/src/axis_ptz/axis_ptz.cpp
pkg/trunk/drivers/cam/cv_cam/cv_cam.cpp
pkg/trunk/drivers/cam/elphel_cam/src/elphel_cam/elphel_cam.cpp
pkg/trunk/drivers/cam/elphel_cam/src/elphel_node/elphel_node.cpp
pkg/trunk/drivers/input/joy/joy.cpp
pkg/trunk/drivers/laser/hokuyo_node/hokuyo_node.cpp
pkg/trunk/drivers/motor/ethercat_hardware/src/ethercat_hardware.cpp
pkg/trunk/drivers/motor/ethercat_hardware/src/wg0x.cpp
pkg/trunk/drivers/robot/segway_apox/segway.cpp
pkg/trunk/nav/teleop_base/teleop_base.cpp
pkg/trunk/nav/teleop_base/teleop_head.cpp
pkg/trunk/robot_control_loops/pr2_etherCAT/src/main.cpp
pkg/trunk/vision/cv_movie_streamer/cv_movie_streamer.cpp
Modified: pkg/trunk/audio/audio_capture/audio_capture.cpp
===================================================================
--- pkg/trunk/audio/audio_capture/audio_capture.cpp 2008-10-22 19:46:56 UTC (rev 5660)
+++ pkg/trunk/audio/audio_capture/audio_capture.cpp 2008-10-22 20:22:26 UTC (rev 5661)
@@ -3,27 +3,27 @@
//
// Copyright (C) 2008, Morgan Quigley
//
-// Redistribution and use in source and binary forms, with or without
+// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
-// * Redistributions of source code must retain the above copyright notice,
+// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
-// * Neither the name of Stanford University nor the names of its
-// contributors may be used to endorse or promote products derived from
+// * Neither the name of Stanford University nor the names of its
+// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//////////////////////////////////////////////////////////////////////////////
@@ -40,7 +40,7 @@
//#define GRATUITOUS_DEBUGING
static int audio_cb(const void *input, void *output,
- unsigned long frame_count,
+ unsigned long frame_count,
const PaStreamCallbackTimeInfo *time_info,
PaStreamCallbackFlags status, void *user_data)
{
@@ -86,31 +86,46 @@
PaError err;
ROS_DEBUG("initializing portaudio");
if (Pa_Initialize() != paNoError)
+ {
ROS_FATAL("unable to initialize portaudio");
+ ROS_BREAK();
+ }
ROS_DEBUG("opening default audio stream");
ros::init(argc, argv);
ros::node n("audio_capture", ros::node::DONT_HANDLE_SIGINT);
g_audio_node = &n;
n.advertise<robot_msgs::AudioRawStream>("audio", 5);
- err = Pa_OpenDefaultStream(&stream, 1, 0, paFloat32, SAMPLE_RATE, 4096,
+ err = Pa_OpenDefaultStream(&stream, 1, 0, paFloat32, SAMPLE_RATE, 4096,
audio_cb, NULL);
if (err != paNoError)
+ {
ROS_FATAL("unable to open audio stream\n");
+ ROS_BREAK();
+ }
ROS_INFO("starting audio stream, ctrl-c to stop.");
#ifdef SHOW_MAX_SAMPLE
ROS_INFO("the printout stream shows the maximum audio sample for each portaudio snippet; use this to sanity-check your audio configuration and to set the gains inside alsamixer and on your audio hardware. You want the peaks to be near 1.0 but not quite 1.0 -- digital audio doesn't saturate very nicely.");
#endif
if (Pa_StartStream(stream) != paNoError)
+ {
ROS_FATAL("unable to start audio stream");
+ ROS_BREAK();
+ }
signal(SIGINT, sig_handler);
while (!g_caught_sigint)
usleep(500*1000);
ROS_DEBUG("stopping audio stream");
if (Pa_StopStream(stream) != paNoError)
+ {
ROS_FATAL("unable to stop audio stream");
+ ROS_BREAK();
+ }
ROS_DEBUG("shutting down portaudio");
if (Pa_Terminate() != paNoError)
+ {
ROS_FATAL("unable to close portaudio");
+ ROS_BREAK();
+ }
ros::fini();
return 0;
}
Modified: pkg/trunk/audio/audio_capture/audio_clip_writer.cpp
===================================================================
--- pkg/trunk/audio/audio_capture/audio_clip_writer.cpp 2008-10-22 19:46:56 UTC (rev 5660)
+++ pkg/trunk/audio/audio_capture/audio_clip_writer.cpp 2008-10-22 20:22:26 UTC (rev 5661)
@@ -3,27 +3,27 @@
//
// Copyright (C) 2008, Morgan Quigley
//
-// Redistribution and use in source and binary forms, with or without
+// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
-// * Redistributions of source code must retain the above copyright notice,
+// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
-// * Neither the name of Stanford University nor the names of its
-// contributors may be used to endorse or promote products derived from
+// * Neither the name of Stanford University nor the names of its
+// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//////////////////////////////////////////////////////////////////////////////
@@ -54,7 +54,10 @@
void audio_cb()
{
if (audio_msg.num_channels != 1)
- ROS_FATAL("audio_clip_writer can only handle single-channel audio.");
+ {
+ ROS_FATAL("audio_clip_writer can only handle single-channel audio.");
+ ROS_BREAK();
+ }
for (size_t i = 0; i < audio_msg.samples.size(); i++)
{
audio_clock++;
@@ -67,7 +70,7 @@
// compute RMS power
float sum_squares = 0;
int win_idx = 0;
- for (deque<float>::iterator j = window.begin(); j != window.end();
+ for (deque<float>::iterator j = window.begin(); j != window.end();
++j, win_idx++)
sum_squares += (*j) * (*j);// * ((float)win_idx / window.size());
//window_power = sqrt(2 * sum_squares / window.size());
@@ -84,7 +87,7 @@
clip_state = CLIP_START;
clip.clear();
clip.reserve(window.size());
- for (deque<float>::iterator j = window.begin();
+ for (deque<float>::iterator j = window.begin();
j != window.end(); ++j)
clip.push_back(*j);
}
Modified: pkg/trunk/curltest/curlnode.cpp
===================================================================
--- pkg/trunk/curltest/curlnode.cpp 2008-10-22 19:46:56 UTC (rev 5660)
+++ pkg/trunk/curltest/curlnode.cpp 2008-10-22 20:22:26 UTC (rev 5661)
@@ -4,27 +4,27 @@
//
// Copyright (C) 2008, Morgan Quigley
//
-// Redistribution and use in source and binary forms, with or without
+// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
-// * Redistributions of source code must retain the above copyright notice,
+// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
-// * Neither the name of Stanford University nor the names of its
-// contributors may be used to endorse or promote products derived from
+// * Neither the name of Stanford University nor the names of its
+// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#include "ros/node.h"
@@ -49,9 +49,9 @@
}
virtual ~CurlNode()
- {
- if (curl)
- delete curl;
+ {
+ if (curl)
+ delete curl;
}
bool spin()
@@ -59,7 +59,7 @@
while (ok())
{
if (curl->get())
- log(ros::ERROR,"Get failed.");
+ ROS_ERROR("Get failed.");
publish("chatter", msg_out);
}
Modified: pkg/trunk/deprecated/etherdrive_old/src/base_node/base_node.cpp
===================================================================
--- pkg/trunk/deprecated/etherdrive_old/src/base_node/base_node.cpp 2008-10-22 19:46:56 UTC (rev 5660)
+++ pkg/trunk/deprecated/etherdrive_old/src/base_node/base_node.cpp 2008-10-22 20:22:26 UTC (rev 5661)
@@ -4,27 +4,27 @@
//
// Copyright (C) 2008, Jimmy Sastra
//
-// Redistribution and use in source and binary forms, with or without
+// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
-// * Redistributions of source code must retain the above copyright notice,
+// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
-// * Neither the name of Stanford University nor the names of its
-// contributors may be used to endorse or promote products derived from
+// * Neither the name of Stanford University nor the names of its
+// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#include "ros/node.h"
@@ -106,21 +106,21 @@
for (int i = 0; i < 6; i++)
{
// setting gains on controls on ethercard drive
- edLeft->set_gain(i,'P',0);
+ edLeft->set_gain(i,'P',0);
edLeft->set_gain(i,'I',10);
- edLeft->set_gain(i,'D',0);
- edLeft->set_gain(i,'W',100);
+ edLeft->set_gain(i,'D',0);
+ edLeft->set_gain(i,'W',100);
edLeft->set_gain(i,'M',1004);
- edLeft->set_gain(i,'Z',1);
- edRight->set_gain(i,'P',0);
+ edLeft->set_gain(i,'Z',1);
+ edRight->set_gain(i,'P',0);
edRight->set_gain(i,'I',10);
- edRight->set_gain(i,'D',0);
- edRight->set_gain(i,'W',100);
+ edRight->set_gain(i,'D',0);
+ edRight->set_gain(i,'W',100);
edRight->set_gain(i,'M',1004);
- edRight->set_gain(i,'Z',1);
+ edRight->set_gain(i,'Z',1);
}
-
-
+
+
edLeft->set_control_mode(1); // 0=voltage, 1=current control
edRight->set_control_mode(1); // 0=voltage, 1=current control
@@ -133,17 +133,17 @@
}
void mot_callback()
- {
+ {
//printf("received motor 3 command %f\n", mot_cmd[3].val);
}
virtual ~EtherDrive_Node()
- {
+ {
if (edRight)
- {
+ {
printf("deleting edRight\n");
- delete edRight;
- }
+ delete edRight;
+ }
if (edLeft)
{
printf("deleting edLeft\n");
@@ -187,7 +187,7 @@
{ // turret motors, position control
desPos[i] = float(mot_cmd[i].cmd)/360*90000;
if(i < 6) posError[i] = desPos[i] - float(edLeft->get_enc(i));
- else posError[i] = desPos[i] - float(edRight->get_enc(i-6));
+ else posError[i] = desPos[i] - float(edRight->get_enc(i-6));
if(i==11) printf("posError: %f, despos: %f, enc: %i\n", posError[i], desPos[i], edRight->get_enc(i-6));
tmp_mot_cmd[i] = int(k_p[i]*posError[i]) + int(k_d[i]*(posError[i]-lastPosError[i])/0.001) + int(k_i[i]*intPosError[i]);
@@ -196,16 +196,16 @@
intPosError[i] += posError[i];
}
else
- { // wheels, velocity control
-
+ { // wheels, velocity control
+
if(i<6) currEncPos[i] = edLeft->get_enc(i);
else currEncPos[i] = edRight->get_enc(i-6);
curVel = float(currEncPos[i] - lastEncPos[i])/9000*0.48;
desVel = mot_cmd[i].cmd; // enc units/msec. should be (wheel rev/s)
if(i == 0| i ==1) tmp_mot_cmd[i] = int(k_p[i]*(desVel - curVel) + k_cross[i]*tmp_mot_cmd[2]);
- else if(i == 3| i ==4) tmp_mot_cmd[i] = int(k_p[i]*(desVel - curVel) + k_cross[i]*tmp_mot_cmd[5]);
- else if(i == 6| i ==7) tmp_mot_cmd[i] = int(k_p[i]*(desVel - curVel) + k_cross[i]*tmp_mot_cmd[8]);
- else if(i == 9| i ==10) tmp_mot_cmd[i] = int(k_p[i]*(desVel - curVel) + k_cross[i]*tmp_mot_cmd[11]);
+ else if(i == 3| i ==4) tmp_mot_cmd[i] = int(k_p[i]*(desVel - curVel) + k_cross[i]*tmp_mot_cmd[5]);
+ else if(i == 6| i ==7) tmp_mot_cmd[i] = int(k_p[i]*(desVel - curVel) + k_cross[i]*tmp_mot_cmd[8]);
+ else if(i == 9| i ==10) tmp_mot_cmd[i] = int(k_p[i]*(desVel - curVel) + k_cross[i]*tmp_mot_cmd[11]);
lastEncPos[i] = currEncPos[i];
}
@@ -221,7 +221,7 @@
tmp_mot_cmd[i] = -3000;
// printf("Max -ve current motor %i \n", i);
}
-
+
}
// edLeft->drive(6,tmp_mot_cmd);
@@ -229,7 +229,7 @@
{
tmp_mot_cmd_left[i] = tmp_mot_cmd[i];
tmp_mot_cmd_right[i] = tmp_mot_cmd[i+6];
- }
+ }
edLeft->drive(6,tmp_mot_cmd_left);
edRight->drive(6,tmp_mot_cmd_right);
// int footmp[6] = {500,500,0,500,500,0};
@@ -247,7 +247,7 @@
return false;
}
-
+
for (int i = 0; i < 6; i++)
{
mot[i].pos_valid = true;
@@ -272,7 +272,7 @@
usleep(1000);
if (!a.do_tick())
{
- a.log(ros::ERROR,"Etherdrive tick failed.");
+ ROS_ERROR("Etherdrive tick failed.");
break;
}
}
Modified: pkg/trunk/deprecated/etherdrive_old/src/etherdrive_node/etherdrive_node.cpp
===================================================================
--- pkg/trunk/deprecated/etherdrive_old/src/etherdrive_node/etherdrive_node.cpp 2008-10-22 19:46:56 UTC (rev 5660)
+++ pkg/trunk/deprecated/etherdrive_old/src/etherdrive_node/etherdrive_node.cpp 2008-10-22 20:22:26 UTC (rev 5661)
@@ -4,27 +4,27 @@
//
// Copyright (C) 2008, Morgan Quigley
//
-// Redistribution and use in source and binary forms, with or without
+// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
-// * Redistributions of source code must retain the above copyright notice,
+// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
-// * Neither the name of Stanford University nor the names of its
-// contributors may be used to endorse or promote products derived from
+// * Neither the name of Stanford University nor the names of its
+// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#include "ros/node.h"
@@ -101,9 +101,9 @@
}
virtual ~EtherDrive_Node()
- {
- if (ed)
- delete ed;
+ {
+ if (ed)
+ delete ed;
}
bool do_tick()
@@ -141,7 +141,7 @@
int val[6];
ros::Time before = ros::Time::now();
-
+
if (!ed->tick(6,val)) {
return false;
}
@@ -160,7 +160,7 @@
ostringstream oss;
oss << "mot" << i;
- if (frame_id[i] != string("BAD_ID") && parent_id[i] != string("BAD_ID"))
+ if (frame_id[i] != string("BAD_ID") && parent_id[i] != string("BAD_ID"))
{
tf.sendEuler(frame_id[i], parent_id[i],
@@ -187,7 +187,7 @@
usleep(1000);
if (!a.do_tick())
{
- a.log(ros::ERROR,"Etherdrive tick failed.");
+ ROS_ERROR("Etherdrive tick failed.");
break;
}
}
Modified: pkg/trunk/deprecated/etherdrive_old/src/etherdrive_node_new/etherdrive_node.cpp
===================================================================
--- pkg/trunk/deprecated/etherdrive_old/src/etherdrive_node_new/etherdrive_node.cpp 2008-10-22 19:46:56 UTC (rev 5660)
+++ pkg/trunk/deprecated/etherdrive_old/src/etherdrive_node_new/etherdrive_node.cpp 2008-10-22 20:22:26 UTC (rev 5661)
@@ -4,27 +4,27 @@
//
// Copyright (C) 2008, Morgan Quigley
//
-// Redistribution and use in source and binary forms, with or without
+// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
-// * Redistributions of source code must retain the above copyright notice,
+// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
-// * Neither the name of Stanford University nor the names of its
-// contributors may be used to endorse or promote products derived from
+// * Neither the name of Stanford University nor the names of its
+// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#include "ros/node.h"
@@ -94,38 +94,38 @@
mot_cmd[i].rel = 0;
mot_cmd[i].cmd = 0;
- ed->set_gain(i,'P',0);
+ ed->set_gain(i,'P',0);
ed->set_gain(i,'I',10);
- ed->set_gain(i,'D',0);
- ed->set_gain(i,'W',100);
+ ed->set_gain(i,'D',0);
+ ed->set_gain(i,'W',100);
ed->set_gain(i,'M',1004);
- ed->set_gain(i,'Z',1);
+ ed->set_gain(i,'Z',1);
}
-
+
ed->set_control_mode(1); // 0=voltage, 1=current control
-
-
+
+
firstTimeVelCtrl = true;
fooCounter = 0;
ed->motors_on();
counter = 0;
}
- void mot_callback() {
+ void mot_callback() {
//printf("received motor 3 command %f\n", mot_cmd[3].val);
}
virtual ~EtherDrive_Node()
- {
- if (ed)
- delete ed;
+ {
+ if (ed)
+ delete ed;
}
bool do_tick()
{
-//printf("%i: enc: %i \n", fooCounter, ed->get_enc(5));
+//printf("%i: enc: %i \n", fooCounter, ed->get_enc(5));
int tmp_mot_cmd[6];
int currEncPos[6];
@@ -165,7 +165,7 @@
pos_k_p[2] = -3;
pos_k_p[3] = 1.2;
pos_k_p[4] = 1.2;
- pos_k_p[5] = -1.2; //
+ pos_k_p[5] = -1.2; //
pos_k_i[0] = 0;
pos_k_i[1] = 0;
@@ -179,7 +179,7 @@
pos_k_d[2] = -3;
pos_k_d[3] = 0.075; //1;
pos_k_d[4] = 0.075; //-0.075; //1;
- pos_k_d[5] = -0.075;//-0.075; //
+ pos_k_d[5] = -0.075;//-0.075; //
/*
voltage control settings:
pos_k_p[3] = -1;
@@ -193,7 +193,7 @@
{
case 0: // direct
- tmp_mot_cmd[i] = (int)mot_cmd[i].cmd; //last_mot_val[i]; //JS
+ tmp_mot_cmd[i] = (int)mot_cmd[i].cmd; //last_mot_val[i]; //JS
break;
case 1: // position control on computer
desPos[i] = float(mot_cmd[i].cmd)/360*90000; //desPos[i]=ed->get_enc(i) + mot[i].val;
@@ -204,26 +204,26 @@
lastPosError[i] = posError[i];
intPosError[i] += posError[i];
break;
- case 2: // velocity control
+ case 2: // velocity control
if(fooCounter < 10) { // first couple of encoder readings are messed up for some reason. JS
lastEncPos[i] = ed->get_enc(i);
last_mot_cmd[i] = 0;
}
fooCounter++;
-
+
currEncPos[i] = ed->get_enc(i);
curVel = float(currEncPos[i] - lastEncPos[i])/9000*0.48; //encoder (units/msec) need to calibrate this
desVel = mot_cmd[i].cmd; // enc units/msec. should be (wheel rev/s)
- if((desVel-float(curVel))>0) tmp_mot_cmd[i] = int(last_mot_cmd[i] + 10*k_p[i]);
+ if((desVel-float(curVel))>0) tmp_mot_cmd[i] = int(last_mot_cmd[i] + 10*k_p[i]);
if((desVel-float(curVel))<0) tmp_mot_cmd[i] = int(last_mot_cmd[i] - 10*k_p[i]);
- if(desVel <= 0.0001 && desVel >=-0.0001) tmp_mot_cmd[i] = 0;
+ if(desVel <= 0.0001 && desVel >=-0.0001) tmp_mot_cmd[i] = 0;
//tmp_mot_cmd[i] = int(last_mot_cmd[i] + k_p[i]*(desVel-float(curVel)));
-
+
lastEncPos[i] = currEncPos[i];
last_mot_cmd[i] = last_mot_cmd[i] + k_p[i]*(desVel-curVel);
break;
- case 3: // On board position control?
+ case 3: // On board position control?
if (mot_cmd[i].valid) {
if (mot_cmd[i].rel) {
last_mot_val[i] = mot[i].pos + mot_cmd[i].cmd;
@@ -237,7 +237,7 @@
// do nothing
tmp_mot_cmd[i] = 0;
break;
-
+
}
mot_cmd[i].valid = false; // set to invalid so we don't re-use
mot_cmd[i].unlock();
@@ -249,14 +249,14 @@
tmp_mot_cmd[i] = -3000;
printf("Max current\n");
}
- }
+ }
ed->drive(6,tmp_mot_cmd);
int val[6];
if (!ed->tick(6,val)) {
return false;
}
-
+
for (int i = 0; i < 6; i++) {
mot[i].pos = val[i] / pulse_per_rad[i];
mot[i].pos_valid = true;
@@ -278,7 +278,7 @@
usleep(1000);
if (!a.do_tick())
{
- a.log(ros::ERROR,"Etherdrive tick failed.");
+ ROS_ERROR("Etherdrive tick failed.");
break;
}
}
Modified: pkg/trunk/drivers/cam/axis_cam/src/axis_cam/axis_cam.cpp
===================================================================
--- pkg/trunk/drivers/cam/axis_cam/src/axis_cam/axis_cam.cpp 2008-10-22 19:46:56 UTC (rev 5660)
+++ pkg/trunk/drivers/cam/axis_cam/src/axis_cam/axis_cam.cpp 2008-10-22 20:22:26 UTC (rev 5661)
@@ -4,27 +4,27 @@
//
// Copyright (C) 2008, Morgan Quigley
//
-// Redistribution and use in source and binary forms, with or without
+// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
-// * Redistributions of source code must retain the above copyright notice,
+// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
-// * Neither the name of Stanford University nor the names of its
-// contributors may be used to endorse or promote products derived from
+// * Neither the name of Stanford University nor the names of its
+// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#include <stdio.h>
@@ -77,9 +77,9 @@
}
virtual ~Axis_cam_node()
- {
- if (cam)
- delete cam;
+ {
+ if (cam)
+ delete cam;
}
bool polled_image_cb(std_srvs::PolledImage::request &req,
@@ -98,7 +98,7 @@
if (cam->get_jpeg(&jpeg, &jpeg_size))
{
- log(ros::ERROR, "woah! AxisCam::get_jpeg returned an error");
+ ROS_ERROR("woah! AxisCam::get_jpeg returned an error");
return false;
}
@@ -131,7 +131,7 @@
next_time = next_time + ros::Duration(1,0);
}
} else {
- log(ros::ERROR,"couldn't take image.");
+ ROS_ERROR("couldn't take image.");
usleep(1000000);
param("~host", axis_host, string("192.168.0.90"));
cam->set_host(axis_host);
@@ -143,7 +143,7 @@
void checkImage(robot_msgs::DiagnosticStatus& status)
- {
+ {
status.name = "Image Test";
uint8_t *jpeg;
uint32_t jpeg_size;
@@ -183,7 +183,7 @@
status.name = "MAC test";
char cmd[100];
snprintf(cmd, 100, "arp -n %s", axis_host.c_str());
-
+
FILE* f = popen(cmd, "r");
char buf1[100];
char buf2[100];
Modified: pkg/trunk/drivers/cam/axis_cam/src/axis_ptz/axis_ptz.cpp
===================================================================
--- pkg/trunk/drivers/cam/axis_cam/src/axis_ptz/axis_ptz.cpp 2008-10-22 19:46:56 UTC (rev 5660)
+++ pkg/trunk/drivers/cam/axis_cam/src/axis_ptz/axis_ptz.cpp 2008-10-22 20:22:26 UTC (rev 5661)
@@ -4,27 +4,27 @@
//
// Copyright (C) 2008, Morgan Quigley
//
-// Redistribution and use in source and binary forms, with or without
+// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
-// * Redistributions of source code must retain the above copyright notice,
+// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
-// * Neither the name of Stanford University nor the names of its
-// contributors may be used to endorse or promote products derived from
+// * Neither the name of Stanford University nor the names of its
+// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#include "ros/node.h"
@@ -60,9 +60,9 @@
}
virtual ~Axis_PTZ_node()
- {
- if (cam)
- delete cam;
+ {
+ if (cam)
+ delete cam;
}
void set_actuator_pos(std_msgs::ActuatorState& act, float pos) {
@@ -121,7 +121,7 @@
{
ostringstream oss;
-
+
if (ptz_cmd_saved.pan.valid)
oss << (ptz_cmd_saved.pan.rel ? "r" : "") << string("pan=") << ptz_cmd_saved.pan.cmd << string("&");
if (ptz_cmd_saved.tilt.valid)
@@ -132,14 +132,14 @@
if (ptz_cmd_saved.focus.valid) {
if (!ptz_cmd_saved.focus.rel && ptz_cmd_saved.focus.cmd <= 0)
oss << string("autofocus=on&");
- else
+ else
oss << string("autofocus=off&") << (ptz_cmd_saved.focus.rel ? "r" : "") << string("focus=") << ptz_cmd_saved.focus.cmd << string("&");
}
if (ptz_cmd_saved.iris.valid) {
if (!ptz_cmd_saved.iris.rel && ptz_cmd_saved.iris.cmd <= 0)
oss << string("autoiris=on&");
- else
+ else
oss << string("autoiris=off&") << (ptz_cmd_saved.iris.rel ? "r" : "") << string("iris=") << ptz_cmd_saved.iris.cmd << string("&");
}
@@ -155,7 +155,7 @@
}
control_mutex.unlock();
-
+
return retval;
}
@@ -166,14 +166,14 @@
{
if (!get_and_send_ptz())
{
- log(ros::ERROR,"Couldn't acquire ptz info.");
+ ROS_ERROR("Couldn't acquire ptz info.");
usleep(1000000);
param("~host", axis_host, string("192.168.0.90"));
cam->set_host(axis_host);
}
if (!do_ptz_control())
{
- log(ros::ERROR,"Couldn't command ptz.");
+ ROS_ERROR("Couldn't command ptz.");
usleep(1000000);
param("~host", axis_host, string("192.168.0.90"));
cam->set_host(axis_host);
Modified: pkg/trunk/drivers/cam/cv_cam/cv_cam.cpp
===================================================================
--- pkg/trunk/drivers/cam/cv_cam/cv_cam.cpp 2008-10-22 19:46:56 UTC (rev 5660)
+++ pkg/trunk/drivers/cam/cv_cam/cv_cam.cpp 2008-10-22 20:22:26 UTC (rev 5661)
@@ -4,27 +4,27 @@
//
// Copyright (C) 2008, Morgan Quigley
//
-// Redistribution and use in source and binary forms, with or without
+// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
-// * Redistributions of source code must retain the above copyright notice,
+// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
-// * Neither the name of Stanford University nor the names of its
-// contributors may be used to endorse or promote products derived from
+// * Neither the name of Stanford University nor the names of its
+// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#include "ros/node.h"
@@ -44,19 +44,22 @@
double last_print_time;
int show_image, fps_count, delay_us;
- CVCam() : node("cv_cam"), cv_bridge(&image_msg),
+ CVCam() : node("cv_cam"), cv_bridge(&image_msg),
last_print_time(0), show_image(0), fps_count(0)
{
advertise<MsgImage>("image");
capture = cvCaptureFromCAM(CV_CAP_ANY);
if (!capture)
- log(FATAL, "woah! couldn't open a camera. is one connected?\n");
+ {
+ ROS_FATAL("woah! couldn't open a camera. is one connected?");
+ ROS_BREAK();
+ }
param("display", show_image, 0);
param("delay_us", delay_us, 0);
if (show_image)
cvNamedWindow("cv_cam", CV_WINDOW_AUTOSIZE);
}
- virtual ~CVCam()
+ virtual ~CVCam()
{
if (capture)
cvReleaseCapture(&capture);
Modified: pkg/trunk/drivers/cam/elphel_cam/src/elphel_cam/elphel_cam.cpp
===================================================================
--- pkg/trunk/drivers/cam/elphel_cam/src/elphel_cam/elphel_cam.cpp 2008-10-22 19:46:56 UTC (rev 5660)
+++ pkg/trunk/drivers/cam/elphel_cam/src/elphel_cam/elphel_cam.cpp 2008-10-22 20:22:26 UTC (rev 5661)
@@ -4,27 +4,27 @@
//
// Copyright (C) 2008, Morgan Quigley
//
-// Redistribution and use in source and binary forms, with or without
+// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
-// * Redistributions of source code must retain the above copyright notice,
+// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
-// * Neither the name of Stanford University nor the names of its
-// contributors may be used to endorse or promote products derived from
+// * Neither the name of Stanford University nor the names of its
+// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#include "ros/ros_slave.h"
@@ -59,11 +59,11 @@
if (!get_double_param(".fps", &fps))
fps = 20;
- printf("elphel_cam fps set to [%d]\n", fps);
+ printf("elphel_cam fps set to [%d]\n", fps);
if (!get_int_param(".im_dec", &im_dec))
im_dec = 4;
- printf("elphel_cam image decimation and binning set to [%d]\n", im_dec);
+ printf("elphel_cam image decimation and binning set to [%d]\n", im_dec);
cam = new Elphel_Cam(elphel_host);
@@ -72,9 +72,9 @@
cam->start();
}
virtual ~Elphel_Cam_Node()
- {
- if (cam)
- delete cam;
+ {
+ if (cam)
+ delete cam;
}
bool take_and_send_image()
{
@@ -82,7 +82,7 @@
uint32_t jpeg_size;
if (!cam->next_jpeg(&jpeg, &jpeg_size))
{
- log(ROS::ERROR, "Elphel_Cam::next_jpeg returned an error");
+ ROS_ERROR("Elphel_Cam::next_jpeg returned an error");
return false;
}
@@ -99,8 +99,8 @@
}
if (!cam->next_jpeg(&jpeg, &jpeg_size))
{
- log(ROS::ERROR, "Elphel_Cam::next_jpeg returned an error");
- return false;
+ ROS_ERROR("Elphel_Cam::next_jpeg returned an error");
+ return false;
}
}
@@ -127,7 +127,7 @@
while (a.happy())
if (!a.take_and_send_image())
{
- a.log(ROS::ERROR,"couldn't take image.");
+ ROS_ERROR("couldn't take image.");
break;
}
return 0;
Modified: pkg/trunk/drivers/cam/elphel_cam/src/elphel_node/elphel_node.cpp
===================================================================
--- pkg/trunk/drivers/cam/elphel_cam/src/elphel_node/elphel_node.cpp 2008-10-22 19:46:56 UTC (rev 5660)
+++ pkg/trunk/drivers/cam/elphel_cam/src/elphel_node/elphel_node.cpp 2008-10-22 20:22:26 UTC (rev 5661)
@@ -1,13 +1,13 @@
/*********************************************************************
* Software License Agreement (BSD License)
-*
+*
* Copyright (c) 2008, Jimmy Sastra
* All rights reserved.
-*
+*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
-*
+*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
@@ -17,7 +17,7 @@
* * Neither the name of the Willow Garage nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
-*
+*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@@ -60,11 +60,11 @@
uint8_t* jpeg;
uint32_t jpeg_size;
-
+
Elphel_Cam *e; //("10.12.0.103");
IplImage* img;
-
+
Elphel_Node() : ros::node("elphel"), cv_bridge(&image_msg), codec(&image_msg)
{
advertise<std_msgs::Image>("elphel_bus");
@@ -76,12 +76,12 @@
bool getFrame() {
- static int i = 0;
- i++;
+ static int i = 0;
+ i++;
if (!e->next_jpeg(&jpeg, &jpeg_size))
{
- log(ros::ERROR, "Elphel_Cam::next_jpeg returned an error");
+ ROS_ERROR("Elphel_Cam::next_jpeg returned an error");
return false;
}
@@ -98,7 +98,7 @@
}
if (!e->next_jpeg(&jpeg, &jpeg_size))
{
- log(ros::ERROR, "Elphel_Cam::next_jpeg returned an error");
+ ROS_ERROR("Elphel_Cam::next_jpeg returned an error");
return false;
}
}
@@ -122,21 +122,21 @@
virtual ~Elphel_Node() {
if(e) {
e->stop();
- }
+ }
}
};
-int main(int argc, char **argv)
+int main(int argc, char **argv)
{
ros::init(argc, argv);
Elphel_Node n;
while(n.ok()) {
- if(!n.getFrame())
+ if(!n.getFrame())
{
printf("Elphel camera failed.\n");
- n.log(ros::ERROR,"Elphel camera failed.");
+ ROS_ERROR("Elphel camera failed.");
break;
- }
+ }
}
ros::fini();
Modified: pkg/trunk/drivers/input/joy/joy.cpp
===================================================================
--- pkg/trunk/drivers/input/joy/joy.cpp 2008-10-22 19:46:56 UTC (rev 5660)
+++ pkg/trunk/drivers/input/joy/joy.cpp 2008-10-22 20:22:26 UTC (rev 5661)
@@ -37,7 +37,10 @@
{
joy_fd = open(joy_dev.c_str(), O_RDONLY);
if (joy_fd <= 0)
- log(FATAL, "couldn't open joystick %s.", joy_dev.c_str());
+ {
+ ROS_FATAL("couldn't open joystick %s.", joy_dev.c_str());
+ ROS_BREAK();
+ }
pthread_create(&joy_thread, NULL, s_joy_func, this);
}
void stop()
@@ -77,7 +80,7 @@
for(unsigned int i=0;i<joy_msg.get_axes_size();i++)
joy_msg.axes[i] = 0.0;
}
- joy_msg.axes[event.number] = (fabs(event.value) < deadzone) ? 0.0 :
+ joy_msg.axes[event.number] = (fabs(event.value) < deadzone) ? 0.0 :
(-event.value / 32767.0);
cout << "axis: " << (int) event.number << ", value: " << joy_msg.axes[event.number] << endl;
publish("joy", joy_msg);
Modified: pkg/trunk/drivers/laser/hokuyo_node/hokuyo_node.cpp
===================================================================
--- pkg/trunk/drivers/laser/hokuyo_node/hokuyo_node.cpp 2008-10-22 19:46:56 UTC (rev 5660)
+++ pkg/trunk/drivers/laser/hokuyo_node/hokuyo_node.cpp 2008-10-22 20:22:26 UTC (rev 5661)
@@ -1,13 +1,13 @@
/*********************************************************************
* Software License Agreement (BSD License)
-*
+*
* Copyright (c) 2008, Willow Garage, Inc.
* All rights reserved.
-*
+*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
-*
+*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
@@ -17,7 +17,7 @@
* * Neither the name of the Willow Garage nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
-*
+*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@@ -39,7 +39,7 @@
@htmlinclude manifest.html
@b hokuyo_node is a driver for SCIP2.0 compliant Hokuyo laser range-finders.
-This driver has been designed, primarliy with the Hokuyo UTM-30LX in mind, also
+This driver has been designed, primarliy with the Hokuyo UTM-30LX in mind, also
known as the Hokuyo Top-URG.
<hr>
@@ -124,7 +124,7 @@
bool running_;
int count_;
-
+
SelfTest<HokuyoNode> self_test_;
DiagnosticUpdater<HokuyoNode> diagnostic_;
@@ -195,24 +195,24 @@
string device_id_ = laser_.getID();
string device_status_ = laser_.getStatus();
- log(ros::INFO, "Connected to device with ID: %s", device_id_.c_str());
+ ROS_INFO("Connected to device with ID: %s", device_id_.c_str());
laser_.laserOn();
if (calibrate_time_)
laser_.calcLatency(true, min_ang_, max_ang_, cluster_, skip_);
-
+
int status = laser_.requestScans(true, min_ang_, max_ang_, cluster_, skip_);
if (status != 0) {
- log(ros::WARNING,"Failed to request scans from device. Status: %d.", status);
+ ROS_WARN("Failed to request scans from device. Status: %d.", status);
return -1;
}
running_ = true;
} catch (hokuyo::Exception& e) {
- log(ros::WARNING,"Exception thrown while starting urg.\n%s", e.what());
+ ROS_WARN("Exception thrown while starting urg.\n%s", e.what());
return -1;
}
@@ -227,7 +227,7 @@
{
laser_.close();
} catch (hokuyo::Exception& e) {
- log(ros::WARNING,"Exception thrown while trying to close:\n%s",e.what());
+ ROS_WARN("Exception thrown while trying to close:\n%s",e.what());
}
running_ = false;
}
@@ -240,21 +240,21 @@
try
{
int status = laser_.serviceScan(&scan_);
-
+
if(status != 0)
{
- log(ros::WARNING,"Error getting scan: %d", status);
+ ROS_WARN("Error getting scan: %d", status);
return 0;
}
} catch (hokuyo::CorruptedDataException &e) {
- log(ros::WARNING,"Skipping corrupted data");
+ ROS_WARN("Skipping corrupted data");
return 0;
} catch (hokuyo::Exception& e) {
- log(ros::WARNING,"Exception thrown while trying to get scan.\n%s", e.what());
+ ROS_WARN("Exception thrown while trying to get scan.\n%s", e.what());
running_ = false; //If we're here, we are no longer running
return -1;
}
-
+
scan_msg_.angle_min = scan_.config.min_angle;
scan_msg_.angle_max = scan_.config.max_angle;
scan_msg_.angle_increment = scan_.config.ang_increment;
@@ -266,7 +266,7 @@
scan_msg_.set_intensities_size(scan_.num_readings);
scan_msg_.header.stamp = ros::Time(scan_.system_time_stamp);
scan_msg_.header.frame_id = frameid_;
-
+
for(int i = 0; i < scan_.num_readings; ++i)
{
scan_msg_.ranges[i] = scan_.ranges[i];
@@ -322,7 +322,7 @@
} else {
status.level = 0;
status.message = "Sensor connected";
- }
+ }
status.set_strings_size(3);
status.strings[0].label = "Port";
@@ -579,7 +579,7 @@
}
status.level = 0;
- status.message = "Previous operation resumed successfully.";
+ status.message = "Previous operation resumed successfully.";
}
};
Modified: pkg/trunk/drivers/motor/ethercat_hardware/src/ethercat_hardware.cpp
===================================================================
--- pkg/trunk/drivers/motor/ethercat_hardware/src/ethercat_hardware.cpp 2008-10-22 19:46:56 UTC (rev 5660)
+++ pkg/trunk/drivers/motor/ethercat_hardware/src/ethercat_hardware.cpp 2008-10-22 20:22:26 UTC (rev 5661)
@@ -78,36 +78,42 @@
interface_ = interface;
if ((ni_ = init_ec(interface)) == NULL)
{
- node->log(ros::FATAL, "Unable to initialize interface: %s", interface);
+ ROS_FATAL("Unable to initialize interface: %s", interface);
+ ROS_BREAK();
}
if (set_socket_timeout(ni_, 1000*500))
{
- node->log(ros::FATAL, "Unable to change socket timeout");
- }
+ ROS_FATAL("Unable to change socket timeout");
+ ROS_BREAK();
+ }
// Initialize Application Layer (AL)
EtherCAT_DataLinkLayer::instance()->attach(ni_);
if ((al_ = EtherCAT_AL::instance()) == NULL)
{
- node->log(ros::FATAL, "Unable to initialize Application Layer (AL): %08x", al_);
+ ROS_FATAL("Unable to initialize Application Layer (AL): %08x", al_);
+ ROS_BREAK();
}
num_slaves_ = al_->get_num_slaves();
if (num_slaves_ == 0)
{
- node->log(ros::FATAL, "Unable...
[truncated message content] |