Hi,
updating the orocos toolchain to use the latest version from master (I
guess very close to the actual 2.4 release), we had to make the
following changes to the rtt_ros_integration in order to get the
typekits to compile. Do these changes look OK? Especially the addition
of the "true" argument we're in doubt.
regards,
Steven
diff --git a/rtt_ros_integration/src/ros_msg_transporter.hpp
b/rtt_ros_integration/src/ros_msg_transporter.hpp
index 2cdebb9..ac6b685 100644
--- a/rtt_ros_integration/src/ros_msg_transporter.hpp
+++ b/rtt_ros_integration/src/ros_msg_transporter.hpp
@@ -145,7 +145,7 @@ namespace ros_integration {
typename base::ChannelElement<T>::value_t sample; // XXX:
real-time !
// this read should always succeed since signal() means 'data
available in a data element'.
typename base::ChannelElement<T>::shared_ptr input =
this->getInput();
- if( input && (input->read(sample) == NewData) )
+ if( input && (input->read(sample,true) == NewData) )
ros_pub.publish(sample);
}
@@ -219,7 +219,7 @@ namespace ros_integration {
template <class T>
class RosMsgTransporter : public RTT::types::TypeTransporter{
- virtual base::ChannelElementBase * createStream
(base::PortInterface *port, const ConnPolicy &policy, bool is_sender)
const{
+ virtual base::ChannelElementBase::shared_ptr createStream
(base::PortInterface *port, const ConnPolicy &policy, bool is_sender)
const{
if(is_sender){
base::ChannelElementBase* buf =
internal::ConnFactory::buildDataStorage<T>(policy);
base::ChannelElementBase::shared_ptr tmp =
base::ChannelElementBase::shared_ptr(new
RosPubChannelElement<T>(port,policy));
patch in rtt ros integration for RTT read API changes
On Tuesday 03 May 2011 14:20:08 Steven Bellens wrote:
> Hi,
>
> updating the orocos toolchain to use the latest version from master (I
> guess very close to the actual 2.4 release), we had to make the
> following changes to the rtt_ros_integration in order to get the
> typekits to compile. Do these changes look OK? Especially the addition
> of the "true" argument we're in doubt.
>
> regards,
>
> Steven
>
> diff --git a/rtt_ros_integration/src/ros_msg_transporter.hpp
> b/rtt_ros_integration/src/ros_msg_transporter.hpp
> index 2cdebb9..ac6b685 100644
> --- a/rtt_ros_integration/src/ros_msg_transporter.hpp
> +++ b/rtt_ros_integration/src/ros_msg_transporter.hpp
> @@ -145,7 +145,7 @@ namespace ros_integration {
> typename base::ChannelElement<T>::value_t sample; // XXX:
> real-time !
> // this read should always succeed since signal() means 'data
> available in a data element'.
> typename base::ChannelElement<T>::shared_ptr input =
> this->getInput();
> - if( input && (input->read(sample) == NewData) )
> + if( input && (input->read(sample,true) == NewData) )
It's not correct. What you should have done is to extend your own read()
function with a bool parameter 'copy_old_data', and pass it to the read
function instead of the 'true'.
> ros_pub.publish(sample);
> }
>
> @@ -219,7 +219,7 @@ namespace ros_integration {
>
> template <class T>
> class RosMsgTransporter : public RTT::types::TypeTransporter{
> - virtual base::ChannelElementBase * createStream
> (base::PortInterface *port, const ConnPolicy &policy, bool is_sender)
> const{
> + virtual base::ChannelElementBase::shared_ptr createStream
> (base::PortInterface *port, const ConnPolicy &policy, bool is_sender)
> const{
This is correct.
> if(is_sender){
> base::ChannelElementBase* buf =
> internal::ConnFactory::buildDataStorage<T>(policy);
> base::ChannelElementBase::shared_ptr tmp =
> base::ChannelElementBase::shared_ptr(new
> RosPubChannelElement<T>(port,policy));
Peter
patch in rtt ros integration for RTT read API changes
2011/5/3 Peter Soetens <peter [..] ...>:
> On Tuesday 03 May 2011 14:20:08 Steven Bellens wrote:
>> Hi,
>>
>> updating the orocos toolchain to use the latest version from master (I
>> guess very close to the actual 2.4 release), we had to make the
>> following changes to the rtt_ros_integration in order to get the
>> typekits to compile. Do these changes look OK? Especially the addition
>> of the "true" argument we're in doubt.
>>
>> regards,
>>
>> Steven
>>
>> diff --git a/rtt_ros_integration/src/ros_msg_transporter.hpp
>> b/rtt_ros_integration/src/ros_msg_transporter.hpp
>> index 2cdebb9..ac6b685 100644
>> --- a/rtt_ros_integration/src/ros_msg_transporter.hpp
>> +++ b/rtt_ros_integration/src/ros_msg_transporter.hpp
>> @@ -145,7 +145,7 @@ namespace ros_integration {
>> typename base::ChannelElement<T>::value_t sample; // XXX:
>> real-time !
>> // this read should always succeed since signal() means 'data
>> available in a data element'.
>> typename base::ChannelElement<T>::shared_ptr input =
>> this->getInput();
>> - if( input && (input->read(sample) == NewData) )
>> + if( input && (input->read(sample,true) == NewData) )
>
> It's not correct. What you should have done is to extend your own read()
> function with a bool parameter 'copy_old_data', and pass it to the read
> function instead of the 'true'.
What exactly does this copy_old_data bool mean? We've made a second attempt:
--- a/rtt_ros_integration/src/ros_msg_transporter.hpp
+++ b/rtt_ros_integration/src/ros_msg_transporter.hpp
@@ -145,7 +145,7 @@ namespace ros_integration {
typename base::ChannelElement<T>::value_t sample; // XXX:
real-time !
// this read should always succeed since signal() means 'data
available in a data element'.
typename base::ChannelElement<T>::shared_ptr input =
this->getInput();
- if( input && (input->read(sample) == NewData) )
+ if( input && (input->read(sample,true) == NewData) )
ros_pub.publish(sample);
}
@@ -202,24 +202,26 @@ namespace ros_integration {
*
* @return FlowStatus for the port
*/
- FlowStatus read(typename base::ChannelElement<T>::reference_t
sample)
+ FlowStatus read(typename base::ChannelElement<T>::reference_t
sample, bool copy_old_data)
{
- if(!init)
- return NoData;
- sample=m_msg.Get();
-
+ if(!init)
+ return NoData;
+
if(newdata){
- newdata=false;
- return NewData;
+ newdata=false;
+ sample=m_msg.Get();
+ return NewData;
}
else
- return OldData;
+ if(copy_old_data)
+ sample=m_msg.Get();
+ return OldData;
}
};
-
+
template <class T>
class RosMsgTransporter : public RTT::types::TypeTransporter{
- virtual base::ChannelElementBase * createStream
(base::PortInterface *port, const ConnPolicy &policy, bool is_sender)
const{
+ virtual base::ChannelElementBase::shared_ptr createStream
(base::PortInterface *port, const ConnPolicy &policy, bool is_sender)
const{
if(is_sender){
base::ChannelElementBase* buf =
internal::ConnFactory::buildDataStorage<T>(policy);
base::ChannelElementBase::shared_ptr tmp =
base::ChannelElementBase::shared_ptr(new
RosPubChannelElement<T>(port,policy));
Steven
>
>> ros_pub.publish(sample);
>> }
>>
>> @@ -219,7 +219,7 @@ namespace ros_integration {
>>
>> template <class T>
>> class RosMsgTransporter : public RTT::types::TypeTransporter{
>> - virtual base::ChannelElementBase * createStream
>> (base::PortInterface *port, const ConnPolicy &policy, bool is_sender)
>> const{
>> + virtual base::ChannelElementBase::shared_ptr createStream
>> (base::PortInterface *port, const ConnPolicy &policy, bool is_sender)
>> const{
>
> This is correct.
>
>> if(is_sender){
>> base::ChannelElementBase* buf =
>> internal::ConnFactory::buildDataStorage<T>(policy);
>> base::ChannelElementBase::shared_ptr tmp =
>> base::ChannelElementBase::shared_ptr(new
>> RosPubChannelElement<T>(port,policy));
>
> Peter
>
patch in rtt ros integration for RTT read API changes
On Wednesday 04 May 2011 09:30:20 Steven Bellens wrote:
> 2011/5/3 Peter Soetens <peter [..] ...>:
> > On Tuesday 03 May 2011 14:20:08 Steven Bellens wrote:
> >> Hi,
> >>
> >> updating the orocos toolchain to use the latest version from master (I
> >> guess very close to the actual 2.4 release), we had to make the
> >> following changes to the rtt_ros_integration in order to get the
> >> typekits to compile. Do these changes look OK? Especially the addition
> >> of the "true" argument we're in doubt.
> >>
> >> regards,
> >>
> >> Steven
> >>
> >> diff --git a/rtt_ros_integration/src/ros_msg_transporter.hpp
> >> b/rtt_ros_integration/src/ros_msg_transporter.hpp
> >> index 2cdebb9..ac6b685 100644
> >> --- a/rtt_ros_integration/src/ros_msg_transporter.hpp
> >> +++ b/rtt_ros_integration/src/ros_msg_transporter.hpp
> >> @@ -145,7 +145,7 @@ namespace ros_integration {
> >> typename base::ChannelElement<T>::value_t sample; // XXX:
> >> real-time !
> >> // this read should always succeed since signal() means 'data
> >> available in a data element'.
> >> typename base::ChannelElement<T>::shared_ptr input =
> >> this->getInput();
> >> - if( input && (input->read(sample) == NewData) )
> >> + if( input && (input->read(sample,true) == NewData) )
> >
> > It's not correct. What you should have done is to extend your own read()
> > function with a bool parameter 'copy_old_data', and pass it to the read
> > function instead of the 'true'.
>
> What exactly does this copy_old_data bool mean? We've made a second attempt:
>
> --- a/rtt_ros_integration/src/ros_msg_transporter.hpp
> +++ b/rtt_ros_integration/src/ros_msg_transporter.hpp
> @@ -145,7 +145,7 @@ namespace ros_integration {
> typename base::ChannelElement<T>::value_t sample; // XXX:
> real-time !
> // this read should always succeed since signal() means 'data
> available in a data element'.
> typename base::ChannelElement<T>::shared_ptr input =
> this->getInput();
> - if( input && (input->read(sample) == NewData) )
> + if( input && (input->read(sample,true) == NewData) )
> ros_pub.publish(sample);
> }
shouldn't this be input->read(sample,false) since we do not need a copy of
OldData since we do not do anything with sample in this case?
-- Ruben
>
> @@ -202,24 +202,26 @@ namespace ros_integration {
> *
> * @return FlowStatus for the port
> */
> - FlowStatus read(typename base::ChannelElement<T>::reference_t
> sample)
> + FlowStatus read(typename base::ChannelElement<T>::reference_t
> sample, bool copy_old_data)
> {
> - if(!init)
> - return NoData;
> - sample=m_msg.Get();
> -
> + if(!init)
> + return NoData;
> +
> if(newdata){
> - newdata=false;
> - return NewData;
> + newdata=false;
> + sample=m_msg.Get();
> + return NewData;
> }
> else
> - return OldData;
> + if(copy_old_data)
> + sample=m_msg.Get();
> + return OldData;
> }
> };
> -
> +
> template <class T>
> class RosMsgTransporter : public RTT::types::TypeTransporter{
> - virtual base::ChannelElementBase * createStream
> (base::PortInterface *port, const ConnPolicy &policy, bool is_sender)
> const{
> + virtual base::ChannelElementBase::shared_ptr createStream
> (base::PortInterface *port, const ConnPolicy &policy, bool is_sender)
> const{
> if(is_sender){
> base::ChannelElementBase* buf =
> internal::ConnFactory::buildDataStorage<T>(policy);
> base::ChannelElementBase::shared_ptr tmp =
> base::ChannelElementBase::shared_ptr(new
> RosPubChannelElement<T>(port,policy));
>
>
> Steven
>
> >> ros_pub.publish(sample);
> >> }
> >>
> >> @@ -219,7 +219,7 @@ namespace ros_integration {
> >>
> >> template <class T>
> >> class RosMsgTransporter : public RTT::types::TypeTransporter{
> >> - virtual base::ChannelElementBase * createStream
> >> (base::PortInterface *port, const ConnPolicy &policy, bool is_sender)
> >> const{
> >> + virtual base::ChannelElementBase::shared_ptr createStream
> >> (base::PortInterface *port, const ConnPolicy &policy, bool is_sender)
> >> const{
> >
> > This is correct.
> >
> >> if(is_sender){
> >> base::ChannelElementBase* buf =
> >> internal::ConnFactory::buildDataStorage<T>(policy);
> >> base::ChannelElementBase::shared_ptr tmp =
> >> base::ChannelElementBase::shared_ptr(new
> >> RosPubChannelElement<T>(port,policy));
> >
> > Peter